OSDN Git Service

Prepare next release
[dictzip-java/dictzip-java.git] / build.gradle
1 import org.apache.tools.ant.filters.ReplaceTokens
2
3 plugins {
4     // github
5     id "co.riiid.gradle" version "0.4.2"
6     // bintray
7     id "com.jfrog.bintray" version "1.6"
8 }
9
10 // common settings
11 subprojects {
12   apply plugin: 'java'
13   apply plugin: 'jacoco'
14   apply plugin: 'checkstyle'
15   apply plugin: 'findbugs'
16   apply plugin: 'co.riiid.gradle'
17   apply plugin: 'com.jfrog.bintray'
18   apply plugin: 'maven'
19
20   sourceCompatibility = jdkVersion
21   targetCompatibility = jdkVersion
22   [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
23   [compileJava, compileTestJava]*.options*.bootClasspath = "$JDK_HOME/jre/lib/rt.jar"
24   checkstyle {
25     config = resources.text.fromFile("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
26     ignoreFailures = true
27     toolVersion = '6.16.1'
28   }
29
30   // Force prevent checkstyle/findbugs on Test.
31   task checkstyleTest(overwrite: true) << {}
32   task findbugsTest(overwrite: true) << {}
33   tasks.withType(FindBugs) {
34     reports {
35       xml.enabled = false
36       html.enabled = true
37     }
38   }
39
40   repositories {
41     jcenter()
42     mavenCentral()
43   }
44
45   dependencies {
46     testCompile 'org.testng:testng:6.9.10'
47   }
48
49   test {
50     useTestNG()
51   }
52
53   javadoc {
54     options.locale = 'en_US'
55   }
56
57   task sourceJar(type: Jar) {
58       from sourceSets.main.allSource
59       classifier = 'sources'
60   }
61
62   task javadocJar(type: Jar, dependsOn: javadoc) {
63       classifier = 'javadoc'
64       from javadoc.destinationDir
65   }
66
67   artifacts {
68       archives jar
69       archives sourceJar
70       archives javadocJar
71   }
72 }
73
74 project(':dictzip-lib') {
75   dependencies {
76     testCompile 'tokyo.northside:northside-io:0.2.0'
77   }
78   version = projectVersion
79   group = projectGroup
80   bintray {
81       user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
82       key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
83       configurations = ['archives']
84       pkg {
85           repo = 'maven'
86           name = 'dictzip-lib'
87           userOrg = 'dictzip'
88           licenses = ['GPL-2.0+CE']
89           vcsUrl = projectUrl
90           labels = ['java','dictzip']
91           publicDownloadNumbers = true
92       }
93   }
94   task mandoc << {}
95   task githubRelease(overwrite: true) << {}
96 }
97
98 project(':dictzip-cli') {
99   apply plugin: 'application'
100   mainClassName = 'org.dict.zip.cli.Main'
101   applicationName = 'dictzip'
102
103   dependencies {
104     compile project(':dictzip-lib'),
105        'gnu.getopt:java-getopt:1.0.13'
106     testCompile 'tokyo.northside:northside-io:0.2.0'
107   }
108   version = projectVersion
109   group = projectGroup
110   bintray {
111       user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
112       key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
113       configurations = ['archives']
114       pkg {
115           repo = 'maven'
116           name = 'dictzip-cli'
117           userOrg = 'dictzip'
118           licenses = ['GPL-3.0']
119           vcsUrl = projectUrl
120           labels = ['java','dictzip']
121           publicDownloadNumbers = true
122       }
123   }
124
125   task mandoc(type: Copy, overwrite: true) {
126     from "doc/dictzip.1.in"
127     into 'build/docs'
128     rename { String fileName ->
129         fileName.replace('dictzip.1.in', 'dictzip.1')
130     }
131     filter(ReplaceTokens, tokens: [copyright: projectYears, version: projectVersion])
132   }
133
134   distTar {
135     compression = Compression.GZIP
136   }
137   distTar.dependsOn mandoc
138
139   distributions {
140       main {
141           baseName = 'dictzip'
142           contents {
143               from('build/docs/dictzip.1') {
144                   into 'docs/man/man1'
145               }
146               from(javadocJar) {
147                   into 'docs'
148               }
149               from(sourceJar) {
150                   into 'source'
151               }
152           }
153       }
154   }
155   task githubRelease(overwrite: true) << {}
156 }
157
158 task mandoc << {}
159 task bintrayUpload(overwrite: true) << {}
160
161 if (gradle.startParameter.taskNames.contains('bintrayUpload')  ||
162     gradle.startParameter.taskNames.contains('githubRelease')) {
163   apply from: 'build.publish.gradle'
164 }