glimmer-dsl-swt 4.21.1.1 → 4.21.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9bf8841cfbf5434aa97cc021720d0198f54b2aa8579ca21086d0edd94c36f896
4
- data.tar.gz: c2a683b52ec35a36036db500ad8af9b1571387bf89fc2ed5ceeaccd2012a9753
3
+ metadata.gz: 06baa33f2bcb64eee399561cbc5b92ea160d677462b690d36746816385d5c81a
4
+ data.tar.gz: de77d266007ed06d74ff5f28374167561f6989620d3293ab0597bc006b7e1af3
5
5
  SHA512:
6
- metadata.gz: a4af7fca643eace69c2d323bb8ec0c9610af59e554d490fbac62bb79ac53ebc24fb25f1bd87bc25bf3471475d1a033db957825c2770787a3ffd1decae1a1b812
7
- data.tar.gz: a16a96f5239163c25742b5728c7e10fdd31a12c5d4153ea4a47a3a8795025554701422b74ae3fdfa3c4e7cc0e75beb4353b2f91902d0c2bab543436b4208d0d3
6
+ metadata.gz: 4a16bdc52e1fa03b29f602b163e170d00acddd9858a438dbedff4d60895521f3b9597b5bca920a2bc8b657854772ee79c367b95e2433545c954975ab3fb81f17
7
+ data.tar.gz: 3a414799220cf1257a5c8c5af278e924a547a54ba17c6c201dfde25dcdf3f91f522ee42326e35ce3b34e00a1b039d2e9604aa400dda1457f1ddcea65d3cd922b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.21.2.0
4
+
5
+ - Support Linux packaging into deb/rpm native executables (not just gems) through standard `glimmer package` call (e.g. `glimmer package[deb]` or `glimmer package[rpm]`)
6
+ - Update `Glimmer::SWT::ImageProxy` implementation of image loading from JAR to use `JRuby.runtime.jruby_class_loader.get_resource_as_stream(file_path).to_io.to_input_stream`
7
+ - Remove scaffolding/packaging building/using of a generated Java `Resource` class
8
+ - Force installing `gem 'psych', '3.3.2'` in scaffolded app as a temporary workaround to `psych` issues with the latest jruby (jruby-9.3.1.0)
9
+
3
10
  ### 4.21.1.1
4
11
 
5
12
  - Fix samples for Windows, espcially Hello, Cool Bar!, Hello, Tool Bar!, and Weather
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.21.1.1
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.21.2.0
2
2
  ## JRuby Desktop Development GUI Framework
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -10,12 +10,12 @@
10
10
 
11
11
  **(The Original Glimmer Library Handling the World’s Ruby GUI Needs Since 2007. Beware of Imitators!)**
12
12
 
