diff --git a/buildSrc/src/main/kotlin/artifacts.kt b/buildSrc/src/main/kotlin/artifacts.kt index 18c18b6e367..452c7879348 100644 --- a/buildSrc/src/main/kotlin/artifacts.kt +++ b/buildSrc/src/main/kotlin/artifacts.kt @@ -25,7 +25,6 @@ import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.Upload import org.gradle.api.tasks.javadoc.Javadoc import org.gradle.jvm.tasks.Jar -import org.gradle.api.artifacts.dsl.DependencyHandler import org.gradle.kotlin.dsl.* import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer import plugins.KotlinBuildPublishingPlugin diff --git a/buildSrc/src/main/kotlin/copyright.kt b/buildSrc/src/main/kotlin/copyright.kt index 0005e58cffc..591ed38845c 100644 --- a/buildSrc/src/main/kotlin/copyright.kt +++ b/buildSrc/src/main/kotlin/copyright.kt @@ -8,48 +8,37 @@ package tasks import groovy.util.Node import groovy.util.XmlParser import org.gradle.api.DefaultTask -import org.gradle.api.Project +import org.gradle.api.file.RegularFileProperty +import org.gradle.api.provider.Property import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction -import java.io.File import java.util.* - - - -open class WriteCopyrightToFile : DefaultTask() { - +abstract class WriteCopyrightToFile : DefaultTask() { @InputFile - var path = project.file("${project.rootDir}/.idea/copyright/apache.xml") + val path = project.file("${project.rootDir}/.idea/copyright/apache.xml") - @OutputFile - var outputFile: File? = null + @get:OutputFile + abstract val outputFile: RegularFileProperty - @Input - var commented: Boolean = true + @get:Input + val commented: Property = project.objects.property(Boolean::class.java).convention(true) @TaskAction fun write() { - if (commented) { - outputFile!!.writeText(project.readCopyrightCommented()) - } else { - outputFile!!.writeText(project.readCopyright()) - } + val file = outputFile.asFile.get() + file.writeText(if (commented.get()) readCopyrightCommented() else readCopyright()) } - - fun Project.readCopyright(): String { - val file = rootDir.resolve(".idea/copyright/apache.xml") - - assert(file.exists()) { - "File $file with copyright not found" + private fun readCopyright(): String { + assert(path.exists()) { + "File $path with copyright not found" } - val xmlParser = XmlParser() - val node = xmlParser.parse(file) + val node = xmlParser.parse(path) assert(node.attribute("name") == "CopyrightManager") { "Format changed occasionally?" } @@ -59,7 +48,7 @@ open class WriteCopyrightToFile : DefaultTask() { return noticeNode.attribute("value").toString().replace("$today.year", GregorianCalendar()[Calendar.YEAR].toString()) } - fun Project.readCopyrightCommented(): String { + private fun readCopyrightCommented(): String { return "/*\n" + readCopyright().prependIndent(" * ") + "\n */" } } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/embeddable.kt b/buildSrc/src/main/kotlin/embeddable.kt index d845e27bffa..f6f865e49f7 100644 --- a/buildSrc/src/main/kotlin/embeddable.kt +++ b/buildSrc/src/main/kotlin/embeddable.kt @@ -128,7 +128,6 @@ fun Project.rewriteDepsToShadedJar( archiveClassifier.set("original") } - val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile } shadowJarTask.configure { dependsOn(originalJarTask) @@ -136,7 +135,8 @@ fun Project.rewriteDepsToShadedJar( // When Gradle traverses the inputs, reject the shaded compiler JAR, // which leads to the content of that JAR being excluded as well: - exclude { it.file == compilerDummyJarFile } + val compilerDummyJarFile = project.provider { configurations.getByName("compilerDummyJar").singleFile } + exclude { it.file == compilerDummyJarFile.get() } archiveClassifier.set("original") body() diff --git a/compiler/compiler-runner/build.gradle.kts b/compiler/compiler-runner/build.gradle.kts index 9f6d7083322..2c2c59cdc9d 100644 --- a/compiler/compiler-runner/build.gradle.kts +++ b/compiler/compiler-runner/build.gradle.kts @@ -1,6 +1,3 @@ - -import org.gradle.jvm.tasks.Jar - description = "Compiler runner + daemon client" plugins { diff --git a/compiler/fir/checkers/checkers-component-generator/build.gradle.kts b/compiler/fir/checkers/checkers-component-generator/build.gradle.kts index e57d16ffdb9..776e72b47a6 100644 --- a/compiler/fir/checkers/checkers-component-generator/build.gradle.kts +++ b/compiler/fir/checkers/checkers-component-generator/build.gradle.kts @@ -20,8 +20,8 @@ dependencies { } val writeCopyright by task { - outputFile = file("$buildDir/copyright/notice.txt") - commented = true + outputFile.set(file("$buildDir/copyright/notice.txt")) + commented.set(true) } application { diff --git a/compiler/fir/tree/tree-generator/build.gradle.kts b/compiler/fir/tree/tree-generator/build.gradle.kts index 79b273788ac..629dbcf8758 100644 --- a/compiler/fir/tree/tree-generator/build.gradle.kts +++ b/compiler/fir/tree/tree-generator/build.gradle.kts @@ -28,8 +28,8 @@ dependencies { } val writeCopyright by task { - outputFile = file("$buildDir/copyright/notice.txt") - commented = true + outputFile.set(file("$buildDir/copyright/notice.txt")) + commented.set(true) } application { diff --git a/idea/idea-frontend-fir/idea-frontend-fir-generator/build.gradle.kts b/idea/idea-frontend-fir/idea-frontend-fir-generator/build.gradle.kts index 0b73e6b7c8f..db932ee5d1c 100644 --- a/idea/idea-frontend-fir/idea-frontend-fir-generator/build.gradle.kts +++ b/idea/idea-frontend-fir/idea-frontend-fir-generator/build.gradle.kts @@ -23,8 +23,8 @@ dependencies { } val writeCopyright by task { - outputFile = file("$buildDir/copyright/notice.txt") - commented = true + outputFile.set(file("$buildDir/copyright/notice.txt")) + commented.set(true) } application { diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index 1f8ef786ba8..e6294948b95 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -104,7 +104,7 @@ val currentOsType = run { else -> OsName.UNKNOWN } - val osArch = when (System.getProperty("sun.arch.data.model")) { + val osArch = when (providers.systemProperty("sun.arch.data.model").forUseAtConfigurationTime().get()) { "32" -> OsArch.X86_32 "64" -> OsArch.X86_64 else -> OsArch.UNKNOWN @@ -219,13 +219,15 @@ fun Test.setUpBoxTests() { workingDir = rootDir dependsOn(antLauncherJar) inputs.files(antLauncherJar) + val antLauncherJarPath = antLauncherJar.asPath doFirst { - systemProperty("kotlin.ant.classpath", antLauncherJar.asPath) + systemProperty("kotlin.ant.classpath", antLauncherJarPath) systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main") } systemProperty("kotlin.js.test.root.out.dir", "$buildDir/") - systemProperty("overwrite.output", findProperty("overwrite.output") ?: "false") + systemProperty("overwrite.output", project.providers.gradleProperty("overwrite.output") + .forUseAtConfigurationTime().orNull ?: "false") val prefixForPpropertiesToForward = "fd." for ((key, value) in properties) { diff --git a/libraries/commonConfiguration.gradle b/libraries/commonConfiguration.gradle index 5758e72f22a..c0d54d95539 100644 --- a/libraries/commonConfiguration.gradle +++ b/libraries/commonConfiguration.gradle @@ -62,9 +62,10 @@ ext.compileJava9Sources = { Project project, String moduleName, Collection