Skip to content

Commit

Permalink
fix: providers.gradleProperty (ReVanced#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminHalko authored Sep 6, 2023
1 parent 42e0346 commit 0b0ba21
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
pluginManagement {
// TODO: remove this once https://github.com/gradle/gradle/issues/23572 is fixed
val (gprUser, gprKey) = if (File(".gradle/gradle.properties").exists()) {
File(".gradle/gradle.properties").inputStream().use {
java.util.Properties().apply { load(it) }.let {
it.getProperty("gpr.user") to it.getProperty("gpr.key")
}
}
} else {
null to null
}

repositories {
gradlePluginPortal()
google()
Expand All @@ -7,13 +18,24 @@ pluginManagement {
maven {
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials {
username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
username = gprUser ?: providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
password = gprKey ?: providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
}
}
}
}
dependencyResolutionManagement {
// TODO: remove this once https://github.com/gradle/gradle/issues/23572 is fixed
val (gprUser, gprKey) = if (File(".gradle/gradle.properties").exists()) {
File(".gradle/gradle.properties").inputStream().use {
java.util.Properties().apply { load(it) }.let {
it.getProperty("gpr.user") to it.getProperty("gpr.key")
}
}
} else {
null to null
}

repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
Expand All @@ -22,8 +44,8 @@ dependencyResolutionManagement {
maven {
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
credentials {
username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
username = gprUser ?: providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_ACTOR")
password = gprKey ?: providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
}
}
}
Expand Down

0 comments on commit 0b0ba21

Please sign in to comment.