diff options
| author | Edwin Jakobs <edwin@rndr.studio> | 2020-05-17 11:00:48 +0200 |
|---|---|---|
| committer | Edwin Jakobs <edwin@rndr.studio> | 2020-05-17 11:00:48 +0200 |
| commit | f391fed2554b2aabe8005a2d1d415771d89eec5e (patch) | |
| tree | 504df06d5d11b4df4d0e7bb4f8d9f77e295b12b2 | |
| parent | 896a8629fae20dcf80f0da3ab4aef9e33269cd26 (diff) | |
| download | art-playground-openrndr-f391fed2554b2aabe8005a2d1d415771d89eec5e.tar.gz art-playground-openrndr-f391fed2554b2aabe8005a2d1d415771d89eec5e.zip | |
Add jpackageZip and Github actions for publishing binaries
Diffstat (limited to '')
| -rw-r--r-- | .github/workflows/build-on-commit.yaml | 2 | ||||
| -rw-r--r-- | .github/workflows/publish-binaries-linux-x64.yaml | 30 | ||||
| -rw-r--r-- | .github/workflows/publish-binaries-macos.yaml | 30 | ||||
| -rw-r--r-- | .github/workflows/publish-binaries-windows.yaml | 30 | ||||
| -rw-r--r-- | README.md | 8 | ||||
| -rw-r--r-- | build.gradle.kts | 79 |
6 files changed, 156 insertions, 23 deletions
diff --git a/.github/workflows/build-on-commit.yaml b/.github/workflows/build-on-commit.yaml index 48c0db7..658ce15 100644 --- a/.github/workflows/build-on-commit.yaml +++ b/.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
\ No newline at end of file diff --git a/.github/workflows/publish-binaries-linux-x64.yaml b/.github/workflows/publish-binaries-linux-x64.yaml new file mode 100644 index 0000000..4eed920 --- /dev/null +++ b/.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/release-action@v1.6.1 + id: create_release + with: + token: ${{ secrets.GITHUB_TOKEN }} + allowUpdates: true + replaceArtifacts: false + body: Fully automated release + artifacts: "./build/distributions/openrndr-application-linux-x64.zip"
\ No newline at end of file diff --git a/.github/workflows/publish-binaries-macos.yaml b/.github/workflows/publish-binaries-macos.yaml new file mode 100644 index 0000000..e631eed --- /dev/null +++ b/.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/release-action@v1.6.1 + id: create_release + with: + token: ${{ secrets.GITHUB_TOKEN }} + allowUpdates: true + replaceArtifacts: false + body: Fully automated release + artifacts: "./build/distributions/openrndr-application-macos.zip"
\ No newline at end of file diff --git a/.github/workflows/publish-binaries-windows.yaml b/.github/workflows/publish-binaries-windows.yaml new file mode 100644 index 0000000..b6fb4a5 --- /dev/null +++ b/.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/release-action@v1.6.1 + id: create_release + with: + token: ${{ secrets.GITHUB_TOKEN }} + allowUpdates: true + replaceArtifacts: false + body: Fully automated release + artifacts: "./build/distributions/openrndr-application-windows.zip"
\ No newline at end of file @@ -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.*`.
\ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 2677e57..ae6cc25 100644 --- a/build.gradle.kts +++ b/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 - manifest { - attributes["Main-Class"] = applicationMainClass + +project.setProperty("mainClassName", applicationMainClass) +tasks { + named<ShadowJar>("shadowJar") { + manifest { + attributes["Main-Class"] = applicationMainClass + } + minimize { + exclude(dependency("org.openrndr:openrndr-gl3:.*")) + exclude(dependency("org.jetbrains.kotlin:kotlin-reflect:.*")) + } } - 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) }) + 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") +} |
