glimmer-dsl-swt 4.20.15.4 → 4.21.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/README.md +17 -11
- data/RUBY_VERSION +1 -1
- data/VERSION +1 -1
- data/bin/girb +0 -0
- data/bin/glimmer +0 -0
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +0 -2
- data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +84 -92
- data/docs/reference/GLIMMER_STYLE_GUIDE.md +1 -2
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/data_binding/widget_binding.rb +3 -3
- data/lib/glimmer/rake_task/package.rb +20 -22
- data/lib/glimmer/rake_task/scaffold.rb +45 -28
- data/lib/glimmer/swt/image_proxy.rb +3 -3
- data/lib/glimmer/swt/shell_proxy.rb +6 -4
- data/lib/glimmer/swt/widget_proxy.rb +4 -0
- data/samples/elaborate/meta_sample.rb +1 -1
- data/samples/elaborate/tetris.rb +1 -1
- data/samples/hello/hello_scale.rb +1 -4
- data/samples/hello/hello_slider.rb +1 -4
- data/vendor/swt/linux/swt.jar +0 -0
- data/vendor/swt/linux_aarch64/swt.jar +0 -0
- data/vendor/swt/mac/swt.jar +0 -0
- data/vendor/swt/mac_aarch64/swt.jar +0 -0
- data/vendor/swt/windows/swt.jar +0 -0
- metadata +22 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45cbd1e7513012e29439dbf431ce0819b0490637fb8bd32b9b0cbfbbb5bb1637
|
4
|
+
data.tar.gz: 8982fb5dc7441b3cf666aacc1c6610901d67b5333450c0bc8c8c1ca19e85ccfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55f4817c088c8216d024f9b3c98bc147a54833756017ad9f7c1fcb76eec025e37ba8534c84cf3d0a7510104a17caa39700aeb5b86de320d4847811fa2cf83e10
|
7
|
+
data.tar.gz: cb40211d2487b87d6ac54b0bcf2bb0d50096ee1c27ffa4f70d7a443e7e9f94f406a94740d1796d143c62b51c7382a9fa1b0d6ca40ff89a5bacff564819ca7ccc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.21.1.0
|
4
|
+
|
5
|
+
- Upgrade to jruby 9.3.1.0
|
6
|
+
- Upgrade to glimmer 2.4.0 (with better observing of array of arrays nested changes)
|
7
|
+
- Minor sample fixes for Linux: Tetris (down button now works), Hello, Scale! (now fits horizontally), and Hello, Slider! (now fits horizontally)
|
8
|
+
- Adjusted minimum size of Meta-Sample to allow more shrinking (`minimum_size 640, 384`)
|
9
|
+
- Do not clean observers when disposing of a widget while closing the last shell (e.g. when closing an app, it is not needed to clean observers, so it is better to exit faster)
|
10
|
+
|
11
|
+
### 4.21.0.1
|
12
|
+
|
13
|
+
- Updated default width for `shell` to `190` (was `130` before)
|
14
|
+
|
15
|
+
### 4.21.0.0
|
16
|
+
|
17
|
+
- Upgrade to SWT 4.21
|
18
|
+
- Upgrade to JDK 16.0.2
|
19
|
+
- Upgrade to JRuby 9.3.0.0
|
20
|
+
- Update packaging to rely on JDK 16 `jpackage` (instead of older JDK 8 `javapackager`)
|
21
|
+
- Renamed `Glimmer::RakeTask::Package.javapackager_extra_args` to `Glimmer::RakeTask::Package.jpackage_extra_args` to match the name of `jpackage` in JDK 16
|
22
|
+
- Change `package/[os]` scaffolding placement for packaging icons into `icons/[os]` to accomodate Java 9 Module security for icon retrieval from within a JAR
|
23
|
+
|
24
|
+
### 4.20.15.5
|
25
|
+
|
26
|
+
- Upgrade to glimmer 2.1.5
|
27
|
+
|
3
28
|
### 4.20.15.4
|
4
29
|
|
5
30
|
- Fix issue with not tying observer registrations to custom widgets correctly automatically
|
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.
|
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.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 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 [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.
|
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.
|
18
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.21.1.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
|
|
@@ -27,6 +27,7 @@ Glimmer DSL gems:
|
|
27
27
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
28
28
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
|
29
29
|
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
30
|
+
- [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
|
30
31
|
|
31
32
|
## Examples
|
32
33
|
|
@@ -289,10 +290,10 @@ https://www.eclipse.org/swt/faq.php
|
|
289
290
|
|
290
291
|
## Pre-requisites
|
291
292
|
|
292
|
-
- JDK
|
293
|
+
- JDK 16 (16.0.2) (find at https://www.oracle.com/java/technologies/downloads/#java16 / On Windows, ensure PATH includes Java bin directory for jpackage to work during packaging Glimmer applications)
|
293
294
|
- [RVM](http://rvm.io) on Mac & Linux (not available on Windows)
|
294
|
-
- JRuby 9.
|
295
|
-
- SWT 4.
|
295
|
+
- JRuby 9.3.0.0 (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.0.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download) [you might have to dual-install JDK8 temporarily as it might be required by jruby installer and then switch JAVA_HOME to JDK16 once done installing and restart command prompt/git bash])
|
296
|
+
- SWT 4.21 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem). Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested with Glimmer DSL for SWT yet, so it is considered experimental until declared otherwise.
|
296
297
|
- Git (comes with Mac and Linux. Install on Windows: https://git-scm.com/download/win )
|
297
298
|
|
298
299
|
Glimmer might still work on other versions of Java, JRuby and SWT, but there are no guarantees, so it is best to stick to the pre-requisites outlined above.
|
@@ -321,7 +322,7 @@ jgem install glimmer-dsl-swt
|
|
321
322
|
|
322
323
|
Or this command if you want a specific version:
|
323
324
|
```
|
324
|
-
jgem install glimmer-dsl-swt -v 4.
|
325
|
+
jgem install glimmer-dsl-swt -v 4.21.1.0
|
325
326
|
```
|
326
327
|
|
327
328
|
`jgem` is JRuby's version of `gem` command.
|
@@ -336,7 +337,7 @@ On the Mac, you also have to run:
|
|
336
337
|
glimmer-setup
|
337
338
|
```
|
338
339
|
|
339
|
-
This ensures configuring
|
340
|
+
This ensures configuring required Mac jruby options before using `glimmer` and `girb` commands (adding `export JRUBY_OPTS="$JRUBY_OPTS -J-XstartOnFirstThread"` to `~/.zprofile` and `~/.bash_profile`).
|
340
341
|
|
341
342
|
If you are new to Glimmer and would like to continue learning the basics, you may continue to the [Glimmer Command](#glimmer-command) section.
|
342
343
|
|
@@ -349,7 +350,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
349
350
|
|
350
351
|
Add the following to `Gemfile`:
|
351
352
|
```
|
352
|
-
gem 'glimmer-dsl-swt', '~> 4.
|
353
|
+
gem 'glimmer-dsl-swt', '~> 4.21.1.0'
|
353
354
|
```
|
354
355
|
|
355
356
|
And, then run:
|
@@ -370,7 +371,7 @@ glimmer
|
|
370
371
|
```
|
371
372
|
|
372
373
|
```
|
373
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.
|
374
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.21.1.0
|
374
375
|
|
375
376
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
376
377
|
|
@@ -534,6 +535,10 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
|
|
534
535
|
|
535
536
|
[<img alt="Connector Logo" src="https://raw.githubusercontent.com/AndyObtiva/dcr/f31cd45a8503051e899ed8e831fd03654d38e418/package/linux/Draw%20Color%20Repeat.png" height=40 /> Draw Color Repeat](https://github.com/AndyObtiva/dcr): A young boy programming language for Drawing and Coloring with Repetition
|
536
537
|
|
538
|
+
### Befunge 98 Programming Language
|
539
|
+
|
540
|
+
[Befunge 98 GUI](https://github.com/AndyObtiva/befunge98/tree/gui)
|
541
|
+
|
537
542
|
## Packaging & Distribution
|
538
543
|
|
539
544
|
Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single command:
|
@@ -671,7 +676,8 @@ You may apply for contributing to any of these Glimmer DSL gems whether you pref
|
|
671
676
|
## Contributors
|
672
677
|
|
673
678
|
* [Andy Maleh](https://github.com/AndyObtiva) (Founder)
|
674
|
-
* [Dennis Theisen](https://github.com/Soleone) (Contributor, originally in [Glimmer](https://github.com/AndyObtiva/glimmer/graphs/contributors) before splitting glimmer-dsl-swt)
|
679
|
+
* [Dennis Theisen](https://github.com/Soleone) (Contributor, originally in [Glimmer](https://github.com/AndyObtiva/glimmer/graphs/contributors) before splitting [glimmer-dsl-swt](https://rubygems.org/gems/glimmer))
|
680
|
+
* [Wayne Vucenic](https://github.com/rubycoder)
|
675
681
|
|
676
682
|
[Click here to view contributor commits.](https://github.com/AndyObtiva/glimmer-dsl-swt/graphs/contributors)
|
677
683
|
|
data/RUBY_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
jruby-9.
|
1
|
+
jruby-9.3.1.0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.21.1.0
|
data/bin/girb
CHANGED
File without changes
|
data/bin/glimmer
CHANGED
File without changes
|
@@ -2383,8 +2383,6 @@ Example from [samples/hello/hello_combo.rb](samples/hello_combo.rb) sample (you
|
|
2383
2383
|
|
2384
2384
|
#### Shine
|
2385
2385
|
|
2386
|
-
**(BETA FEATURE)**
|
2387
|
-
|
2388
2386
|
The new Shine syntax for View/Model Attribute Mapping allows data-binding visually with simple arrow operators in Ruby.
|
2389
2387
|
|
2390
2388
|
Use `<=> [model, attribute, options]` for bidirectional (two-way) data-binding instead of `bind(model, attribute, options)`.
|
@@ -1,8 +1,10 @@
|
|
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).
|
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
4
|
|
5
|
-
Note 2:
|
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`.
|
6
8
|
|
7
9
|
Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
|
8
10
|
|
@@ -10,9 +12,7 @@ Glimmer simplifies the process of native-executable packaging and distribution o
|
|
10
12
|
glimmer package
|
11
13
|
```
|
12
14
|
|
13
|
-
It works out of the box for any application scaffolded by [Glimmer Scaffolding](#scaffolding), generating
|
14
|
-
|
15
|
-
(note: if you see this error on the Mac 'Error: Bundler "DMG Installer" (dmg) failed to produce a bundle.', ignore it as it should have produced a bundle anyways. It is a harmless issue in 3rd party dependency: javapackager.)
|
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.
|
16
16
|
|
17
17
|
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
18
|
|
@@ -20,16 +20,23 @@ You may choose to generate a specific type of packaging instead by addionally pa
|
|
20
20
|
glimmer package[msi]
|
21
21
|
```
|
22
22
|
|
23
|
+
This generates a DMG file on the Mac:
|
24
|
+
|
25
|
+
```
|
26
|
+
glimmer package[dmg]
|
27
|
+
```
|
28
|
+
|
23
29
|
Make sure to surround with double-quotes when running from ZShell (zsh):
|
24
30
|
|
25
31
|
```
|
26
|
-
glimmer "package[
|
32
|
+
glimmer "package[dmg]"
|
27
33
|
```
|
28
34
|
|
29
|
-
- Available Mac packaging types are `dmg`, `pkg`, and `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.
|
30
|
-
- Available Windows packaging types are `msi`, `exe`, and `image` (image means a Windows application directory without a setup program). Learn more about Windows packaging are [over here](#windows-application-packaging).
|
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
|
+
- 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).
|
31
38
|
|
32
|
-
Note: if you are using Glimmer manually, 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]`):
|
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]`):
|
33
40
|
|
34
41
|
```ruby
|
35
42
|
require 'glimmer/rake_task'
|
@@ -40,20 +47,20 @@ The Glimmer packaging process done in the `glimmer package` command consists of
|
|
40
47
|
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.
|
41
48
|
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.
|
42
49
|
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
|
43
|
-
1. Generate native executable using [
|
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).
|
44
51
|
|
45
|
-
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 `
|
52
|
+
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`.
|
46
53
|
The JAR file name will match your application local directory name (e.g. `MathBowling.jar` for `~/code/MathBowling`)
|
47
54
|
The DMG file name will match the humanized local directory name + dash + application version (e.g. `Math Bowling-1.0.dmg` for `~/code/MathBowling` with version 1.0 or unspecified)
|
48
55
|
|
49
56
|
The `glimmer package` command will automatically set "mac.CFBundleIdentifier" to ="org.#{project_name}.application.#{project_name}".
|
50
|
-
You may override by configuring as an extra argument for javapackger (e.g. Glimmer::RakeTask::Package.
|
57
|
+
You may override by configuring as an extra argument for javapackger (e.g. Glimmer::RakeTask::Package.jpackage_extra_args = " --mac-package-identifier org.andymaleh.application.MathBowling")
|
51
58
|
|
52
59
|
### Packaging Defaults
|
53
60
|
|
54
61
|
Glimmer employs smart defaults in packaging.
|
55
62
|
|
56
|
-
The package application name (shows up in top menu bar on the Mac) will be a human form of the app root directory name (e.g. "Math Bowling" for "MathBowling" or "math_bowling" app root directory name). However, application name and version may be specified explicitly via "-
|
63
|
+
The package application name (shows up in top menu bar on the Mac) will be a human form of the app root directory name (e.g. "Math Bowling" for "MathBowling" or "math_bowling" app root directory name). However, application name and version may be specified explicitly via "--name", "--mac-package-name" and "--version" options.
|
57
64
|
|
58
65
|
Also, the package will only include these directories: app, config, db, lib, script, bin, docs, fonts, images, sounds, videos
|
59
66
|
|
@@ -74,47 +81,41 @@ require_relative '../app/my_application.rb'
|
|
74
81
|
- Include Icon (Optional): If you'd like to include an icon for your app (.icns format on the Mac), place it under `package/macosx` matching the humanized application local directory name (e.g. 'Math Bowling.icns' [containing space] for MathBowling or math_bowling). You may generate your Mac icon easily using tools like Image2Icon (http://www.img2icnsapp.com/) or manually using the Mac terminal command `iconutil` (iconutil guide: https://applehelpwriter.com/tag/iconutil/)
|
75
82
|
- Include DMG Background Icon (Optional): Simply place a .png file under `package/macosx/{HumanAppName}-background.png`
|
76
83
|
- Include Version (Optional): Create a `VERSION` file in your application and fill it your app version on one line (e.g. `1.1.0`)
|
77
|
-
- Include License (Optional): Create a `LICENSE.txt` file in your application and fill it up with your license (e.g. MIT). It will show up to people when installing your app. Note that, you may optionally also specify license type, but you'd have to do so manually via
|
78
|
-
- Extra args (Optional): You may optionally add the following to `Rakefile` to configure extra arguments for
|
84
|
+
- Include License (Optional): Create a `LICENSE.txt` file in your application and fill it up with your license (e.g. MIT). It will show up to people when installing your app. Note that, you may optionally also specify license type, but you'd have to do so manually via `--license-file LICENSE.txt` shown in an [example below](#jpackage-extra-arguments).
|
85
|
+
- Extra args (Optional): You may optionally add the following to `Rakefile` to configure extra arguments for jpackage: `Glimmer::RakeTask::Package.jpackage_extra_args = "..."` (Useful to avoid re-entering extra arguments on every run of rake task.). Read about them in [their section below](#jpackage-extra-arguments).
|
79
86
|
|
80
|
-
###
|
87
|
+
### jpackage Extra Arguments
|
81
88
|
|
82
|
-
(note: currently `Glimmer::RakeTask::Package.
|
89
|
+
(note: currently `Glimmer::RakeTask::Package.jpackage_extra_args` is only honored when packaging from bash, not zsh)
|
83
90
|
|
84
|
-
In order to explicitly configure
|
85
|
-
-
|
86
|
-
- https://docs.oracle.com/
|
87
|
-
- https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#BCGICFDB
|
88
|
-
- https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html
|
91
|
+
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
|
+
- Run `jpackage --help` for more info
|
93
|
+
- https://docs.oracle.com/en/java/javase/14/jpackage/packaging-tool-user-guide.pdf
|
89
94
|
- https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMacAppStore/index.html#//apple_ref/doc/uid/TP40010572-CH16-SW8
|
90
95
|
|
91
|
-
The Glimmer rake task allows passing extra options to
|
92
|
-
- `Glimmer::RakeTask::Package.
|
93
|
-
- Environment variable: `
|
96
|
+
The Glimmer rake task allows passing extra options to jpackage via:
|
97
|
+
- `Glimmer::RakeTask::Package.jpackage_extra_args="..."` in your application Rakefile
|
98
|
+
- Environment variable: `JPACKAGE_EXTRA_ARGS`
|
94
99
|
|
95
100
|
Example (Rakefile):
|
96
101
|
|
97
102
|
```ruby
|
98
103
|
require 'glimmer/rake_task'
|
99
104
|
|
100
|
-
Glimmer::RakeTask::Package.
|
105
|
+
Glimmer::RakeTask::Package.jpackage_extra_args = '--license-file LICENSE.txt --mac-sign --mac-signing-key-user-name "Andy Maleh"'
|
101
106
|
```
|
102
107
|
|
103
|
-
Note that `mac.category` defaults to "public.app-category.business", but can be overridden with one of the category UTI values mentioned here:
|
104
|
-
|
105
|
-
https://developer.apple.com/library/archive/releasenotes/General/SubmittingToMacAppStore/index.html#//apple_ref/doc/uid/TP40010572-CH16-SW8
|
106
|
-
|
107
108
|
Example (env var):
|
108
109
|
|
109
110
|
```
|
110
|
-
|
111
|
+
JPACKAGE_EXTRA_ARGS='--mac-package-name "Math Bowling Game"' glimmer package
|
111
112
|
```
|
112
113
|
|
113
114
|
That overrides the default application display name.
|
114
115
|
|
115
116
|
### Verbose Mode
|
116
117
|
|
117
|
-
Pass `-v` to
|
118
|
+
Pass `-v` to jpackage in `Glimmer::RakeTask::Package.jpackage_extra_args` or by running `glimmer package:native[type] -v` to learn more about further available customizations for the installer you are requesting to generate.
|
118
119
|
|
119
120
|
### Windows Application Packaging
|
120
121
|
|
@@ -122,89 +123,80 @@ Windows s two options for setup packaging:
|
|
122
123
|
- `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)).
|
123
124
|
- `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.
|
124
125
|
|
125
|
-
If you just want to test out packaging into a native Windows app that is not packaged for Windows setup, just pass `image` to generate a native Windows app only.
|
126
|
+
If you just want to test out packaging into a native Windows app that is not packaged for Windows setup, just pass `app-image` (default) to generate a native Windows app only.
|
126
127
|
|
127
128
|
### Mac Application Distribution
|
128
129
|
|
129
130
|
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.
|
130
131
|
|
131
|
-
Afterwards, you may add
|
132
|
-
|
133
|
-
DMG signing key argument:
|
134
|
-
```
|
135
|
-
-Bmac.signing-key-developer-id-app="..."
|
136
|
-
```
|
137
|
-
|
138
|
-
PKG signing key argument:
|
139
|
-
```
|
140
|
-
-Bmac.signing-key-developer-id-installer="..."
|
141
|
-
```
|
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
|
142
133
|
|
143
|
-
Mac App Store signing key arguments:
|
144
134
|
```
|
145
|
-
-
|
146
|
-
|
135
|
+
--mac-package-signing-prefix <prefix string>
|
136
|
+
When signing the application package, this value is prefixed
|
137
|
+
to all components that need to be signed that don't have
|
138
|
+
an existing package identifier.
|
139
|
+
--mac-sign
|
140
|
+
Request that the package be signed
|
141
|
+
--mac-signing-keychain <file path>
|
142
|
+
Path of the keychain to search for the signing identity
|
143
|
+
(absolute path or relative to the current directory).
|
144
|
+
If not specified, the standard keychains are used.
|
145
|
+
--mac-signing-key-user-name <team name>
|
146
|
+
Team name portion in Apple signing identities' names.
|
147
|
+
For example "Developer ID Application: "
|
147
148
|
```
|
148
149
|
|
149
|
-
### Self Signed Certificate
|
150
|
-
|
151
|
-
You may still release a signed DMG file without enrolling into the Apple Developer Program with the caveat that users will always fail in opening the app the first time, and have to go to System Preferences -> Privacy -> General tab to "Open Anyway".
|
152
|
-
|
153
|
-
To do so, you may follow these steps (abbreviated version from https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW2):
|
154
|
-
- Open Keychain Access
|
155
|
-
- Choose Keychain Access > Certificate Assistant > Create Certificate ...
|
156
|
-
- Enter Name (referred to below as "CertificateName")
|
157
|
-
- Set 'Certificate Type' to 'Code Signing'
|
158
|
-
- Create (if you alternatively override defaults, make sure to enable all capabilities)
|
159
|
-
- Add the following option to javapackager: `-Bmac.signing-key-developer-id-app="CertificateName"` via `Glimmer::RakeTask::Package.javapackager_extra_args` or `JAVAPACKAGER_EXTRA_ARGS`
|
160
|
-
|
161
|
-
Example:
|
162
|
-
|
163
|
-
```ruby
|
164
|
-
Glimmer::RakeTask::Package.javapackager_extra_args = '-Bmac.signing-key-developer-id-app="Andy Maleh"'
|
165
|
-
```
|
166
|
-
|
167
|
-
Now, when you run `glimmer package`, it builds a self-signed DMG file. When you make available online, and users download, upon launching application, they are presented with your certificate, which they have to sign if they trust you in order to use the application.
|
168
|
-
|
169
150
|
### Packaging Gotchas
|
170
151
|
|
171
|
-
1.
|
172
|
-
|
173
|
-
The javapackager documentation states that a license file may be specified with "-BlicenseFile" javapackager option. However, in order for that to work, one must specify as a source file via "-srcfiles" javapackager option.
|
174
|
-
Keep that in mind if you are not going to rely on the default `LICENSE.txt` support.
|
175
|
-
|
176
|
-
Example:
|
177
|
-
|
178
|
-
```ruby
|
179
|
-
Glimmer::RakeTask::Package.javapackager_extra_args = '-srcfiles "ACME.txt" -BlicenseFile="ACME.txt" -BlicenseType="ACME"'
|
180
|
-
```
|
152
|
+
1. Zsh (Z Shell)
|
181
153
|
|
182
|
-
|
154
|
+
Currently, `Glimmer::RakeTask::Package.jpackage_extra_args` is only honored when packaging from bash, not zsh.
|
183
155
|
|
184
|
-
|
185
|
-
|
186
|
-
By the way, keep in mind that during normal operation, it does also indicate a false-negative while completing successfully similar to the following (please ignore):
|
156
|
+
You can get around that in zsh by running glimmer package commands with `bash -c` prefix:
|
187
157
|
|
188
158
|
```
|
189
|
-
|
159
|
+
bash -c 'source ~/.glimmer_source; glimmer package'
|
190
160
|
```
|
191
161
|
|
192
|
-
|
193
|
-
|
194
|
-
Currently, `Glimmer::RakeTask::Package.javapackager_extra_args` is only honored when packaging from bash, not zsh.
|
162
|
+
2. unsupported Java version "16", defaulting to 1.7
|
195
163
|
|
196
|
-
|
164
|
+
If you get this error while packaging:
|
197
165
|
|
198
166
|
```
|
199
|
-
|
167
|
+
unsupported Java version "16", defaulting to 1.7
|
168
|
+
[ERROR] Internal error: 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 -> [Help 1]
|
169
|
+
org.apache.maven.InternalErrorException: Internal error: 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
|
170
|
+
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121)
|
171
|
+
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
|
172
|
+
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
|
173
|
+
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
|
174
|
+
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
175
|
+
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
|
176
|
+
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
177
|
+
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
|
178
|
+
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
|
179
|
+
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
|
180
|
+
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
|
181
|
+
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
|
182
|
+
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
|
+
[ERROR]
|
184
|
+
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
|
185
|
+
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
|
186
|
+
[ERROR]
|
187
|
+
[ERROR] For more information about the errors and possible solutions, please read the following articles:
|
188
|
+
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException
|
200
189
|
```
|
201
190
|
|
202
|
-
|
191
|
+
Please ignore. It should be harmless. If you get blocked by it for any reason, please open an Issue about it.
|
203
192
|
|
204
|
-
|
205
|
-
|
193
|
+
3. Java on Windows System PATH
|
194
|
+
|
195
|
+
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.
|
206
196
|
|
207
197
|
The problem is Oracle seems to be adding an indirect Java path junction in later versions of their installer:
|
208
|
-
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
|
198
|
+
`C:\Program Files (x86)\Common Files\Oracle\Java\javapath`
|
199
|
+
|
200
|
+
Simply replace it with the simple path mentioned above (`"C:\Program Files\Java\jdk-16.0.2\bin"` matching your correct version number)
|
209
201
|
|
210
|
-
|
202
|
+
Lastly, reinstall JRuby to ensure it is using Java from the right path.
|
@@ -8,8 +8,7 @@
|
|
8
8
|
- Widget property declarations always have arguments and never take a block
|
9
9
|
- Widget property arguments are never wrapped inside parentheses
|
10
10
|
- Widget listeners are always declared starting with `on_` prefix and affixing listener event method name afterwards in underscored lowercase form. Their multi-line blocks rely on the `do; end` style.
|
11
|
-
-
|
12
|
-
- Data-binding is done via `bind` keyword, which always takes arguments wrapped in parentheses
|
11
|
+
- Data-binding can be done via `bind` keyword, which always takes arguments wrapped in parentheses, or using `<=>` and `<=` operators, which expect an array of model/property/options as arguments.
|
13
12
|
- Custom widget/shell/shape `body` blocks open and close with curly braces.
|
14
13
|
- Custom widget/shell/shape `before_body` and `after_body` blocks are declared as `do; end` blocks.
|
15
14
|
- Custom widgets receive additional keyword arguments called options, which come after the SWT styles.
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -40,7 +40,7 @@ module Glimmer
|
|
40
40
|
SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @sync_exec, override_async_exec: @async_exec) do
|
41
41
|
if @widget.respond_to?(:on_widget_disposed)
|
42
42
|
@widget.on_widget_disposed do |dispose_event|
|
43
|
-
|
43
|
+
deregister_all_observables unless @widget.shell_proxy.last_shell_closing?
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -49,7 +49,7 @@ module Glimmer
|
|
49
49
|
def call(value)
|
50
50
|
SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @sync_exec, override_async_exec: @async_exec) do
|
51
51
|
if @widget.respond_to?(:disposed?) && @widget.disposed?
|
52
|
-
|
52
|
+
deregister_all_observables
|
53
53
|
return
|
54
54
|
end
|
55
55
|
# need the rescue false for a scenario with tree items not being equal to model objects raising an exception
|
@@ -61,7 +61,7 @@ module Glimmer
|
|
61
61
|
|
62
62
|
def evaluate_property
|
63
63
|
if @widget.respond_to?(:disposed?) && @widget.disposed?
|
64
|
-
|
64
|
+
deregister_all_observables
|
65
65
|
return
|
66
66
|
end
|
67
67
|
@widget.get_attribute(@property)
|
@@ -26,8 +26,7 @@ module Glimmer
|
|
26
26
|
module RakeTask
|
27
27
|
module Package
|
28
28
|
class << self
|
29
|
-
attr_accessor :
|
30
|
-
alias jpackage_extra_args javapackager_extra_args
|
29
|
+
attr_accessor :jpackage_extra_args
|
31
30
|
|
32
31
|
def clean
|
33
32
|
require 'fileutils'
|
@@ -89,12 +88,12 @@ module Glimmer
|
|
89
88
|
end
|
90
89
|
|
91
90
|
def native(native_type=nil, native_extra_args)
|
92
|
-
puts "Generating native executable with
|
91
|
+
puts "Generating native executable with jpackage..."
|
93
92
|
java_version = `jruby -v`
|
94
|
-
if java_version.include?('
|
95
|
-
puts "Java Version
|
93
|
+
if java_version.include?('16.0.2')
|
94
|
+
puts "Java Version 16.0.2 Detected!"
|
96
95
|
else
|
97
|
-
puts "WARNING! Glimmer Packaging Pre-Requisite Java Version
|
96
|
+
puts "WARNING! Glimmer Packaging Pre-Requisite Java Version 16.0.2 Is Not Found!"
|
98
97
|
end
|
99
98
|
require 'facets/string/titlecase'
|
100
99
|
require 'facets/string/underscore'
|
@@ -106,28 +105,27 @@ module Glimmer
|
|
106
105
|
license = (File.read(license_file).strip if File.exists?(license_file) && File.file?(license_file)) rescue nil
|
107
106
|
copyright = license.split("\n").first
|
108
107
|
human_name = project_name.underscore.titlecase
|
109
|
-
icon = "
|
110
|
-
if
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
command
|
115
|
-
command += "
|
116
|
-
command += " -
|
117
|
-
|
118
|
-
command
|
119
|
-
command += " --win-per-user-install --win-dir-chooser --win-menu --win-menu-group '#{human_name}' " if OS.windows?
|
108
|
+
icon = "icons/#{OS.mac? ? 'macosx' : (OS.linux? ? 'linux' : 'windows')}/#{human_name}.#{OS.mac? ? 'icns' : (OS.linux? ? 'png' : 'ico')}"
|
109
|
+
native_type = 'app-image' if native_type.to_s.strip.empty?
|
110
|
+
if (`jpackage`.to_s.include?('Usage: jpackage') rescue nil)
|
111
|
+
FileUtils.rm_rf("packages/bundles")
|
112
|
+
FileUtils.mkdir_p('packages/bundles')
|
113
|
+
command = "jpackage"
|
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}' "
|
116
|
+
command += " --win-per-user-install --win-dir-chooser --win-menu --win-menu-group '#{human_name}' " if OS.windows? && native_type != 'app-image'
|
117
|
+
command += " --linux-menu-group '#{human_name}' " if OS.linux? && native_type != 'app-image'
|
120
118
|
command += " --java-options '-XstartOnFirstThread' --mac-package-name '#{human_name}' --mac-package-identifier 'org.#{project_name}.application.#{project_name}' " if OS.mac?
|
121
119
|
command += " --app-version \"#{version}\" " if version
|
122
|
-
command += " --license-file LICENSE.txt " if license
|
120
|
+
command += " --license-file LICENSE.txt " if license && native_type != 'app-image'
|
123
121
|
command += " --copyright \"#{copyright}\" " if copyright
|
124
122
|
else
|
125
|
-
puts "
|
123
|
+
puts "jpackage does not exist in your Java installation. Please ensure jpackage is available in PATH environment variable."
|
126
124
|
return
|
127
125
|
end
|
128
|
-
Rake.application.load_rakefile # make sure to load potential
|
129
|
-
command += " #{
|
130
|
-
command += " #{ENV['
|
126
|
+
Rake.application.load_rakefile # make sure to load potential jpackage_extra_args config in app Rakefile
|
127
|
+
command += " #{jpackage_extra_args} " if jpackage_extra_args
|
128
|
+
command += " #{ENV['JPACKAGE_EXTRA_ARGS']} " if ENV['JPACKAGE_EXTRA_ARGS']
|
131
129
|
command += " #{native_extra_args} " if native_extra_args
|
132
130
|
puts command
|
133
131
|
system command
|
@@ -167,20 +167,25 @@ module Glimmer
|
|
167
167
|
custom_shell('AppView', current_dir_name, shell_type)
|
168
168
|
end
|
169
169
|
|
170
|
-
mkdir_p '
|
171
|
-
icon_file = "
|
170
|
+
mkdir_p 'icons/windows'
|
171
|
+
icon_file = "icons/windows/#{human_name(app_name)}.ico"
|
172
172
|
cp File.expand_path('../../../../icons/scaffold_app.ico', __FILE__), icon_file
|
173
173
|
puts "Created #{current_dir_name}/#{icon_file}"
|
174
174
|
|
175
|
-
mkdir_p '
|
176
|
-
icon_file = "
|
175
|
+
mkdir_p 'icons/macosx'
|
176
|
+
icon_file = "icons/macosx/#{human_name(app_name)}.icns"
|
177
177
|
cp File.expand_path('../../../../icons/scaffold_app.icns', __FILE__), icon_file
|
178
178
|
puts "Created #{current_dir_name}/#{icon_file}"
|
179
179
|
|
180
|
-
mkdir_p '
|
181
|
-
icon_file = "
|
180
|
+
mkdir_p 'icons/linux'
|
181
|
+
icon_file = "icons/linux/#{human_name(app_name)}.png"
|
182
182
|
cp File.expand_path('../../../../icons/scaffold_app.png', __FILE__), icon_file
|
183
183
|
puts "Created #{current_dir_name}/#{icon_file}"
|
184
|
+
|
185
|
+
write "Resource.java", resource_java_file(app_name)
|
186
|
+
cd '..'
|
187
|
+
system "javac #{file_name(app_name)}/Resource.java"
|
188
|
+
cd gem_name
|
184
189
|
|
185
190
|
mkdir_p "app/#{file_name(app_name)}"
|
186
191
|
write "app/#{file_name(app_name)}/launch.rb", app_launch_file(app_name)
|
@@ -195,14 +200,14 @@ module Glimmer
|
|
195
200
|
end
|
196
201
|
write 'spec/spec_helper.rb', spec_helper_file
|
197
202
|
if OS.windows?
|
198
|
-
system "glimmer
|
203
|
+
system "glimmer package" # TODO handle Windows with batch file
|
199
204
|
system "\"packages/bundles/#{human_name(app_name)}/#{human_name(app_name)}.exe\""
|
200
205
|
else
|
201
206
|
system "bash -c '#{RVM_FUNCTION}\n cd .\n glimmer package\n'"
|
202
207
|
if OS.mac?
|
203
|
-
system "
|
208
|
+
system "bash -c '#{RVM_FUNCTION}\n cd .\n JRUBY_OPTS=\"$JRUBY_OPTS -J-XstartOnFirstThread\" glimmer run\n'"
|
204
209
|
else
|
205
|
-
system "glimmer run"
|
210
|
+
system "bash -c '#{RVM_FUNCTION}\n cd .\n glimmer run\n'"
|
206
211
|
end
|
207
212
|
end
|
208
213
|
end
|
@@ -278,30 +283,35 @@ module Glimmer
|
|
278
283
|
end
|
279
284
|
write 'spec/spec_helper.rb', spec_helper_file
|
280
285
|
|
281
|
-
mkdir_p '
|
282
|
-
icon_file = "
|
286
|
+
mkdir_p 'icons/windows'
|
287
|
+
icon_file = "icons/windows/#{human_name(custom_shell_name)}.ico"
|
283
288
|
cp File.expand_path('../../../../icons/scaffold_app.ico', __FILE__), icon_file
|
284
289
|
puts "Created #{current_dir_name}/#{icon_file}"
|
285
290
|
|
286
|
-
mkdir_p '
|
287
|
-
icon_file = "
|
291
|
+
mkdir_p 'icons/macosx'
|
292
|
+
icon_file = "icons/macosx/#{human_name(custom_shell_name)}.icns"
|
288
293
|
cp File.expand_path('../../../../icons/scaffold_app.icns', __FILE__), icon_file
|
289
294
|
puts "Created #{current_dir_name}/#{icon_file}"
|
290
295
|
|
291
|
-
mkdir_p '
|
292
|
-
icon_file = "
|
296
|
+
mkdir_p 'icons/linux'
|
297
|
+
icon_file = "icons/linux/#{human_name(custom_shell_name)}.png"
|
293
298
|
cp File.expand_path('../../../../icons/scaffold_app.png', __FILE__), icon_file
|
294
299
|
puts "Created #{current_dir_name}/#{icon_file}"
|
295
300
|
|
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
|
+
|
296
306
|
if OS.windows?
|
297
|
-
system "glimmer package
|
307
|
+
system "glimmer package" # TODO handle windows properly with batch file
|
298
308
|
system "\"packages/bundles/#{human_name(custom_shell_name)}/#{human_name(custom_shell_name)}.exe\""
|
299
309
|
else
|
300
310
|
system "bash -c '#{RVM_FUNCTION}\n cd .\n glimmer package\n'"
|
301
311
|
if OS.mac?
|
302
|
-
system "
|
312
|
+
system "bash -c '#{RVM_FUNCTION}\n cd .\n JRUBY_OPTS=\"$JRUBY_OPTS -J-XstartOnFirstThread\" glimmer run\n'"
|
303
313
|
else
|
304
|
-
system "glimmer run"
|
314
|
+
system "bash -c '#{RVM_FUNCTION}\n cd .\n glimmer run\n'"
|
305
315
|
end
|
306
316
|
end
|
307
317
|
puts "Finished creating #{gem_name} Ruby gem."
|
@@ -485,6 +495,16 @@ module Glimmer
|
|
485
495
|
#{class_name(app_name)}::View::AppView.launch
|
486
496
|
MULTI_LINE_STRING
|
487
497
|
end
|
498
|
+
|
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
|
488
508
|
|
489
509
|
def app_bin_command_file(app_name_or_gem_name, custom_shell_name=nil, namespace=nil)
|
490
510
|
if custom_shell_name.nil?
|
@@ -525,7 +545,7 @@ module Glimmer
|
|
525
545
|
lines.insert(require_rake_line_index, "require 'glimmer/launcher'")
|
526
546
|
gem_files_line_index = lines.index(lines.detect {|l| l.include?('# dependencies defined in Gemfile') })
|
527
547
|
if custom_shell_name
|
528
|
-
lines.insert(gem_files_line_index, " gem.files = Dir['VERSION', 'LICENSE.txt', 'app/**/*', 'bin/**/*', 'config/**/*', 'db/**/*', 'docs/**/*', 'fonts/**/*', 'icons/**/*', 'images/**/*', 'lib/**/*', '
|
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/**/*']")
|
529
549
|
# 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)
|
530
550
|
lines.insert(gem_files_line_index+1, " gem.require_paths = ['vendor', 'lib', 'app']")
|
531
551
|
lines.insert(gem_files_line_index+2, " gem.executables = ['#{file_name(custom_shell_name)}']") if custom_shell_name
|
@@ -538,14 +558,10 @@ module Glimmer
|
|
538
558
|
file_content = lines.join("\n")
|
539
559
|
if custom_shell_name
|
540
560
|
file_content << <<~MULTI_LINE_STRING
|
541
|
-
Glimmer::RakeTask::Package.
|
542
|
-
"
|
543
|
-
"
|
544
|
-
|
545
|
-
" -Bmac.CFBundleIdentifier='org.#{namespace ? compact_name(namespace) : compact_name(custom_shell_name)}.application.#{compact_name(custom_shell_name).camelcase(:upper)}'"
|
546
|
-
# " -BlicenseType=" +
|
547
|
-
# " -Bmac.category=" +
|
548
|
-
# " -Bmac.signing-key-developer-id-app="
|
561
|
+
Glimmer::RakeTask::Package.jpackage_extra_args =
|
562
|
+
" --name '#{human_name(custom_shell_name)}'" +
|
563
|
+
" --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
|
549
565
|
MULTI_LINE_STRING
|
550
566
|
end
|
551
567
|
file_content
|
@@ -643,7 +659,8 @@ module Glimmer
|
|
643
659
|
shell#{'(:fill_screen)' if shell_type == :desktopify} {
|
644
660
|
# Replace example content below with custom shell content
|
645
661
|
minimum_size #{shell_type == :desktopify ? '768, 432' : '420, 240'}
|
646
|
-
image File.join(APP_ROOT, '
|
662
|
+
image File.join(APP_ROOT, 'icons', 'windows', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.ico") if OS.windows?
|
663
|
+
image File.join(APP_ROOT, 'icons', 'linux', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.png") unless OS.windows?
|
647
664
|
text "#{human_name(namespace)} - #{human_name(custom_shell_name)}"
|
648
665
|
|
649
666
|
MULTI_LINE_STRING
|
@@ -122,9 +122,9 @@ 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('//', '
|
126
|
-
|
127
|
-
file_input_stream =
|
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)
|
128
128
|
else
|
129
129
|
file_input_stream = java.io.FileInputStream.new(@file_path)
|
130
130
|
end
|
@@ -32,10 +32,11 @@ module Glimmer
|
|
32
32
|
include_package 'org.eclipse.swt.widgets'
|
33
33
|
include_package 'org.eclipse.swt.layout'
|
34
34
|
|
35
|
-
WIDTH_MIN =
|
35
|
+
WIDTH_MIN = 190
|
36
36
|
HEIGHT_MIN = 0
|
37
37
|
|
38
|
-
attr_reader :opened_before
|
38
|
+
attr_reader :opened_before, :last_shell_closing
|
39
|
+
alias last_shell_closing? last_shell_closing
|
39
40
|
alias opened_before? opened_before
|
40
41
|
|
41
42
|
# Instantiates ShellProxy with same arguments expected by SWT Shell
|
@@ -85,9 +86,10 @@ module Glimmer
|
|
85
86
|
end
|
86
87
|
end
|
87
88
|
end
|
88
|
-
on_widget_disposed
|
89
|
+
on_widget_disposed do
|
90
|
+
@last_shell_closing = true if @display.shells.count == 1 && @display.shells.first == @swt_widget
|
89
91
|
clear_shapes
|
90
|
-
|
92
|
+
end
|
91
93
|
@display ||= @swt_widget.getDisplay
|
92
94
|
end
|
93
95
|
end
|
@@ -198,6 +198,10 @@ module Glimmer
|
|
198
198
|
@finished_add_content = true
|
199
199
|
end
|
200
200
|
|
201
|
+
def shell_proxy
|
202
|
+
@swt_widget.shell.get_data('proxy')
|
203
|
+
end
|
204
|
+
|
201
205
|
def extract_args(underscored_widget_name, args)
|
202
206
|
@arg_extractor_mapping ||= {
|
203
207
|
'menu_item' => lambda do |args|
|
data/samples/elaborate/tetris.rb
CHANGED
data/vendor/swt/linux/swt.jar
CHANGED
Binary file
|
Binary file
|
data/vendor/swt/mac/swt.jar
CHANGED
Binary file
|
Binary file
|
data/vendor/swt/windows/swt.jar
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.21.1.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-
|
11
|
+
date: 2021-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 2.
|
18
|
+
version: 2.4.0
|
19
19
|
name: glimmer
|
20
20
|
prerelease: false
|
21
21
|
type: :runtime
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
@@ -238,6 +238,20 @@ dependencies:
|
|
238
238
|
- - "<"
|
239
239
|
- !ruby/object:Gem::Version
|
240
240
|
version: 4.0.0
|
241
|
+
- !ruby/object:Gem::Dependency
|
242
|
+
requirement: !ruby/object:Gem::Requirement
|
243
|
+
requirements:
|
244
|
+
- - '='
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: 3.3.2
|
247
|
+
name: psych
|
248
|
+
prerelease: false
|
249
|
+
type: :runtime
|
250
|
+
version_requirements: !ruby/object:Gem::Requirement
|
251
|
+
requirements:
|
252
|
+
- - '='
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: 3.3.2
|
241
255
|
- !ruby/object:Gem::Dependency
|
242
256
|
requirement: !ruby/object:Gem::Requirement
|
243
257
|
requirements:
|
@@ -362,10 +376,9 @@ description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a
|
|
362
376
|
started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets.
|
363
377
|
Glimmer also includes native-executable packaging support, sorely lacking in other
|
364
378
|
libraries, thus enabling the delivery of desktop apps written in Ruby as truly native
|
365
|
-
DMG/PKG/APP files on the Mac
|
366
|
-
|
367
|
-
|
368
|
-
speaker and expert.
|
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.
|
369
382
|
email: andy.am@gmail.com
|
370
383
|
executables:
|
371
384
|
- glimmer
|
@@ -712,7 +725,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
712
725
|
- !ruby/object:Gem::Version
|
713
726
|
version: '0'
|
714
727
|
requirements: []
|
715
|
-
rubygems_version: 3.
|
728
|
+
rubygems_version: 3.2.29
|
716
729
|
signing_key:
|
717
730
|
specification_version: 4
|
718
731
|
summary: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|