Browse Source

Add jpackageZip and Github actions for publishing binaries

master
Edwin Jakobs 4 years ago
parent
commit
f391fed255
  1. 2
      .github/workflows/build-on-commit.yaml
  2. 30
      .github/workflows/publish-binaries-linux-x64.yaml
  3. 30
      .github/workflows/publish-binaries-macos.yaml
  4. 30
      .github/workflows/publish-binaries-windows.yaml
  5. 8
      README.md
  6. 75
      build.gradle.kts

2
.github/workflows/build-on-commit.yaml

@ -11,5 +11,5 @@ jobs:
- uses: actions/setup-java@v1
with:
java-version: 14
- name: Build apidocs
- name: Build sources
run: ./gradlew build

30
.github/workflows/publish-binaries-linux-x64.yaml

@ -0,0 +1,30 @@
name: Publish Linux/x64 binaries
on:
push:
tags:
- v0.*
- v0.*.*
- v1.*
- v1.*.*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 14
uses: actions/setup-java@v1
with:
java-version: 14
- name: Build with Gradle
run: ./gradlew jpackageZip
- name: Create Release
uses: ncipollo/[email protected]
id: create_release
with:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
replaceArtifacts: false
body: Fully automated release
artifacts: "./build/distributions/openrndr-application-linux-x64.zip"

30
.github/workflows/publish-binaries-macos.yaml

@ -0,0 +1,30 @@
name: Publish macOS binaries
on:
push:
tags:
- v0.*
- v0.*.*
- v1.*
- v1.*.*
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 14
uses: actions/setup-java@v1
with:
java-version: 14
- name: Build with Gradle
run: ./gradlew jpackageZip
- name: Create Release
uses: ncipollo/[email protected]
id: create_release
with:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
replaceArtifacts: false
body: Fully automated release
artifacts: "./build/distributions/openrndr-application-macos.zip"

30
.github/workflows/publish-binaries-windows.yaml

@ -0,0 +1,30 @@
name: Publish Windows binaries
on:
push:
tags:
- v0.*
- v0.*.*
- v1.*
- v1.*.*
-
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 14
uses: actions/setup-java@v1
with:
java-version: 14
- name: Build with Gradle
run: ./gradlew jpackageZip
- name: Create Release
uses: ncipollo/[email protected]
id: create_release
with:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
replaceArtifacts: false
body: Fully automated release
artifacts: "./build/distributions/openrndr-application-windows.zip"

8
README.md

@ -12,7 +12,13 @@ You will find some [basic instructions](https://guide.openrndr.org/#/02_Getting_
- `run` runs the TemplateProgram
- `jar` creates an executable platform specific jar file with all dependencies
- `zipDistribution` creates a zip file containing the application jar and the data folder
- `jpackageZip` creates a zip with a stand-alone executable for the current platform (works with Java 14 only)
## Cross builds
To create runnable jars for a platform different from the platform you use to build one uses `./gradlew jar --PtargetPlatform=<platform>`. The supported platforms are `windows`, `macos`, `linux-x64` and `linux-arm64`. Note that the `linux-arm64` platform will only work with OPENRNDR snapshot builds from master and OPENRNDR 0.3.39 (a future version).
## Github Actions
This repository contains a number of Github Actions in `./github/workflows`.
The actions enable a basic build run on commit, plus publication actions that are executed when
a commit is tagged with a version number like `v0.*` or `v1.*`.

75
build.gradle.kts

@ -1,3 +1,4 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
@ -46,7 +47,6 @@ val orxFeatures = setOf(
/* Which OPENRNDR libraries should be added to this project? */
val openrndrFeatures = setOf(
"panel",
"video"
)
@ -93,6 +93,8 @@ val kotlinVersion = "1.3.72"
plugins {
java
kotlin("jvm") version("1.3.72")
id("com.github.johnrengelman.shadow") version ("5.2.0")
id("org.beryx.runtime") version ("1.8.1")
}
repositories {
@ -182,29 +184,64 @@ tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType<Jar> {
isZip64 = true
project.setProperty("mainClassName", applicationMainClass)
tasks {
named<ShadowJar>("shadowJar") {
manifest {
attributes["Main-Class"] = applicationMainClass
}
doFirst {
from(configurations.compileClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
minimize {
exclude(dependency("org.openrndr:openrndr-gl3:.*"))
exclude(dependency("org.jetbrains.kotlin:kotlin-reflect:.*"))
}
}
named<org.beryx.runtime.JPackageTask>("jpackage") {
doLast {
when (OperatingSystem.current()) {
OperatingSystem.WINDOWS, OperatingSystem.LINUX -> {
copy {
from("data") {
include("**/*")
}
into("build/jpackage/openrndr-application/data")
}
}
OperatingSystem.MAC_OS -> {
copy {
from("data") {
include("**/*")
}
into("build/jpackage/openrndr-application.app/data")
}
}
}
}
}
exclude(listOf("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA", "**/module-info*"))
archiveFileName.set("application-$openrndrOs.jar")
}
tasks.create("zipDistribution", Zip::class.java) {
archiveFileName.set("application-$openrndrOs.zip")
from("./") {
include("data/**")
tasks.register<Zip>("jpackageZip") {
archiveFileName.set("openrndr-application-$openrndrOs.zip")
from("$buildDir/jpackage") {
include("**/*")
}
from("$buildDir/libs/application-$openrndrOs.jar")
}.dependsOn(tasks.jar)
}
tasks.findByName("jpackageZip")?.dependsOn("jpackage")
tasks.create("run", JavaExec::class.java) {
main = applicationMainClass
classpath = sourceSets.main.get().runtimeClasspath
}.dependsOn(tasks.build)
runtime {
jpackage {
imageName = "openrndr-application"
skipInstaller = true
if (OperatingSystem.current() == OperatingSystem.MAC_OS) {
jvmArgs.add("-XstartOnFirstThread")
}
}
options.empty()
options.add("--strip-debug")
options.add("--compress")
options.add("1")
options.add("--no-header-files")
options.add("--no-man-pages")
modules.empty()
modules.add("jdk.unsupported")
}

Loading…
Cancel
Save