Skip to content

Commit a35fefb

Browse files
author
Chris Bellew
committed
Updated build.gradle file.
1 parent bdd4d1c commit a35fefb

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

Voice Control For Plex/build.gradle

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
1+
import groovy.swing.SwingBuilder
12
apply plugin: 'android'
23

34
android {
45
compileSdkVersion 19
56
buildToolsVersion '19.0.3'
67

78
defaultConfig {
8-
minSdkVersion 16
9+
minSdkVersion 14
910
targetSdkVersion 19
1011
}
1112

13+
signingConfigs {
14+
debug {
15+
storeFile file("/path/to/keystore/file")
16+
}
17+
release {
18+
storeFile file("/path/to/keystore/file")
19+
keyAlias "keyAlias"
20+
storePassword ""
21+
keyPassword ""
22+
}
23+
}
1224
buildTypes {
1325
release {
26+
signingConfig signingConfigs.release
27+
debuggable false
1428
runProguard false
1529
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
1630
}
1731
}
32+
lintOptions {
33+
abortOnError false
34+
}
1835
}
1936

2037
dependencies {
@@ -25,3 +42,44 @@ dependencies {
2542
compile 'com.android.support:support-v4:+'
2643
compile 'com.github.codechimp-org.apprater:library:1.0.+'
2744
}
45+
46+
gradle.taskGraph.whenReady { taskGraph ->
47+
if(taskGraph.hasTask(':Voice Control For Plex:assembleRelease')) {
48+
49+
def pass = ''
50+
if(System.console() == null) {
51+
new SwingBuilder().edt {
52+
dialog(modal: true, // Otherwise the build will continue running before you closed the dialog
53+
title: 'Enter password', // Dialog title
54+
alwaysOnTop: true, // pretty much what the name says
55+
resizable: false, // Don't allow the user to resize the dialog
56+
locationRelativeTo: null, // Place dialog in center of the screen
57+
pack: true, // We need to pack the dialog (so it will take the size of it's children)
58+
show: true // Let's show it
59+
) {
60+
vbox { // Put everything below each other
61+
label(text: "!Please enter key passphrase:")
62+
input = passwordField()
63+
button(defaultButton: true, text: 'OK', actionPerformed: {
64+
pass = new String(input.password); // Set pass variable to value of input field
65+
dispose(); // Close dialog
66+
})
67+
} // vbox end
68+
} // dialog end
69+
} // edt end
70+
} else {
71+
pass = System.console().readPassword("\nPlease enter key passphrase: ")
72+
pass = new String(pass)
73+
}
74+
75+
if(pass.size() <= 0) {
76+
throw new InvalidUserDataException("You must enter a password to proceed.")
77+
}
78+
79+
// -----
80+
// Do what you need to do with pass here!
81+
// -----
82+
android.signingConfigs.release.storePassword = pass;
83+
android.signingConfigs.release.keyPassword = pass;
84+
} // end if has task
85+
} // end whenReady

0 commit comments

Comments
 (0)