jarbler 0.4.3 → 0.4.5

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: b72eccf370b618ce376f9091afac4360a8cae86f60908b50ddbb3d0bb1c6647f
4
+ data.tar.gz: 659ea949e16bedfe51de531eb9cd54a71fe47e4873f41f58eb0708255aac8108
5
5
  SHA512:
6
- metadata.gz: c1b459f1612a905b71b9e9a0c4f73c60c7ecc38bfe5427cb57f03bad3c8c4228ac9f501059ca0d3f6459031d101c2b580cc04037da54ae3a4d2385477c87d194
7
- data.tar.gz: 2c5434ea23201d59276dbca474b6927e155d4556db012fcd78b1a1935500b3af8bc073d0db103c08300f92f467f416294cd908267d29e88431eebd2365a91589
6
+ metadata.gz: 5284e6ee863cc608f78759bcc52ffa81989ba13cb236f13d7e74631dd15eb92df0af7df3c16bc7e9fb232632966bc68dbba19d3aed7a46032840b801db9ef701
7
+ data.tar.gz: 6fe30919e5763b5861c33a3d797c04f1ba5839b3a6d84cf04698fbab40337f08bfb2edef0e18ae5f3aa8a66c72c5b422c66dc253630008bba195af0fb9d32d79
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Ask2AgentMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
data/CHANGELOG.md CHANGED
@@ -1,12 +1,22 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.5] - 2026-03-10
4
+ - Show JRuby warnings at execution of jar file only if environment variable `DEBUG` is set to 'true'
5
+
6
+ ## [0.4.4] - 2026-02-03
7
+
8
+ - Version conflicts with installed system default gems are fixed. <br/>
9
+ This is done by supressing the load/activate of the target gems during the jar file build.
10
+ - Platforms attribute for JRuby 10.0.3.0 is "universal-java" now, without the previous suffix with Java major number.<br/>
11
+ 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
12
+
3
13
  ## [0.4.3] - 2025-07-29
4
14
 
5
15
  - Enable Ruby and JRuby warnings ($VERBOSE = true) in call of 'jarble' if environment variable `DEBUG` is set
6
16
 
7
17
  ## [0.4.2] - 2025-07-24
8
18
 
9
- - Native Gem extensions are also copied into the jar file if the Gem has a native extension<br/>
19
+ - Native gem extensions are also copied into the jar file if the gem has a native extension<br/>
10
20
  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
21
  Extensions of other platform types are copied as is.
12
22
 
@@ -35,8 +45,8 @@
35
45
 
36
46
  - Warning if Ruby-specific environment variables (GEM_HOME etc.) are set which may cause malfunction of app in jar file
37
47
  - 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.
48
+ - Setting `compile_ruby_files=true` compiles only .rb file of the application, but does not compile the .rb files in gems.<br/>
49
+ Compiling the gems also remains an open task.
40
50
  - Bugfix: Accept spaces in the path to the jar file, especially for Windows
41
51
 
42
52
  ## [0.3.1] - 2024-07-02
@@ -72,11 +82,11 @@
72
82
 
73
83
  ## [0.1.5] - 2023-06-15
74
84
 
75
- - Bugfix: use minor ruby version without patch level for Gem files location
85
+ - Bugfix: use minor ruby version without patch level for gem files location
76
86
 
77
87
  ## [0.1.4] - 2023-04-28
78
88
 
79
- - Jarbler also supports Gemfile references to Gems with git dependencies now
89
+ - Jarbler also supports Gemfile references to gems with git dependencies now
80
90
 
81
91
  ## [0.1.3] - 2023-04-25
82
92
 
@@ -84,7 +94,7 @@
84
94
 
85
95
  ## [0.1.2] - 2023-04-24
86
96
 
87
- - extract valid Gem paths from Bundler instead of using the environment variable GEM_PATH
97
+ - extract valid gem paths from Bundler instead of using the environment variable GEM_PATH
88
98
 
89
99
  ## [0.1.1] - 2023-04-24
90
100
 
data/README.md CHANGED
@@ -70,7 +70,8 @@ The default configuration is focused on Ruby on Rails applications.<br>
70
70
 
71
71
  ## Troubleshooting
72
72
  * Set DEBUG=true in OS environment to get additional runtime information
73
- * The temporary folder with the extracted app and JRuby runtime files is not deleted after execution if DEBUG is set.
73
+ * The temporary folder with the extracted app and JRuby runtime files is not deleted after execution if DEBUG is set.<br/>
74
+ This is the case for execution of `jarble` as well as for execution of the created jar file.
74
75
 
