diff --git a/settings.gradle.kts b/settings.gradle.kts index 89a5a62e83..7906ef55cf 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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() @@ -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() @@ -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") } } }