jarbler 0.3.4 → 0.3.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +11 -10
- data/lib/jarbler/builder.rb +7 -1
- data/lib/jarbler/config.rb +10 -3
- 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: 2b0f184ae1d09ac0464ed7c607600571e77873ae91a1aa2c20578856cd2b8404
|
4
|
+
data.tar.gz: 0dce28c9d7e4856d5903da84f8ea4f5ec5f173931fe4fca6ec5e8e849bbcbc4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b4383469571b3ce72c7e97123f8a8a0b25834848970921ae84dd445f3ea9268fec77193b796dddd2444831d5854e477d13d912de9d962fea3bcdd74ecb9d56d
|
7
|
+
data.tar.gz: dfcfdd76de3397adabb0e8677c09dedc112486387addeca59f8b85b50b40f8d7230c337b61c191f2d2752eb1cf9514011905579818add6665cce66dc38db0b66
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.3.5] - 2025-03-22
|
4
|
+
|
5
|
+
- new config attribute "config.compile_java_version" allows control of setting for "javac -source and -target" for AOT compilation
|
6
|
+
- fix typo with smart quotes in config.rb
|
7
|
+
|
3
8
|
## [0.3.4] - 2025-03-07
|
4
9
|
|
5
10
|
- Warning if Ruby-specific environment variables (GEM_HOME etc.) are set which may cause malfunction of app in jar file
|
data/README.md
CHANGED
@@ -53,16 +53,17 @@ To create a template config file with information about all the supported config
|
|
53
53
|
The default configuration is focused on Ruby on Rails applications.<br>
|
54
54
|
|
55
55
|
### Configuration options
|
56
|
-
| Option | Default value | Description
|
57
|
-
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
| Option | Default value | Description |
|
57
|
+
|-------------------------|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
58
|
+
| compile_java_version | none | Java version the compiled .class files should be compatible with. Controls the target and source version of the Java compiler if compile_ruby_files=true (javac -source and -target). E.g. "1.8" for Java 8. If not set then it generates the class file version according to your current Java version. |
|
59
|
+
| compile_ruby_files | false | Ahead of time compilation of all .rb files of the application to .class files. Only the .class files are stored in the jar file. The Gem dependencies are not compiled. Requires JRuby as Ruby environment at compile time. |
|
60
|
+
| 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. |
|
61
|
+
| executable_params | ["server", "-e", "production", "-p", "8080"] | Command line parameters to be used for the ruby executable |
|
62
|
+
| 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"] ) |
|
63
|
+
| 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 |
|
64
|
+
| includes | ["app", "bin", "config", ...] (see generated template file for whole content) | The files and dirs of the project to include in the jar file |
|
65
|
+
| jar_name | < Name of project dir >.jar | The name of the generated jar file |
|
66
|
+
| jruby_version | A valid JRuby version from file '.ruby-version' or the current most recent version of the Gem 'jruby-jars' | The version of the JRuby runtime to use |
|
66
67
|
|
67
68
|
|
68
69
|
## Troubleshooting
|
data/lib/jarbler/builder.rb
CHANGED
@@ -19,8 +19,12 @@ module Jarbler
|
|
19
19
|
app_root = Dir.pwd
|
20
20
|
debug "Project dir: #{app_root}"
|
21
21
|
|
22
|
+
source_and_target = if config.compile_java_version
|
23
|
+
"-source #{config.compile_java_version} -target #{config.compile_java_version}"
|
24
|
+
end
|
25
|
+
|
22
26
|
ruby_minor_version = copy_jruby_jars_to_staging(staging_dir) # Copy the jruby jars to the staging directory
|
23
|
-
exec_command "javac -nowarn -Xlint:deprecation
|
27
|
+
exec_command "javac -nowarn -Xlint:deprecation #{source_and_target} -d #{staging_dir} #{__dir__}/JarMain.java" # Compile the Java files
|
24
28
|
|
25
29
|
# Copy the application project to the staging directory
|
26
30
|
FileUtils.mkdir_p("#{staging_dir}/app_root")
|
@@ -308,6 +312,8 @@ module Jarbler
|
|
308
312
|
# Inform if used JRuby version is different from the intended runtime JRuby version
|
309
313
|
if JRUBY_VERSION != config.jruby_version
|
310
314
|
puts "Compiling .rb files to .class is done with JRuby version #{JRUBY_VERSION}, but intended runtime JRuby version for jar file is #{config.jruby_version}"
|
315
|
+
puts "Mismatch between the JRuby versions used for compile and runtime is not supported by JRuby and may cause sudden errors"
|
316
|
+
raise "JRuby version mismatch: #{JRUBY_VERSION} != #{config.jruby_version}"
|
311
317
|
end
|
312
318
|
|
313
319
|
# Compile all .rb files in the current directory tree, but not in the gems directory
|
data/lib/jarbler/config.rb
CHANGED
@@ -3,7 +3,7 @@ require 'json'
|
|
3
3
|
|
4
4
|
module Jarbler
|
5
5
|
class Config
|
6
|
-
attr_accessor :jar_name, :includes, :excludes, :jruby_version, :executable, :executable_params, :compile_ruby_files, :excludes_from_compile
|
6
|
+
attr_accessor :jar_name, :includes, :excludes, :jruby_version, :executable, :executable_params, :compile_ruby_files, :excludes_from_compile, :compile_java_version
|
7
7
|
|
8
8
|
CONFIG_FILE = 'config/jarble.rb'
|
9
9
|
# create instance of Config class with defaults or from config file
|
@@ -31,9 +31,10 @@ module Jarbler
|
|
31
31
|
puts "No configuration file found at #{File.join(Dir.pwd, CONFIG_FILE)}. Using default values."
|
32
32
|
end
|
33
33
|
puts "Used configuration values are:"
|
34
|
+
puts " compile_java_version: #{config.compile_java_version}" if config.compile_ruby_files
|
34
35
|
puts " compile_ruby_files: #{config.compile_ruby_files}"
|
35
36
|
puts " excludes: #{config.excludes}"
|
36
|
-
puts " excludes_from_compile: #{config.excludes_from_compile}"
|
37
|
+
puts " excludes_from_compile: #{config.excludes_from_compile}" if config.compile_ruby_files
|
37
38
|
puts " executable: #{config.executable}"
|
38
39
|
puts " executable_params: #{config.executable_params}"
|
39
40
|
puts " includes: #{config.includes}"
|
@@ -45,6 +46,7 @@ module Jarbler
|
|
45
46
|
|
46
47
|
def initialize
|
47
48
|
@compile_ruby_files = false
|
49
|
+
@compile_java_version = nil # not specified by default
|
48
50
|
@excludes = %w(tmp/cache tmp/pids tmp/sockets vendor/bundle vendor/cache vendor/ruby)
|
49
51
|
@excludes_from_compile = []
|
50
52
|
@executable = 'bin/rails'
|
@@ -86,6 +88,11 @@ module Jarbler
|
|
86
88
|
# the original ruby files are not included in the jar file, so source code is not visible
|
87
89
|
# config.compile_ruby_files = #{compile_ruby_files}
|
88
90
|
|
91
|
+
# Java version the compiled .class files should be compatible with
|
92
|
+
# controls the target and source version of the Java compiler (javac -source and -target)
|
93
|
+
# if not set then it generates the class file version according to your current Java version
|
94
|
+
# config.compile_java_version = '1.8'
|
95
|
+
|
89
96
|
# Directories or files to exclude from the compilation if compile_ruby_files = true
|
90
97
|
# The paths map to the final location of files or dirs in the jar file, e.g. config.excludes_from_compile = ['gems', 'app_root/app/models']
|
91
98
|
# config.excludes_from_compile = #{excludes_from_compile}
|
@@ -153,7 +160,7 @@ module Jarbler
|
|
153
160
|
|
154
161
|
# Avoid exception if using depprecated config attribute include_gems_to_compile
|
155
162
|
def include_gems_to_compile=(_value)
|
156
|
-
puts "Configuration attribute 'include_gems_to_compile' is deprecated. Use 'excludes_from_compile = [
|
163
|
+
puts "Configuration attribute 'include_gems_to_compile' is deprecated. Use 'excludes_from_compile = [\"gems\"]' instead."
|
157
164
|
end
|
158
165
|
|
159
166
|
def validate_values
|
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.3.
|
4
|
+
version: 0.3.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-03-
|
11
|
+
date: 2025-03-22 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'
|