refactor: gradle build script

This commit is contained in:
oSumAtrIX 2022-06-14 00:54:22 +02:00
parent bc92eb7fd8
commit 4c8eb0e5c7
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -1,24 +1,21 @@
plugins { plugins {
kotlin("jvm") version "1.6.21" kotlin("jvm") version "1.7.0"
java java
`maven-publish` `maven-publish`
} }
group = "app.revanced" group = "app.revanced"
val githubUsername: String = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR")
val githubPassword: String = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN")
repositories { repositories {
mavenCentral() mavenCentral()
maven { maven {
url = uri("https://maven.pkg.github.com/revanced/multidexlib2") url = uri("https://maven.pkg.github.com/revanced/multidexlib2")
credentials { credentials {
// DO NOT set these variables in the project's gradle.properties. username = githubUsername
// Instead, you should set them in: password = githubPassword
// Windows: %homepath%\.gradle\gradle.properties
// Linux: ~/.gradle/gradle.properties
username =
project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR") // DO NOT CHANGE!
password =
project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN") // DO NOT CHANGE!
} }
} }
} }
@ -32,8 +29,7 @@ dependencies {
api("org.smali:smali:2.5.2") api("org.smali:smali:2.5.2")
testImplementation(kotlin("test")) testImplementation(kotlin("test"))
implementation(kotlin("reflect")) implementation(kotlin("reflect"))}
}
tasks { tasks {
test { test {
@ -49,11 +45,8 @@ java {
withJavadocJar() withJavadocJar()
} }
val isGitHubCI = System.getenv("GITHUB_ACTOR") != null
publishing { publishing {
repositories { repositories {
if (isGitHubCI) {
maven { maven {
name = "GitHubPackages" name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher") url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
@ -62,9 +55,6 @@ publishing {
password = System.getenv("GITHUB_TOKEN") password = System.getenv("GITHUB_TOKEN")
} }
} }
} else {
mavenLocal()
}
} }
publications { publications {
register<MavenPublication>("gpr") { register<MavenPublication>("gpr") {