Skip to content

Commit

Permalink
trying to clean up build.gradle...
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharlottes committed Aug 26, 2023
1 parent ff5f879 commit 3f7d600
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@ apply plugin: "java"

version '1.0'

ext{
sourceSets.main {
java.srcDir("src/")
resources.srcDir("assets/")
}

ext {
sdkRoot = System.getenv("ANDROID_HOME")
sdkVersion = '30'
mindustryVersion = 'v145.1'
artifactFilename = "Informatis.jar"
}

sourceSets.main {
java.srcDir("src/")
resources.srcDir("assets/")
}

repositories {
mavenCentral()
maven { url "https://raw.githubusercontent.com/Zelaux/MindustryRepo/master/repository" }
maven { url "https://jitpack.io" }
}

java {
targetCompatibility = 8
sourceCompatibility = JavaVersion.VERSION_17
}

dependencies {
annotationProcessor 'com.github.Anuken:jabel:0.8.0'
compileOnly "com.github.Anuken.Arc:flabel:$mindustryVersion"
Expand All @@ -30,31 +35,31 @@ dependencies {
jar.archiveFileName.set("raw-$artifactFilename")

def isWindows = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows")
task dexify(type: Jar){
tasks.register('dexify', Jar) {
dependsOn "jar"

archiveFileName.set(artifactFilename)

final File jarArtifact = new File(tasks.jar.archiveFile.get().asFile.parent, "raw-$artifactFilename"),
dexedArtifact = new File(tasks.dexify.getTemporaryDir(), "dexed.jar")

doFirst{
doFirst {
//collect dependencies needed for desugaring
def files = (configurations.compileClasspath.asList() + configurations.runtimeClasspath.asList() + [new File("$sdkRoot/platforms/android-$sdkVersion/android.jar")])

exec{
exec {
workingDir dexedArtifact.parent
def command = ["d8", "--min-api", "14"]
for(def file : files){
for (def file : files) {
command += "--classpath"
command += file.path
}

command += ["--output", dexedArtifact, jarArtifact]

if(isWindows){
if (isWindows) {
commandLine("cmd", "/c", *command)
}else{
} else {
commandLine(*command)
}
}
Expand All @@ -63,18 +68,15 @@ task dexify(type: Jar){
from(zipTree(jarArtifact), zipTree(dexedArtifact))
}

task deploy(type: Jar) {
dependsOn dexify
tasks.register('deploy', Jar) {
dependsOn "dexify"
dependsOn "build"
}

tasks.withType(JavaCompile){
targetCompatibility = 8
sourceCompatibility = JavaVersion.VERSION_17
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.compilerArgs += ["-Xlint:deprecation"]
if(JavaVersion.current() != JavaVersion.VERSION_1_8){
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
options.compilerArgs.addAll(['--release', '8'])
}
compileJava.options.fork = true
}

0 comments on commit 3f7d600

Please sign in to comment.