Open zhlinh opened 4 months ago
I need the same capability, we are using secrets.properties
to provide our credentials for the project, and since the gradle.properties
is committed to the git, we can not save the credentials in that file, and ~/.gradle/gradle.properties
is ok but in that case we need to maintain two places for credentials, and it's preferable to have all of them in the secrets.properties
.
basically, I need to provide a new properties file to the gradle plugin and it reads the variables from that file
val secretProperties = Properties().apply {
load(FileInputStream(File(rootProject.rootDir, "secrets.properties")))
}
properties = secretProperties
Same, we have a lot of properties and creating an env variable for each of them is cumbersome. Instead, we have been just base64'ing and creating a local.properties file with all secrets on each ci deployment. Strange that manual overrides are not possible with this plugin.
I've found a workaround only for signing with inMemory key.
plugins {
signing
}
val signProperties = Properties().apply { load(rootProject.file("lib1.sign.properties").reader()) }
//lib1.sign.properties
//secretKeyId=***
//secretKeyPass=***
//secretInMemoryKey=***
signing {
useInMemoryPgpKeys(
signProperties.getProperty("secretKeyId"),
signProperties.getProperty("secretInMemoryKey"),
signProperties.getProperty("secretKeyPass")
)
}
But there is no solution for mavenCentralUsername and mavenCentralPassword
Now provided two ways to set username and password config. by ~/.gradle/gradle.properties or by system env.
But if want different project has different username and password settings, I found it so hard to do it.