OSDN Git Service

Release v0.14.1
[dictzip-java/dictzip-java.git] / build.gradle
index 8adf4f6..ee3932c 100644 (file)
@@ -1,38 +1,23 @@
-// common settings
-subprojects {
-  apply plugin: 'java'
-  apply plugin: 'jacoco'
-  apply plugin: 'checkstyle'
-
-  sourceCompatibility = '1.7'
-  targetCompatibility = '1.7'
-  [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
-  [compileJava, compileTestJava]*.options*.bootClasspath = "$JDK7_HOME/jre/lib/rt.jar"
-  checkstyle {
-    config = resources.text.fromFile("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
-    toolVersion = '6.16.1'
-  }
-
-  repositories {
-    mavenCentral()
-  }
-
-  dependencies {
-    testCompile group: 'junit', name: 'junit', version: '4.11'
-  }
+plugins {
+    alias(libs.plugins.nexus.publish)
+    alias(libs.plugins.git.version)
 }
 
-project(':dictzip-lib') {}
+group = projectGroup
 
-project(':dictzip-cli') {
-  apply plugin: 'application'
-  mainClassName = 'org.dict.zip.cli.Main'
-  applicationName = 'DictZip'
+// 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'
+}
 
-  dependencies {
-    compile project(':dictzip-lib'),
-       'commons-codec:commons-codec:1.10',
-       'gnu.getopt:java-getopt:1.0.13'
-    testCompile 'commons-io:commons-io:2.4'
-  }
+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')
+    }
 }