mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-30 23:04:57 +01:00
Gradle is always so extra
- Set secret properties using project.extra - Improve logging when loading secrets - Log when adding the maven specified in secrets
This commit is contained in:
parent
0288b37b22
commit
8d53f99956
1 changed files with 7 additions and 4 deletions
|
@ -163,6 +163,8 @@ open class SubprojectExtension(val project: Project) {
|
|||
// Sets maven credentials if they are provided. This is generally
|
||||
// only used for external/remote uploads.
|
||||
if (project.hasProperty("mavenUsername") && project.hasProperty("mavenPassword") && project.hasProperty("mavenURL")) {
|
||||
project.logger.lifecycle("Adding maven from secrets")
|
||||
|
||||
maven {
|
||||
credentials {
|
||||
username = project.property("mavenUsername") as String
|
||||
|
@ -177,10 +179,11 @@ open class SubprojectExtension(val project: Project) {
|
|||
private fun loadSecrets() {
|
||||
// Detects the secrets file provided by CI and loads it into the project properties
|
||||
if (project.rootProject.hasProperty("secretFile")) {
|
||||
project.logger.lifecycle("Automatically loading properties from the secretFile")
|
||||
val secretsFile = project.rootProject.file(project.rootProject.property("secretFile") as String)
|
||||
|
||||
if (secretsFile.exists() && secretsFile.name.endsWith(".properties")) {
|
||||
project.logger.lifecycle("Loading secrets")
|
||||
|
||||
loadProperties(secretsFile)
|
||||
}
|
||||
}
|
||||
|
@ -193,14 +196,14 @@ open class SubprojectExtension(val project: Project) {
|
|||
var count = 0
|
||||
for (entry in properties.entries) {
|
||||
if (entry.key is String) {
|
||||
project.setProperty(entry.key as String, entry.value)
|
||||
project.extra[entry.key as String] = entry.value as String
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
project.logger.lifecycle("Successfully loaded $count properties")
|
||||
project.logger.lifecycle("Loaded $count properties")
|
||||
} else {
|
||||
project.logger.warn("The property file ${propertyFile.getName()} could not be loaded. It does not exist.")
|
||||
project.logger.warn("The property file ${propertyFile.getName()} does not exist")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue