1 import org.apache.tools.ant.filters.ReplaceTokens
6 id 'java-library-distribution'
8 id "com.jfrog.bintray" version "1.8.5"
9 id "org.nosphere.gradle.github.actions" version "1.1.0"
10 id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
11 id "io.freefair.maven-central.validate-poms" version "5.3.0"
12 id 'com.palantir.git-version' version "0.12.3"
15 // calculate version string from git tag, hash and commit distance
16 if (versionDetails().isCleanTag) {
17 // drop first 'v' from version tag
18 version = gitVersion().substring(1)
20 version = versionDetails().lastTag.substring(1) + '-' + versionDetails().commitDistance + '-' + versionDetails().gitHash + '-SNAPSHOT'
25 apply plugin: 'jacoco'
27 apply plugin: 'checkstyle'
29 apply plugin: 'maven-publish'
31 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
33 config = resources.text.fromFile("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
35 toolVersion = '6.16.1'
37 version = rootProject.version
45 testImplementation 'commons-io:commons-io:2.6'
46 testImplementation 'org.testng:testng:6.9.10'
51 sourceCompatibility = JavaVersion.VERSION_1_8
52 targetCompatibility = JavaVersion.VERSION_1_8
58 options.locale = 'en_US'
68 project(':dictzip-lib') {
69 apply plugin: 'java-library'
70 apply plugin: 'com.jfrog.bintray'
71 version = rootProject.version
73 user = System.getenv('BINTRAY_USER')
74 key = System.getenv('BINTRAY_KEY')
75 configurations = ['archives']
80 licenses = ['GPL-2.0+CE']
82 labels = ['java', 'dictzip']
83 publicDownloadNumbers = true
87 repositories.mavenInstaller {
91 description = projectDesc
93 version = project.version
103 connection = "scm:git:${githubUrl}"
104 developerConnection = "scm:git:${githubUrl}"
110 email = developerEmail
119 mavenJava(MavenPublication) {
121 artifactId = "dictzip"
122 groupId = "io.github.dictzip"
125 description.set(projectDesc)
129 name.set("GNU General Public License Version 2+CE")
130 url.set("https://www.gnu.org/licenses/old-licenses/gpl-2.0")
134 connection.set("scm:git:git://github.com/dictzip/dictzip-java.git")
135 developerConnection.set("scm:git:git://github.com/dictzip/dictzip-java.git")
141 name = "Hiroshi Miura"
142 email = "miurahr@linux.com"
146 url.set(projectUrl + "/issues")
154 name = "GitHubPackages"
155 url = "https://maven.pkg.github.com/dictzip/dictzip-java"
157 username = System.getenv("GITHUB_ACTOR")
158 password = System.getenv("GITHUB_TOKEN")
163 url 'https://pkgs.dev.azure.com/miurahr/github/_packaging/maven/maven/v1'
164 credentials(PasswordCredentials) {
165 username = System.getenv("AZURE_USER")
166 password = System.getenv("AZURE_TOKEN")
169 basic(BasicAuthentication)
176 stagingProfileId = "a1cf138b142cd"
177 nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
178 snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
179 username = project.hasProperty('sonatypeUsername') ? project.property('sonatypeUsername') : System.getenv('SONATYPE_USER')
180 password = project.hasProperty('sonatypePassword') ? project.property('sonatypePassword') : System.getenv('SONATYPE_PASS')
186 def signingKey = findProperty("signingKey")
187 def signingPassword = findProperty("signingPassword")
189 useInMemoryPgpKeys(signingKey, signingPassword)
193 sign publishing.publications.mavenJava
195 tasks.withType(Sign) {
196 def hasKey = project.hasProperty("signingKey") || project.hasProperty("signing.gnupg.keyName")
197 onlyIf { hasKey && versionDetails().isCleanTag }
201 project(':dictzip-cli') {
202 apply plugin: 'application'
203 mainClassName = 'org.dict.zip.cli.Main'
204 applicationName = 'dictzip'
205 version = rootProject.version
207 implementation project(':dictzip-lib')
208 implementation 'gnu.getopt:java-getopt:1.0.13'
210 task mandoc(type: Copy) {
211 from "doc/dictzip.1.in"
213 rename { String fileName ->
214 fileName.replace('dictzip.1.in', 'dictzip.1')
216 filter(ReplaceTokens, tokens: [copyright: projectYears, version: project.version])
220 compression = Compression.GZIP
222 distTar.dependsOn mandoc
228 from('build/docs/dictzip.1') {