75
76
  ### Possible error messages
76
77
  * Gem::LoadError: You have already activated ..., but your Gemfile requires ... . Since ... is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports net-protocol as a default gem.
@@ -157,10 +157,12 @@ class JarMain {
157
157
  //debug("JRuby set property 'jruby.gem.home' to '" + full_gem_home + "'");
158
158
  //System.setProperty("jruby.gem.home", full_gem_home);
159
159
 
160
- // Enable JRuby warnings, not proof to really function
161
- System.setProperty("jruby.log.warnings", "true");
162
- System.setProperty("jruby.cli.verbose", "true");
163
- // System.setProperty("jruby.debug.fullTrace", "true");
160
+ // Enable JRuby warnings
161
+ if (debug_active()) {
162
+ System.setProperty("jruby.log.warnings", "true");
163
+ System.setProperty("jruby.cli.verbose", "true");
164
+ // System.setProperty("jruby.debug.fullTrace", "true");
165
+ }
164
166
 
165
167
  debug("JRuby program starts with the following arguments: ");
166
168
  for (String arg : mainArgs) {
@@ -251,7 +253,7 @@ class JarMain {
251
253
  try {
252
254
  String destFileName = zipEntry.getName();
253
255
 
254
- // the platform name in extension dir depends on the the target java version, therfore we replace the platform name here
256
+ // the platform name in extension dir depends on the the target java version, therefore we replace the platform name here
255
257
  if (destFileName.contains("universal-java-XX")) {
256
258
  String newPlatformName = "universal-java-" + javaMajorRelease4RubyPlatform();
257
259
  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
@@ -171,7 +181,7 @@ module Jarbler
171
181
  # find lockfile record for Gemfile spec
172
182
  lockfile_spec = lockfile_specs.find { |lockfile_spec| lockfile_spec.name == gemfile_spec.name }
173
183
  if lockfile_spec
174
- unless needed_gems.map{|n| n[:fullname]}.include?(lockfile_spec.full_name)
184
+ unless needed_gems.map{|n| n[:full_name]}.include?(lockfile_spec.full_name)
175
185
  needed_gems << { full_name: lockfile_spec.full_name, name: lockfile_spec.name, version: lockfile_spec.version }
176
186
  end
177
187
  debug "Direct Gem dependency: #{lockfile_spec.full_name}"
@@ -201,7 +211,7 @@ module Jarbler
201
211
  lockfile_spec_found = lockfile_specs.find { |lockfile_spec| lockfile_spec.name == lockfile_spec_dep.name }
202
212
  if lockfile_spec_found
203
213
  debug "Indirect Gem dependency from #{lockfile_spec.full_name}: #{lockfile_spec_found.full_name}"
204
- unless needed_gems.map{|n| n[:fullname]}.include?(lockfile_spec_found.full_name)
214
+ unless needed_gems.map{|n| n[:full_name]}.include?(lockfile_spec_found.full_name)
205
215
  needed_gems << { full_name: lockfile_spec_found.full_name, name: lockfile_spec_found.name, version: lockfile_spec_found.version }
206
216
  add_indirect_dependencies(lockfile_specs, lockfile_spec_found, needed_gems)
207
217
  end
@@ -26,7 +26,7 @@ module Jarbler
26
26
  config = Jarbler::Config.new
27
27
  end
28
28
  unless config.class == Jarbler::Config
29
- Jarbler.debug "No valid config provided in #{CONFIG_FILE}! Using defaults."
29
+ puts "No valid config provided in #{CONFIG_FILE}! Using defaults."
30
30
  config = Config.new
31
31
  end
32
32
  config.define_jruby_version
@@ -52,7 +52,7 @@ module Jarbler
52
52
  puts " includes: #{config.includes}"
53
53
  puts " jar_name: #{config.jar_name}"
54
54
  puts " java_opts: #{config.java_opts}"
55
- puts " jrubyc_opts: #{config.jruby_version}" if config.compile_ruby_files
55
+ puts " jrubyc_opts: #{config.jrubyc_opts}" if config.compile_ruby_files
56
56
  puts " jruby_version: #{config.jruby_version}"
57
57
  puts ""
58
58
  config
@@ -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.5"
5
+ VERSION_DATE = "2026-03-10"
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.5
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-03-10 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'
@@ -19,6 +19,7 @@ executables:
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - ".idea/copilot.data.migration.ask2agent.xml"
22
23
  - CHANGELOG.md
23
24
  - Gemfile
24
25
  - LICENSE