forked from keenlabs/KeenClient-Java
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
79 lines (70 loc) · 2.87 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Common build instructions & instructions for the root project.
//task wrapper(type: Wrapper) {
// gradleVersion = '7.3.3'
//}
allprojects {
apply plugin: 'idea'
version = VERSION_NAME
group = GROUP
repositories {
mavenCentral()
}
}
gradle.taskGraph.whenReady { taskGraph ->
// if (taskGraph.allTasks.any { it.name.contains("uploadArchives") }) {
// if (project.hasProperty('signing.keyId') &&
// project.hasProperty('signing.secretKeyRingFile') &&
// project.hasProperty('sonatypeUsername') &&
// project.hasProperty('sonatypePassword')) {
//
// println "Found signing properties and sonatype credentials"
// ext."signing.password" = getPassword("Enter GPG secret key passphrase")
// } else {
// throw new GradleScriptException(
// "Missing required signing configuration. Ensure that you have a " +
// "gradle.properties file which defines the values 'signing.keyId', " +
// "'signing.secretKeyRingFile', 'sonatypeUsername', and 'sonatypePassword'.", null);
// }
// } else {
// println "No publish tasks; skipping all artifact signing"
// taskGraph.allTasks.findAll {
// it instanceof Sign
// }.each {
// it.enabled = false
// }
// }
}
import groovy.swing.SwingBuilder
// Get a password from either console or dialog. Adapted from:
// https://www.timroes.de/2014/01/19/using-password-prompts-with-gradle-build-files/
String getPassword(String prompt) {
def pass = ''
if (System.console() == null) {
new SwingBuilder().edt {
dialog(modal: true, // Otherwise the build will continue running before you closed the dialog
title: 'Enter password', // Dialog title
alwaysOnTop: true, // pretty much what the name says
resizable: false, // Don't allow the user to resize the dialog
locationRelativeTo: null, // Place dialog in center of the screen
pack: true, // We need to pack the dialog (so it will take the size of it's children)
show: true // Let's show it
) {
vbox { // Put everything below each other
label(text: prompt)
def input = passwordField()
button(defaultButton: true, text: 'OK', actionPerformed: {
pass = input.password; // Set pass variable to value of input field
dispose(); // Close dialog
})
} // vbox end
} // dialog end
} // edt end
} else {
pass = System.console().readPassword("\n" + prompt)
}
pass = new String(pass)
if (pass.size() <= 0) {
throw new InvalidUserDataException("You must enter a password to proceed.")
}
return pass
}