-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8651037
commit 4d7e8e1
Showing
19 changed files
with
565 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
* text=auto | ||
MANIFEST text eol=crlf | ||
*.bat text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
/build/ | ||
/.gradle/ | ||
/.idea/* | ||
!/.idea/artifacts | ||
!/.idea/libraries | ||
!/.idea/kotlinc.xml | ||
!/.idea/modules.xml | ||
!/.idea/vcs.xml | ||
/.idea | ||
/application.conf | ||
*.iml |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
id("com.github.johnrengelman.shadow") version "8.1.1" | ||
kotlin("jvm") version "1.9.10" | ||
kotlin("plugin.serialization") version "1.9.10" | ||
} | ||
|
||
val javaVersion = JavaVersion.VERSION_1_8 | ||
val javaVersionNumber = javaVersion.name.substringAfter('_').replace('_', '.') | ||
val javaVersionMajor = javaVersion.name.substringAfterLast('_') | ||
|
||
val r8: Configuration by configurations.creating | ||
dependencies { | ||
implementation(kotlin("serialization")) | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-hocon:1.6.0") | ||
r8("com.android.tools:r8:+") | ||
} | ||
|
||
|
||
tasks.withType<KotlinCompile> { | ||
kotlinOptions.jvmTarget = javaVersionNumber | ||
} | ||
|
||
tasks.withType<AbstractCompile> { | ||
sourceCompatibility = javaVersionNumber | ||
targetCompatibility = javaVersionNumber | ||
} | ||
|
||
tasks.withType<Jar> { | ||
manifest { | ||
attributes(mapOf("Main-Class" to "MainKt")) | ||
} | ||
} | ||
|
||
tasks.withType<ShadowJar> { | ||
archiveClassifier.set("shadow") | ||
mergeServiceFiles() | ||
minimize() | ||
exclude("**/*.kotlin_*") | ||
} | ||
|
||
tasks { | ||
assemble { | ||
dependsOn(shadowJarMinified) | ||
} | ||
} | ||
|
||
val shadowJarMinified = tasks.register<JavaExec>("shadowJarMinified") { | ||
dependsOn(configurations.runtimeClasspath) | ||
|
||
val proguardRules = file("src/main/proguard-rules.pro") | ||
inputs.files(tasks.shadowJar.get().outputs.files, proguardRules) | ||
|
||
val r8File = layout.buildDirectory.file("libs/${base.archivesName.get()}-shadow-minified.jar").get().asFile | ||
outputs.file(r8File) | ||
|
||
classpath(r8) | ||
|
||
mainClass.set("com.android.tools.r8.R8") | ||
val javaHome = File(ProcessHandle.current().info().command().get()).parentFile.parentFile.canonicalPath | ||
|
||
val args = mutableListOf( | ||
//"--debug", | ||
"--classfile", | ||
"--output", | ||
r8File.toString(), | ||
"--pg-conf", | ||
proguardRules.toString(), | ||
"--lib", | ||
javaHome, | ||
) | ||
args.add(tasks.shadowJar.get().outputs.files.joinToString(" ")) | ||
|
||
this.args = args | ||
|
||
doFirst { | ||
val javaHomeVersion = Runtime.getRuntime().exec("$javaHome/bin/java -version").run { | ||
(inputStream.bufferedReader().readText() + errorStream.bufferedReader().readText()).split('"')[1] | ||
} | ||
check(JavaVersion.toVersion(javaHomeVersion).isCompatibleWith(javaVersion)) { | ||
"Incompatible Java Versions: compile-target $javaVersionNumber, r8 runtime $javaHomeVersion (needs to be as new or newer)" | ||
} | ||
|
||
check(proguardRules.exists()) { "$proguardRules doesn't exist" } | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
kotlin.code.style=official | ||
org.gradle.caching=true | ||
org.gradle.parallel=true |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.