diff options
author | Yahor Berdnikau <egorr.berd@gmail.com> | 2022-03-25 19:18:10 +0100 |
---|---|---|
committer | mvicsokolova <maria.sokolova@jetbrains.com> | 2022-06-15 18:59:02 +0300 |
commit | a6104229b3f94af0998efbe8659ad56889f2d866 (patch) | |
tree | 9d671f033de3753d093567bd7f6f0b46144bd590 | |
parent | d096806d0d2704d260403997f16bae489197e744 (diff) | |
download | kotlinx.atomicfu-a6104229b3f94af0998efbe8659ad56889f2d866.tar.gz |
Update script to be compatible with KGP breaking changes
-rw-r--r-- | atomicfu-maven-plugin/build.gradle | 11 | ||||
-rw-r--r-- | atomicfu/build.gradle | 10 | ||||
-rw-r--r-- | gradle/interop-as-source-set-klib.gradle | 2 | ||||
-rw-r--r-- | gradle/publish-npm-js.gradle | 2 |
4 files changed, 15 insertions, 10 deletions
diff --git a/atomicfu-maven-plugin/build.gradle b/atomicfu-maven-plugin/build.gradle index b48d856..a165769 100644 --- a/atomicfu-maven-plugin/build.gradle +++ b/atomicfu-maven-plugin/build.gradle @@ -18,7 +18,7 @@ dependencies { } def pomFile = file("$buildDir/pom.xml") -def outputDir = compileKotlin.destinationDir +def outputDir = compileKotlin.destinationDirectory def buildSnapshots = rootProject.properties['build_snapshot_train'] != null evaluationDependsOn(':atomicfu-transformer') @@ -37,7 +37,7 @@ task generatePomFile(dependsOn: [compileKotlin, ':atomicfu-transformer:publishTo asNode().with { appendNode('build').with { appendNode('directory', buildDir) - appendNode('outputDirectory', outputDir) + appendNode('outputDirectory', outputDir.get().getAsFile()) } appendNode('properties').with { appendNode('project.build.sourceEncoding', 'UTF-8') @@ -69,7 +69,7 @@ String mavenRepoLocal = System.getProperty("maven.repo.local") // runs the plugin description generator task generatePluginDescriptor(type: Exec, dependsOn: generatePomFile) { - def pluginDescriptorFile = new File(outputDir, 'META-INF/maven/plugin.xml') + def pluginDescriptorFile = outputDir.file('META-INF/maven/plugin.xml') workingDir projectDir boolean isWindows = System.getProperty("os.name").toLowerCase().indexOf("windows") >= 0 @@ -85,8 +85,9 @@ task generatePluginDescriptor(type: Exec, dependsOn: generatePomFile) { ]) commandLine args doLast { - assert pluginDescriptorFile.file, "$pluginDescriptorFile: was not generated" - logger.info("Plugin descriptor is generated in $pluginDescriptorFile") + def descriptorFile = pluginDescriptorFile.get().getAsFile() + assert descriptorFile, "$descriptorFile: was not generated" + logger.info("Plugin descriptor is generated in $descriptorFile") } } diff --git a/atomicfu/build.gradle b/atomicfu/build.gradle index cfee622..2374d59 100644 --- a/atomicfu/build.gradle +++ b/atomicfu/build.gradle @@ -327,7 +327,7 @@ task compileJavaModuleInfo(type: JavaCompile) { def moduleName = "kotlinx.atomicfu" // this module's name def compileKotlinJvm = kotlin.targets["jvm"].compilations["main"].compileKotlinTask def sourceDir = file("src/jvmMain/java9/") - def targetDir = file("${compileKotlinJvm.destinationDir}/../java9/") + def targetDir = compileKotlinJvm.destinationDirectory.map { it.dir("../java9/") } // Use a Java 11 compiler for the module info. javaCompiler.set(project.javaToolchains.compilerFor { languageVersion.set(JavaLanguageVersion.of(11)) }) @@ -353,7 +353,7 @@ task compileJavaModuleInfo(type: JavaCompile) { // Set the task outputs and destination dir outputs.dir(targetDir) - destinationDir = targetDir + destinationDirectory.set(targetDir) // Configure JVM compatibility sourceCompatibility = JavaVersion.VERSION_1_9.toString() @@ -367,12 +367,16 @@ task compileJavaModuleInfo(type: JavaCompile) { options.compilerArgs.add("-Xlint:-requires-transitive-automatic") // Patch the compileKotlinJvm output classes into the compilation so exporting packages works correctly. - options.compilerArgs.addAll(["--patch-module", "$moduleName=${compileKotlinJvm.destinationDir}"]) + options.compilerArgs.addAll(["--patch-module", "$moduleName=${compileKotlinJvm.destinationDirectory.get().getAsFile()}"]) // Use the classpath of the compileKotlinJvm task. // Also ensure that the module path is used instead of classpath. classpath = compileKotlinJvm.classpath modularity.inferModulePath.set(true) + + doFirst { + logger.warn("Task destination directory: ${destinationDirectory.get().getAsFile()}") + } } // Configure the JAR task so that it will include the compiled module-info class file. diff --git a/gradle/interop-as-source-set-klib.gradle b/gradle/interop-as-source-set-klib.gradle index 62f2b77..25cb0c2 100644 --- a/gradle/interop-as-source-set-klib.gradle +++ b/gradle/interop-as-source-set-klib.gradle @@ -7,7 +7,7 @@ project.ext.registerInteropAsSourceSetOutput = { interop, sourceSet -> def cinteropTask = tasks.named(interop.interopProcessingTaskName) def cinteropKlib = cinteropTask.map { it.outputFile } def fakeCinteropCompilation = kotlin.targets["metadata"].compilations[sourceSet.name] - def destination = fakeCinteropCompilation.compileKotlinTask.destinationDir + def destination = fakeCinteropCompilation.compileKotlinTask.destinationDirectory def tempDir = "$buildDir/tmp/${sourceSet.name}UnpackedInteropKlib" diff --git a/gradle/publish-npm-js.gradle b/gradle/publish-npm-js.gradle index e6760a7..b7e7264 100644 --- a/gradle/publish-npm-js.gradle +++ b/gradle/publish-npm-js.gradle @@ -29,7 +29,7 @@ task preparePublishNpm(type: Copy, dependsOn: [compileJsLegacy]) { from(npmTemplateDir) { expand (project.properties + [kotlinDependency: "\"kotlin\": \"$kotlin_version\""]) } - from(compileJsLegacy.destinationDir) + from(compileJsLegacy.destinationDirectory) into npmDeployDir } |