-
Notifications
You must be signed in to change notification settings - Fork 5
Migrate to Gradle DSL as a build tool #73
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 3 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1f34cd6
gradle kotlin DSL migration
Pazus df4b726
separated integration tests, updated CONTRIBUTING.md
Pazus f0c3ea9
collapse Coverage resources tasks
Pazus 59d69cc
Update CONTRIBUTING.md
Pazus a35f8a2
remove clean phase before publishing jar
Pazus 3d632dd
showStandardStreams = true
Pazus 2bc1c16
check if build speeds up
Pazus 1b7849c
check if build speeds up
Pazus 9f28122
narrow caches
Pazus 431125e
Revert "narrow caches"
Pazus 2dcb1b3
debug
Pazus 4b6d291
echo opts
Pazus 0214d77
Update .travis.yml
Pazus 20ad8bf
clean up to initial state
Pazus 5bc0d92
remove pom.xml file as project is not migrated to Gradle
Pazus 91a051f
publish only on develop and tags
Pazus 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
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 { | ||
test { | ||
useJUnitPlatform() | ||
exclude("**/*IT.class") | ||
testLogging { | ||
events("passed", "skipped", "failed") | ||
exceptionFormat = TestExceptionFormat.FULL | ||
showStackTraces = true | ||
} | ||
} | ||
|
||
val intTest = create<Test>("intTest") { | ||
dependsOn(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() | ||
include("**/*IT.class") | ||
testLogging { | ||
events("passed", "skipped", "failed") | ||
exceptionFormat = TestExceptionFormat.FULL | ||
showStackTraces = true | ||
} | ||
} | ||
|
||
// add integration tests to the whole check | ||
named("check") { | ||
dependsOn(intTest) | ||
} | ||
|
||
val coverageResourcesDirectory = "${project.buildDir}/resources/main/CoverageHTMLReporter" | ||
val coverageResourcesZip = "${project.buildDir}/utPLSQL-coverage-html-$coverageResourcesVersion.zip" | ||
|
||
// download Coverage Resources from web | ||
val downloadResources = create<Download>("downloadCoverageResources") { | ||
src("https://codeload.github.com/utPLSQL/utPLSQL-coverage-html/zip/$coverageResourcesVersion") | ||
dest(File(coverageResourcesZip)) | ||
overwrite(true) | ||
} | ||
|
||
withType<ProcessResources> { | ||
dependsOn(downloadResources) | ||
|
||
val properties = project.properties.toMutableMap() | ||
properties.putIfAbsent("travisBuildNumber", "local") | ||
expand(properties) | ||
|
||
doLast { | ||
copy { | ||
// extract assets folder only from downloaded archive | ||
// https://github.com/gradle/gradle/pull/8494 | ||
from(zipTree(coverageResourcesZip)) { | ||
include("*/assets/**") | ||
eachFile { | ||
relativePath = RelativePath(true, *relativePath.segments.drop(2).toTypedArray()) // <2> | ||
} | ||
includeEmptyDirs = false | ||
} | ||
into(coverageResourcesDirectory) | ||
} | ||
} | ||
} | ||
|
||
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 not shown.
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,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 |
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.