From ba8121a8a72220762a706c537951446082e7d637 Mon Sep 17 00:00:00 2001 From: adigyran Date: Sun, 22 Aug 2021 13:15:22 +0300 Subject: [PATCH 1/8] Gradle shadow plugin. Based on Kitlith change of build.gradle. Using now library for Slime Commons dependency resolving. Changed gradle.yml accordingly. It produces slimevr.jar file --- .github/workflows/gradle.yml | 20 ++++++++++---------- build.gradle | 25 +++++++++---------------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 2418c459bb..4f9a46b1c6 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -11,23 +11,23 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - + - name: Clone Slime Java Commons uses: actions/checkout@v2.3.4 with: repository: Eirenliel/slime-java-commons # Relative path under $GITHUB_WORKSPACE to place the repository path: Slime Java Commons - + - name: Set up JDK 8 uses: actions/setup-java@v2.1.0 with: java-version: '8' distribution: 'adopt' - + - name: Grant execute permission for gradlew run: chmod +x gradlew - + - name: Test with Gradle run: ./gradlew clean test @@ -36,26 +36,26 @@ jobs: steps: - uses: actions/checkout@v2.3.4 - + - name: Clone Slime Java Commons uses: actions/checkout@v2.3.4 with: repository: Eirenliel/slime-java-commons # Relative path under $GITHUB_WORKSPACE to place the repository path: Slime Java Commons - + - name: Set up JDK 8 uses: actions/setup-java@v2.1.0 with: java-version: '8' distribution: 'adopt' - + - name: Grant execute permission for gradlew run: chmod +x gradlew - + - name: Build with Gradle - run: ./gradlew clean serverJar - + run: ./gradlew clean shadowJar + - name: Upload the Server JAR as a Build Artifact uses: actions/upload-artifact@v2.2.4 with: diff --git a/build.gradle b/build.gradle index 3f8c75b1bd..8ddc6a1cd7 100644 --- a/build.gradle +++ b/build.gradle @@ -7,8 +7,8 @@ */ plugins { - // Apply the java-library plugin to add support for Java Library - id 'java-library' + id 'application' + id "com.github.johnrengelman.shadow" version "6.1.0" } sourceCompatibility = 1.8 @@ -60,18 +60,11 @@ test { useJUnitPlatform() } -subprojects.each { subproject -> evaluationDependsOn(subproject.path) } -task serverJar (type: Jar, dependsOn: subprojects.tasks['build']) { - // Make the JAR runnable - manifest { - attributes 'Main-Class': 'io.eiren.vr.Main' - } - - // Pack all dependencies within the JAR - from { - configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } - } - - // Add this project's classes in the JAR - with jar +shadowJar { + archiveBaseName.set('slimevr') + archiveClassifier.set('') + archiveVersion.set('') +} +application { + mainClassName = 'io.eiren.vr.Main' } From 208ae6b6d690c592ea198ccebb99c99c8a5253c8 Mon Sep 17 00:00:00 2001 From: adigyran Date: Sun, 22 Aug 2021 13:21:20 +0300 Subject: [PATCH 2/8] reformat code --- .github/workflows/gradle.yml | 80 ++++++++++++++++++------------------ build.gradle | 32 +++++++-------- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 4f9a46b1c6..d3039c5dba 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -3,63 +3,63 @@ name: SlimeVR Server -on: [push, pull_request] +on: [ push, pull_request ] jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2.3.4 - - name: Clone Slime Java Commons - uses: actions/checkout@v2.3.4 - with: - repository: Eirenliel/slime-java-commons - # Relative path under $GITHUB_WORKSPACE to place the repository - path: Slime Java Commons + - name: Clone Slime Java Commons + uses: actions/checkout@v2.3.4 + with: + repository: Eirenliel/slime-java-commons + # Relative path under $GITHUB_WORKSPACE to place the repository + path: Slime Java Commons - - name: Set up JDK 8 - uses: actions/setup-java@v2.1.0 - with: - java-version: '8' - distribution: 'adopt' + - name: Set up JDK 8 + uses: actions/setup-java@v2.1.0 + with: + java-version: '8' + distribution: 'adopt' - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Grant execute permission for gradlew + run: chmod +x gradlew - - name: Test with Gradle - run: ./gradlew clean test + - name: Test with Gradle + run: ./gradlew clean test build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2.3.4 - - name: Clone Slime Java Commons - uses: actions/checkout@v2.3.4 - with: - repository: Eirenliel/slime-java-commons - # Relative path under $GITHUB_WORKSPACE to place the repository - path: Slime Java Commons + - name: Clone Slime Java Commons + uses: actions/checkout@v2.3.4 + with: + repository: Eirenliel/slime-java-commons + # Relative path under $GITHUB_WORKSPACE to place the repository + path: Slime Java Commons - - name: Set up JDK 8 - uses: actions/setup-java@v2.1.0 - with: - java-version: '8' - distribution: 'adopt' + - name: Set up JDK 8 + uses: actions/setup-java@v2.1.0 + with: + java-version: '8' + distribution: 'adopt' - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Grant execute permission for gradlew + run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew clean shadowJar + - name: Build with Gradle + run: ./gradlew clean shadowJar - - name: Upload the Server JAR as a Build Artifact - uses: actions/upload-artifact@v2.2.4 - with: - # Artifact name - name: "SlimeVR-Server" # optional, default is artifact - # A file, directory or wildcard pattern that describes what to upload - path: build/libs/* + - name: Upload the Server JAR as a Build Artifact + uses: actions/upload-artifact@v2.2.4 + with: + # Artifact name + name: "SlimeVR-Server" # optional, default is artifact + # A file, directory or wildcard pattern that describes what to upload + path: build/libs/* diff --git a/build.gradle b/build.gradle index 8ddc6a1cd7..29f19f5341 100644 --- a/build.gradle +++ b/build.gradle @@ -25,39 +25,39 @@ tasks.withType(JavaCompile) { tasks.withType(Test) { systemProperty('file.encoding', 'UTF-8') } -tasks.withType(Javadoc){ +tasks.withType(Javadoc) { options.encoding = 'UTF-8' } repositories { - // Use jcenter for resolving dependencies. - // You can declare any Maven/Ivy/file repository here. - jcenter() - mavenCentral() + // Use jcenter for resolving dependencies. + // You can declare any Maven/Ivy/file repository here. + jcenter() + mavenCentral() } dependencies { compile project(':Slime Java Commons') - // This dependency is exported to consumers, that is to say found on their compile classpath. - compile 'org.apache.commons:commons-math3:3.6.1' - compile 'org.yaml:snakeyaml:1.25' - compile 'net.java.dev.jna:jna:5.6.0' - compile 'net.java.dev.jna:jna-platform:5.6.0' - compile 'com.illposed.osc:javaosc-core:0.8' - compile 'com.fazecast:jSerialComm:[2.0.0,3.0.0)' + // This dependency is exported to consumers, that is to say found on their compile classpath. + compile 'org.apache.commons:commons-math3:3.6.1' + compile 'org.yaml:snakeyaml:1.25' + compile 'net.java.dev.jna:jna:5.6.0' + compile 'net.java.dev.jna:jna-platform:5.6.0' + compile 'com.illposed.osc:javaosc-core:0.8' + compile 'com.fazecast:jSerialComm:[2.0.0,3.0.0)' - // This dependency is used internally, and not exposed to consumers on their own compile classpath. - implementation 'com.google.guava:guava:28.2-jre' + // This dependency is used internally, and not exposed to consumers on their own compile classpath. + implementation 'com.google.guava:guava:28.2-jre' - // Use JUnit test framework + // Use JUnit test framework testImplementation platform('org.junit:junit-bom:5.7.2') testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.junit.platform:junit-platform-launcher' } test { - useJUnitPlatform() + useJUnitPlatform() } shadowJar { From 8bc2b72ab00e9d8d6d1be67161a21b17ba0adb6a Mon Sep 17 00:00:00 2001 From: adigyran Date: Sun, 22 Aug 2021 13:32:20 +0300 Subject: [PATCH 3/8] readme fix for new command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e76283c4ab..567cefe955 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ git clone https://github.com/Eirenliel/slime-java-commons.git # Enter the directory and build the runnable server JAR cd SlimeVR-Server -gradlew serverJar +gradlew shadowJar ``` Open Slime VR Server project in Eclipse or Intellij Idea From 12292070ce59c7f7d631e4307613ba0e252e19d6 Mon Sep 17 00:00:00 2001 From: Yury Date: Sun, 22 Aug 2021 13:34:46 +0300 Subject: [PATCH 4/8] Update .github/workflows/gradle.yml Co-authored-by: Butterscotch! --- .github/workflows/gradle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index d3039c5dba..b848cd2f15 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -49,6 +49,7 @@ jobs: with: java-version: '8' distribution: 'adopt' + cache: 'gradle' # will restore cache of dependencies and wrappers - name: Grant execute permission for gradlew run: chmod +x gradlew From 7f8fe9e4f44612795ffe8c9378ecb51d31a6645b Mon Sep 17 00:00:00 2001 From: Yury Date: Sun, 22 Aug 2021 13:38:22 +0300 Subject: [PATCH 5/8] Update .github/workflows/gradle.yml Co-authored-by: Butterscotch! --- .github/workflows/gradle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b848cd2f15..2e0b6b357c 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -24,6 +24,7 @@ jobs: with: java-version: '8' distribution: 'adopt' + cache: 'gradle' # will restore cache of dependencies and wrappers - name: Grant execute permission for gradlew run: chmod +x gradlew From 2ba66d7f91fb7171ae7f16a018605b3e72d4d3aa Mon Sep 17 00:00:00 2001 From: Yury Date: Sun, 22 Aug 2021 13:38:28 +0300 Subject: [PATCH 6/8] Update .github/workflows/gradle.yml Co-authored-by: Butterscotch! --- .github/workflows/gradle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 2e0b6b357c..5d74b2a851 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -51,6 +51,7 @@ jobs: java-version: '8' distribution: 'adopt' cache: 'gradle' # will restore cache of dependencies and wrappers + cache: 'gradle' # will restore cache of dependencies and wrappers - name: Grant execute permission for gradlew run: chmod +x gradlew From 5ebbb907e79b8c0f50beeebf624fab6a9dcd36cc Mon Sep 17 00:00:00 2001 From: Yury Date: Sun, 22 Aug 2021 13:39:20 +0300 Subject: [PATCH 7/8] Update gradle.yml fix resolving --- .github/workflows/gradle.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 5d74b2a851..6abdd05bfd 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -51,8 +51,6 @@ jobs: java-version: '8' distribution: 'adopt' cache: 'gradle' # will restore cache of dependencies and wrappers - cache: 'gradle' # will restore cache of dependencies and wrappers - - name: Grant execute permission for gradlew run: chmod +x gradlew From bb4a65882d642fa2610fcb9efbf4a488c68f432a Mon Sep 17 00:00:00 2001 From: adigyran Date: Sun, 22 Aug 2021 13:44:26 +0300 Subject: [PATCH 8/8] Gradle shadow plugin. Based on Kitlith change of build.gradle. Using now library for Slime Commons dependency resolving. Changed gradle.yml accordingly. It produces slimevr.jar file --- .github/workflows/gradle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 6abdd05bfd..2e0b6b357c 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -51,6 +51,7 @@ jobs: java-version: '8' distribution: 'adopt' cache: 'gradle' # will restore cache of dependencies and wrappers + - name: Grant execute permission for gradlew run: chmod +x gradlew