Skip to content

Commit 26bf576

Browse files
committed
fix: make signing secrets optional for basic checks
1 parent 0c19384 commit 26bf576

3 files changed

Lines changed: 31 additions & 17 deletions

File tree

buildSrc/src/main/kotlin/Util.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ fun String.toBase64() = Base64.getEncoder().encodeToString(toByteArray())
5252
fun Project.localProperties() = lazy {
5353
Properties().apply {
5454
val file = File(rootProject.rootDir.absolutePath, "local.properties")
55-
if (!file.exists()) {
56-
println("w: Local.properties file does not exist. You may be missing some publishing keys")
57-
return@apply
58-
}
55+
if (!file.exists()) return@apply
5956
load(FileInputStream(file))
6057
}
6158
}

debugger/ideplugin/build.gradle.kts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,20 @@ plugins {
1010
alias(libs.plugins.intellij.ide)
1111
}
1212

13-
val props by localProperties()
13+
val pluginPrivateKey by lazy {
14+
val props by localProperties()
15+
props["plugin.publishing.privatekey"]?.toString()?.trim()?.takeIf { it.isNotBlank() }
16+
}
17+
18+
val pluginSigningPassword by lazy {
19+
val props by localProperties()
20+
props["signing.password"]?.toString()?.trim()?.takeIf { it.isNotBlank() }
21+
}
22+
23+
val pluginPublishingToken by lazy {
24+
val props by localProperties()
25+
props["plugin.publishing.token"]?.toString()?.trim()?.takeIf { it.isNotBlank() }
26+
}
1427

1528
repositories {
1629
google {
@@ -30,13 +43,15 @@ intellijPlatform {
3043
projectName = Config.name
3144
// needed when plugin provides custom settings exposed to the UI
3245
buildSearchableOptions = false
33-
signing {
34-
certificateChainFile = rootProject.rootDir.resolve(Config.Plugin.certPath)
35-
privateKey = props["plugin.publishing.privatekey"]?.toString()
36-
password = props["signing.password"]?.toString()
46+
if (pluginPrivateKey != null && pluginSigningPassword != null) {
47+
signing {
48+
certificateChainFile = rootProject.rootDir.resolve(Config.Plugin.certPath)
49+
privateKey = pluginPrivateKey
50+
password = pluginSigningPassword
51+
}
3752
}
3853
publishing {
39-
token = props["plugin.publishing.token"]?.toString()
54+
token = pluginPublishingToken
4055
hidden = true
4156
}
4257
pluginVerification {

sample/build.gradle.kts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,20 @@ android {
166166
outputFileName = "${Config.Sample.namespace}.apk"
167167
}
168168
}
169-
val props by localProperties()
170-
val passwd = props["keystore.password"]?.toString()?.trim()?.takeIf { it.isNotBlank() }
171-
val keystore = File(rootDir, "certificates/keystore.jks")
172-
val signed = passwd != null && keystore.exists()
173-
if (signed) signingConfigs {
174-
create("release") {
169+
val passwd by lazy {
170+
val props by localProperties()
171+
props["keystore.password"]?.toString()?.trim()?.takeIf { it.isNotBlank() }
172+
}
173+
val keystore by lazy { File(rootDir, "certificates/keystore.jks") }
174+
val signed by lazy { passwd != null && keystore.exists() }
175+
signingConfigs {
176+
if (signed) create("release") {
175177
keyAlias = "key"
176178
keyPassword = passwd
177179
storeFile = keystore
178180
storePassword = passwd
179181
}
180-
} else println("w: skipping signing because keystore.password property is not present or keystore is missing")
182+
}
181183
buildTypes {
182184
debug {
183185
applicationIdSuffix = ".debug"

0 commit comments

Comments
 (0)