forked from promeG/TinyPinyin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
163 lines (136 loc) · 4.46 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import java.text.SimpleDateFormat
apply plugin: 'java'
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply from: '../config/quality-java.gradle'
group = rootProject.ext.groupName
version = rootProject.ext.releaseVersionName
buildscript {
repositories {
mavenLocal()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "me.champeau.gradle:jmh-gradle-plugin:0.3.1"
classpath 'org.apache.ant:ant:1.9.7'
}
}
sourceCompatibility = 1.6
targetCompatibility = 1.6
jmh {
jmhVersion = '1.3.3'
include = ['*.PinyinDictBenchmark.*']
operationsPerInvocation = 10
benchmarkMode = ['thrpt']
verbosity = 'NORMAL'
fork = 2
timeUnit = 'us'
duplicateClassesStrategy = 'warn'
}
configurations {
jmh
}
sourceSets {
jmh
}
project.sourceSets.jmh {
compileClasspath += project.configurations.jmh + project.sourceSets.main.output
runtimeClasspath += project.configurations.jmh + project.sourceSets.main.output
}
task jmhJarFixed(type: Jar, dependsOn: jmhClasses) {
doFirst {
from (project.configurations.jmh.collect {it.isDirectory() ? it : project.zipTree(it)}) {
exclude '**/META-INF/services/**'
exclude '**/META-INF/*.SF'
exclude '**/META-INF/*.DSA'
exclude '**/META-INF/*.RSA'
}
from project.sourceSets.jmh.output
from project.sourceSets.main.output
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
manifest {
attributes 'Main-Class':'org.openjdk.jmh.Main'
}
classifier = 'jmh'
}
task jmhFixed(type: JavaExec, dependsOn: jmhJarFixed) {
main = 'org.openjdk.jmh.Main'
classpath = project.files(project.jmhJar.archivePath) + project.sourceSets.main.runtimeClasspath
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile 'org.assertj:assertj-core:1.7.1'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'com.belerweb:pinyin4j:2.5.0'
compile 'org.ahocorasick:ahocorasick:0.3.0'
jmh fileTree(dir: 'jmh-libs', include: ['*.jar'])
jmh 'org.apache.commons:commons-lang3:3.0'
jmh 'com.belerweb:pinyin4j:2.5.0'
jmh 'org.openjdk.jmh:jmh-core:1.3.3'
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.3.3'
}
// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar, javadocJar
}
publishing {
publications {
mavenJava(MavenPublication) {
if (plugins.hasPlugin('war')) {
from components.web
} else {
from components.java
}
artifact sourcesJar
artifact javadocJar
artifactId 'tinypinyin'
}
}
}
bintray {
user = bintray_user
key = bintray_api_key
publications = ['mavenJava']
dryRun = false
publish = true
pkg {
repo = 'maven'
name = 'tinypinyin'
desc = '适用于Java和Android的快速、低内存占用的汉字转拼音库。'
websiteUrl = 'https://github.com/promeG/TinyPinyin'
issueTrackerUrl = 'https://github.com/promeG/TinyPinyin/issues'
vcsUrl = 'https://github.com/promeG/TinyPinyin.git'
licenses = ['Apache-2.0']
labels = ['pinyin', 'java', 'android']
publicDownloadNumbers = true
//Optional version descriptor
version {
name = rootProject.ext.releaseVersionName //Bintray logical version name
released = new SimpleDateFormat('yyyy-MM-dd\'T\'HH:mm:ss.SSSZZ').format(new Date())
vcsTag = '1.0.0'
mavenCentralSync {
sync = false
//Optional (true by default). Determines whether to sync the version to Maven Central.
user = 'userToken' //OSS user token
password = 'paasword' //OSS user password
close = '1'
//Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually.
}
}
}
}