Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
fvarrui committed Aug 11, 2023
2 parents 05a2195 + 0615a5d commit 15330cc
Show file tree
Hide file tree
Showing 26 changed files with 390 additions and 238 deletions.
43 changes: 18 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# JavaPackager

[![Maven Central](http://img.shields.io/maven-central/v/io.github.fvarrui/javapackager)](https://central.sonatype.com/artifact/io.github.fvarrui/javapackager/1.7.2)
[![Maven Central](http://img.shields.io/maven-central/v/io.github.fvarrui/javapackager)](https://central.sonatype.com/artifact/io.github.fvarrui/javapackager/1.7.3)
[![GPL-3.0](https://img.shields.io/badge/license-GPL--3.0-%250778B9.svg)](https://www.gnu.org/licenses/gpl-3.0.html)

JavaPackager is a hybrid plugin for **Maven** and **Gradle** which provides an easy way to package Java applications in native Windows, MacOS or GNU/Linux executables, and generate installers for them.

> SNAPSHOT version (available in `devel` branch) is not released to Maven Central, so you have to [install it manually](#how-to-build-and-install-the-plugin).
> :eyes: See [JavaPackager changes and fixes](https://github.com/fvarrui/JavaPackager/releases).
## History
Expand Down Expand Up @@ -123,21 +121,21 @@ gradle packageMyApp

By default it will generate next artifacts in `${outputDirectory} ` folder:

| Artifact | Description | Platform | Requires |
| --------------------------------------- | ---------------------------------------------------------------- | --------- | --------------------------------------------------------------------------- |
| `${name}` | Directory with native application and other assets. | All | |
| `${name}-${version}-runnable.jar` | Runnable JAR file. | All | |
| `${name}_${version}.AppImage` | AppImage package file. | GNU/Linux | [FUSE 2](https://github.com/AppImage/AppImageKit/wiki/FUSE) to run the app. |
| `${name}_${version}.deb` | DEB package file. | All | |
| `${name}_${version}.rpm` | RPM package file. | All | |
| `${name}_${version}.exe` | Setup file. | Windows | [Inno Setup](http://www.jrsoftware.org/isinfo.php) |
| `${name}_${version}.msi` | MSI installer file. | Windows | [WiX Toolset](https://wixtoolset.org/) |
| `${name}_${version}.msm` | MSI merge module file. | Windows | [WiX Toolset](https://wixtoolset.org/) |
| `${name}_${version}.dmg` | Disk image file (uses **hdiutil**). | MacOS | |
| `${name}_${version}.pkg` | PKG installer file (uses **pkgbuild**). | MacOS | |
| `${name}-${version}-${platform}.zip` | Zipball containing generated directory `${name}`. | All | |
| `${name}-${version}-${platform}.tar.gz` | Compressed tarball containing generated directory `${name}`. | All | |
| `assets` | Directory with all intermediate files generated by JavaPackager. | All | |
| Artifact | Description | Platform | Requires |
| --------------------------------------- | ---------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------ |
| `${name}` | Directory with native application and other assets. | All | |
| `${name}-${version}-runnable.jar` | Runnable JAR file. | All | |
| `${name}_${version}.AppImage` | AppImage package file. | GNU/Linux | [FUSE 2](https://github.com/AppImage/AppImageKit/wiki/FUSE) to run the app. |
| `${name}_${version}.deb` | DEB package file. | All | |
| `${name}_${version}.rpm` | RPM package file. | All | |
| `${name}_${version}.exe` | Setup file. | Windows | [Inno Setup](http://www.jrsoftware.org/isinfo.php) (`iscc` command must be in PATH variable) |
| `${name}_${version}.msi` | MSI installer file. | Windows | [WiX Toolset](https://wixtoolset.org/) (`candle` and `light` commands must be in PATH variable) |
| `${name}_${version}.msm` | MSI merge module file. | Windows | [WiX Toolset](https://wixtoolset.org/) ( `candle` and `light` commands must be in PATH variable) |
| `${name}_${version}.dmg` | Disk image file (uses **hdiutil**). | MacOS | |
| `${name}_${version}.pkg` | PKG installer file (uses **pkgbuild**). | MacOS | |
| `${name}-${version}-${platform}.zip` | Zipball containing generated directory `${name}`. | All | |
| `${name}-${version}-${platform}.tar.gz` | Compressed tarball containing generated directory `${name}`. | All | |
| `assets` | Directory with all intermediate files generated by JavaPackager. | All | |

> **Inno Setup** and **WiX Toolset** installation [guide](docs/windows-tools-guide.md).
Expand All @@ -148,6 +146,7 @@ By default it will generate next artifacts in `${outputDirectory} ` folder:
| `additionalModulePaths` | :x: | `[]` | Additional module paths for `jdeps`. |
| `additionalModules` | :x: | `[]` | Additional modules to the ones identified by `jdeps` or the specified with `modules` property. |
| `additionalResources` | :x: | `[]` | Additional files and folders to include in the bundled app. |
| `arch` | :x: | `${os.arch}` | The dependency of some ArtifactGenerator objects in the process of making packages, such as GenerateDeb |
| `administratorRequired` | :x: | `false` | App will run as administrator (with elevated privileges). |
| `assetsDir` | :x: | `${basedir}/assets` or `${projectdir}/assets` | Assets location (icons and custom Velocity templates). |
| `bundleJre` | :x: | `false` | Embeds a customized JRE with the app. |
Expand Down Expand Up @@ -261,7 +260,7 @@ You can use [default templates](https://github.com/fvarrui/JavaPackager/tree/mas

### Additional JVM options at runtime

When you build your app, all configuration details are hardcoded into the executable and cannot be changed without recreating it or hacking with a resource editor. JavaPackager introduces a feature that allows to pass additional JVM options at runtime from an `.l4j.ini` file (like [Launch4j](http://launch4j.sourceforge.net/docs.html) does, but available for all platforms in the same way). So, you can specify these options in the packager's configuration (packaging time), in INI file (runtime) or in both.
When you build your app, all configuration details are hardcoded into the executable and cannot be changed without recreating or hacking it with a resource editor. JavaPackager introduces a feature that allows to pass additional JVM options at runtime from an `.l4j.ini` file (like [Launch4j](http://launch4j.sourceforge.net/docs.html) does, but available for all platforms in the same way). So, you can specify these options in the packager's configuration (packaging time), in INI file (runtime) or in both.

The INI file's name must correspond to `${name}.l4j.ini` and it has to be located next to the executable on Windows and GNU/Linux, and in `Resources` folder on MacOS.

Expand Down Expand Up @@ -389,9 +388,3 @@ Run next command (ommit `./` on Windows):
```bash
./gradlew publish closeAndReleaseRepository
```

> Related [guide](https://nemerosa.ghost.io/2015/07/01/publishing-to-the-maven-central-using-gradle/).
## Future features

Check the [TO-DO list](https://github.com/fvarrui/JavaPackager/projects/1#column-7704117) to know the features we plan to add to JavaPackager.
55 changes: 32 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies {
implementation 'org.vafer:jdeb:1.9'
implementation 'net.jsign:jsign-core:3.1'
implementation 'org.redline-rpm:redline:1.2.10'
implementation 'io.github.fvarrui:launch4j:2.5.2'
implementation 'edu.sc.seis.launch4j:launch4j:2.5.2'

testImplementation 'junit:junit:4.12'

Expand All @@ -64,7 +64,7 @@ dependencies {
}

group = 'io.github.fvarrui'
version = '1.7.2'
version = '1.7.3'
description = 'Hybrid Maven/Gradle plugin to package Java applications as native Windows, Mac OS X or GNU/Linux executables and create installers for them'

sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -114,27 +114,37 @@ publishing {
name = project.name
groupId = project.group
artifactId = project.name
version = project.version
description = project.description
packaging = 'maven-plugin'
url = 'https://github.com/fvarrui/JavaPackager'
scm {
connection = 'scm:git:git://github.com/fvarrui/JavaPackager.git'
developerConnection = 'scm:git:[email protected]:fvarrui/fvarrui.git'
}
}
}

afterEvaluate {
publications {
withType(MavenPublication) {
// customize all publications here
pom {
version = project.version
description = project.description
url = 'https://github.com/fvarrui/JavaPackager'
}
licenses {
license {
name = 'GPL-v3.0'
url = 'http://www.gnu.org/licenses/gpl-3.0.txt'
distribution = 'repo'
scm {
connection = 'scm:git:git://github.com/fvarrui/JavaPackager.git'
developerConnection = 'scm:git:[email protected]:fvarrui/fvarrui.git'
url = 'https://github.com/fvarrui/JavaPackager'
}
}
developers {
developer {
id = 'fvarrui'
name = 'Francisco Vargas Ruiz'
url = 'https://github.com/fvarrui'
licenses {
license {
name = 'GPL-v3.0'
url = 'http://www.gnu.org/licenses/gpl-3.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'fvarrui'
name = 'Francisco Vargas Ruiz'
url = 'https://github.com/fvarrui'
}
}
}
}
Expand All @@ -157,7 +167,7 @@ task generatePluginDescriptor(type: JavaExec, dependsOn: compileJava) {
'--errors',
'--batch-mode',
'--file', generatePomFileForPluginMavenPublication.destination,
'org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor',
'org.apache.maven.plugins:maven-plugin-plugin:3.9.0:descriptor',
'-Dproject.build.sourceEncoding=' + compileJava.options.encoding
]
doLast {
Expand Down Expand Up @@ -186,7 +196,7 @@ nexusStaging {
}

task updateUniversalJavaApplicationStub(type : Download) {
def version = '20220410.162252'
def version = '20230601.235708'
group 'Update assets'
description 'Downloads compiled and scripted versions of universalJavaApplicationStub to src/main/resources/mac overriding the existing ones.'
src([
Expand All @@ -209,4 +219,3 @@ task updateWhyJavaLauncher(type : Download) {
dest file('src/main/resources/windows')
overwrite true
}

2 changes: 2 additions & 0 deletions docs/windows-specific-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<copyright>${organizationName}</copyright>
<productName>${name}</productName>
<internalName>${name}</internalName>
<txtShortcutName>${name}</txtShortcutName>
<originalFilename>${name}.exe</originalFilename>

<!-- choose EXE creation tool -->
Expand Down Expand Up @@ -103,6 +104,7 @@
| ------------------------- | --------- | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
| `setupMode` | :x: | `installForAllUsers` | Setup installation mode: require administrative privileges or not. [*](#setupmode) |
| `setupLanguages` | :x: | `<english>compiler:Default.isl</english><spanish>compiler:Languages\Spanish.isl</spanish>` | Map with setup languages. |
| `shortcutName` | :x: | `${name}` | Sets the name of the user optional shortcut created on the desktop |
| `disableDirPage` | :x: | `true` | If this is set to `true`, Setup will not show the **Select Destination Location** wizard page. |
| `disableProgramGroupPage` | :x: | `true` | If this is set to `true`, Setup will not show the **Select Start Menu Folder** wizard page. |
| `disableFinishedPage` | :x: | `true` | If this is set to `true`, Setup will not show the **Setup Completed** wizard page. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package io.github.fvarrui.javapackager.gradle;

import static io.github.fvarrui.javapackager.utils.ObjectUtils.defaultIfNull;

import io.github.fvarrui.javapackager.packagers.Context;
import io.github.fvarrui.javapackager.packagers.Packager;
import io.github.fvarrui.javapackager.packagers.PackagerFactory;

import static io.github.fvarrui.javapackager.utils.ObjectUtils.defaultIfNull;

/**
* Default packaging task for Gradle
*/
Expand All @@ -22,6 +23,7 @@ protected Packager createPackager() throws Exception {
.additionalModulePaths(extension.getAdditionalModulePaths())
.additionalResources(extension.getAdditionalResources())
.administratorRequired(extension.getAdministratorRequired())
.arch(extension.getArch())
.assetsDir(extension.getAssetsDir())
.bundleJre(extension.getBundleJre())
.classpath(extension.getClasspath())
Expand Down Expand Up @@ -51,7 +53,7 @@ protected Packager createPackager() throws Exception {
.organizationName(extension.getOrganizationName())
.organizationUrl(extension.getOrganizationUrl())
.outputDirectory(extension.getOutputDirectory())
.packagingJdk(extension.getPackagingJdk())
.packagingJdk(defaultIfNull(extension.getPackagingJdk(), Context.getGradleContext().getDefaultToolchain()))
.runnableJar(extension.getRunnableJar())
.scripts(extension.getScripts())
.useResourcesAsWorkingDir(extension.isUseResourcesAsWorkingDir())
Expand All @@ -61,5 +63,5 @@ protected Packager createPackager() throws Exception {
.winConfig(extension.getWinConfig());

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,5 @@ public File createWindowsExe(WindowsPackager packager) throws Exception {
}
return null;
}



}
Loading

0 comments on commit 15330cc

Please sign in to comment.