jarbler 0.4.5 → 0.4.7
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +1 -0
- data/lib/jarbler/builder.rb +26 -12
- data/lib/jarbler/config.rb +10 -0
- data/lib/jarbler/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d88d349fabf49c5b9ea16086626224f646c48fb2728c902639111a77a3dc56b2
|
|
4
|
+
data.tar.gz: 1a4f5b5391d5345cd6f93125ad62e3f166ee284620dc1c6055d65d383b7323ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f52227bb7e0a056b378e55418f43089bc559ce4254d96487d8f74413990e49ac8af1ffa9f178f188b9c6eacd9218d222e33714803154a3e7a28b8bb927e7a5fe
|
|
7
|
+
data.tar.gz: ce2d2990496544e91cad453db873ef4c9dec9ff3ea50e5b4d0c928e9feed75dd24b6de2d397dac74bc803c167ee6ffa044be2267e069c78dc7113f9dc5ba8c9a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.4.7] - 2026-04-08
|
|
4
|
+
- Enhance 'excluded_gems' so that an empty extension dir with 'gem.build_complete' is included in jar file
|
|
5
|
+
|
|
6
|
+
## [0.4.6] - 2026-04-07
|
|
7
|
+
- New config attribute 'excluded_gems' to exclude certain gems from being included in the jar file. <br/>
|
|
8
|
+
Gems specified in 'excluded_gems' are not included in the jar file and not available at runtime. <br/>
|
|
9
|
+
This allows to exclude gems which are dependencies of other gems that are not needed for the application and are excluded from initialization by 'gem name, require: false'.
|
|
10
|
+
|
|
3
11
|
## [0.4.5] - 2026-03-10
|
|
4
12
|
- Show JRuby warnings at execution of jar file only if environment variable `DEBUG` is set to 'true'
|
|
5
13
|
|
data/README.md
CHANGED
|
@@ -56,6 +56,7 @@ The default configuration is focused on Ruby on Rails applications.<br>
|
|
|
56
56
|
| Option | Default value | Description |
|
|
57
57
|
|-----------------------|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
58
58
|
| compile_ruby_files | false | Ahead of time compilation of all .rb files of the application to .class files.<br/>Only the .class files are stored in the jar file. The Gem dependencies are not compiled. Requires JRuby as Ruby environment at compile time. |
|
|
59
|
+
| exclude_gems | [] | Exclude certain gems from being included in the jar file. <br/>Gems specified in 'exclude_gems' are not included in the jar file and are not available at runtime. Only the specification file is needed to be in the jar file.<br/>This allows to exclude gems which are dependencies of other gems that are not needed for the application and are excluded from initialization by 'gem name, require: false'. |
|
|
59
60
|
| excludes_from_compile | [] | The files and dirs of the project to exclude from the compilation of .rb files. Paths specifies the location in the jar file (e.g. ["app_root/file.rb"] ) |
|
|
60
61
|
| excludes | ["tmp/cache", "tmp/pids", ...] (see generated template file for whole content) | The files and dirs of the project to exclude from the include option |
|
|
61
62
|
| executable | "bin/rails" | The ruby start file to run at execution of jar file. File extension .class is used automatically if start file is .rb and AOT compilation is used. |
|
data/lib/jarbler/builder.rb
CHANGED
|
@@ -139,20 +139,34 @@ module Jarbler
|
|
|
139
139
|
else # Gem is from rubygems
|
|
140
140
|
unless spec.default_gem? # Do not copy default gems, because they are already included in the jruby jars standard library
|
|
141
141
|
# copy the Gem and gemspec separately
|
|
142
|
-
debug "Adding local Gem from dir '#{spec.gem_dir}' into jar file at temporary location '#{gem_target_location}/gems'"
|
|
143
|
-
file_utils_copy(spec.gem_dir, "#{gem_target_location}/gems")
|
|
144
142
|
|
|
143
|
+
# spec.loaded_from contains the path to the gemspec file including the path prefix "default/" for default gems
|
|
144
|
+
file_utils_copy(spec.loaded_from, "#{gem_target_location}/specifications")
|
|
145
|
+
|
|
146
|
+
# Extensions are needed even if config.excluded_gems includes the Gem
|
|
145
147
|
if spec.extension_dir && Dir.exist?(spec.extension_dir)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
unless config.excluded_gems.include?(needed_gem[:name])
|
|
149
|
+
debug "Adding extension from dir '#{spec.extension_dir}' into jar file at temporary location '#{extension_target_location}'"
|
|
150
|
+
puts "Adding extension from dir '#{spec.extension_dir}' into jar file but extension is not for platform 'universal-java-xx'!!!" unless spec.extension_dir['universal-java']
|
|
151
|
+
file_utils_copy(spec.extension_dir, extension_target_location)
|
|
152
|
+
else
|
|
153
|
+
faked_extension_dir = File.join(extension_target_location, needed_gem[:full_name])
|
|
154
|
+
debug "Faking empty extension dir '#{faked_extension_dir}' with gem.build_complete only for excluded gem"
|
|
155
|
+
Dir.mkdir(faked_extension_dir)
|
|
156
|
+
FileUtils.touch(File.join(faked_extension_dir, 'gem.build_complete'))
|
|
157
|
+
end
|
|
149
158
|
end
|
|
150
159
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
160
|
+
unless config.excluded_gems.include?(needed_gem[:name]) # only the spec file needs to be included for excluded_gems
|
|
161
|
+
debug "Adding local Gem from dir '#{spec.gem_dir}' into jar file at temporary location '#{gem_target_location}/gems'"
|
|
162
|
+
file_utils_copy(spec.gem_dir, "#{gem_target_location}/gems") unless config.excluded_gems.include?(needed_gem[:name])
|
|
163
|
+
|
|
164
|
+
spec.executables.each do |executable|
|
|
165
|
+
debug "Adding executable of local Gem from dir '#{spec.bin_dir}/#{executable}/' into jar file at temporary location '#{gem_target_location}/bin'"
|
|
166
|
+
file_utils_copy("#{spec.bin_dir}/#{executable}", "#{gem_target_location}/bin")
|
|
167
|
+
end
|
|
168
|
+
else
|
|
169
|
+
debug "Skipping copy of excluded gem #{needed_gem[:name]} version #{needed_gem[:version]} from dir '#{spec.gem_dir}' into jar file"
|
|
156
170
|
end
|
|
157
171
|
end
|
|
158
172
|
end
|
|
@@ -184,7 +198,7 @@ module Jarbler
|
|
|
184
198
|
unless needed_gems.map{|n| n[:full_name]}.include?(lockfile_spec.full_name)
|
|
185
199
|
needed_gems << { full_name: lockfile_spec.full_name, name: lockfile_spec.name, version: lockfile_spec.version }
|
|
186
200
|
end
|
|
187
|
-
debug "Direct Gem dependency: #{lockfile_spec.full_name}"
|
|
201
|
+
debug "Direct Gem dependency: #{lockfile_spec.full_name}#{" : Gem should by excluded in jar according to 'excluded_gems'" if config.excluded_gems.include?(lockfile_spec.name)}"
|
|
188
202
|
add_indirect_dependencies(lockfile_specs, lockfile_spec, needed_gems)
|
|
189
203
|
else
|
|
190
204
|
if gemfile_spec.name == 'bundler'
|
|
@@ -210,7 +224,7 @@ module Jarbler
|
|
|
210
224
|
lockfile_spec.dependencies.each do |lockfile_spec_dep|
|
|
211
225
|
lockfile_spec_found = lockfile_specs.find { |lockfile_spec| lockfile_spec.name == lockfile_spec_dep.name }
|
|
212
226
|
if lockfile_spec_found
|
|
213
|
-
debug "Indirect Gem dependency from #{lockfile_spec.full_name}: #{lockfile_spec_found.full_name}"
|
|
227
|
+
debug "Indirect Gem dependency from #{lockfile_spec.full_name}: #{lockfile_spec_found.full_name}#{" : Gem should be excluded in jar according to 'excluded_gems'" if config.excluded_gems.include?(lockfile_spec_found.name)}"
|
|
214
228
|
unless needed_gems.map{|n| n[:full_name]}.include?(lockfile_spec_found.full_name)
|
|
215
229
|
needed_gems << { full_name: lockfile_spec_found.full_name, name: lockfile_spec_found.name, version: lockfile_spec_found.version }
|
|
216
230
|
add_indirect_dependencies(lockfile_specs, lockfile_spec_found, needed_gems)
|
data/lib/jarbler/config.rb
CHANGED
|
@@ -5,6 +5,7 @@ module Jarbler
|
|
|
5
5
|
class Config
|
|
6
6
|
attr_accessor :compile_java_version, # compile_java_version only for backward compatibility, use java_opts instead
|
|
7
7
|
:compile_ruby_files,
|
|
8
|
+
:excluded_gems,
|
|
8
9
|
:excludes,
|
|
9
10
|
:excludes_from_compile,
|
|
10
11
|
:executable,
|
|
@@ -44,6 +45,7 @@ module Jarbler
|
|
|
44
45
|
end
|
|
45
46
|
puts "Used configuration values are:"
|
|
46
47
|
puts " compile_ruby_files: #{config.compile_ruby_files}"
|
|
48
|
+
puts " excluded_gems: #{config.excluded_gems}" unless config.excluded_gems.empty?
|
|
47
49
|
puts " excludes: #{config.excludes}"
|
|
48
50
|
puts " excludes_from_compile: #{config.excludes_from_compile}" if config.compile_ruby_files
|
|
49
51
|
puts " executable: #{config.executable}"
|
|
@@ -61,6 +63,7 @@ module Jarbler
|
|
|
61
63
|
def initialize
|
|
62
64
|
@compile_ruby_files = false
|
|
63
65
|
@compile_java_version = nil # deprecated, use java_opts instead
|
|
66
|
+
@excluded_gems = []
|
|
64
67
|
@excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby)
|
|
65
68
|
@excludes_from_compile = []
|
|
66
69
|
@executable = 'bin/rails'
|
|
@@ -82,6 +85,12 @@ module Jarbler
|
|
|
82
85
|
# the original ruby files are not included in the jar file, so source code is not visible
|
|
83
86
|
# config.compile_ruby_files = #{compile_ruby_files}
|
|
84
87
|
|
|
88
|
+
# Exclude certain gems from being included in the jar file.
|
|
89
|
+
# Gems specified in 'exclude_gems' are not included in the jar file and not available at runtime.
|
|
90
|
+
# This allows to exclude gems which are dependencies of other gems
|
|
91
|
+
# that are not needed for the application and are excluded from initialization by 'gem name, require: false'.
|
|
92
|
+
# config.excluded_gems = #{excluded_gems}
|
|
93
|
+
|
|
85
94
|
# Application directories or files to exclude from the jar file
|
|
86
95
|
# config.excludes = #{excludes}
|
|
87
96
|
# config.excludes << 'additional'
|
|
@@ -192,6 +201,7 @@ module Jarbler
|
|
|
192
201
|
def validate_values
|
|
193
202
|
raise "compile_java_version is not valid any more! Use config.java_opts instead with -source and -target." if compile_java_version
|
|
194
203
|
raise "Invalid config value for jar name: #{jar_name}" unless jar_name =~ /\w+/
|
|
204
|
+
raise "Invalid config value for excluded_gems: #{excluded_gems}" unless @excluded_gems.is_a?(Array)
|
|
195
205
|
raise "Invalid config value for executable: #{executable}" unless executable =~ /\w+/
|
|
196
206
|
raise "Invalid config value for executable params: #{executable_params}" unless executable_params.is_a?(Array)
|
|
197
207
|
raise "Invalid config value for gemfile groups: #{gemfile_groups}" unless gemfile_groups.is_a?(Array)
|
data/lib/jarbler/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.4.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Ramm
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-08 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'
|