Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,57 +0,0 @@
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'

classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.1"
classpath "gradle.plugin.com.kageiit:lintrules:1.1.2"
}
}

allprojects {
repositories {
jcenter()
mavenCentral()
mavenLocal()
google()
}
}


ext {
userName = 'PromeG'
developer = [
id : 'promeg',
name : 'promeg',
email: 'gyacong@gmail.com'
]
license = [
id : 'MIT',
name: 'The MIT License (MIT)',
url : 'http://opensource.org/licenses/MIT'
]
groupName = 'com.github.promeg'
artifactName = 'TinyPinyin'
artifactDescription = '适用于Java和Android的快速、低内存占用的汉字转拼音库。'
artifactLabels = ['pinyin', 'java', 'android']


groupName = 'com.github.promeg'
releaseVersionName = "3.0.0"
releaseVersionCode = 6

// Android
androidBuildToolsVersion = '24.0.3'
androidMinSdkVersion = 16
androidTargetSdkVersion = 24
androidCompileSdkVersion = 24
androidSupportSdkVersion = '24.2.1'
}
134 changes: 3 additions & 131 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,137 +1,9 @@
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'

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

javadoc {
options.encoding = 'UTF-8'
}

group = rootProject.ext.groupName
version = rootProject.ext.releaseVersionName

buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}

dependencies {
classpath "me.champeau.gradle:jmh-gradle-plugin:0.5.0"
classpath 'org.apache.ant:ant:1.9.7'
}
apply plugin: 'java-library'

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes the explicit sourceCompatibility/targetCompatibility configuration (previously 1.6) for the core lib module. That will change the produced bytecode level to whatever the build JDK defaults to, and can break consumers that expect Java 6/7-compatible artifacts (notably the Android-related subprojects in this repo). Please pin the compatibility level explicitly to match the rest of the project’s Gradle modules (e.g., tinypinyin-lexicons-java-cncity sets both to 1.6).

Suggested change
sourceCompatibility = 1.6
targetCompatibility = 1.6

Copilot uses AI. Check for mistakes.
repositories {
mavenCentral()
}

sourceCompatibility = 1.6
targetCompatibility = 1.6

jmh {
jmhVersion = '1.21'
include = ['PinyinDictBenchmark.*', 'PinyinSampleBenchmark.*']
operationsPerInvocation = 10
benchmarkMode = ['thrpt']
verbosity = 'NORMAL'
fork = 2
timeUnit = 'us'
duplicateClassesStrategy = 'warn'
jvmArgs = ['-Djmh.separateClasspathJAR=true']
}


dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.assertj:assertj-core:1.7.1'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'com.belerweb:pinyin4j:2.5.0'

implementation 'org.ahocorasick:ahocorasick:0.3.0'

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib has an extensive src/test/java suite that imports JUnit, Hamcrest, and Pinyin4J, but this build.gradle no longer declares any testImplementation dependencies. As a result, :lib:test (and ./gradlew build) will fail to compile tests. Please add the required test dependencies back (at least JUnit 4, a Hamcrest artifact that provides org.hamcrest.Matchers, and Pinyin4J for PinyinTest).

Suggested change
implementation 'org.ahocorasick:ahocorasick:0.3.0'
implementation 'org.ahocorasick:ahocorasick:0.3.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'com.belerweb:pinyin4j:2.5.1'

Copilot uses AI. Check for mistakes.

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:0.9'
jmh 'org.openjdk.jmh:jmh-generator-annprocess:0.9'
}



// 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.
}
}
}
}
3 changes: 0 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
include ':tinypinyin-lexicons-android-cncity', ':tinypinyin-lexicons-java-cncity',
':android-sample',
':tinypinyin-android-asset-lexicons'
rootProject.name = 'tinypinyin'
include 'lib'

Copilot AI Mar 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings.gradle now only includes the lib module, but the repository still contains android-sample, tinypinyin-lexicons-android-cncity, tinypinyin-android-asset-lexicons, and tinypinyin-lexicons-java-cncity. CI/docs currently run Gradle tasks against those projects (e.g., .travis.yml and README), so Gradle will fail with “Project '…' not found”. Either re-add the includes for these modules, or update/remove the CI and documentation tasks and any inter-module project() dependencies to match the new single-module build.

Suggested change
include 'lib'
include 'lib', 'android-sample', 'tinypinyin-lexicons-android-cncity', 'tinypinyin-android-asset-lexicons', 'tinypinyin-lexicons-java-cncity'

Copilot uses AI. Check for mistakes.
Loading