Skip to content

Comments

Refactor persist-tools to extract core Java APIs into separate module#428

Merged
TharmiganK merged 5 commits intomainfrom
core-package
Nov 27, 2025
Merged

Refactor persist-tools to extract core Java APIs into separate module#428
TharmiganK merged 5 commits intomainfrom
core-package

Conversation

@TharmiganK
Copy link
Contributor

@TharmiganK TharmiganK commented Nov 25, 2025

Purpose

Create new persist-core gradle subproject containing reusable Java APIs that were previously tightly coupled to the CLI tool. This enables direct usage of core persistence functionality in other Java packages without depending on the CLI.

Fixes: ballerina-platform/ballerina-library#8471

Examples

N/A

Checklist

  • Linked to an issue
  • Updated the specification
  • Updated the changelog
  • Added tests

Create new `persist-core` gradle subproject containing reusable Java APIs
that were previously tightly coupled to the CLI tool. This enables direct
usage of core persistence functionality in other Java packages without
depending on the CLI.

Changes:
- Add `persist-core` gradle subproject with Java library configuration
- Move core packages from `persist-cli` to `persist-core`:
  * configuration, introspect, nodegenerator (all subpackages)
  * inflector, utils, models, components, introspectiondto
  * BalException.java, PersistToolsConstants.java
- Create JPMS module definition for `persist-core`
- Extract shared file utilities into FileUtils class
- Update `persist-cli` to depend on `persist-core`
- Update `persist-cli-tests` to include both modules
- Configure GitHub Packages publication for `persist-core`
- Preserve all gradle build functionality and test execution

This architectural change maintains backward compatibility while providing
a cleaner separation of concerns between the CLI interface and core
persistence logic.
@TharmiganK TharmiganK marked this pull request as ready for review November 25, 2025 12:17
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

❌ Patch coverage is 71.87500% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.10%. Comparing base (d2ddd63) to head (1543f94).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ain/java/io/ballerina/persist/utils/FileUtils.java 70.58% 8 Missing and 2 partials ⚠️
...va/io/ballerina/persist/utils/BalProjectUtils.java 75.00% 0 Missing and 5 partials ⚠️
...allerina/persist/cmd/PersistCodeGeneratorTool.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #428      +/-   ##
============================================
- Coverage     86.21%   86.10%   -0.11%     
- Complexity        0     1269    +1269     
============================================
  Files            66       67       +1     
  Lines          6543     6529      -14     
  Branches        874      872       -2     
============================================
- Hits           5641     5622      -19     
  Misses          651      651              
- Partials        251      256       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

daneshk
daneshk previously approved these changes Nov 25, 2025
Co-authored-by: Danesh Kuruppu <daneshk@users.noreply.github.com>
# Conflicts:
#	persist-cli/src/main/java/io/ballerina/persist/cmd/Utils.java
#	persist-core/src/main/java/io/ballerina/persist/utils/BalProjectUtils.java
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
3.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@TharmiganK TharmiganK merged commit 943258c into main Nov 27, 2025
5 of 7 checks passed
@TharmiganK TharmiganK deleted the core-package branch November 27, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract the core functionalities to a persist-core package and publish it as a GitHub package

2 participants