1- import java.text.SimpleDateFormat
2-
3- apply plugin : ' java'
4- apply plugin : ' me.champeau.gradle.jmh'
5- apply plugin : ' maven-publish'
6- apply plugin : ' com.jfrog.bintray'
7- // apply from: '../config/quality-java.gradle'
8-
9- tasks. withType(JavaCompile ) {
10- options. encoding = ' UTF-8'
11- }
12-
13- javadoc {
14- options. encoding = ' UTF-8'
15- }
16-
17- group = rootProject. ext. groupName
18- version = rootProject. ext. releaseVersionName
19-
20- buildscript {
21- repositories {
22- mavenLocal()
23- mavenCentral()
24- jcenter()
25- maven {
26- url " https://plugins.gradle.org/m2/"
27- }
28- }
29-
30- dependencies {
31- classpath " me.champeau.gradle:jmh-gradle-plugin:0.5.0"
32- classpath ' org.apache.ant:ant:1.9.7'
33- }
1+ apply plugin : ' java-library'
342
3+ repositories {
4+ mavenCentral()
355}
366
37- sourceCompatibility = 1.6
38- targetCompatibility = 1.6
39-
40- jmh {
41- jmhVersion = ' 1.21'
42- include = [' PinyinDictBenchmark.*' , ' PinyinSampleBenchmark.*' ]
43- operationsPerInvocation = 10
44- benchmarkMode = [' thrpt' ]
45- verbosity = ' NORMAL'
46- fork = 2
47- timeUnit = ' us'
48- duplicateClassesStrategy = ' warn'
49- jvmArgs = [' -Djmh.separateClasspathJAR=true' ]
50- }
51-
52-
537dependencies {
54- testImplementation ' junit:junit:4.12'
55- testImplementation ' org.hamcrest:hamcrest-all:1.3'
56- testImplementation ' org.assertj:assertj-core:1.7.1'
57- testImplementation ' org.mockito:mockito-core:1.10.19'
58- testImplementation ' com.belerweb:pinyin4j:2.5.0'
59-
608 implementation ' org.ahocorasick:ahocorasick:0.3.0'
61-
62- jmh fileTree(dir : ' jmh-libs' , include : [' *.jar' ])
63- jmh ' org.apache.commons:commons-lang3:3.0'
64- jmh ' com.belerweb:pinyin4j:2.5.0'
65- jmh ' org.openjdk.jmh:jmh-core:0.9'
66- jmh ' org.openjdk.jmh:jmh-generator-annprocess:0.9'
67- }
68-
69-
70-
71- // custom tasks for creating source/javadoc jars
72- task sourcesJar (type : Jar , dependsOn : classes) {
73- classifier = ' sources'
74- from sourceSets. main. allSource
75- }
76-
77- task javadocJar (type : Jar , dependsOn : javadoc) {
78- classifier = ' javadoc'
79- from javadoc. destinationDir
80- }
81-
82- // add javadoc/source jar tasks as artifacts
83- artifacts {
84- archives sourcesJar, javadocJar
85- }
86-
87- publishing {
88- publications {
89- mavenJava(MavenPublication ) {
90- if (plugins. hasPlugin(' war' )) {
91- from components. web
92- } else {
93- from components. java
94- }
95-
96- artifact sourcesJar
97- artifact javadocJar
98-
99- artifactId ' tinypinyin'
100- }
101- }
102- }
103-
104- bintray {
105- user = bintray_user
106- key = bintray_api_key
107-
108- publications = [' mavenJava' ]
109-
110- dryRun = false
111- publish = true
112- pkg {
113- repo = ' maven'
114- name = ' tinypinyin'
115- desc = ' 适用于Java和Android的快速、低内存占用的汉字转拼音库。'
116- websiteUrl = ' https://github.com/promeG/TinyPinyin'
117- issueTrackerUrl = ' https://github.com/promeG/TinyPinyin/issues'
118- vcsUrl = ' https://github.com/promeG/TinyPinyin.git'
119- licenses = [' Apache-2.0' ]
120- labels = [' pinyin' , ' java' , ' android' ]
121- publicDownloadNumbers = true
122- // Optional version descriptor
123- version {
124- name = rootProject. ext. releaseVersionName // Bintray logical version name
125- released = new SimpleDateFormat (' yyyy-MM-dd\' T\' HH:mm:ss.SSSZZ' ). format(new Date ())
126- vcsTag = ' 1.0.0'
127- mavenCentralSync {
128- sync = false
129- // Optional (true by default). Determines whether to sync the version to Maven Central.
130- user = ' userToken' // OSS user token
131- password = ' paasword' // OSS user password
132- close = ' 1'
133- // 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.
134- }
135- }
136- }
1379}
0 commit comments