build.gradle.kts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import org.jetbrains.kotlin.gradle.dsl.JvmTarget
  2. plugins {
  3. alias(libs.plugins.kotlin)
  4. alias(libs.plugins.shadow)
  5. application
  6. `maven-publish`
  7. signing
  8. }
  9. group = "app.revanced"
  10. application {
  11. mainClass = "app.revanced.cli.command.MainCommandKt"
  12. }
  13. repositories {
  14. mavenCentral()
  15. google()
  16. maven {
  17. // A repository must be specified for some reason. "registry" is a dummy.
  18. url = uri("https://maven.pkg.github.com/revanced/registry")
  19. credentials {
  20. username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
  21. password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
  22. }
  23. }
  24. }
  25. dependencies {
  26. implementation(libs.revanced.patcher)
  27. implementation(libs.revanced.library)
  28. implementation(libs.kotlinx.coroutines.core)
  29. implementation(libs.picocli)
  30. testImplementation(libs.kotlin.test)
  31. }
  32. kotlin {
  33. compilerOptions {
  34. jvmTarget.set(JvmTarget.JVM_11)
  35. }
  36. }
  37. java {
  38. targetCompatibility = JavaVersion.VERSION_11
  39. }
  40. tasks {
  41. test {
  42. useJUnitPlatform()
  43. testLogging {
  44. events("PASSED", "SKIPPED", "FAILED")
  45. }
  46. }
  47. processResources {
  48. expand("projectVersion" to project.version)
  49. }
  50. shadowJar {
  51. minimize {
  52. exclude(dependency("org.jetbrains.kotlin:.*"))
  53. exclude(dependency("org.bouncycastle:.*"))
  54. exclude(dependency("app.revanced:.*"))
  55. }
  56. }
  57. publish {
  58. dependsOn(shadowJar)
  59. }
  60. }
  61. // Needed by gradle-semantic-release-plugin.
  62. // Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
  63. // The maven-publish is also necessary to make the signing plugin work.
  64. publishing {
  65. repositories {
  66. mavenLocal()
  67. }
  68. publications {
  69. create<MavenPublication>("revanced-cli-publication") {
  70. from(components["java"])
  71. }
  72. }
  73. }
  74. signing {
  75. useGpgCmd()
  76. sign(publishing.publications["revanced-cli-publication"])
  77. }