From 3a2b40e0ddb1aa9f4c6ad51a668c572ac07e71b2 Mon Sep 17 00:00:00 2001 From: rpopma Date: Tue, 8 Aug 2017 21:53:29 +0900 Subject: [PATCH] #121 make picocli.AutoComplete the main class of the picocli jar --- build.gradle | 399 ++++++++++++++++++++++++++------------------------- 1 file changed, 200 insertions(+), 199 deletions(-) diff --git a/build.gradle b/build.gradle index da95f1616..b90862e82 100644 --- a/build.gradle +++ b/build.gradle @@ -1,200 +1,201 @@ -group 'info.picocli' -description 'Annotation-based Java command line parser. Usage help with ANSI styles and colors. Easily included as source to avoid adding a dependency.' -version '1.0.0-SNAPSHOT' - -// for bumpVersion task -def oldVersion = '0\\.9\\.8' -def oldRevdate = '2017\\-08\\-07' -def revDate = '2017-08-07' - -buildscript { - repositories { - jcenter() - } - - dependencies { - classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3' - } -} - -apply plugin: 'org.asciidoctor.convert' -apply plugin: 'java' -apply plugin: 'jacoco' -apply plugin: 'distribution' -apply plugin: 'maven-publish' - -sourceCompatibility = 1.5 - -repositories { - mavenCentral() -} - -dependencies { - testCompile "junit:junit:4.12", - "org.hamcrest:hamcrest-core:1.3", - "org.fusesource.jansi:jansi:1.15" -} -jar { - manifest { - attributes 'Implementation-Title': 'picocli', - 'Implementation-Vendor': 'Remko Popma', - 'Implementation-Version': version - } -} -javadoc { - destinationDir = file("build/docs/apidocs") -} -javadoc.dependsOn('asciidoctor') - -jacocoTestReport { - reports { - xml.enabled true - html.enabled false - } -} -task testJar(type: Jar, dependsOn: compileTestJava) { - from sourceSets.test.output - classifier = 'tests' -} -task sourcesJar(type: Jar) { - from sourceSets.main.java.srcDirs - classifier = 'sources' -} -task testSourcesJar(type: Jar) { - from sourceSets.test.java.srcDirs - classifier = 'test-sources' -} -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} -asciidoctor { - sourceDir = file('docs') - outputDir = file('build/docs') - logDocuments = true -} -artifacts { - archives javadocJar - archives sourcesJar - archives testSourcesJar - archives testJar - archives jar -} -task bumpVersion { - doLast { - ant.replaceregexp(match: "\"$oldVersion\"", replace: "\"$version\"", flags: 'g', byline: true, encoding: 'UTF8') { - fileset(dir: 'src/main/java/picocli', includes: 'CommandLine.java') - fileset(dir: 'src/test/java/picocli', includes: 'CommandLineTest.java') - } - ant.replaceregexp(match: ":revnumber: $oldVersion", replace: ":revnumber: $version", flags: 'g', byline: true, encoding: 'UTF8') { - fileset(dir: 'docs', includes: 'index.adoc') - } - ant.replaceregexp(match: oldRevdate, replace: revDate, flags: 'g', byline: true, encoding: 'UTF8') { - fileset(dir: 'docs', includes: 'index.adoc') - } - } -} -task copyDocs(type: Copy) { - from 'build/docs/html5/index.html' - from('build/docs/') { exclude 'html5'} - into 'docs' -} - -distributions { - main { - baseName = "$archivesBaseName-all" - contents { - from jar - from sourcesJar - from testJar - from testSourcesJar - from javadocJar - from ('LICENSE') - from ('RELEASE-NOTES.adoc') - } - } -} -ext { - bintrayBaseUrl = 'https://api.bintray.com/maven' - bintrayRepository = 'picocli' - bintrayPackage = 'picocli' - bintrayUsername = System.getenv('BINTRAY_USER') - bintrayApiKey = System.getenv('BINTRAY_KEY') -} -publishing { - publications { - plugin(MavenPublication) { - from components.java - artifact sourcesJar - artifact testJar - artifact testSourcesJar - artifact javadocJar - pom.withXml { - def root = asNode() - root.appendNode('packaging', 'jar') - root.appendNode('name', 'picocli - a mighty tiny Command Line Interface') - root.appendNode('description', description) - root.appendNode('url', 'http://picocli.info') - root.appendNode('inceptionYear', '2017') - - def license = root.appendNode('licenses').appendNode('license') - license.appendNode('name', 'The Apache Software License, version 2.0') - license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt') - license.appendNode('distribution', 'repo') - - def developer = root.appendNode('developers').appendNode('developer') - developer.appendNode('id', 'rpopma') - developer.appendNode('name', 'Remko Popma') - developer.appendNode('email', 'rpopma@apache.org') - - def scm = root.appendNode('scm') - scm.appendNode('connection', 'scm:git:https://github.com/remkop/picocli.git') - scm.appendNode('developerConnection', 'scm:git:ssh://github.com:remkop/picocli.git') - scm.appendNode('url', 'https://github.com/remkop/picocli/tree/master') - } - } - } - repositories { - maven { - name 'myLocal' - url "file://$projectDir/../repo/$bintrayUsername" - } - maven { - name 'Bintray' - url "$bintrayBaseUrl/$bintrayUsername/$bintrayRepository/$bintrayPackage" - credentials { - username = bintrayUsername - password = bintrayApiKey - } - } - } -} -/* -Release procedure: -1. edit version numbers: remove -SNAPSHOT classifier -2. gradlew bumpVersion -3. check modified files (especially line 767 in index.adoc) -4. gradlew clean build -5. gradlew copyDocs -6. update RELEASE-NOTES.adoc -7. commit -m "Release picocli version ..." -8. tag v$version -9. gradlew publishPluginPublicationToBintrayRepository - -10. edit version numbers: increase minor version and add -SNAPSHOT classifier -11. gradlew bumpVersion -12. check modified files (especially line 767 in index.adoc) -13. commit -m "Prepare for next development cycle" -14. push (make sure that Push Tags is checked) - -15. Log in to GitHub, go to https://github.com/remkop/picocli/releases -16. Click the new tag, click Edit button, update title and release notes (copy from RELEASE-NOTES.adoc) -17. Upload picocli-$version.jar and picocli-all$version.zip to GitHub - -18. Log in to Bintray -19. Navigate to the page for the new version -20. Edit version: Publication Date, Description, VCS tag, GitHub release notes file (RELEASE-NOTES.adoc) -21. On the version page, Release Notes tab, select GitHub File -22. Publish artifacts to JCenter -22. On the version page, Maven Central tab, sync to Maven (takes several minutes) +group 'info.picocli' +description 'Annotation-based Java command line parser. Usage help with ANSI styles and colors. Easily included as source to avoid adding a dependency.' +version '1.0.0-SNAPSHOT' + +// for bumpVersion task +def oldVersion = '0\\.9\\.8' +def oldRevdate = '2017\\-08\\-07' +def revDate = '2017-08-07' + +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3' + } +} + +apply plugin: 'org.asciidoctor.convert' +apply plugin: 'java' +apply plugin: 'jacoco' +apply plugin: 'distribution' +apply plugin: 'maven-publish' + +sourceCompatibility = 1.5 + +repositories { + mavenCentral() +} + +dependencies { + testCompile "junit:junit:4.12", + "org.hamcrest:hamcrest-core:1.3", + "org.fusesource.jansi:jansi:1.15" +} +jar { + manifest { + attributes 'Implementation-Title' : 'picocli', + 'Implementation-Vendor' : 'Remko Popma', + 'Implementation-Version': version, + 'Main-Class' : 'picocli.AutoComplete' + } +} +javadoc { + destinationDir = file("build/docs/apidocs") +} +javadoc.dependsOn('asciidoctor') + +jacocoTestReport { + reports { + xml.enabled true + html.enabled false + } +} +task testJar(type: Jar, dependsOn: compileTestJava) { + from sourceSets.test.output + classifier = 'tests' +} +task sourcesJar(type: Jar) { + from sourceSets.main.java.srcDirs + classifier = 'sources' +} +task testSourcesJar(type: Jar) { + from sourceSets.test.java.srcDirs + classifier = 'test-sources' +} +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} +asciidoctor { + sourceDir = file('docs') + outputDir = file('build/docs') + logDocuments = true +} +artifacts { + archives javadocJar + archives sourcesJar + archives testSourcesJar + archives testJar + archives jar +} +task bumpVersion { + doLast { + ant.replaceregexp(match: "\"$oldVersion\"", replace: "\"$version\"", flags: 'g', byline: true, encoding: 'UTF8') { + fileset(dir: 'src/main/java/picocli', includes: 'CommandLine.java') + fileset(dir: 'src/test/java/picocli', includes: 'CommandLineTest.java') + } + ant.replaceregexp(match: ":revnumber: $oldVersion", replace: ":revnumber: $version", flags: 'g', byline: true, encoding: 'UTF8') { + fileset(dir: 'docs', includes: 'index.adoc') + } + ant.replaceregexp(match: oldRevdate, replace: revDate, flags: 'g', byline: true, encoding: 'UTF8') { + fileset(dir: 'docs', includes: 'index.adoc') + } + } +} +task copyDocs(type: Copy) { + from 'build/docs/html5/index.html' + from('build/docs/') { exclude 'html5'} + into 'docs' +} + +distributions { + main { + baseName = "$archivesBaseName-all" + contents { + from jar + from sourcesJar + from testJar + from testSourcesJar + from javadocJar + from ('LICENSE') + from ('RELEASE-NOTES.adoc') + } + } +} +ext { + bintrayBaseUrl = 'https://api.bintray.com/maven' + bintrayRepository = 'picocli' + bintrayPackage = 'picocli' + bintrayUsername = System.getenv('BINTRAY_USER') + bintrayApiKey = System.getenv('BINTRAY_KEY') +} +publishing { + publications { + plugin(MavenPublication) { + from components.java + artifact sourcesJar + artifact testJar + artifact testSourcesJar + artifact javadocJar + pom.withXml { + def root = asNode() + root.appendNode('packaging', 'jar') + root.appendNode('name', 'picocli - a mighty tiny Command Line Interface') + root.appendNode('description', description) + root.appendNode('url', 'http://picocli.info') + root.appendNode('inceptionYear', '2017') + + def license = root.appendNode('licenses').appendNode('license') + license.appendNode('name', 'The Apache Software License, version 2.0') + license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt') + license.appendNode('distribution', 'repo') + + def developer = root.appendNode('developers').appendNode('developer') + developer.appendNode('id', 'rpopma') + developer.appendNode('name', 'Remko Popma') + developer.appendNode('email', 'rpopma@apache.org') + + def scm = root.appendNode('scm') + scm.appendNode('connection', 'scm:git:https://github.com/remkop/picocli.git') + scm.appendNode('developerConnection', 'scm:git:ssh://github.com:remkop/picocli.git') + scm.appendNode('url', 'https://github.com/remkop/picocli/tree/master') + } + } + } + repositories { + maven { + name 'myLocal' + url "file://$projectDir/../repo/$bintrayUsername" + } + maven { + name 'Bintray' + url "$bintrayBaseUrl/$bintrayUsername/$bintrayRepository/$bintrayPackage" + credentials { + username = bintrayUsername + password = bintrayApiKey + } + } + } +} +/* +Release procedure: +1. edit version numbers: remove -SNAPSHOT classifier +2. gradlew bumpVersion +3. check modified files (especially line 767 in index.adoc) +4. gradlew clean build +5. gradlew copyDocs +6. update RELEASE-NOTES.adoc +7. commit -m "Release picocli version ..." +8. tag v$version +9. gradlew publishPluginPublicationToBintrayRepository + +10. edit version numbers: increase minor version and add -SNAPSHOT classifier +11. gradlew bumpVersion +12. check modified files (especially line 767 in index.adoc) +13. commit -m "Prepare for next development cycle" +14. push (make sure that Push Tags is checked) + +15. Log in to GitHub, go to https://github.com/remkop/picocli/releases +16. Click the new tag, click Edit button, update title and release notes (copy from RELEASE-NOTES.adoc) +17. Upload picocli-$version.jar and picocli-all$version.zip to GitHub + +18. Log in to Bintray +19. Navigate to the page for the new version +20. Edit version: Publication Date, Description, VCS tag, GitHub release notes file (RELEASE-NOTES.adoc) +21. On the version page, Release Notes tab, select GitHub File +22. Publish artifacts to JCenter +22. On the version page, Maven Central tab, sync to Maven (takes several minutes) */ \ No newline at end of file