Skip to content

Commit d405fab

Browse files
committed
feat: Add lib module with java-library plugin and ahocorasick dependency, and update project build configuration.
1 parent b65acaa commit d405fab

3 files changed

Lines changed: 3 additions & 191 deletions

File tree

build.gradle

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +0,0 @@
1-
buildscript {
2-
repositories {
3-
jcenter()
4-
mavenCentral()
5-
maven {
6-
url "https://plugins.gradle.org/m2/"
7-
}
8-
google()
9-
}
10-
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.5.3'
12-
13-
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
14-
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.1"
15-
classpath "gradle.plugin.com.kageiit:lintrules:1.1.2"
16-
}
17-
}
18-
19-
allprojects {
20-
repositories {
21-
jcenter()
22-
mavenCentral()
23-
mavenLocal()
24-
google()
25-
}
26-
}
27-
28-
29-
ext {
30-
userName = 'PromeG'
31-
developer = [
32-
id : 'promeg',
33-
name : 'promeg',
34-
email: 'gyacong@gmail.com'
35-
]
36-
license = [
37-
id : 'MIT',
38-
name: 'The MIT License (MIT)',
39-
url : 'http://opensource.org/licenses/MIT'
40-
]
41-
groupName = 'com.github.promeg'
42-
artifactName = 'TinyPinyin'
43-
artifactDescription = '适用于Java和Android的快速、低内存占用的汉字转拼音库。'
44-
artifactLabels = ['pinyin', 'java', 'android']
45-
46-
47-
groupName = 'com.github.promeg'
48-
releaseVersionName = "3.0.0"
49-
releaseVersionCode = 6
50-
51-
// Android
52-
androidBuildToolsVersion = '24.0.3'
53-
androidMinSdkVersion = 16
54-
androidTargetSdkVersion = 24
55-
androidCompileSdkVersion = 24
56-
androidSupportSdkVersion = '24.2.1'
57-
}

lib/build.gradle

Lines changed: 3 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,9 @@
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-
537
dependencies {
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
}

settings.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
include ':tinypinyin-lexicons-android-cncity', ':tinypinyin-lexicons-java-cncity',
2-
':android-sample',
3-
':tinypinyin-android-asset-lexicons'
41
rootProject.name = 'tinypinyin'
52
include 'lib'

0 commit comments

Comments
 (0)