1 import org.apache.tools.ant.filters.ReplaceTokens
4 id "com.jfrog.bintray" version "1.8.5"
6 id "org.nosphere.gradle.github.actions" version "1.1.0"
8 id 'com.palantir.git-version' version "0.12.3"
9 id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
13 // calculate version string from git tag, hash and commit distance
14 if (versionDetails().isCleanTag) {
15 // drop first 'v' from version tag
16 version = gitVersion().substring(1)
18 version = versionDetails().lastTag.substring(1) + '-' + versionDetails().commitDistance + '-' + versionDetails().gitHash + '-SNAPSHOT'
23 apply plugin: 'jacoco'
25 apply plugin: 'checkstyle'
27 apply plugin: 'maven-publish'
29 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
31 config = resources.text.fromFile("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
33 toolVersion = '6.16.1'
35 version = rootProject.version
43 testImplementation 'commons-io:commons-io:2.6'
44 testImplementation 'org.testng:testng:6.9.10'
49 sourceCompatibility = JavaVersion.VERSION_1_8
50 targetCompatibility = JavaVersion.VERSION_1_8
56 options.locale = 'en_US'
66 project(':dictzip-lib') {
67 apply plugin: 'java-library'
68 apply plugin: 'com.jfrog.bintray'
69 version = rootProject.version
71 user = System.getenv('BINTRAY_USER')
72 key = System.getenv('BINTRAY_KEY')
73 configurations = ['archives']
78 licenses = ['GPL-2.0+CE']
80 labels = ['java', 'dictzip']
81 publicDownloadNumbers = true
85 repositories.mavenInstaller {
89 description = projectDesc
91 version = project.version
101 connection = "scm:git:${githubUrl}"
102 developerConnection = "scm:git:${githubUrl}"
108 email = developerEmail
117 project.afterEvaluate {
118 mavenJava(MavenPublication) {
120 artifactId = "dictzip"
121 groupId = projectGroup
122 version = project.version.toString()
124 name.set(project.name)
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)
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')
185 project.afterEvaluate {
187 def signingKey = findProperty("signingKey")
188 def signingPassword = findProperty("signingPassword")
190 useInMemoryPgpKeys(signingKey, signingPassword)
194 sign publishing.publications.mavenJava
196 tasks.withType(Sign) {
197 def hasKey = project.hasProperty("signingKey") || project.hasProperty("signing.gnupg.keyName")
198 onlyIf { hasKey && versionDetails().isCleanTag }
203 project(':dictzip-cli') {
204 apply plugin: 'application'
205 mainClassName = 'org.dict.zip.cli.Main'
206 applicationName = 'dictzip'
207 version = rootProject.version
209 implementation project(':dictzip-lib')
210 implementation 'gnu.getopt:java-getopt:1.0.13'
212 task mandoc(type: Copy) {
213 from "doc/dictzip.1.in"
215 rename { String fileName ->
216 fileName.replace('dictzip.1.in', 'dictzip.1')
218 filter(ReplaceTokens, tokens: [copyright: projectYears, version: project.version])
222 compression = Compression.GZIP
224 distTar.dependsOn mandoc
230 from('build/docs/dictzip.1') {