Skip to content

Commit

Permalink
gradle fixxxx
Browse files Browse the repository at this point in the history
  • Loading branch information
LaoHuaJiOfficial committed Jul 13, 2024
1 parent 4b17ac0 commit 3b0ab8b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/commitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
- name: Set up PATH
run: |
echo "${ANDROID_HOME}/build-tools/34.0.0" >> $GITHUB_PATH
- name: Set up JDK 17
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 17
java-version: 8
- name: Build mod jar
run: |
chmod +x ./gradlew
Expand Down
15 changes: 7 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ configurations.configureEach {
}
}

tasks.register('jarAndroid') {
task jarAndroid{
dependsOn "jar"

doLast {
if (!sdkRoot || !new File(sdkRoot as String).exists()) throw new GradleException("No valid Android SDK found. Ensure that ANDROID_HOME is set to your Android SDK directory.")
doLast{
if(!sdkRoot || !new File(sdkRoot).exists()) throw new GradleException("No valid Android SDK found. Ensure that ANDROID_HOME is set to your Android SDK directory.");

def platformRoot = new File("$sdkRoot/platforms/").listFiles().sort().reverse().find { f -> new File(f, "android.jar").exists() }
def platformRoot = new File("$sdkRoot/platforms/").listFiles().sort().reverse().find{ f -> new File(f, "android.jar").exists()}

if (!platformRoot) throw new GradleException("No android.jar found. Ensure that you have an Android platform installed.")
if(!platformRoot) throw new GradleException("No android.jar found. Ensure that you have an Android platform installed.")

//collect dependencies needed for desugaring
def dependencies = (configurations.compileClasspath.asList() + configurations.runtimeClasspath.asList() + [new File(platformRoot, "android.jar")]).collect { "--classpath $it.path" }.join(" ")
def dependencies = (configurations.compileClasspath.asList() + configurations.runtimeClasspath.asList() + [new File(platformRoot, "android.jar")]).collect{ "--classpath $it.path" }.join(" ")

def d8 = isWindows ? "d8.bat" : "d8"

Expand All @@ -82,7 +82,7 @@ jar{
configurations.runtimeClasspath.collect{ it.isDirectory() ? it : zipTree(it) }
}

from(rootDir){
from(projectDir){
include "mod.hjson"
}

Expand Down Expand Up @@ -139,4 +139,3 @@ tasks.register('deploy', Jar) {
}
}
}

0 comments on commit 3b0ab8b

Please sign in to comment.