import org.apache.tools.ant.filters.ReplaceTokens
+import groovy.swing.SwingBuilder
plugins {
// github
apply plugin: 'co.riiid.gradle'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven'
+ apply plugin: 'signing'
sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
archives sourceJar
archives javadocJar
}
+
+ signing {
+ sign configurations.archives
+ }
}
project(':dictzip-lib') {
task mandoc << {}
task bintrayUpload(overwrite: true) << {}
+boolean validProperty(propertyName) {
+ try { project.property(propertyName) != null }
+ catch (MissingPropertyException) { false }
+}
+
+String askPassword(prompt) {
+ def keyPass = ''
+ if(System.console() == null) {
+ new SwingBuilder().edt {
+ dialog(modal: true, title: 'Enter password', alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) {
+ vbox {
+ label(text: prompt)
+ def input1 = passwordField()
+ button(defaultButton: true, text: 'OK', actionPerformed: {
+ keyPass = input1.password;
+ dispose();
+ })
+ }
+ }
+ }
+ } else {
+ keyPass = System.console().readPassword(prompt)
+ }
+ if (keyPass.size() <= 0) {
+ throw new InvalidUserDataException("You must enter the passwords to proceed.")
+ }
+ new String(keyPass)
+}
+
+github {
+ owner = projectOwner
+ repo = 'dictzip-java'
+ token = githubToken
+ tagName = projectTag
+ targetCommitish = 'master'
+ name = projectTag
+ draft = true
+ body = projectReleaseBody
+ assets = [
+ 'dictzip-cli/build/distributions/dictzip-' + projectVersion + '.tgz',
+ 'dictzip-cli/build/distributions/dictzip-' + projectVersion + '.zip',
+ 'dictzip-lib/build/libs/dictzip-lib-' + projectVersion + '.jar',
+ 'dictzip-lib/build/libs/dictzip-lib-' + projectVersion + '-sources.jar',
+ 'dictzip-lib/build/libs/dictzip-lib-' + projectVersion + '-javadoc.jar'
+ ]
+}
+
if (gradle.startParameter.taskNames.contains('bintrayUpload') ||
gradle.startParameter.taskNames.contains('githubRelease')) {
- apply from: 'build.publish.gradle'
+ assert validProperty('signing.keyId'), 'properties for signing must be provided'
+ assert validProperty('signing.secretKeyRingFile'), 'properties for signing must be provided'
+ ext.'signing.password' = askPassword("Enter password for PGP key ${property('signing.keyId')}: ")
+
}
+++ /dev/null
-apply plugin: 'signing'
-import groovy.swing.SwingBuilder
-
-boolean validProperty(propertyName) {
- try { project.property(propertyName) != null }
- catch (MissingPropertyException) { false }
-}
-assert validProperty('signing.keyId'), 'properties for signing must be provided'
-assert validProperty('signing.secretKeyRingFile'), 'properties for signing must be provided'
-
-def keyPass = ''
-if(System.console() == null) {
- new SwingBuilder().edt {
- dialog(modal: true, title: 'Enter password', alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) {
- vbox { // Put everything below each other
- label(text: "Please enter passphrase for PGP key ${property('signing.keyId')}:")
- def input2 = passwordField()
- button(defaultButton: true, text: 'OK', actionPerformed: {
- keyPass = input2.password;
- dispose();
- })
- }
- }
- }
-} else {
- keyPass = System.console().readPassword("Enter password for PGP key ${property('signing.keyId')}: ")
-}
-if (keyPass.size() <= 0) {
- throw new InvalidUserDataException("You must enter the passwords to proceed.")
-}
-ext.'signing.password' = new String(keyPass)
-
-signing {
- sign configurations.archives
-}
-
-github {
- owner = projectOwner
- repo = 'dictzip-java'
- token = githubToken
- tagName = projectTag
- targetCommitish = 'master'
- name = projectTag
- draft = true
- body = projectReleaseBody
- assets = [
- 'dictzip-cli/build/distributions/dictzip-' + projectVersion + '.tgz',
- 'dictzip-cli/build/distributions/dictzip-' + projectVersion + '.zip',
- 'dictzip-lib/build/libs/dictzip-lib-' + projectVersion + '.jar',
- 'dictzip-lib/build/libs/dictzip-lib-' + projectVersion + '-sources.jar',
- 'dictzip-lib/build/libs/dictzip-lib-' + projectVersion + '-javadoc.jar'
- ]
-}