Skip to content

Commit bffc0cb

Browse files
committed
If tag is of format (v)#.#.# then it is used as artifact version
update gradle and junit
1 parent 1306e46 commit bffc0cb

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

build.gradle.kts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import de.undercouch.gradle.tasks.download.Download
22
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
33

4-
val deployerJars by configurations.creating
4+
val tag = System.getenv("TRAVIS_TAG")?.replaceFirst("^v".toRegex(), "")
55

66
group = "org.utplsql"
77
val mavenArtifactId = "java-api"
8-
version = "3.1.7-SNAPSHOT"
8+
val baseVersion = "3.1.7-SNAPSHOT"
9+
// if build is on tag like 3.1.7 or v3.1.7 then use tag as version replacing leading "v"
10+
version = if (tag != null && "^[0-9.]+$".toRegex().matches(tag)) tag else baseVersion
911

1012
val coverageResourcesVersion = "1.0.1"
1113
val ojdbcVersion = "12.2.0.1"
14+
val junitVersion = "5.4.1"
15+
16+
val deployerJars by configurations.creating
1217

1318
plugins {
1419
`java-library`
@@ -28,8 +33,8 @@ repositories {
2833
url = uri("https://www.oracle.com/content/secure/maven/content")
2934
credentials {
3035
// you may set this properties using gradle.properties file in the root of the project or in your GRADLE_HOME
31-
username = if (project.hasProperty("ORACLE_OTN_USER")) project.property("ORACLE_OTN_USER") as String? else System.getenv("ORACLE_OTN_USER")
32-
password = if (project.hasProperty("ORACLE_OTN_PASSWORD")) project.property("ORACLE_OTN_PASSWORD") as String? else System.getenv("ORACLE_OTN_PASSWORD")
36+
username = (project.findProperty("ORACLE_OTN_USER") as String?) ?: System.getenv("ORACLE_OTN_USER")
37+
password = (project.findProperty("ORACLE_OTN_PASSWORD") as String?) ?: System.getenv("ORACLE_OTN_PASSWORD")
3338
}
3439
}
3540
mavenCentral()
@@ -47,8 +52,10 @@ dependencies {
4752
implementation("com.oracle.jdbc:orai18n:$ojdbcVersion")
4853

4954
// Use Jupiter test framework
50-
testImplementation("org.junit.jupiter:junit-jupiter:5.4.0")
55+
testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion")
5156
testImplementation("org.hamcrest:hamcrest:2.1")
57+
58+
// deployer for packagecloud
5259
deployerJars("io.packagecloud.maven.wagon:maven-packagecloud-wagon:0.0.6")
5360
}
5461

@@ -66,9 +73,10 @@ tasks {
6673
val intTest = create<Test>("intTest") {
6774
dependsOn(test)
6875
doFirst {
69-
environment("DB_URL", System.getenv("DB_URL") ?: "localhost:1521/XE")
70-
environment("DB_USER", System.getenv("DB_USER") ?: "app")
71-
environment("DB_PASS", System.getenv("DB_PASS") ?: "app")
76+
environment("DB_URL", (project.findProperty("DB_URL") as String?) ?: System.getenv("DB_URL")
77+
?: "localhost:1521/XE")
78+
environment("DB_USER", (project.findProperty("DB_USER") as String?) ?: System.getenv("DB_USER") ?: "app")
79+
environment("DB_PASS", (project.findProperty("DB_PASS") as String?) ?: System.getenv("DB_PASS") ?: "app")
7280
}
7381
useJUnitPlatform()
7482
include("**/*IT.class")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)