|
1 | 1 | buildscript{ |
2 | | - if (!System.getenv("SONATYPE_USERNAME").isEmpty()){ |
| 2 | + if (System.getenv("SONATYPE_USERNAME") != null){ |
3 | 3 | ext."sonatypeUsername" = System.getenv("SONATYPE_USERNAME") |
4 | 4 | ext."sonatypePassword" = System.getenv("SONATYPE_PASSWORD") |
5 | 5 | } |
| 6 | + if(project.findProperty("sonatypeUsername") == null){ |
| 7 | + ext.sonatypeUsername = "" |
| 8 | + ext.sonatypePassword = "" |
| 9 | + } |
6 | 10 | } |
7 | 11 | allprojects { |
8 | 12 | buildscript { |
@@ -33,38 +37,32 @@ allprojects { |
33 | 37 |
|
34 | 38 |
|
35 | 39 | gradle.taskGraph.whenReady { taskGraph -> |
36 | | - if (!System.getenv('GPG_KEY_ID').isEmpty() && taskGraph.allTasks.any { it instanceof Sign }) { |
| 40 | + if (taskGraph.allTasks.any { it instanceof Sign }) { |
37 | 41 | // Use Java's console to read from the console (no good for |
38 | 42 | // a CI environment) |
39 | | - def id = System.getenv('GPG_KEY_ID') |
40 | | - def file = "../secring.gpg" |
41 | | - def password = System.getenv('GPG_KEY_PASSPHRASE') |
42 | | - |
43 | | - allprojects { |
44 | | - ext."signing.keyId" = id |
45 | | - ext."signing.secretKeyRingFile" = file |
46 | | - ext."signing.password" = password |
| 43 | + if(System.getenv('GPG_KEY_ID') != null){ |
| 44 | + def id = System.getenv('GPG_KEY_ID') |
| 45 | + def file = "../secring.gpg" |
| 46 | + def password = System.getenv('GPG_KEY_PASSPHRASE') |
| 47 | + |
| 48 | + allprojects { |
| 49 | + ext."signing.keyId" = id |
| 50 | + ext."signing.secretKeyRingFile" = file |
| 51 | + ext."signing.password" = password |
| 52 | + |
| 53 | + ext.sonatypeUsername = System.getenv("SONATYPE_USERNAME") |
| 54 | + ext.sonatypePassword = System.getenv("SONATYPE_PASSWORD") |
| 55 | + } |
| 56 | + } |
47 | 57 |
|
48 | | - ext.sonatypeUsername = System.getenv("SONATYPE_USERNAME") |
49 | | - ext.sonatypePassword = System.getenv("SONATYPE_PASSWORD") |
50 | 58 |
|
51 | | - } |
52 | 59 | } |
53 | 60 | } |
54 | 61 |
|
55 | 62 |
|
56 | 63 | } |
57 | 64 | apply plugin: 'signing' |
58 | 65 |
|
59 | | -subprojects { |
60 | | - |
61 | | - |
62 | | -// signing.keyId=System.getenv('GPG_KEY_ID') |
63 | | -// signing.password=System.getenv('GPG_KEY_PASSPHRASE') |
64 | | -// signing.secretKeyRingFile="/Users/paperhuang/.gnupg/secring.gpg" |
65 | | - |
66 | | - |
67 | | -} |
68 | 66 |
|
69 | 67 |
|
70 | 68 |
|
|
0 commit comments