jarbler 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97e69aa07983bce3eac767254171ee446d3d75f05cc391c95d4f8cf2be52b98b
4
- data.tar.gz: 001b795796c7deb3fc315256a1938bd7aaae0bb98d12ef7575cc81bcf87dd913
3
+ metadata.gz: 640a16561d8e25d6674c56908ffb3442ad42eeccb9d34bd54dc480167902f52a
4
+ data.tar.gz: 76c9ea77cbf7eaea89588a6ffbcc6d06b39d79e6cd7560df822c31b979a7bf81
5
5
  SHA512:
6
- metadata.gz: c1b459f1612a905b71b9e9a0c4f73c60c7ecc38bfe5427cb57f03bad3c8c4228ac9f501059ca0d3f6459031d101c2b580cc04037da54ae3a4d2385477c87d194
7
- data.tar.gz: 2c5434ea23201d59276dbca474b6927e155d4556db012fcd78b1a1935500b3af8bc073d0db103c08300f92f467f416294cd908267d29e88431eebd2365a91589
6
+ metadata.gz: 9ecdbb4c5485b2e816793e367e4f1257e2f546ed95b515ec6c34393a8dd22fe8546efe8f63eef393b5f455396267db2dfc71f0ff22c0f246034f35736bcd05a0
7
+ data.tar.gz: acfe393d73f216856896a60fe815a94a3016eaf7a9dbf88734b8a99431b59ec5a39d947ace599a72365d70fac5ba55fff240dd0d92a9d57e46dce8d4bac66745
data/CHANGELOG.md CHANGED
@@ -1,12 +1,19 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.4] - 2026-02-03
4
+
5
+ - Version conflicts with installed system default gems are fixed. <br/>
6
+ This is done by supressing the load/activate of the target gems during the jar file build.
7
+ - Platforms attribute for JRuby 10.0.3.0 is "universal-java" now, without the previous suffix with Java major number.<br/>
8
+ So, replacement of "universal-java-XX" directories in jar file with current Java major number at jar startup isn't necessary for recent JRuby versions
9
+
3
10
  ## [0.4.3] - 2025-07-29
4
11
 
5
12
  - Enable Ruby and JRuby warnings ($VERBOSE = true) in call of 'jarble' if environment variable `DEBUG` is set
6
13
 
7
14
  ## [0.4.2] - 2025-07-24
8
15
 
9
- - Native Gem extensions are also copied into the jar file if the Gem has a native extension<br/>
16
+ - Native gem extensions are also copied into the jar file if the gem has a native extension<br/>
10
17
  If the extension is of platform type 'universal-java-XX' then the 'XX' in the dir name 'universal-java-XX' is corrected with the real Java major version at start of the jar file.<br/>
11
18
  Extensions of other platform types are copied as is.
12
19
 
@@ -35,8 +42,8 @@
35
42
 
36
43
  - Warning if Ruby-specific environment variables (GEM_HOME etc.) are set which may cause malfunction of app in jar file
37
44
  - Accept jar file locations with blanks in the path, especially for Windows
38
- - Setting `compile_ruby_files=true` compiles only .rb file of the application, but does not compile the .rb files in Gems.<br/>
39
- Compiling the Gems also remains an open task.
45
+ - Setting `compile_ruby_files=true` compiles only .rb file of the application, but does not compile the .rb files in gems.<br/>
46
+ Compiling the gems also remains an open task.
40
47
  - Bugfix: Accept spaces in the path to the jar file, especially for Windows
41
48
 
42
49
  ## [0.3.1] - 2024-07-02
@@ -72,11 +79,11 @@
72
79
 
73
80
  ## [0.1.5] - 2023-06-15
74
81
 
75
- - Bugfix: use minor ruby version without patch level for Gem files location
82
+ - Bugfix: use minor ruby version without patch level for gem files location
76
83
 
77
84
  ## [0.1.4] - 2023-04-28
78
85
 
