Vinay Nagaraj
05/24/2023, 1:23 PMfun RepositoryHandler.customRepo(provider: ProviderFactory) {
maven("<https://release-url>") {
mavenContent { releasesOnly() }
artifactoryCredentials(provider)
}
maven("<https://snapshot-url>") {
mavenContent { snapshotsOnly() }
artifactoryCredentials(provider)
}
}
fun AuthenticationSupported.artifactoryCredentials(provider: ProviderFactory) {
val userName = provider.propOrEnv("artifactory_username").get()
val apiKey = provider.propOrEnv("artifactory_api_key").get()
credentials {
username = userName
password = apiKey
}
}
fun ProviderFactory.propOrEnv(key: String): Provider<String> {
return gradleProperty(key).orElse(environmentVariable(key))
}
What's the best way to make this function available in both (buildSrc & root) settings.gradle?Martin
05/24/2023, 1:30 PMapply(from = repositories.gradle.kts)
is the easiest way to do this without going circular dependencies all the way down. One example hereVinay Nagaraj
05/24/2023, 1:33 PMMartin
05/24/2023, 1:33 PMVampire
05/24/2023, 1:34 PMpluginManagement { repositories { ... } }
or dependendencyManagement { repositories { ... } }
?Martin
05/24/2023, 1:35 PMpluginManagement
too in KTS (but maybe not in Groovy)Vinay Nagaraj
05/24/2023, 1:37 PMdependendencyManagement
(assuming that will make these plugins available to all subprojects), and also as a repository in dependencyManagement
for all my subprojects.Vampire
05/24/2023, 1:40 PMincludeBuild
that build within pluginManagement { ... }
.Vinay Nagaraj
05/24/2023, 1:52 PMproject
dependencies to the buildscript classpath.Vampire
05/24/2023, 1:55 PMVinay Nagaraj
05/24/2023, 2:00 PMpluginManagement
, would it automatically get added to buildscript classpath?Vampire
05/24/2023, 2:01 PM