13
- [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [SWT](https://www.eclipse.org/swt/) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models afterwards. Not only does Glimmer provide a large set of GUI [widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#widgets), but it also supports drawing Canvas Graphics like [Shapes](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl) and [Animations](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](docs/reference/GLIMMER_COMMAND.md#scaffolding) options for [Apps](#in-production), [Gems](docs/reference/GLIMMER_COMMAND.md#custom-shell-gem), and [Custom Widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gems](docs/reference/GLIMMER_COMMAND.md#packaging) on [Linux](https://www.linux.org/). [Glimmer](https://github.com/AndyObtiva/glimmer) was the [first Ruby gem](https://rubygems.org/gems/glimmer) to bring [SWT](https://www.eclipse.org/swt/) (Standard Widget Toolkit) to [Ruby](https://www.ruby-lang.org/en/), thanks to creator [Andy Maleh](https://andymaleh.blogspot.com/), EclipseCon/EclipseWorld/RubyConf speaker.
13
+ [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [SWT](https://www.eclipse.org/swt/) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models afterwards. Not only does Glimmer provide a large set of GUI [widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#widgets), but it also supports drawing Canvas Graphics like [Shapes](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl) and [Animations](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](docs/reference/GLIMMER_COMMAND.md#scaffolding) options for [Apps](#in-production), [Gems](docs/reference/GLIMMER_COMMAND.md#custom-shell-gem), and [Custom Widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and DEB/RPM files on [Linux](https://www.linux.org/). [Glimmer](https://github.com/AndyObtiva/glimmer) was the [first Ruby gem](https://rubygems.org/gems/glimmer) to bring [SWT](https://www.eclipse.org/swt/) (Standard Widget Toolkit) to [Ruby](https://www.ruby-lang.org/en/), thanks to creator [Andy Maleh](https://andymaleh.blogspot.com/), EclipseCon/EclipseWorld/RubyConf speaker.
14
14
 
15
15
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
16
16
  Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
17
17
 
18
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.21.1.1 includes [SWT 4.21](https://download.eclipse.org/eclipse/downloads/drops4/R-4.21-202109060500/), which was released on September 6, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
18
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.21.2.0 includes [SWT 4.21](https://download.eclipse.org/eclipse/downloads/drops4/R-4.21-202109060500/), which was released on September 6, 2021. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
19
19
 
20
20
  **Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword (keep in mind that it is still a beta, so default back to `bind` whenever needed).
21
21
 
@@ -322,7 +322,7 @@ jgem install glimmer-dsl-swt
322
322
 
323
323
  Or this command if you want a specific version:
324
324
  ```
325
- jgem install glimmer-dsl-swt -v 4.21.1.1
325
+ jgem install glimmer-dsl-swt -v 4.21.2.0
326
326
  ```
327
327
 
328
328
  `jgem` is JRuby's version of `gem` command.
@@ -350,7 +350,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
350
350
 
351
351
  Add the following to `Gemfile`:
352
352
  ```
353
- gem 'glimmer-dsl-swt', '~> 4.21.1.1'
353
+ gem 'glimmer-dsl-swt', '~> 4.21.2.0'
354
354
  ```
355
355
 
356
356
  And, then run:
@@ -371,7 +371,7 @@ glimmer
371
371
  ```
372
372
 
373
373
  ```
374
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.1.1
374
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.2.0
375
375
 
376
376
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
377
377
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.21.1.1
1
+ 4.21.2.0
@@ -1270,6 +1270,17 @@ It is a graphics `Image` object (not a widget), but is used used in setting the
1270
1270
 
1271
1271
  Glimmer recently included **EXPERIMENTAL** gif animation support for the `background_image` property on `composite' since SWT does not support animation by default. On Windows, it only works inside composites nested under standard shells, not ones that have the SWT styles :on_top or :no_trim
1272
1272
 
1273
+ When an app is packaged (i.e. JAR inside a DMG or MSI native executable), jruby generates file paths that start with "uri:classloader". The `image` keyword automatically knows how to interpret such paths when passed as an argument.
1274
+
1275
+ Should you need to read a file from a JAR file manually, you may use this code (assuming a `file_path` formed using standard Ruby `File.expand_path` call, which jruby automatically overrides when running from a JAR to generate a `uri:classloader` path) :
1276
+ ```ruby
1277
+ require 'jruby'
1278
+ file_path = file_path.sub(/^uri\:classloader\:/, '').sub(/^\/+/, '')
1279
+ jcl = JRuby.runtime.jruby_class_loader
1280
+ resource = jcl.get_resource_as_stream(file_path)
1281
+ file_input_stream = resource.to_io.to_input_stream
1282
+ ```
1283
+
1273
1284
  Learn more about images in general at this SWT Image guide: https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html
1274
1285
 
1275
1286
  #### Image Options
@@ -3870,7 +3881,7 @@ class Example
3870
3881
  text 'Application Menu Items'
3871
3882
  font height: 30
3872
3883
  }
3873
- }
3884
+ }
3874
3885
  }
3875
3886
  end
3876
3887
 
@@ -1,18 +1,12 @@
1
1
  ## Glimmer Packaging and Distribution
2
2
 
3
- Note: this section mostly applies to Mac and Windows. On Linux, you can just run `glimmer package:gem` and after installing the gem, you get an executable matching the name of the app/custom-shell-gem you are building (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem).
4
-
5
- Note 2: On Windows, ensure system environment PATH includes Java bin directory `"C:\Program Files\Java\jdk-16.0.2\bin"` at the top for `jpackage` command to work during packaging Glimmer applications (the default Oracle setup path for Java after installing the JDK is usually not sufficient).
6
-
7
- Note 3: Glimmer packaging has a strong dependency on JDK16 since it includes the packaging tool `jpackage`. On the Mac, it seems there is a new gotcha in the latest JDK 16 DMG/PKG installable that is resulting in `jpackage` to be missing from `PATH`. To include, you might need to add `export PATH="/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin:$PATH"` to `~/.zprofile` or `~/.bashrc`
8
-
9
- Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
3
+ Glimmer simplifies the process of native-executable packaging and distribution on Mac, Windows, and Linux via a single `glimmer package` command:
10
4
 
11
5
  ```
12
6
  glimmer package
13
7
  ```
14
8
 
15
- It works out of the box for any application scaffolded by [Glimmer Scaffolding](#scaffolding), generating default packaging type on the current platform if not specified (i.e. `app-image`) and displaying a message indicating what pre-requisite setup tools are needed if not installed already (e.g. [Wix Toolset](https://wixtoolset.org/) to generate MSI files on Windows). If you install Wix, make sure it is on the system PATH by adding for example "C:\Program Files (x86)\WiX Toolset v3.11\bin" to the Windows Environment Variables.
9
+ It works out of the box for any application scaffolded by [Glimmer Scaffolding](#scaffolding), generating default packaging type on the current platform if not specified (i.e. `app-image`) and displaying a message indicating what pre-requisite setup tools are needed if not installed already (e.g. [Wix Toolset](https://wixtoolset.org/) to generate MSI files on Windows. If you install Wix, make sure it is on the system PATH by adding for example "C:\Program Files (x86)\WiX Toolset v3.11\bin" to the Windows Environment Variables.).
16
10
 
17
11
  You may choose to generate a specific type of packaging instead by addionally passing in the `[type]` option. For example, this generates an MSI setup file on Windows:
18
12
 
@@ -20,7 +14,7 @@ You may choose to generate a specific type of packaging instead by addionally pa
20
14
  glimmer package[msi]
21
15
  ```
22
16
 
23
- This generates a DMG file on the Mac:
17
+ This command generates a DMG file on the Mac:
24
18
 
25
19
  ```
26
20
  glimmer package[dmg]
@@ -32,11 +26,23 @@ Make sure to surround with double-quotes when running from ZShell (zsh):
32
26
  glimmer "package[dmg]"
33
27
  ```
34
28
 
29
+ This command generates a DEB file on a Linux that supports deb packages (e.g. Linux Mint Cinnamon):
30
+
31
+ ```
32
+ glimmer package[deb]
33
+ ```
34
+
35
35
  - Available Mac packaging types are `dmg`, `pkg`, and `app-image` (image means a pure Mac `app` without a setup program). Keep in mind that the packages you produce are compatible with the same MacOS you are on or older.
36
36
  - Available Windows packaging types are `msi`, `exe`, and `app-image` (image means a Windows application directory without a setup program). Learn more about Windows packaging are [over here](#windows-application-packaging).
37
- - Available Linux packaging types are `deb`, `rpm`, and `app-image` (Note: Linux native packaging has not been tested successfully, which is why `glimmer package:gem` is recommended on Linux instead. If you get it working, please contribute to this doc file with a Pull Request).
37
+ - Available Linux packaging types are `deb`, `rpm`, and `app-image` (note the prerequisites: for Red Hat Linux, the `rpm-build` package is required (for rpm) and for Ubuntu Linux, the `fakeroot` package is required (for deb). Also, use common sense to know which package type to generate on what Linux [e.g. use `deb` on `Linux Mint Cinnamon` or use `rpm` on `Fedora Linux`]).
38
+
39
+ Note 1: On Windows, ensure system environment PATH includes Java bin directory `"C:\Program Files\Java\jdk-16.0.2\bin"` at the top for `jpackage` command to work during packaging Glimmer applications (the default Oracle setup path for Java after installing the JDK is usually not sufficient).
40
+
41
+ Note 2: Glimmer packaging has a strong dependency on JDK16 since it includes the packaging tool `jpackage`. On the Mac, it seems there is a new gotcha in the latest JDK 16 DMG/PKG installable that is resulting in `jpackage` to be missing from `PATH`. To include, you might need to add `export PATH="/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin:$PATH"` to `~/.zprofile` or `~/.bashrc`
42
+
43
+ Note 3: On Linux, note the prerequisites: for Red Hat Linux, the `rpm-build` package is required (for rpm) and for Ubuntu Linux, the `fakeroot` package is required (for deb). Also, use common sense to know which package type to generate on what Linux (e.g. use `deb` on `Linux Mint Cinnamon` or use `rpm` on `Fedora Linux`)
38
44
 
39
- Note: if you are using Glimmer manually without scaffolding, in order to make the `glimmer package` command available, you must add the following line to your application `Rakefile` (automatically done for you if you scaffold an app or gem with `glimmer scaffold[AppName]` or `glimmer scaffold:gem:customshell[GemName]`):
45
+ Note 4: if you are using Glimmer packaging with a manually generated app (without scaffolding), in order to make the `glimmer package` command available, you must add the following line to your application `Rakefile` (automatically done for you if you scaffold an app or gem with `glimmer scaffold[AppName]` or `glimmer scaffold:gem:customshell[GemName]`):
40
46
 
41
47
  ```ruby
42
48
  require 'glimmer/rake_task'
@@ -47,7 +53,7 @@ The Glimmer packaging process done in the `glimmer package` command consists of
47
53
  1. Lock JAR versions (`glimmer package:lock_jars`): This locks versions of JAR dependencies leveraged by the `jar-dependencies` JRuby gem, downloading them into the `./vendor` directory so they would get inside the top-level Glimmer app/gem JAR file.
48
54
  1. Generate [Warbler](https://github.com/jruby/warbler) config (`glimmer package:config`): Generates initial Warbler config file (under `./config/warble.rb`) to use for generating JAR file.
49
55
  1. Generate JAR file using [Warbler](https://github.com/jruby/warbler) (`glimmer package:jar`): Enables bundling a Glimmer app into a JAR file under the `./dist` directory
50
- 1. Generate native executable using [jpackage](https://docs.oracle.com/en/java/javase/14/jpackage/packaging-tool-user-guide.pdf) (`glimmer package:native`): Enables packaging a JAR file as a DMG/PKG/APP file on Mac, MSI/EXE/APP on Windows, and DEB/RPM/APP on Linux (Glimmer does not officially support Linux with the `glimmer package` command yet, but it generates the JAR file successfully, and you could use `jpackage` manually afterwards if needed).
56
+ 1. Generate native executable using [jpackage](https://docs.oracle.com/en/java/javase/16/jpackage/packaging-tool-user-guide.pdf) (`glimmer package:native`): Enables packaging a JAR file as a DMG/PKG/APP file on Mac, MSI/EXE/APP on Windows, and DEB/RPM/APP on Linux (Glimmer does not officially support Linux with the `glimmer package` command yet, but it generates the JAR file successfully, and you could use `jpackage` manually afterwards if needed).
51
57
 
52
58
  Those steps automatically ensure generating a JAR file under the `./dist` directory using [Warbler](https://github.com/jruby/warbler), which is then used to automatically generate a DMG/MSI file (and other executables) under the `./packages/bundles` directory using `jpackage`.
53
59
  The JAR file name will match your application local directory name (e.g. `MathBowling.jar` for `~/code/MathBowling`)
@@ -90,7 +96,7 @@ require_relative '../app/my_application.rb'
90
96
 
91
97
  In order to explicitly configure jpackage, Mac package attributes, or sign your Mac app to distribute on the App Store, you can follow more advanced instructions for `jpackage` here:
92
98
  - Run `jpackage --help` for more info
93
- - https://docs.oracle.com/en/java/javase/14/jpackage/packaging-tool-user-guide.pdf
99
+ - https://docs.oracle.com/en/java/javase/16/jpackage/packaging-tool-user-guide.pdf
94
100
  - https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMacAppStore/index.html#//apple_ref/doc/uid/TP40010572-CH16-SW8
95
101
 
96
102
  The Glimmer rake task allows passing extra options to jpackage via:
@@ -119,7 +125,7 @@ Pass `-v` to jpackage in `Glimmer::RakeTask::Package.jpackage_extra_args` or by
119
125
 
120
126
  ### Windows Application Packaging
121
127
 
122
- Windows s two options for setup packaging:
128
+ Windows offers two options for packaging:
123
129
  - `msi` (recommended): simpler packaging option. Requires [WiX Toolset](https://wixtoolset.org/) and [.NET Framework](https://dotnet.microsoft.com/download/dotnet-framework). Simply run `glimmer package[msi]` (or `glimmer package:native[msi]` if it's not your first time) and it will give you more details on the pre-requisites you need to install (e.g. [WiX Toolset](https://wixtoolset.org/) and [.NET Framework 3.5 SP1](https://dotnet.microsoft.com/download/dotnet-framework/net35-sp1)).
124
130
  - `exe`: more advanced packaging option. Requires [Inno Setup](https://jrsoftware.org/isinfo.php). Simply run `glimmer package[exe]` (or `glimmer package:native[exe]` if it's not your first time) and it will tell you what you need to install.
125
131
 
@@ -129,7 +135,7 @@ If you just want to test out packaging into a native Windows app that is not pac
129
135
 
130
136
  Recent macOS versions (starting with Catalina) have very stringent security requirements requiring all applications to be signed before running (unless the user goes to System Preferences -> Privacy -> General tab and clicks "Open Anyway" after failing to open application the first time they run it). So, to release a desktop application on the Mac, it is recommended to enroll in the [Apple Developer Program](https://developer.apple.com/programs/) to distribute on the [Mac App Store](https://developer.apple.com/distribute/) or otherwise request [app notarization from Apple](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution) to distribute independently.
131
137
 
132
- Afterwards, you may add signing arguments to `jpackage` via `Glimmer::RakeTask::Package.jpackage_extra_args` or `JPACKAGE_EXTRA_ARGS` according to this webpage: https://docs.oracle.com/en/java/javase/14/jpackage/packaging-tool-user-guide.pdf
138
+ Afterwards, you may add signing arguments to `jpackage` via `Glimmer::RakeTask::Package.jpackage_extra_args` or `JPACKAGE_EXTRA_ARGS` according to this webpage: https://docs.oracle.com/en/java/javase/16/jpackage/packaging-tool-user-guide.pdf
133
139
 
134
140
  ```
135
141
  --mac-package-signing-prefix <prefix string>
@@ -182,10 +188,12 @@ org.apache.maven.InternalErrorException: Internal error: org.jruby.exceptions.Ra
182
188
  Caused by: org.jruby.exceptions.RaiseException: (LoadError) library `java' could not be loaded: java.lang.reflect.InaccessibleObjectException: Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @138caeca
183
189
  [ERROR]
184
190
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
191
+ ```
185
192
 
186
193
  3. jpackage missing from PATH on the Mac
187
194
 
188
195
  On the Mac, the latest JDK 16 installable DMG/PKG is resulting in `jpackage` to be missing from `PATH`. To include, you might need to add `export PATH="/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin:$PATH"` to `~/.zprofile` or `~/.bashrc`
196
+ ```
189
197
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
190
198
  [ERROR]
191
199
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
@@ -194,7 +202,7 @@ On the Mac, the latest JDK 16 installable DMG/PKG is resulting in `jpackage` to
194
202
 
195
203
  Please ignore. It should be harmless. If you get blocked by it for any reason, please open an Issue about it.
196
204
 
197
- 3. Java on Windows System PATH
205
+ 4. Java on Windows System PATH
198
206
 
199
207
  If you get any errors running Java on Windows, keep in mind that you need to have the Java binaries "C:\Program Files\Java\jdk-16.0.2\bin" on the Windows System PATH environment variable.
200
208
 
@@ -204,3 +212,21 @@ The problem is Oracle seems to be adding an indirect Java path junction in later
204
212
  Simply replace it with the simple path mentioned above (`"C:\Program Files\Java\jdk-16.0.2\bin"` matching your correct version number)
205
213
 
206
214
  Lastly, reinstall JRuby to ensure it is using Java from the right path.
215
+
216
+ 5. File paths in app running from packaged JAR file
217
+
218
+ Glimmer packaged apps always reside within a JAR file before being wrapped by a native executable.
219
+
220
+ JRuby automatically converts any paths produced by File.expand_path inside packaged JAR file into uri:classloader prefixed paths. They work just fine when performing File.read, but if you need to access as a Java input stream, you need to use special code:
221
+
222
+ ```ruby
223
+ require 'jruby'
224
+ file_path = File.expand_path(some_path, __dir__)
225
+ file_path = file_path.sub(/^uri\:classloader\:/, '').sub(/^\/+/, '')
226
+ jcl = JRuby.runtime.jruby_class_loader
227
+ resource = jcl.get_resource_as_stream(file_path)
228
+ file_input_stream = resource.to_io.to_input_stream
229
+ ```
230
+
231
+ The `image` keyword in Glimmer automatically does that work when passing an image path produced from inside a JAR file.
232
+
Binary file
@@ -112,7 +112,7 @@ module Glimmer
112
112
  FileUtils.mkdir_p('packages/bundles')
113
113
  command = "jpackage"
114
114
  command += " --type #{native_type}"
115
- command += " --dest 'packages/bundles' --input 'dist' --main-class JarMain --main-jar '#{project_name}.jar' --java-options '-Dproject_name=#{project_name}' --name '#{human_name}' --vendor '#{human_name}' --icon '#{icon}' "
115
+ command += " --dest 'packages/bundles' --input 'dist' --main-class JarMain --main-jar '#{project_name}.jar' --name '#{human_name}' --vendor '#{human_name}' --icon '#{icon}' "
116
116
  command += " --win-per-user-install --win-dir-chooser --win-menu --win-menu-group '#{human_name}' " if OS.windows? && native_type != 'app-image'
117
117
  command += " --linux-menu-group '#{human_name}' " if OS.linux? && native_type != 'app-image'
118
118
  command += " --java-options '-XstartOnFirstThread' --mac-package-name '#{human_name}' --mac-package-identifier 'org.#{project_name}.application.#{project_name}' " if OS.mac?
@@ -116,10 +116,12 @@ module Glimmer
116
116
  GEMFILE_APP_MIDFIX = <<~MULTI_LINE_STRING
117
117
 
118
118
  gem 'glimmer-dsl-swt', '~> #{VERSION}'
119
+ gem 'psych', '3.3.2' # Fixed temporarily because installing latest on JDK16 was causing issues
119
120
  MULTI_LINE_STRING
120
121
  GEMFILE_GEM_MIDFIX = <<~MULTI_LINE_STRING
121
122
 
122
123
  gem 'glimmer-dsl-swt', '~> #{VERSION.split('.')[0...2].join('.')}'
124
+ gem 'psych', '3.3.2' # Fixed temporarily because installing latest on JDK16 was causing issues
123
125
  MULTI_LINE_STRING
124
126
  GEMFILE_SUFFIX = <<~MULTI_LINE_STRING
125
127
 
@@ -182,11 +184,6 @@ module Glimmer
182
184
  cp File.expand_path('../../../../icons/scaffold_app.png', __FILE__), icon_file
183
185
  puts "Created #{current_dir_name}/#{icon_file}"
184
186
 
185
- write "Resource.java", resource_java_file(app_name)
186
- cd '..'
187
- system "javac #{file_name(app_name)}/Resource.java"
188
- cd gem_name
189
-
190
187
  mkdir_p "app/#{file_name(app_name)}"
191
188
  write "app/#{file_name(app_name)}/launch.rb", app_launch_file(app_name)
192
189
  mkdir_p 'bin'
@@ -298,11 +295,6 @@ module Glimmer
298
295
  cp File.expand_path('../../../../icons/scaffold_app.png', __FILE__), icon_file
299
296
  puts "Created #{current_dir_name}/#{icon_file}"
300
297
 
301
- write "Resource.java", resource_java_file(custom_shell_name)
302
- cd '..'
303
- system "javac #{file_name(custom_shell_name)}/Resource.java"
304
- cd gem_name
305
-
306
298
  if OS.windows?
307
299
  system "glimmer package" # TODO handle windows properly with batch file
308
300
  system "\"packages/bundles/#{human_name(custom_shell_name)}/#{human_name(custom_shell_name)}.exe\""
@@ -496,16 +488,6 @@ module Glimmer
496
488
  MULTI_LINE_STRING
497
489
  end
498
490
 
499
- def resource_java_file(app_name)
500
- <<~MULTI_LINE_STRING
501
- package #{file_name(app_name)};
502
-
503
- /** The soul purpose of this class is to retrieve icons for uri:classloader paths used from JAR */
504
- class Resource {
505
- }
506
- MULTI_LINE_STRING
507
- end
508
-
509
491
  def app_bin_command_file(app_name_or_gem_name, custom_shell_name=nil, namespace=nil)
510
492
  if custom_shell_name.nil?
511
493
  runner = "File.expand_path('../../app/#{file_name(app_name_or_gem_name)}/launch.rb', __FILE__)"
@@ -545,7 +527,7 @@ module Glimmer
545
527
  lines.insert(require_rake_line_index, "require 'glimmer/launcher'")
546
528
  gem_files_line_index = lines.index(lines.detect {|l| l.include?('# dependencies defined in Gemfile') })
547
529
  if custom_shell_name
548
- lines.insert(gem_files_line_index, " gem.files = Dir['Resource.class', 'VERSION', 'LICENSE.txt', 'app/**/*', 'bin/**/*', 'config/**/*', 'db/**/*', 'docs/**/*', 'fonts/**/*', 'icons/**/*', 'images/**/*', 'lib/**/*', 'script/**/*', 'sounds/**/*', 'vendor/**/*', 'videos/**/*']")
530
+ lines.insert(gem_files_line_index, " gem.files = Dir['VERSION', 'LICENSE.txt', 'app/**/*', 'bin/**/*', 'config/**/*', 'db/**/*', 'docs/**/*', 'fonts/**/*', 'icons/**/*', 'images/**/*', 'lib/**/*', 'script/**/*', 'sounds/**/*', 'vendor/**/*', 'videos/**/*']")
549
531
  # the second executable is needed for warbler as it matches the gem name, which is the default expected file (alternatively in the future, we could do away with it and configure warbler to use the other file)
550
532
  lines.insert(gem_files_line_index+1, " gem.require_paths = ['vendor', 'lib', 'app']")
551
533
  lines.insert(gem_files_line_index+2, " gem.executables = ['#{file_name(custom_shell_name)}']") if custom_shell_name
@@ -561,7 +543,7 @@ module Glimmer
561
543
  Glimmer::RakeTask::Package.jpackage_extra_args =
562
544
  " --name '#{human_name(custom_shell_name)}'" +
563
545
  " --description '#{human_name(custom_shell_name)}'"
564
- # You can add more options from https://docs.oracle.com/en/java/javase/14/jpackage/packaging-tool-user-guide.pdf
546
+ # You can add more options from https://docs.oracle.com/en/java/javase/16/jpackage/packaging-tool-user-guide.pdf
565
547
  MULTI_LINE_STRING
566
548
  end
567
549
  file_content
@@ -111,11 +111,7 @@ namespace :glimmer do
111
111
  Rake::Task['glimmer:package:lock_jars'].execute
112
112
  Rake::Task['glimmer:package:config'].execute
113
113
  Rake::Task['glimmer:package:jar'].execute
114
- if OS.linux?
115
- Rake::Task['glimmer:package:gem'].execute
116
- else
117
- Rake::Task['glimmer:package:native'].execute(args)
118
- end
114
+ Rake::Task['glimmer:package:native'].execute(args)
119
115
  end
120
116
 
121
117
  desc 'Scaffold Glimmer application directory structure to build a new app'
@@ -122,9 +122,11 @@ module Glimmer
122
122
  def input_stream
123
123
  if @file_path.start_with?('uri:classloader')
124
124
  @jar_file_path = @file_path
125
- file_path = @jar_file_path.sub(/^uri\:classloader\:/, '').sub('//', '') # the latter sub is needed for Mac
126
- project_name = java.lang.System.getProperty('project_name')
127
- file_input_stream = java_import("#{project_name}.Resource").last.java_class.resource_as_stream(file_path)
125
+ file_path = @jar_file_path.sub(/^uri\:classloader\:/, '').sub(/^\/+/, '')
126
+ require 'jruby'
127
+ jcl = JRuby.runtime.jruby_class_loader
128
+ resource = jcl.get_resource_as_stream(file_path)
129
+ file_input_stream = resource.to_io.to_input_stream
128
130
  else
129
131
  file_input_stream = java.io.FileInputStream.new(@file_path)
130
132
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.21.1.1
4
+ version: 4.21.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-31 00:00:00.000000000 Z
11
+ date: 2021-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -376,9 +376,9 @@ description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a
376
376
  started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
377
377
  Glimmer also includes native-executable packaging support, sorely lacking in other
378
378
  libraries, thus enabling the delivery of desktop apps written in Ruby as truly native
379
- DMG/PKG/APP files on the Mac, MSI/EXE files on Windows, and Gem Packaged Shell Scripts
380
- on Linux. Glimmer was the first Ruby gem to bring SWT (Standard Widget Toolkit)
381
- to Ruby, thanks to creator Andy Maleh, EclipseCon/EclipseWorld/RubyConf speaker.
379
+ DMG/PKG/APP files on the Mac, MSI/EXE files on Windows, and DEB/RPM files on Linux.
380
+ Glimmer was the first Ruby gem to bring SWT (Standard Widget Toolkit) to Ruby, thanks
381
+ to creator Andy Maleh, EclipseCon/EclipseWorld/RubyConf speaker.
382
382
  email: andy.am@gmail.com
383
383
  executables:
384
384
  - glimmer