OSDN Git Service

Merge remote-tracking branch 'origin/topic/miurahr/fix-dictzip-outputstream' into...
[dictzip-java/dictzip-java.git] / build.gradle
index 8ca25b0..25d8979 100644 (file)
@@ -1,16 +1,17 @@
 import org.apache.tools.ant.filters.ReplaceTokens
 
 plugins {
-    id "com.jfrog.bintray" version "1.8.5"
     id 'java-library'
-    id "org.nosphere.gradle.github.actions" version "1.1.0"
     id 'maven-publish'
-    id 'com.palantir.git-version' version "0.12.3"
-    id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
+    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"
 }
 
 // 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)
@@ -23,7 +24,6 @@ subprojects {
     apply plugin: 'jacoco'
     apply plugin: 'java'
     apply plugin: 'checkstyle'
-    apply plugin: 'maven'
     apply plugin: 'maven-publish'
 
     [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
@@ -40,10 +40,13 @@ subprojects {
     }
 
     dependencies {
-        testImplementation 'commons-io:commons-io:2.6'
-        testImplementation 'org.testng:testng:6.9.10'
+        implementation "org.jetbrains:annotations:23.0.0"
+        testImplementation 'commons-io:commons-io:2.11.0'
+        testImplementation "org.junit.jupiter:junit-jupiter:5.8.2"
+    }
+    test {
+        useJUnitPlatform()
     }
-    test.useTestNG()
 
     java {
         sourceCompatibility = JavaVersion.VERSION_1_8
@@ -65,66 +68,21 @@ subprojects {
 
 project(':dictzip-lib') {
     apply plugin: 'java-library'
-    apply plugin: 'com.jfrog.bintray'
     version = rootProject.version
-    bintray {
-        user = System.getenv('BINTRAY_USER')
-        key = System.getenv('BINTRAY_KEY')
-        configurations = ['archives']
-        pkg {
-            repo = 'maven'
-            name = 'dictzip-lib'
-            userOrg = 'dictzip'
-            licenses = ['GPL-2.0+CE']
-            vcsUrl = projectUrl
-            labels = ['java', 'dictzip']
-            publicDownloadNumbers = true
-        }
-    }
-    install {
-        repositories.mavenInstaller {
-            pom.project {
-                name = project.name
-                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
-                    }
-                }
-            }
-        }
-    }
-
     publishing {
         publications {
             mavenJava(MavenPublication) {
                 from components.java
                 artifactId = "dictzip"
+                groupId = "io.github.dictzip"
                 pom {
-                    name.set(project.name)
+                    name.set("dictzip")
                     description.set(projectDesc)
                     url.set(projectUrl)
                     licenses {
                         license {
-                            name.set("GNU General Public License Version 2+CE")
-                            url.set("https://www.gnu.org/licenses/old-licenses/gpl-2.0")
+                            name.set("GNU General Public License v2.0 w/Classpath exception")
+                            url.set("https://www.gnu.org/software/classpath/license.html")
                         }
                     }
                     scm {
@@ -146,30 +104,10 @@ project(':dictzip-lib') {
             }
         }
     }
-    repositories {
-        maven {
-            name = "GitHubPackages"
-            url = "https://maven.pkg.github.com/dictzip/dictzip-java"
-            credentials {
-                username = System.getenv("GITHUB_ACTOR")
-                password = System.getenv("GITHUB_TOKEN")
-            }
-        }
-        maven {
-            name 'AzurePackages'
-            url 'https://pkgs.dev.azure.com/miurahr/github/_packaging/maven/maven/v1'
-            credentials(PasswordCredentials) {
-                username = System.getenv("AZURE_USER")
-                password = System.getenv("AZURE_TOKEN")
-            }
-            authentication {
-                basic(BasicAuthentication)
-            }
-        }
-    }
     nexusPublishing {
         repositories {
             sonatype {
+                stagingProfileId = "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')
@@ -186,13 +124,13 @@ project(':dictzip-lib') {
         } else {
             useGpgCmd()
         }
-            sign publishing.publications.mavenJava
-        }
-        tasks.withType(Sign) {
-            def hasKey = project.hasProperty("signingKey") || project.hasProperty("signing.gnupg.keyName")
-            onlyIf { hasKey && versionDetails().isCleanTag }
-        }
+        sign publishing.publications.mavenJava
+    }
+    tasks.withType(Sign) {
+        def hasKey = project.hasProperty("signingKey") || project.hasProperty("signing.gnupg.keyName")
+        onlyIf { hasKey && versionDetails().isCleanTag }
     }
+}
 
 project(':dictzip-cli') {
     apply plugin: 'application'
@@ -219,7 +157,6 @@ project(':dictzip-cli') {
 
     distributions {
         main {
-            baseName = 'dictzip'
             contents {
                 from('build/docs/dictzip.1') {
                     into 'docs/man/man1'