-
Notifications
You must be signed in to change notification settings - Fork 29
Refactor persist-tools to extract core Java APIs into separate module #428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9268907
Refactor persist-tools to extract core Java APIs into separate module
TharmiganK 8464da4
Apply suggestions from code review
TharmiganK 911bc0e
Merge remote-tracking branch 'origin/main' into core-package
TharmiganK c7f9d43
Merge remote-tracking branch 'origin/main' into core-package
TharmiganK 1543f94
Refactor file handling in persist tools to utilize FileUtils for outp…
TharmiganK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| /* | ||
| * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com) All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'java-library' | ||
| id 'checkstyle' | ||
| id 'com.github.spotbugs' | ||
| } | ||
|
|
||
| description = 'Ballerina - Persist Core Java Library' | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| configurations { | ||
| implementation | ||
| externalJars | ||
| } | ||
|
|
||
| dependencies { | ||
| checkstyle project(':checkstyle') | ||
| checkstyle "com.puppycrawl.tools:checkstyle:${checkstylePluginVersion}" | ||
|
|
||
| implementation group: 'org.ballerinalang', name: 'ballerina-lang', version: "${ballerinaLangVersion}" | ||
| implementation group: 'org.ballerinalang', name: 'ballerina-runtime', version: "${ballerinaLangVersion}" | ||
| implementation group: 'org.ballerinalang', name: 'ballerina-tools-api', version: "${ballerinaLangVersion}" | ||
| implementation group: 'org.ballerinalang', name: 'ballerina-parser', version: "${ballerinaLangVersion}" | ||
| implementation group: 'org.ballerinalang', name: 'toml-parser', version: "${ballerinaLangVersion}" | ||
| implementation group: 'org.ballerinalang', name: 'formatter-core', version: "${ballerinaLangVersion}" | ||
| testImplementation group: 'org.testng', name: 'testng', version: "${testngVersion}" | ||
| } | ||
|
|
||
| test { | ||
| useTestNG() { | ||
| suites 'src/test/resources/testng.xml' | ||
| } | ||
| testLogging.showStandardStreams = true | ||
| testLogging { | ||
| events "PASSED", "FAILED", "SKIPPED" | ||
| afterSuite { desc, result -> | ||
| if (!desc.parent) { // will match the outermost suite | ||
| def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" | ||
| def startItem = '| ', endItem = ' |' | ||
| def repeatLength = startItem.length() + output.length() + endItem.length() | ||
| println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength)) | ||
| } | ||
| } | ||
| } | ||
| finalizedBy jacocoTestReport | ||
| } | ||
|
|
||
| spotbugsMain { | ||
| enabled = true | ||
| ignoreFailures = true | ||
| def classLoader = plugins["com.github.spotbugs"].class.classLoader | ||
| def SpotBugsConfidence = classLoader.findLoadedClass("com.github.spotbugs.snom.Confidence") | ||
| def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort") | ||
| effort = SpotBugsEffort.MAX | ||
| reportLevel = SpotBugsConfidence.LOW | ||
| reportsDir = layout.buildDirectory.dir("reports/spotbugs") | ||
| reports { | ||
| text.required = true | ||
| } | ||
| def excludeFile = file("${rootDir}/spotbugs-exclude.xml") | ||
| if (excludeFile.exists()) { | ||
| excludeFilter = excludeFile | ||
| } | ||
| } | ||
|
|
||
| spotbugsTest { | ||
| enabled = false | ||
| } | ||
|
|
||
| jacoco { | ||
| toolVersion = "${jacocoVersion}" | ||
| } | ||
|
|
||
| jacocoTestReport { | ||
| dependsOn test | ||
| reports { | ||
| xml.required = true | ||
| } | ||
| } | ||
|
|
||
| task validateSpotbugs() { | ||
| doLast { | ||
| if (spotbugsMain.reports.size() > 0 && | ||
| spotbugsMain.reports[0].destination.exists() && | ||
| spotbugsMain.reports[0].destination.text.readLines().size() > 0) { | ||
| spotbugsMain.reports[0].destination?.eachLine { | ||
| println 'Failure: ' + it | ||
| } | ||
| throw new GradleException("Spotbugs rule violations were found."); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| checkstyle { | ||
| toolVersion "${checkstylePluginVersion}" | ||
| configFile rootProject.file("build-config/checkstyle/build/checkstyle.xml") | ||
| configProperties = ["suppressionFile" : file("${rootDir}/build-config/checkstyle/build/suppressions.xml")] | ||
| } | ||
|
|
||
| spotbugsMain.finalizedBy validateSpotbugs | ||
| checkstyleMain.dependsOn(":checkstyle:downloadCheckstyleRuleFiles") | ||
| checkstyleTest.dependsOn(":checkstyle:downloadCheckstyleRuleFiles") | ||
|
|
||
| def excludePattern = '**/module-info.java' | ||
| tasks.withType(Checkstyle) { | ||
| exclude excludePattern | ||
| } | ||
|
|
||
| compileJava { | ||
| doFirst { | ||
| options.compilerArgs = [ | ||
| '--module-path', classpath.asPath, | ||
| ] | ||
| classpath = files() | ||
| } | ||
| } | ||
|
|
||
| jar { | ||
| manifest { | ||
| attributes('Implementation-Title': project.name, 'Implementation-Version': project.version) | ||
| } | ||
| } | ||
|
|
||
| clean { | ||
| delete layout.buildDirectory | ||
| } | ||
|
|
||
| publishing { | ||
| publications { | ||
| mavenJava(MavenPublication) { | ||
| groupId "io.ballerina" | ||
| artifactId "persist-core" | ||
| from components.java | ||
| } | ||
| } | ||
|
|
||
| repositories { | ||
| maven { | ||
| name = "GitHubPackages" | ||
| url = uri("https://maven.pkg.github.com/ballerina-platform/persist-tools") | ||
| credentials { | ||
| username = System.getenv("publishUser") | ||
| password = System.getenv("publishPAT") | ||
| } | ||
| } | ||
| } | ||
| } | ||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.