Added loading of local.properties.
Added pom.xml generation (for snyk, etc.) Added Grade buildscan.
This commit is contained in:
parent
98ad78ad29
commit
5c4ec02c42
1 changed files with 30 additions and 24 deletions
|
@ -3,10 +3,14 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
import org.gradle.api.publish.maven.MavenPom
|
import org.gradle.api.publish.maven.MavenPom
|
||||||
import org.jetbrains.dokka.DokkaConfiguration
|
import org.jetbrains.dokka.DokkaConfiguration
|
||||||
import org.jetbrains.dokka.gradle.DokkaTask
|
import org.jetbrains.dokka.gradle.DokkaTask
|
||||||
|
import java.io.FileInputStream
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
import java.util.Properties
|
||||||
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.2.50"
|
kotlin("jvm") version "1.2.50"
|
||||||
|
`build-scan`
|
||||||
java
|
java
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
id("com.github.ben-manes.versions") version "0.20.0"
|
id("com.github.ben-manes.versions") version "0.20.0"
|
||||||
|
@ -22,16 +26,30 @@ val gitHub = "ethauvin/$name"
|
||||||
val mavenUrl = "https://github.com/$gitHub"
|
val mavenUrl = "https://github.com/$gitHub"
|
||||||
val deployDir = "deploy"
|
val deployDir = "deploy"
|
||||||
|
|
||||||
dependencies {
|
// Load local.properties
|
||||||
compile(kotlin("stdlib"))
|
File("local.properties").apply {
|
||||||
compile("com.squareup.okhttp3:okhttp:3.10.0")
|
if (exists()) {
|
||||||
testCompile("org.testng:testng:6.14.3")
|
FileInputStream(this).use { fis ->
|
||||||
|
Properties().apply {
|
||||||
|
load(fis)
|
||||||
|
forEach { (k, v) ->
|
||||||
|
extra[k as String] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile(kotlin("stdlib"))
|
||||||
|
compile("com.squareup.okhttp3:okhttp:3.10.0")
|
||||||
|
testCompile("org.testng:testng:6.14.3")
|
||||||
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
withType(Test::class.java).all {
|
withType(Test::class.java).all {
|
||||||
useTestNG()
|
useTestNG()
|
||||||
|
@ -41,13 +59,6 @@ tasks {
|
||||||
kotlinOptions.jvmTarget = "1.8"
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<Javadoc> {
|
|
||||||
options {
|
|
||||||
header = project.name
|
|
||||||
encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val sourcesJar by creating(Jar::class) {
|
val sourcesJar by creating(Jar::class) {
|
||||||
classifier = "sources"
|
classifier = "sources"
|
||||||
from(java.sourceSets["main"].allSource)
|
from(java.sourceSets["main"].allSource)
|
||||||
|
@ -126,7 +137,7 @@ tasks {
|
||||||
|
|
||||||
appendNode("scm").apply {
|
appendNode("scm").apply {
|
||||||
appendNode("connection", "scm:git:$mavenUrl.git")
|
appendNode("connection", "scm:git:$mavenUrl.git")
|
||||||
appendNode("developerConnection", "scm:git:git@github.com:${gitHub}.git")
|
appendNode("developerConnection", "scm:git:git@github.com:$gitHub.git")
|
||||||
appendNode("url", mavenUrl)
|
appendNode("url", mavenUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,16 +151,10 @@ tasks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val generatePom by creating {
|
val generatePomFileForMavenJavaPublication by getting(GenerateMavenPom::class) {
|
||||||
description = "Generates pom.xml for snyk."
|
destination = file("$projectDir/pom.xml")
|
||||||
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
|
||||||
dependsOn("generatePomFileForMavenJavaPublication")
|
|
||||||
val pom = File("build/publications/$publicationName/pom-default.xml")
|
|
||||||
if (pom.exists()) {
|
|
||||||
pom.copyTo(File("pom.xml"), true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findProperty(s: String) = project.findProperty(s) as String?
|
fun findProperty(s: String) = project.findProperty(s) as String?
|
||||||
bintray {
|
bintray {
|
||||||
user = findProperty("bintray.user")
|
user = findProperty("bintray.user")
|
||||||
|
@ -178,11 +183,12 @@ tasks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val bintrayUpload by getting {
|
buildScan {
|
||||||
dependsOn(gitTag)
|
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
|
||||||
|
setTermsOfServiceAgree("yes")
|
||||||
}
|
}
|
||||||
|
|
||||||
"release" {
|
"release" {
|
||||||
dependsOn(generatePom, bintrayUpload, "publishToMavenLocal")
|
dependsOn(gitTag, generatePomFileForMavenJavaPublication, "bintrayUpload", "publishToMavenLocal")
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue