Skip to content

Commit 7c70ff6

Browse files
Break build if uploading to repo, but signing info not set.
1 parent fa5bdb7 commit 7c70ff6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

build.gradle

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ def projectNamesToPublish = [
6767
'objectbox-rxjava'
6868
]
6969

70+
def hasSigningProperties() {
71+
return (project.hasProperty('signingKeyId')
72+
&& project.hasProperty('signingKeyFile')
73+
&& project.hasProperty('signingPassword'))
74+
}
75+
7076
configure(subprojects.findAll { projectNamesToPublish.contains(it.name) }) {
7177
apply plugin: 'maven'
7278
apply plugin: 'signing'
@@ -82,9 +88,7 @@ configure(subprojects.findAll { projectNamesToPublish.contains(it.name) }) {
8288
}
8389

8490
signing {
85-
if (project.hasProperty('signingKeyId')
86-
&& project.hasProperty('signingKeyFile')
87-
&& project.hasProperty('signingPassword')) {
91+
if (hasSigningProperties()) {
8892
String signingKey = new File(signingKeyFile).text
8993
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
9094
sign configurations.archives
@@ -107,6 +111,10 @@ configure(subprojects.findAll { projectNamesToPublish.contains(it.name) }) {
107111
} else if (preferredRepo != null
108112
&& project.hasProperty('preferredUsername')
109113
&& project.hasProperty('preferredPassword')) {
114+
if (!hasSigningProperties()) {
115+
throw new InvalidUserDataException("To upload to repo signing is required.")
116+
}
117+
110118
configuration = configurations.deployerJars
111119

112120
// replace placeholders

0 commit comments

Comments
 (0)