feat: Add lib module with java-library plugin and ahocorasick dependency, and update project build configuration.#77
Conversation
…ependency, and update project build configuration.
There was a problem hiding this comment.
Pull request overview
This PR restructures the Gradle build to focus on a lib Java library module using the java-library plugin, and adds the org.ahocorasick:ahocorasick dependency as part of that module’s build configuration.
Changes:
- Simplifies
settings.gradleto include only thelibmodule. - Replaces
lib/build.gradlewith a minimaljava-librarysetup and adds theahocorasickdependency. - Removes the root
build.gradlebuildscript/ext configuration (resulting in an empty root build file).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| settings.gradle | Reduces the multi-project build to only include lib. |
| lib/build.gradle | Switches to java-library, adds Maven Central, and declares the ahocorasick dependency. |
| build.gradle | Removes prior root buildscript/ext configuration (file becomes empty). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| ':android-sample', | ||
| ':tinypinyin-android-asset-lexicons' | ||
| rootProject.name = 'tinypinyin' | ||
| include 'lib' |
There was a problem hiding this comment.
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.
| include 'lib' | |
| include 'lib', 'android-sample', 'tinypinyin-lexicons-android-cncity', 'tinypinyin-android-asset-lexicons', 'tinypinyin-lexicons-java-cncity' |
| testImplementation 'org.mockito:mockito-core:1.10.19' | ||
| testImplementation 'com.belerweb:pinyin4j:2.5.0' | ||
|
|
||
| implementation 'org.ahocorasick:ahocorasick:0.3.0' |
There was a problem hiding this comment.
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).
| 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' |
| classpath 'org.apache.ant:ant:1.9.7' | ||
| } | ||
| apply plugin: 'java-library' | ||
|
|
There was a problem hiding this comment.
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).
| sourceCompatibility = 1.6 | |
| targetCompatibility = 1.6 |
No description provided.