Skip to content
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

Tooling support for OracleDB module #82

Merged
merged 12 commits into from
Nov 29, 2021
Merged
6 changes: 3 additions & 3 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[package]
org = "ballerinax"
name = "oracledb"
version = "1.1.0"
version = "1.1.1"
authors = ["Ballerina"]
keywords = ["database", "client", "network", "SQL", "RDBMS", "OracleDB", "Oracle"]
repository = "https://github.com/ballerina-platform/module-ballerinax-oracledb"
license = ["Apache-2.0"]
distribution = "slbeta3"

[[platform.java11.dependency]]
path = "../native/build/libs/oracledb-native-1.1.0.jar"
path = "../native/build/libs/oracledb-native-1.1.1-SNAPSHOT.jar"

[[platform.java11.dependency]]
path = "./lib/sql-native-1.1.0.jar"
path = "./lib/sql-native-1.1.1-20211126-000600-ddbfeed.jar"

[[platform.java11.dependency]]
path = "./lib/ojdbc8-12.2.0.1.jar"
Expand Down
6 changes: 6 additions & 0 deletions ballerina/CompilerPlugin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[plugin]
id = "oracledb-compiler-plugin"
class = "io.ballerina.stdlib.oracledb.compiler.OracleDBCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/oracledb-compiler-plugin-1.1.1-SNAPSHOT.jar"
36 changes: 18 additions & 18 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies-toml-version = "2"
[[package]]
org = "ballerina"
name = "auth"
version = "2.0.1"
version = "2.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "crypto"},
Expand All @@ -23,7 +23,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "cache"
version = "3.0.1"
version = "3.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand All @@ -34,7 +34,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.0.1"
version = "2.0.2"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "time"}
Expand All @@ -46,7 +46,7 @@ modules = [
[[package]]
org = "ballerina"
name = "file"
version = "1.0.1"
version = "1.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand All @@ -62,7 +62,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http"
version = "2.0.1"
version = "2.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -90,7 +90,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "io"
version = "1.0.1"
version = "1.0.2"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.value"}
Expand All @@ -110,7 +110,7 @@ modules = [
[[package]]
org = "ballerina"
name = "jwt"
version = "2.0.1"
version = "2.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "cache"},
Expand Down Expand Up @@ -213,7 +213,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "log"
version = "2.0.1"
version = "2.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand All @@ -225,7 +225,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "mime"
version = "2.0.1"
version = "2.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand All @@ -236,7 +236,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "oauth2"
version = "2.0.1"
version = "2.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "cache"},
Expand All @@ -258,7 +258,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "os"
version = "1.0.1"
version = "1.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
Expand All @@ -267,7 +267,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "regex"
version = "1.0.1"
version = "1.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
Expand All @@ -276,7 +276,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "sql"
version = "1.1.0"
version = "1.1.1"
dependencies = [
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
Expand All @@ -290,7 +290,7 @@ modules = [
[[package]]
org = "ballerina"
name = "task"
version = "2.0.1"
version = "2.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
Expand All @@ -312,7 +312,7 @@ modules = [
[[package]]
org = "ballerina"
name = "time"
version = "2.0.1"
version = "2.0.2"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]
Expand All @@ -323,7 +323,7 @@ modules = [
[[package]]
org = "ballerina"
name = "url"
version = "2.0.1"
version = "2.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
Expand All @@ -332,7 +332,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "uuid"
version = "1.0.1"
version = "1.0.2"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "crypto"},
Expand Down Expand Up @@ -366,7 +366,7 @@ modules = [
[[package]]
org = "ballerinax"
name = "oracledb"
version = "1.1.0"
version = "1.1.1"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "file"},
Expand Down
16 changes: 10 additions & 6 deletions ballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ description = 'Ballerina - Oracle DB Ballerina Generator'
def packageName = 'oracledb'
def packageOrg = 'ballerinax'
def tomlVersion = stripBallerinaExtensionVersion("${project.version}")

def ballerinaTomlFilePlaceHolder = new File("${project.rootDir}/build-config/resources/Ballerina.toml")
def compilerPluginTomlFilePlaceHolder = new File("${project.rootDir}/build-config/resources/CompilerPlugin.toml")
def ballerinaTomlFile = new File("$project.projectDir/Ballerina.toml")
def compilerPluginTomlFile = new File("$project.projectDir/CompilerPlugin.toml")

def stripBallerinaExtensionVersion(String extVersion) {
if (extVersion.matches(project.ext.timestampedVersionRegex)) {
Expand Down Expand Up @@ -81,8 +84,10 @@ task updateTomlFiles {
newConfig = newConfig.replace('@oracledb.driver.version@', project.oracleDBDriverVersion)
newConfig = newConfig.replace('@oracle.xdb.version@', project.oracleXDBVersion)
newConfig = newConfig.replace('@oracle.xmlparserv2.version@', project.oracleXMLParserVersion)

ballerinaTomlFile.text = newConfig

def newCompilerPluginToml = compilerPluginTomlFilePlaceHolder.text.replace("@project.version@", project.version)
compilerPluginTomlFile.text = newCompilerPluginToml
}
}

Expand All @@ -91,9 +96,9 @@ task commitTomlFiles {
project.exec {
ignoreExitValue true
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', "git commit -m \"[Automated] Update the native jar versions\" Ballerina.toml Dependencies.toml"
commandLine 'cmd', '/c', "git commit -m \"[Automated] Update the native jar versions\" Ballerina.toml Dependencies.toml CompilerPlugin.toml"
} else {
commandLine 'sh', '-c', "git commit -m '[Automated] Update the native jar versions' Ballerina.toml Dependencies.toml"
commandLine 'sh', '-c', "git commit -m '[Automated] Update the native jar versions' Ballerina.toml Dependencies.toml CompilerPlugin.toml"
}
}
}
Expand Down Expand Up @@ -238,8 +243,7 @@ startTestDockerContainers.dependsOn createTestDockerImage

build.dependsOn ":${packageName}-native:build"
test.dependsOn ":${packageName}-native:build"
build.dependsOn ":${packageName}-compiler-plugin:build"
test.dependsOn ":${packageName}-compiler-plugin:build"
build.finalizedBy stopTestDockerContainers
test.dependsOn startTestDockerContainers

publishToMavenLocal.dependsOn build
publish.dependsOn build
6 changes: 6 additions & 0 deletions build-config/resources/CompilerPlugin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[plugin]
id = "oracledb-compiler-plugin"
class = "io.ballerina.stdlib.oracledb.compiler.OracleDBCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/[email protected]@.jar"
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,12 @@ release {
}

task build {
dependsOn("${packageName}-native:build")
dependsOn("${packageName}-compiler-plugin:build")
dependsOn("${packageName}-ballerina:build")
dependsOn("${packageName}-compiler-plugin-tests:build")
dependsOn("${packageName}-examples:build")
}

publishToMavenLocal.dependsOn build
publish.dependsOn build
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- [Tooling support for OracleDB module](https://github.com/ballerina-platform/ballerina-standard-library/issues/2283)

### Changed

Expand Down
123 changes: 123 additions & 0 deletions compiler-plugin-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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'
id 'checkstyle'
id 'com.github.spotbugs'
}

description = 'Ballerina - OracleDB Compiler Plugin Tests'

dependencies {
checkstyle project(':checkstyle')
checkstyle "com.puppycrawl.tools:checkstyle:${puppycrawlCheckstyleVersion}"

implementation project(':oracledb-compiler-plugin')

testImplementation group: 'org.ballerinalang', name: 'ballerina-lang', version: "${ballerinaLangVersion}"
testImplementation group: 'org.ballerinalang', name: 'ballerina-tools-api', version: "${ballerinaLangVersion}"
testImplementation group: 'org.ballerinalang', name: 'ballerina-parser', version: "${ballerinaLangVersion}"

implementation group: 'org.testng', name: 'testng', version: "${testngVersion}"
}

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

sourceCompatibility = JavaVersion.VERSION_11

test {
systemProperty "ballerina.offline.flag", "true"
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))
}
}
}
}

spotbugsTest {
ignoreFailures = true
effort = "max"
reportLevel = "low"
reportsDir = file("$project.buildDir/reports/spotbugs")
def excludeFile = file("${rootDir}/build-config/spotbugs-exclude.xml")
if (excludeFile.exists()) {
it.excludeFilter = excludeFile
}
reports {
text.enabled = true
}
}

spotbugsMain {
enabled false
}

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.");
}
}
}

tasks.withType(Checkstyle) {
exclude '**/module-info.java'
}

checkstyle {
toolVersion "${project.puppycrawlCheckstyleVersion}"
configFile rootProject.file("build-config/checkstyle/build/checkstyle.xml")
configProperties = ["suppressionFile": file("${rootDir}/build-config/checkstyle/build/suppressions.xml")]
}

checkstyleMain {
enabled false
}

spotbugsTest.finalizedBy validateSpotbugs
checkstyleTest.dependsOn ':checkstyle:downloadCheckstyleRuleFiles'

compileJava {
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
]
classpath = files()
}
}

test.dependsOn ":oracledb-ballerina:build"
build.dependsOn ":oracledb-ballerina:build"
Loading