Skip to content

Commit

Permalink
Merge pull request #34 from adigyran/main
Browse files Browse the repository at this point in the history
Gradle shadow plugin for dependency resolving
  • Loading branch information
Eirenliel committed Aug 22, 2021
2 parents a105879 + bb4a658 commit 4370def
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 82 deletions.
100 changes: 51 additions & 49 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,65 @@

name: SlimeVR Server

on: [push, pull_request]
on: [ push, pull_request ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]

- name: Clone Slime Java Commons
uses: actions/[email protected]
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/[email protected]
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/[email protected]

- name: Clone Slime Java Commons
uses: actions/[email protected]
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/[email protected]
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/[email protected]

- name: Clone Slime Java Commons
uses: actions/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]

- name: Clone Slime Java Commons
uses: actions/[email protected]
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/[email protected]
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/[email protected]
with:
# Artifact name
name: "SlimeVR-Server" # optional, default is artifact
# A file, directory or wildcard pattern that describes what to upload
path: build/libs/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 25 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
}

0 comments on commit 4370def

Please sign in to comment.