OSDN Git Service

Release v0.13.0
[dictzip-java/dictzip-java.git] / build.gradle
index ef78bf1..d0cee3e 100644 (file)
@@ -4,9 +4,8 @@ plugins {
     id 'java-library'
     id 'maven-publish'
     id 'java-library-distribution'
-    id "signing"
     id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
-    id 'com.palantir.git-version' version "0.12.3"
+    id 'com.palantir.git-version' version "0.13.0"
 }
 
 // calculate version string from git tag, hash and commit distance
@@ -19,17 +18,26 @@ if (versionDetails().isCleanTag) {
     version = versionDetails().lastTag.substring(1) + '-' + versionDetails().commitDistance + '-' + versionDetails().gitHash + '-SNAPSHOT'
 }
 
+def props = project.file("dictzip-cli/src/main/resources/org/dict/zip/Version.properties")
+task writeVersionFile {
+    def folder = props.getParentFile()
+    if (!folder.exists()) {
+        folder.mkdirs()
+    }
+    props.delete()
+    props.text = "version=" + project.version
+}
+
+jar.dependsOn("writeVersionFile")
+
 // common settings
 subprojects {
     apply plugin: 'jacoco'
     apply plugin: 'java'
     apply plugin: 'checkstyle'
-    apply plugin: 'maven'
     apply plugin: 'maven-publish'
 
-    [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
     checkstyle {
-        config = resources.text.fromFile("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
         ignoreFailures = true
         toolVersion = '6.16.1'
     }
@@ -41,10 +49,13 @@ subprojects {
     }
 
     dependencies {
+        implementation "org.jetbrains:annotations:23.0.0"
         testImplementation 'commons-io:commons-io:2.11.0'
-        testImplementation 'org.testng:testng:7.4.0'
+        testImplementation "org.junit.jupiter:junit-jupiter:5.8.2"
+    }
+    test {
+        useJUnitPlatform()
     }
-    test.useTestNG()
 
     java {
         sourceCompatibility = JavaVersion.VERSION_1_8
@@ -64,38 +75,21 @@ subprojects {
     }
 }
 
+project(':northside-io') {
+    apply plugin: 'java-library'
+    version = rootProject.version
+    dependencies {
+        implementation 'commons-io:commons-io:2.11.0'
+    }
+}
+
 project(':dictzip-lib') {
     apply plugin: 'java-library'
+    apply plugin: "signing"
     version = rootProject.version
-    install {
-        repositories.mavenInstaller {
-            pom.project {
-                name = 'dictzip'
-                packaging = 'jar'
-                description = projectDesc
-                url = projectUrl
-                version = project.version
-                licenses {
-                    license {
-                        name = licenseName
-                        url = licenseUrl
-                        distribution = 'repo'
-                    }
-                }
-                scm {
-                    url = githubUrl
-                    connection = "scm:git:${githubUrl}"
-                    developerConnection = "scm:git:${githubUrl}"
-                }
-                developers {
-                    developer {
-                        id = projectOwner
-                        name = developerName
-                        email = developerEmail
-                    }
-                }
-            }
-        }
+
+    dependencies {
+        testImplementation project(':northside-io')
     }
 
     publishing {
@@ -103,7 +97,6 @@ project(':dictzip-lib') {
             mavenJava(MavenPublication) {
                 from components.java
                 artifactId = "dictzip"
-                groupId = "io.github.dictzip"
                 pom {
                     name.set("dictzip")
                     description.set(projectDesc)
@@ -121,9 +114,9 @@ project(':dictzip-lib') {
                     }
                     developers {
                         developer {
-                            id = "miurahr"
-                            name = "Hiroshi Miura"
-                            email = "miurahr@linux.com"
+                            id.set("miurahr")
+                            name.set("Hiroshi Miura")
+                            email.set("miurahr@linux.com")
                         }
                     }
                     issueManagement {
@@ -136,7 +129,7 @@ project(':dictzip-lib') {
     nexusPublishing {
         repositories {
             sonatype {
-                stagingProfileId = "a1cf138b142cd"
+                stagingProfileId.set("a1cf138b142cd")
                 nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
                 snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
                 username = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USER')
@@ -146,9 +139,9 @@ project(':dictzip-lib') {
     }
 
     signing {
-        def signingKey = findProperty("signingKey")
-        def signingPassword = findProperty("signingPassword")
-        if (signingKey) {
+        if (project.hasProperty("signingKey")) {
+            def signingKey = findProperty("signingKey").toString()
+            def signingPassword = findProperty("signingPassword").toString()
             useInMemoryPgpKeys(signingKey, signingPassword)
         } else {
             useGpgCmd()
@@ -169,6 +162,7 @@ project(':dictzip-cli') {
     dependencies {
         implementation project(':dictzip-lib')
         implementation 'gnu.getopt:java-getopt:1.0.13'
+        testImplementation project(':northside-io')
     }
     task mandoc(type: Copy) {
         from "doc/dictzip.1.in"
@@ -186,7 +180,6 @@ project(':dictzip-cli') {
 
     distributions {
         main {
-            baseName = 'dictzip'
             contents {
                 from('build/docs/dictzip.1') {
                     into 'docs/man/man1'