Skip to content

Commit 898632e

Browse files
committed
download/gitignore mima .jar files
1 parent a2f8530 commit 898632e

6 files changed

Lines changed: 60 additions & 4 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
with:
1919
ruby-version: ${{ matrix.ruby-version }}
2020
bundler-cache: true
21+
- name: Download Mima jars
22+
run: bundle exec rake download_jars
2123
- name: Run tests
2224
run: bundle exec rake specs
2325
- name: Run RuboCop

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ build.log
66
pom*
77
specs/repository/*
88
example/dependencies.list
9+
lib/jars/mima/*.jar

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source 'https://gem.coop'
44

55
gemspec
66

Rakefile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ task default: [:specs]
44

55
require 'bundler/gem_tasks'
66
require 'rubocop/rake_task'
7+
require 'rake/clean'
78

89
RuboCop::RakeTask.new
910

@@ -15,3 +16,47 @@ task :specs do
1516
require File.basename(f.sub(/.rb$/, ''))
1617
end
1718
end
19+
20+
require_relative 'lib/jars/mima/version'
21+
22+
MIMA_VERSION = Jars::Mima::MIMA_VERSION
23+
SLF4J_VERSION = Jars::Mima::SLF4J_VERSION
24+
MAVEN_CENTRAL = 'https://repo.maven.apache.org/maven2'
25+
MIMA_DIR = 'lib/jars/mima'
26+
27+
MIMA_JARS = {
28+
"slf4j-api-#{SLF4J_VERSION}.jar" =>
29+
"#{MAVEN_CENTRAL}/org/slf4j/slf4j-api/#{SLF4J_VERSION}/slf4j-api-#{SLF4J_VERSION}.jar",
30+
"slf4j-simple-#{SLF4J_VERSION}.jar" =>
31+
"#{MAVEN_CENTRAL}/org/slf4j/slf4j-simple/#{SLF4J_VERSION}/slf4j-simple-#{SLF4J_VERSION}.jar",
32+
"jcl-over-slf4j-#{SLF4J_VERSION}.jar" =>
33+
"#{MAVEN_CENTRAL}/org/slf4j/jcl-over-slf4j/#{SLF4J_VERSION}/jcl-over-slf4j-#{SLF4J_VERSION}.jar",
34+
"context-#{MIMA_VERSION}.jar" =>
35+
"#{MAVEN_CENTRAL}/eu/maveniverse/maven/mima/context/#{MIMA_VERSION}/context-#{MIMA_VERSION}.jar",
36+
"standalone-static-uber-#{MIMA_VERSION}.jar" =>
37+
"#{MAVEN_CENTRAL}/eu/maveniverse/maven/mima/runtime/standalone-static-uber/#{MIMA_VERSION}/standalone-static-uber-#{MIMA_VERSION}.jar"
38+
}
39+
40+
MIMA_JARS.each_key { |jar| CLEAN.include(File.join(MIMA_DIR, jar)) }
41+
42+
desc 'download Mima (and dependent SLF4J) jars'
43+
task :download_jars do
44+
require 'fileutils'
45+
require 'open-uri'
46+
47+
FileUtils.mkdir_p(MIMA_DIR)
48+
49+
MIMA_JARS.each do |filename, url|
50+
target = File.join(MIMA_DIR, filename)
51+
if File.exist?(target)
52+
puts " exists: #{target}"
53+
next
54+
end
55+
56+
puts " downloading #{filename}..."
57+
URI.open(url) do |remote| # rubocop:disable Security/Open
58+
File.open(target, 'wb') { |f| f.write(remote.read) }
59+
end
60+
puts " saved: #{target}"
61+
end
62+
end

lib/jars/mima.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frozen_string_literal: true
22

3+
require 'jars/mima/version'
34
require 'jars/gemspec_artifacts'
45

56
module Jars
@@ -8,8 +9,6 @@ module Jars
89
#
910
# Mima wraps the Maven Resolver (Aether) API as a standalone library (no Maven process is spawned).
1011
module Mima
11-
MIMA_VERSION = '2.4.42'
12-
SLF4J_VERSION = '1.7.36'
1312

1413
class << self
1514
@@jars_loaded = nil
@@ -19,7 +18,8 @@ class << self
1918
def ensure_jars_loaded
2019
return if @@jars_loaded
2120

22-
mima_dir = File.expand_path('mima', File.dirname(__FILE__)).freeze
21+
mima_dir = File.expand_path('mima', File.dirname(__FILE__))
22+
2323
load File.join(mima_dir, "slf4j-api-#{SLF4J_VERSION}.jar")
2424
load File.join(mima_dir, "slf4j-simple-#{SLF4J_VERSION}.jar")
2525
load File.join(mima_dir, "jcl-over-slf4j-#{SLF4J_VERSION}.jar")

lib/jars/mima/version.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
module Jars
4+
module Mima
5+
MIMA_VERSION = '2.4.42'
6+
SLF4J_VERSION = '1.7.36'
7+
end
8+
end

0 commit comments

Comments
 (0)