plugins {
- // github
- id "co.riiid.gradle" version "0.4.2"
- // bintray
- id "com.jfrog.bintray" version "1.6"
-}
-
-// common settings
-subprojects {
- apply plugin: 'java'
- apply plugin: 'jacoco'
- apply plugin: 'checkstyle'
- apply plugin: 'findbugs'
-
- sourceCompatibility = jdkVersion
- targetCompatibility = jdkVersion
- [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
- [compileJava, compileTestJava]*.options*.bootClasspath = "$JDK_HOME/jre/lib/rt.jar"
- checkstyle {
- config = resources.text.fromFile("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
- ignoreFailures = true
- toolVersion = '6.16.1'
- }
-
- // Force prevent checkstyle/findbugs on Test.
- task checkstyleTest(overwrite: true) << {}
- task findbugsTest(overwrite: true) << {}
- tasks.withType(FindBugs) {
- reports {
- xml.enabled = false
- html.enabled = true
- }
- }
-
- repositories {
- jcenter()
- maven {
- url "http://dl.bintray.com/miurahr/maven"
- }
- mavenCentral()
- }
-
- dependencies {
- testCompile 'org.testng:testng:6.9.10'
- }
-
- test {
- useTestNG()
- }
+ alias(libs.plugins.nexus.publish)
+ alias(libs.plugins.git.version)
}
group = projectGroup
-version = projectVersion
-
-project(':dictzip-lib') {
- dependencies {
- testCompile 'tokyo.northside:northside-io:0.2.0'
- }
-}
-
-project(':dictzip-cli') {
- apply plugin: 'application'
- mainClassName = 'org.dict.zip.cli.Main'
- applicationName = 'DictZip'
- dependencies {
- compile project(':dictzip-lib'),
- 'commons-codec:commons-codec:1.10',
- 'gnu.getopt:java-getopt:1.0.13'
- testCompile 'tokyo.northside:northside-io:0.2.0'
- }
+// calculate version string from git tag, hash and commit distance
+// It treat as release tag when current HEAD has a tag,
+// and repository is clean, no modification,and no untracked files,
+if (versionDetails().isCleanTag) {
+ // drop first 'v' from version tag
+ version = gitVersion().substring(1)
+} else {
+ version = versionDetails().lastTag.substring(1) + '-' + versionDetails().commitDistance + '-' + versionDetails().gitHash + '-SNAPSHOT'
}
-if (gradle.startParameter.taskNames.contains('uploadArchives') ||
- gradle.startParameter.taskNames.contains('bintrayUpload') ||
- gradle.startParameter.taskNames.contains('githubRelease)) {
- apply from: 'build.publish.gradle'
+nexusPublishing.repositories {
+ sonatype {
+ username = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USER')
+ password = project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : System.getenv('SONATYPE_PASS')
+ }
}