diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 2418c459bb..2e0b6b357c 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -3,63 +3,65 @@ name: SlimeVR Server -on: [push, pull_request] +on: [ push, pull_request ] jobs: test: runs-on: ubuntu-latest 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 + - 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' + cache: 'gradle' # will restore cache of dependencies and wrappers + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Test with Gradle + run: ./gradlew clean test build: runs-on: ubuntu-latest 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 - - - 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/* + - 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' + cache: 'gradle' # will restore cache of dependencies and wrappers + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - 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/* 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 diff --git a/build.gradle b/build.gradle index 3f8c75b1bd..29f19f5341 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 @@ -25,53 +25,46 @@ 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() } -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' }