79
- - Jarbler also supports Gemfile references to Gems with git dependencies now
86
+ - Jarbler also supports Gemfile references to gems with git dependencies now
80
87
 
81
88
  ## [0.1.3] - 2023-04-25
82
89
 
@@ -84,7 +91,7 @@
84
91
 
85
92
  ## [0.1.2] - 2023-04-24
86
93
 
87
- - extract valid Gem paths from Bundler instead of using the environment variable GEM_PATH
94
+ - extract valid gem paths from Bundler instead of using the environment variable GEM_PATH
88
95
 
89
96
  ## [0.1.1] - 2023-04-24
90
97
 
@@ -251,7 +251,7 @@ class JarMain {
251
251
  try {
252
252
  String destFileName = zipEntry.getName();
253
253
 
254
- // the platform name in extension dir depends on the the target java version, therfore we replace the platform name here
254
+ // the platform name in extension dir depends on the the target java version, therefore we replace the platform name here
255
255
  if (destFileName.contains("universal-java-XX")) {
256
256
  String newPlatformName = "universal-java-" + javaMajorRelease4RubyPlatform();
257
257
  debug ("Replacing platform name in file '" + destFileName + "' from 'universal-java-XX' to '" + newPlatformName + "'");
@@ -87,6 +87,18 @@ module Jarbler
87
87
  end
88
88
  end
89
89
 
90
+ # get the resulting extension target dir
91
+ # Accept that JRuby >= 10.0.3.0 uses "universal-java" where JRuby < 10.0.3.0 has used "universal-java-<Java major version>"
92
+ # "universal-java-XX" is replaced with the correct platform for the current Java version after unzipping of the jar file
93
+ # @return [String] the dir name to use in the jar file for extensions
94
+ def universal_java_dir_for_extensions
95
+ if Gem::Version.new(config.jruby_version) < Gem::Version.new('10.0.3.0')
96
+ 'universal-java-XX' # up to 10.0.2.0 the Java major version was added to the platform
97
+ else
98
+ 'universal-java' # JRuby 10.0.3.0 skipped the Java major version from the platform attribute
99
+ end
100
+ end
101
+
90
102
  private
91
103
 
92
104
  # Copy the needed Gems to the staging directory
@@ -95,9 +107,7 @@ module Jarbler
95
107
  # @return [void]
96
108
  def copy_needed_gems_to_staging(staging_dir, ruby_minor_version)
97
109
  gem_target_location = "#{staging_dir}/gems/jruby/#{ruby_minor_version}"
98
-
99
- # Replace universal-java-XX with the correct platform for the current Java version after unzipping of the jar file
100
- extension_target_location = "#{gem_target_location}/extensions/universal-java-XX/#{ruby_minor_version}"
110
+ extension_target_location = "#{gem_target_location}/extensions/#{universal_java_dir_for_extensions}/#{ruby_minor_version}"
101
111
 
102
112
  FileUtils.mkdir_p("#{gem_target_location}/bin")
103
113
  FileUtils.mkdir_p("#{gem_target_location}/build_info")
@@ -110,11 +120,12 @@ module Jarbler
110
120
  FileUtils.mkdir_p("#{gem_target_location}/bundler/gems")
111
121
 
112
122
  needed_gems = gem_dependencies # get the full names of the dependencies
123
+ specs = Bundler.definition.specs # Get all specs for Gems from Gemfile.lock
113
124
  needed_gems.each do |needed_gem|
114
- # Get the location of the needed gem
115
- spec = Gem::Specification.find_by_name(needed_gem[:name], needed_gem[:version])
125
+ spec = specs.find { |s| s.name == needed_gem[:name] && s.version == needed_gem[:version] }
116
126
  raise "Gem #{needed_gem[:full_name]} not found for copying" unless spec
117
- debug "Found gem #{needed_gem[:full_name]} version #{needed_gem[:version]} in #{spec.gem_dir}"
127
+ debug "Gem #{needed_gem[:full_name]} version #{needed_gem[:version]} should be in #{spec.gem_dir}"
128
+ raise "Gem dir for #{needed_gem[:full_name]} version #{needed_gem[:version]} not found at location specified by Gem::Specification ( #{spec.gem_dir} )" unless Dir.exist?(spec.gem_dir)
118
129
 
119
130
  # differentiate between Gems from git/bundler and Gems from rubygems
120
131
  if spec.source.is_a?(Bundler::Source::Git)
@@ -122,12 +133,10 @@ module Jarbler
122
133
  debug "Adding Bundler Gem from dir '#{spec.gem_dir}' into jar file at temporary location '#{gem_target_location}/gems'"
123
134
  file_utils_copy(spec.gem_dir, "#{gem_target_location}/bundler/gems")
124
135
  spec.executables.each do |executable|
125
- debug "Adding executable of Bundler Gem from dir '#{spec.bin_dir}#{executable}/' into jar file at temporary location '#{gem_target_location}/bundler/bin'"
136
+ debug "Adding executable of Bundler Gem from dir '#{spec.bin_dir}/#{executable}/' into jar file at temporary location '#{gem_target_location}/bundler/bin'"
126
137
  file_utils_copy("#{spec.bin_dir}/#{executable}", "#{gem_target_location}/bundler/bin")
127
138
  end
128
139
  else # Gem is from rubygems
129
- # TODO: Gemfile could request a different version of default gem compared to the one jruby jars
130
- # Should the default gems are also copied to the staging directory?
131
140
  unless spec.default_gem? # Do not copy default gems, because they are already included in the jruby jars standard library
132
141
  # copy the Gem and gemspec separately
133
142
  debug "Adding local Gem from dir '#{spec.gem_dir}' into jar file at temporary location '#{gem_target_location}/gems'"
@@ -142,7 +151,7 @@ module Jarbler
142
151
  # spec.loaded_from contains the path to the gemspec file including the path prefix "default/" for default gems
143
152
  file_utils_copy(spec.loaded_from, "#{gem_target_location}/specifications")
144
153
  spec.executables.each do |executable|
145
- debug "Adding executable of local Gem from dir '#{spec.bin_dir}#{executable}/' into jar file at temporary location '#{gem_target_location}/bin'"
154
+ debug "Adding executable of local Gem from dir '#{spec.bin_dir}/#{executable}/' into jar file at temporary location '#{gem_target_location}/bin'"
146
155
  file_utils_copy("#{spec.bin_dir}/#{executable}", "#{gem_target_location}/bin")
147
156
  end
148
157
  end
@@ -157,11 +166,12 @@ module Jarbler
157
166
  # @return [Array] Array with Hashes containing: name, version, full_name
158
167
  def gem_dependencies
159
168
  needed_gems = []
169
+
160
170
  lockfile_parser = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile))
161
171
  lockfile_specs = lockfile_parser.specs
172
+ # Bundler.definition.specs possibly contains the same information like lockfile_specs
162
173
 
163
- Bundler.setup(*config.gemfile_groups) # Load Gems specified in Gemfile, ensure that Gem path also includes the Gems loaded into bundler dir
164
- # filter Gems needed for production
174
+ # filter Gems needed for the desired groups (eg. production)
165
175
  gemfile_specs = Bundler.definition.dependencies.select do |d|
166
176
  !(d.groups & config.gemfile_groups).empty? # Check if the Gem is in the groups specified in config.gemfile_groups
167
177
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jarbler
4
- VERSION = "0.4.3"
5
- VERSION_DATE = "2025-07-29"
4
+ VERSION = "0.4.4"
5
+ VERSION_DATE = "2026-01-29"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jarbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-29 00:00:00.000000000 Z
11
+ date: 2026-02-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pack a Ruby app combined with JRuby runtime and all its Gem dependencies
14
14
  into a jar file to simply run the app on any Java platform by '> java -jar file.jar'