1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
import groovy.lang.GroovyObject
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
import org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
buildscript {
build.loadExtraPropertiesOf(project)
val kotlinRepo: String by extra
repositories {
maven(url = kotlinRepo)
}
val kotlinVersion: String by extra
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}
plugins {
base
id("com.jfrog.artifactory") version "4.1.1"
}
allprojects {
group = "org.gradle"
version = "0.13.2"
}
val publishedPluginsVersion by extra { "0.13.1" }
val futurePluginsVersion = "0.13.2"
project(":plugins") {
group = "org.gradle.kotlin"
version = futurePluginsVersion
}
// --- Configure publications ------------------------------------------
val publishedProjects =
listOf(
project(":provider"),
project(":tooling-models"),
project(":tooling-builders"))
// For documentation and meaningful `./gradlew dependencies` output
val distribution by configurations.creating
dependencies {
publishedProjects.forEach {
distribution(it)
}
}
tasks {
// Disable publication on root project
"artifactoryPublish"(ArtifactoryTask::class) {
skip = true
}
}
artifactory {
setContextUrl("https://repo.gradle.org/gradle")
publish(delegateClosureOf<PublisherConfig> {
repository(delegateClosureOf<GroovyObject> {
val targetRepoKey = "libs-${buildTagFor(project.version as String)}s-local"
setProperty("repoKey", targetRepoKey)
setProperty("username", project.findProperty("artifactory_user") ?: "nouser")
setProperty("password", project.findProperty("artifactory_password") ?: "nopass")
setProperty("maven", true)
})
defaults(delegateClosureOf<GroovyObject> {
invokeMethod("publications", "mavenJava")
})
})
resolve(delegateClosureOf<ResolverConfig> {
setProperty("repoKey", "repo")
})
}
fun buildTagFor(version: String): String =
when (version.substringAfterLast('-')) {
"SNAPSHOT" -> "snapshot"
in Regex("""M\d+[a-z]*$""") -> "milestone"
else -> "release"
}
// -- Integration testing ----------------------------------------------
val prepareIntegrationTestFixtures by task<GradleBuild> {
dir = file("fixtures")
}
val customInstallationDir = file("$buildDir/custom/gradle-${gradle.gradleVersion}")
val copyCurrentDistro by task<Copy> {
description = "Copies the current Gradle distro into '$customInstallationDir'."
from(gradle.gradleHomeDir)
into(customInstallationDir)
exclude("**/*kotlin*")
// preserve last modified date on each file to make it easier
// to check which files were patched by next step
val copyDetails = mutableListOf<FileCopyDetails>()
eachFile { copyDetails.add(this) }
doLast {
copyDetails.forEach { details ->
File(customInstallationDir, details.path).setLastModified(details.lastModified)
}
}
// don't bother recreating it
onlyIf { !customInstallationDir.exists() }
}
val customInstallation by task<Copy> {
description = "Copies latest gradle-kotlin-dsl snapshot over the custom installation."
dependsOn(copyCurrentDistro)
from(distribution)
into("$customInstallationDir/lib")
}
// -- Performance testing ----------------------------------------------
val benchmark by task<integration.Benchmark> {
dependsOn(customInstallation)
latestInstallation = customInstallationDir
}
// --- Utility functions -----------------------------------------------
operator fun Regex.contains(s: String) = matches(s)
inline
fun <reified T : Task> task(noinline configuration: T.() -> Unit) = tasks.creating(T::class, configuration)
|