Skip to content

Commit

Permalink
Merge pull request #3 from Legion2/packaging
Browse files Browse the repository at this point in the history
Packaging of java runtime
  • Loading branch information
Legion2 authored Aug 17, 2020
2 parents d53896c + aa3a68b commit afd8b58
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 43 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ updates:
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
17 changes: 5 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java JDK 8
uses: actions/setup-java@v1.3.0
- name: Setup Java JDK
uses: actions/setup-java@v1.4.1
with:
java-version: 8
java-version: 14
- name: Gradle Build
run: gradle build
- name: Generate Bash Completion
env:
OPEN_CUE_CLI_COMPLETE: bash
run: |
unzip build/distributions/open-cue-cli.zip
./open-cue-cli/open-cue-cli > open-cue-cli/bash-complete-open-cue-cli.sh
chmod +x open-cue-cli/bash-complete-open-cue-cli.sh
run: gradle runtimeZip
- name: Upload distribution archive
uses: actions/upload-artifact@v2
with:
name: open-cue-cli
path: open-cue-cli/
path: build/open-cue-cli-*.zip
30 changes: 10 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Java JDK 8
uses: actions/setup-java@v1.3.0
- name: Setup Java JDK
uses: actions/setup-java@v1.4.1
with:
java-version: 8
java-version: 14
- name: Gradle Build
run: gradle build
- name: Generate Bash Completion
env:
OPEN_CUE_CLI_COMPLETE: bash
run: |
unzip build/distributions/open-cue-cli.zip
./open-cue-cli/open-cue-cli > open-cue-cli/bash-complete-open-cue-cli.sh
chmod +x open-cue-cli/bash-complete-open-cue-cli.sh
zip -r open-cue-cli.zip open-cue-cli
run: gradle runtimeZip
- name: Get upload url
id: release-id
run: |
RELEASE_ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)
echo "::set-output name=upload_url::https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets{?name,label}"
- name: Upload Release Asset
- name: Upload Release Assets
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: bgpat/release-asset-action@03b0c30db1c4031ce3474740b0e4275cd7e126a3
with:
upload_url: ${{ steps.release-id.outputs.upload_url }}
asset_path: open-cue-cli.zip
asset_name: open-cue-cli.zip
asset_content_type: application/zip
pattern: build/open-cue-cli-*.zip
github-token: ${{ secrets.GITHUB_TOKEN }}
release-url: ${{ steps.release-id.outputs.upload_url }}
allow-overwrite: true
8 changes: 3 additions & 5 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ You can use all your customized iCUE profiles.
## Getting Started
Download and start the [Open CUE Service](https://github.com/Legion2/open-cue-service).
Download the [latest release](https://github.com/Legion2/open-cue-cli/releases/latest) of Open CUE CLI and extract the archive.
You must at least have Java 8 installed.
Call the cli tool `open-cue-cli.bat` or `open-cue-cli` from a command prompt with the option `--help`.

```
Expand Down Expand Up @@ -46,7 +45,7 @@ These profiles are just the exported files when you export a profile in iCUE.
When export profiles from iCUE only select "Lighting Effects" in the export settings.

Profiles are grouped into games, this is because the SDK was designed for iCUE Game integration.
So each subdirectory of `GameSdkEffects` represent a game and contains all it's profiles and a `priorities.cfg` file.
So each subdirectory of `GameSdkEffects` represent a game and contains all its profiles and a `priorities.cfg` file.

### Use own profiles/effects
The subdirectories of `GameSdkEffects` correspond to games, but you can also create own subdirectories.
Expand All @@ -67,9 +66,8 @@ You must set the name of the profile, when you export it from iCUE, you can't ch
The priorities comes into play when you activate two profiles, then the profile with the higher priority is shown on top of the other.

## Packaging of this application
This package is provide as zip containing executables and dependencies as jars.
A Java Runtime Environment (JRE) must be installed to run the application.
Just download the zip archive, extract it where you want and then execute one of the executable scripts from the extracted archive.
This package is provide as zip containing optimized executable runtime image.
Just download the [zip archive for your platform](https://github.com/Legion2/open-cue-cli/releases), extract it where you want and then execute one of the executable scripts from the extracted archive.

### Why not provide native executable
Native executables require curl or other native implementations to do http calls.
Expand Down
71 changes: 65 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import java.io.ByteArrayOutputStream

plugins {
kotlin("jvm") version "1.3.72"
kotlin("jvm") version "1.4.0"
application
id("org.beryx.runtime") version "1.11.2"
}

repositories {
Expand All @@ -14,11 +17,36 @@ application {
applicationName = "open-cue-cli"
}

runtime {
addOptions("--strip-debug", "--compress", "2", "--no-header-files", "--no-man-pages")
addModules("java.base",
"java.sql",//because of gson
"jdk.unsupported"//https://stackoverflow.com/questions/61727613/unexpected-behaviour-from-gson
)

imageZip.set(file("$buildDir/${project.application.applicationName}.zip"))
targetPlatform("linux-x64") {
setJdkHome(jdkDownload("https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.tar.gz"))
}
targetPlatform("linux-aarch64") {
setJdkHome(jdkDownload("https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_aarch64_linux_hotspot_14.0.2_12.tar.gz"))
}
targetPlatform("linux-arm32") {
setJdkHome(jdkDownload("https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_arm_linux_hotspot_14.0.2_12.tar.gz"))
}
targetPlatform("windows-x64") {
setJdkHome(jdkDownload("https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_windows_hotspot_14.0.2_12.zip"))
}
targetPlatform("mac-x64") {
setJdkHome(jdkDownload("https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_mac_hotspot_14.0.2_12.tar.gz"))
}
}

val ktorVersion = "1.3.2"
val cliktVersion = "2.6.0"

dependencies {
implementation("com.github.ajalt:clikt-multiplatform:$cliktVersion")
implementation("com.github.ajalt:clikt:$cliktVersion")
implementation("io.ktor:ktor-client:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-client-json:$ktorVersion")
Expand All @@ -27,14 +55,45 @@ dependencies {

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
languageVersion = "1.3"
apiVersion = "1.3"
jvmTarget = "14"
languageVersion = "1.4"
apiVersion = "1.4"
freeCompilerArgs += "-Xopt-in=com.github.ajalt.clikt.completion.ExperimentalCompletionCandidates"
}
}

val generateCliCompletions by tasks.registering(JavaExec::class) {
dependsOn("classes")
classpath = sourceSets.main.get().runtimeClasspath
main = application.mainClassName
environment("OPEN_CUE_CLI_COMPLETE", "bash")

val completions = file("$buildDir/completions")
outputs.dir(completions)
doFirst {
println("This is executed first during the execution phase.")
completions.mkdirs()
standardOutput = File(completions, "bash-complete-open-cue-cli.sh").outputStream()
}
}

distributions {
main {
contents {
from(generateCliCompletions)
}
}
}

tasks.withType<Wrapper> {
gradleVersion = "6.3"
gradleVersion = "6.6"
distributionType = Wrapper.DistributionType.ALL
}

// workaround for https://github.com/beryx/badass-runtime-plugin/issues/67
tasks.withType<CreateStartScripts> {
doLast {
windowsScript.writeText(windowsScript.readText()
.replace("set JAVA_HOME=\"%~dp0..\"", "set JAVA_HOME=\"%~dp0\""))
}
}

0 comments on commit afd8b58

Please sign in to comment.