Build: upgrade gradle to 4.10

This commit is contained in:
Vyacheslav Gerasimov
2018-08-30 22:27:05 +03:00
parent 8338a0dd85
commit 1109b795da
19 changed files with 92 additions and 88 deletions
+26 -23
View File
@@ -383,14 +383,14 @@ val ideaPlugin by task<Task> {
}
tasks {
"clean" {
create("clean") {
doLast {
delete("$buildDir/repo")
delete(distDir)
}
}
"cleanupArtifacts" {
create("cleanupArtifacts") {
doLast {
delete(ideaPluginDir)
delete(ideaUltimatePluginDir)
@@ -398,7 +398,7 @@ tasks {
}
}
"coreLibsTest" {
create("coreLibsTest") {
(coreLibProjects + listOf(
":kotlin-stdlib:samples",
":kotlin-test:kotlin-test-js:kotlin-test-js-it",
@@ -409,34 +409,34 @@ tasks {
}
}
"gradlePluginTest" {
create("gradlePluginTest") {
gradlePluginProjects.forEach {
dependsOn(it + ":check")
}
}
"gradlePluginIntegrationTest" {
create("gradlePluginIntegrationTest") {
dependsOn(":kotlin-gradle-plugin-integration-tests:check")
}
"jvmCompilerTest" {
create("jvmCompilerTest") {
dependsOn("dist")
dependsOn(":compiler:test",
":compiler:container:test",
":compiler:tests-java8:test")
}
"jsCompilerTest" {
create("jsCompilerTest") {
dependsOn(":js:js.tests:test")
dependsOn(":js:js.tests:runMocha")
}
"scriptingTest" {
create("scriptingTest") {
dependsOn("dist")
dependsOn(":kotlin-script-util:test")
}
"compilerTest" {
create("compilerTest") {
dependsOn("jvmCompilerTest")
dependsOn("jsCompilerTest")
@@ -445,44 +445,44 @@ tasks {
dependsOn(":compiler:incremental-compilation-impl:test")
}
"toolsTest" {
create("toolsTest") {
dependsOn(":tools:kotlinp:test")
}
"examplesTest" {
create("examplesTest") {
dependsOn("dist")
(project(":examples").subprojects + project(":kotlin-gradle-subplugin-example")).forEach { p ->
dependsOn("${p.path}:check")
}
}
"distTest" {
create("distTest") {
dependsOn("compilerTest")
dependsOn("toolsTest")
dependsOn("gradlePluginTest")
dependsOn("examplesTest")
}
"specTest" {
create("specTest") {
dependsOn("dist")
dependsOn(":compiler:tests-spec:test")
}
"androidCodegenTest" {
create("androidCodegenTest") {
dependsOn(":compiler:android-tests:test")
}
"jps-tests" {
create("jps-tests") {
dependsOn("dist")
dependsOn(":jps-plugin:test")
}
"idea-plugin-main-tests" {
create("idea-plugin-main-tests") {
dependsOn("dist")
dependsOn(":idea:test")
}
"idea-plugin-additional-tests" {
create("idea-plugin-additional-tests") {
dependsOn("dist")
dependsOn(":idea:idea-gradle:test",
":idea:idea-maven:test",
@@ -490,20 +490,20 @@ tasks {
":eval4j:test")
}
"idea-plugin-tests" {
create("idea-plugin-tests") {
dependsOn("dist")
dependsOn("idea-plugin-main-tests",
"idea-plugin-additional-tests")
}
"android-ide-tests" {
create("android-ide-tests") {
dependsOn("dist")
dependsOn(":plugins:android-extensions-ide:test",
":idea:idea-android:test",
":kotlin-annotation-processing:test")
}
"plugins-tests" {
create("plugins-tests") {
dependsOn("dist")
dependsOn(":kotlin-annotation-processing:test",
":kotlin-source-sections-compiler-plugin:test",
@@ -516,7 +516,7 @@ tasks {
}
"ideaPluginTest" {
create("ideaPluginTest") {
dependsOn(
"idea-plugin-tests",
"jps-tests",
@@ -527,12 +527,15 @@ tasks {
}
"test" {
create("test") {
doLast {
throw GradleException("Don't use directly, use aggregate tasks *-check instead")
}
}
"check" { dependsOn("test") }
create("check") {
dependsOn("test")
}
}
fun CopySpec.setExecutablePermissions() {
+3 -3
View File
@@ -32,12 +32,12 @@ plugins {
}
gradlePlugin {
(plugins) {
"pill-configurable" {
plugins {
register("pill-configurable") {
id = "pill-configurable"
implementationClass = "org.jetbrains.kotlin.pill.PillConfigurablePlugin"
}
"jps-compatible" {
register("jps-compatible") {
id = "jps-compatible"
implementationClass = "org.jetbrains.kotlin.pill.JpsCompatiblePlugin"
}
+7 -8
View File
@@ -8,7 +8,6 @@ import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.file.FileCollection
import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact
import org.gradle.api.plugins.BasePluginConvention
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
import java.io.File
@@ -65,7 +64,7 @@ fun Project.noDefaultJar() {
}
}
fun<T> Project.runtimeJarArtifactBy(task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {
fun Project.runtimeJarArtifactBy(task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) {
addArtifact("archives", task, artifactRef, body)
addArtifact("runtimeJar", task, artifactRef, body)
configurations.findByName("runtime")?.let {
@@ -80,17 +79,17 @@ fun<T: Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T {
}
return task.apply {
setupPublicJar(project.the<BasePluginConvention>().archivesBaseName)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
body()
project.runtimeJarArtifactBy(this, this)
}
}
fun Project.runtimeJar(taskName: String = "jar", body: Jar.() -> Unit = {}): Jar = runtimeJar(getOrCreateTask(taskName, body))
fun Project.runtimeJar(body: Jar.() -> Unit = {}): Jar = runtimeJar(getOrCreateTask("jar", body), { })
fun Project.sourcesJar(sourceSet: String? = "main", body: Jar.() -> Unit = {}): Jar =
getOrCreateTask("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
classifier = "sources"
try {
if (sourceSet != null) {
@@ -107,7 +106,7 @@ fun Project.sourcesJar(sourceSet: String? = "main", body: Jar.() -> Unit = {}):
fun Project.javadocJar(body: Jar.() -> Unit = {}): Jar =
getOrCreateTask("javadocJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
classifier = "javadoc"
tasks.findByName("javadoc")?.let{ it as Javadoc }?.takeIf { it.enabled }?.let {
dependsOn(it)
@@ -202,14 +201,14 @@ fun Jar.setupPublicJar(baseName: String, classifier: String = "") {
}
fun<T> Project.addArtifact(configuration: Configuration, task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {
fun Project.addArtifact(configuration: Configuration, task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) {
artifacts.add(configuration.name, artifactRef) {
builtBy(task)
body()
}
}
fun<T> Project.addArtifact(configurationName: String, task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) =
fun Project.addArtifact(configurationName: String, task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) =
addArtifact(configurations.getOrCreate(configurationName), task, artifactRef, body)
fun Project.cleanArtifacts() {
+3 -3
View File
@@ -65,7 +65,7 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
return task<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from(compilerJar)
body()
}
@@ -97,7 +97,7 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(taskName: String = "
return task<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from(compilerDummyJar)
configureEmbeddableCompilerRelocation(withJavaxInject = false)
body()
@@ -119,7 +119,7 @@ fun Project.rewriteDepsToShadedJar(originalJarTask: Jar, shadowJarTask: Jar, bod
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
classifier = null
classifier = ""
body()
}
}
+2 -2
View File
@@ -105,12 +105,12 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
@get:OutputDirectory
var output: File? = null
lateinit var output: File
@TaskAction
fun instrumentClasses() {
logger.info("input files are: ${originalClassesDirs?.joinToString("; ", transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)" }"})}")
output?.deleteRecursively()
output.deleteRecursively()
copyOriginalClasses()
val classpath = instrumentationClasspath!!
+2 -2
View File
@@ -105,12 +105,12 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
@get:OutputDirectory
var output: File? = null
lateinit var output: File
@TaskAction
fun instrumentClasses() {
logger.info("input files are: ${originalClassesDirs?.joinToString("; ", transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)" }"})}")
output?.deleteRecursively()
output.deleteRecursively()
copyOriginalClasses()
val classpath = instrumentationClasspath!!
@@ -108,7 +108,7 @@ open class PublishedKotlinModule : Plugin<Project> {
val password: String? by preparePublication.extra
val repoUrl: String by preparePublication.extra
var repository: MavenRemoteRepository by Delegates.notNull()
var repository by Delegates.notNull<MavenRemoteRepository>()
repositories {
withConvention(MavenRepositoryHandlerConvention::class) {
@@ -41,10 +41,10 @@ fun unzipSdkTask(
sdkName: String, sdkVer: String, destinationSubdir: String, coordinatesSuffix: String,
additionalConfig: Configuration? = null, dirLevelsToSkipOnUnzip: Int = 0, ext: String = "zip",
unzipFilter: CopySpec.() -> Unit = {}
): DefaultTask {
): Task {
val id = "${sdkName}_$sdkVer"
val cfg = configurations.create(id)
val dependency = "google:$sdkName:$sdkVer${coordinatesSuffix.takeIf{ it.isNotEmpty() }?.let { ":$it" } ?: ""}@$ext"
val dependency = "google:$sdkName:$sdkVer${coordinatesSuffix.takeIf { it.isNotEmpty() }?.let { ":$it" } ?: ""}@$ext"
dependencies.add(cfg.name, dependency)
val unzipTask = task("unzip_$id") {
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-5
View File
@@ -63,13 +63,11 @@ projectTest {
testsJar()
val testForWebDemo by task<Test> {
include("**/*JavaToKotlinConverterForWebDemoTestGenerated*")
classpath = testSourceSet.runtimeClasspath
workingDir = rootDir
}
val cleanTestForWebDemo by tasks
val test: Test by tasks
test.apply {
@@ -77,7 +75,4 @@ test.apply {
dependsOn(testForWebDemo)
}
val cleanTest by tasks
cleanTest.dependsOn(cleanTestForWebDemo)
ideaPlugin()
-5
View File
@@ -61,13 +61,11 @@ projectTest {
testsJar()
val testForWebDemo by task<Test> {
include("**/*JavaToKotlinConverterForWebDemoTestGenerated*")
classpath = testSourceSet.runtimeClasspath
workingDir = rootDir
}
val cleanTestForWebDemo by tasks
val test: Test by tasks
test.apply {
@@ -75,7 +73,4 @@ test.apply {
dependsOn(testForWebDemo)
}
val cleanTest by tasks
cleanTest.dependsOn(cleanTestForWebDemo)
ideaPlugin()
-5
View File
@@ -62,13 +62,11 @@ projectTest {
testsJar()
val testForWebDemo by task<Test> {
include("**/*JavaToKotlinConverterForWebDemoTestGenerated*")
classpath = testSourceSet.runtimeClasspath
workingDir = rootDir
}
val cleanTestForWebDemo by tasks
val test: Test by tasks
test.apply {
@@ -76,7 +74,4 @@ test.apply {
dependsOn(testForWebDemo)
}
val cleanTest by tasks
cleanTest.dependsOn(cleanTestForWebDemo)
ideaPlugin()
-5
View File
@@ -63,13 +63,11 @@ projectTest {
testsJar()
val testForWebDemo by task<Test> {
include("**/*JavaToKotlinConverterForWebDemoTestGenerated*")
classpath = testSourceSet.runtimeClasspath
workingDir = rootDir
}
val cleanTestForWebDemo by tasks
val test: Test by tasks
test.apply {
@@ -77,7 +75,4 @@ test.apply {
dependsOn(testForWebDemo)
}
val cleanTest by tasks
cleanTest.dependsOn(cleanTestForWebDemo)
ideaPlugin()
-5
View File
@@ -63,13 +63,11 @@ projectTest {
testsJar()
val testForWebDemo by task<Test> {
include("**/*JavaToKotlinConverterForWebDemoTestGenerated*")
classpath = testSourceSet.runtimeClasspath
workingDir = rootDir
}
val cleanTestForWebDemo by tasks
val test: Test by tasks
test.apply {
@@ -77,7 +75,4 @@ test.apply {
dependsOn(testForWebDemo)
}
val cleanTest by tasks
cleanTest.dependsOn(cleanTestForWebDemo)
ideaPlugin()
@@ -476,7 +476,7 @@ internal fun configureDefaultVersionsResolutionStrategy(project: Project, kotlin
} else {
configuration.resolutionStrategy.eachDependency { details ->
val requested = details.requested
if (requested.group == "org.jetbrains.kotlin" && requested.version.isEmpty()) {
if (requested.group == "org.jetbrains.kotlin" && requested.version.isNullOrEmpty()) {
details.useVersion(kotlinPluginVersion)
}
}
@@ -6,10 +6,7 @@
package org.jetbrains.kotlin.gradle.plugin.mpp
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.DependencyConstraint
import org.gradle.api.artifacts.ModuleDependency
import org.gradle.api.artifacts.PublishArtifact
import org.gradle.api.artifacts.*
import org.gradle.api.attributes.AttributeContainer
import org.gradle.api.attributes.Usage
import org.gradle.api.capabilities.Capability
@@ -80,7 +77,7 @@ internal class KotlinPlatformUsageContext(
override fun getCapabilities(): Set<Capability> = emptySet()
// FIXME this is a stub for a function that is not present in the Gradle API that we compile against
fun getGlobalExcludes(): Set<Any> = emptySet()
override fun getGlobalExcludes(): Set<ExcludeRule> = emptySet()
}
private fun rewriteMppDependenciesToTargetModuleDependencies(
+14 -4
View File
@@ -88,15 +88,25 @@ dependencies {
val packCompiler by task<ShadowJar> {
configurations = listOf(fatJar)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDir = File(buildDir, "libs")
setupPublicJar(compilerBaseName, "before-proguard")
from(fatJarContents)
afterEvaluate {
fatJarContentsStripServices.files.forEach { from(zipTree(it)) { exclude("META-INF/services/**") } }
fatJarContentsStripMetadata.files.forEach { from(zipTree(it)) { exclude("META-INF/jb/** META-INF/LICENSE") } }
dependsOn(fatJarContentsStripServices)
from {
fatJarContentsStripServices.files.map {
zipTree(it).matching { exclude("META-INF/services/**") }
}
}
dependsOn(fatJarContentsStripMetadata)
from {
fatJarContentsStripMetadata.files.map {
zipTree(it).matching { exclude("META-INF/jb/**", "META-INF/LICENSE") }
}
}
manifest.attributes["Class-Path"] = compilerManifestClassPath
+14 -4
View File
@@ -88,15 +88,25 @@ dependencies {
val packCompiler by task<ShadowJar> {
configurations = listOf(fatJar)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDir = File(buildDir, "libs")
setupPublicJar(compilerBaseName, "before-proguard")
from(fatJarContents)
afterEvaluate {
fatJarContentsStripServices.files.forEach { from(zipTree(it)) { exclude("META-INF/services/**") } }
fatJarContentsStripMetadata.files.forEach { from(zipTree(it)) { exclude("META-INF/jb/** META-INF/LICENSE") } }
dependsOn(fatJarContentsStripServices)
from {
fatJarContentsStripServices.files.map {
zipTree(it).matching { exclude("META-INF/services/**") }
}
}
dependsOn(fatJarContentsStripMetadata)
from {
fatJarContentsStripMetadata.files.map {
zipTree(it).matching { exclude("META-INF/jb/**", "META-INF/LICENSE") }
}
}
manifest.attributes["Class-Path"] = compilerManifestClassPath
+14 -4
View File
@@ -88,15 +88,25 @@ dependencies {
val packCompiler by task<ShadowJar> {
configurations = listOf(fatJar)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
destinationDir = File(buildDir, "libs")
setupPublicJar(compilerBaseName, "before-proguard")
from(fatJarContents)
afterEvaluate {
fatJarContentsStripServices.files.forEach { from(zipTree(it)) { exclude("META-INF/services/**") } }
fatJarContentsStripMetadata.files.forEach { from(zipTree(it)) { exclude("META-INF/jb/** META-INF/LICENSE") } }
dependsOn(fatJarContentsStripServices)
from {
fatJarContentsStripServices.files.map {
zipTree(it).matching { exclude("META-INF/services/**") }
}
}
dependsOn(fatJarContentsStripMetadata)
from {
fatJarContentsStripMetadata.files.map {
zipTree(it).matching { exclude("META-INF/jb/**", "META-INF/LICENSE") }
}
}
manifest.attributes["Class-Path"] = compilerManifestClassPath