mirror of
https://github.com/yawaflua/Informatis.git
synced 2025-12-08 19:29:25 +02:00
88 lines
2.4 KiB
Groovy
88 lines
2.4 KiB
Groovy
plugins {
|
|
id 'java'
|
|
}
|
|
|
|
ext{
|
|
sdkRoot = System.getenv("ANDROID_HOME")
|
|
sdkVersion = '30'
|
|
mindustryVersion = 'v140.4'
|
|
artifactFilename = "Informatis.jar"
|
|
}
|
|
|
|
group "sharlotte"
|
|
sourceCompatibility = 16
|
|
|
|
sourceSets.main {
|
|
java.srcDir("src/")
|
|
resources.srcDir("assets/")
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven { url "https://jitpack.io" }
|
|
}
|
|
|
|
dependencies {
|
|
annotationProcessor 'com.github.Anuken:jabel:0.8.0'
|
|
compileOnly "com.github.Anuken.Arc:flabel:$mindustryVersion"
|
|
compileOnly "com.github.Anuken.Mindustry:core:$mindustryVersion"
|
|
compileOnly "com.github.Anuken.Arc:arc-core:$mindustryVersion"
|
|
}
|
|
|
|
jar.archiveFileName.set("raw-$artifactFilename")
|
|
|
|
def isWindows = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows")
|
|
task dexify(type: 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{
|
|
//collect dependencies needed for desugaring
|
|
def files = (configurations.compileClasspath.asList() + configurations.runtimeClasspath.asList() + [new File("$sdkRoot/platforms/android-$sdkVersion/android.jar")])
|
|
|
|
exec{
|
|
workingDir dexedArtifact.parent
|
|
def command = ["d8", "--min-api", "14"]
|
|
for(def file : files){
|
|
command += "--classpath"
|
|
command += file.path
|
|
}
|
|
|
|
command += ["--output", dexedArtifact, jarArtifact]
|
|
|
|
if(isWindows){
|
|
commandLine("cmd", "/c", *command)
|
|
}else{
|
|
commandLine(*command)
|
|
}
|
|
}
|
|
}
|
|
|
|
from(zipTree(jarArtifact), zipTree(dexedArtifact))
|
|
}
|
|
|
|
tasks.named("dexify").configure { dependsOn(":jar") }
|
|
task buildDex dependsOn "build", "dexify"
|
|
|
|
task buildMove(dependsOn: build) {
|
|
doLast {
|
|
copy {
|
|
from "build/libs/raw-Informatis.jar"
|
|
into System.getenv("destination")
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile){
|
|
targetCompatibility = 8
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
options.encoding = "UTF-8"
|
|
options.compilerArgs += ["-Xlint:deprecation"]
|
|
if(JavaVersion.current() != JavaVersion.VERSION_1_8){
|
|
options.compilerArgs.addAll(['--release', '8'])
|
|
}
|
|
compileJava.options.fork = true
|
|
}
|