Build: Make JavaExec relative path system independent
This commit is contained in:
@@ -7,8 +7,8 @@ import org.gradle.api.Task
|
||||
import org.gradle.api.file.CopySourceSpec
|
||||
import org.gradle.api.file.SourceDirectorySet
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.tasks.JavaExec
|
||||
import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.api.tasks.SourceSetOutput
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import java.io.File
|
||||
@@ -69,3 +69,5 @@ inline fun CopySourceSpec.from(crossinline filesProvider: () -> Any?): CopySourc
|
||||
fun Project.javaPluginConvention(): JavaPluginConvention = the()
|
||||
|
||||
fun Project.findJavaPluginConvention(): JavaPluginConvention? = convention.findByType() ?: convention.findPlugin()
|
||||
|
||||
fun JavaExec.pathRelativeToWorkingDir(file: File): String = file.relativeTo(workingDir).invariantSeparatorsPath
|
||||
|
||||
@@ -32,8 +32,8 @@ val serialize by tasks.registering(NoDebugJavaExec::class) {
|
||||
main = "org.jetbrains.kotlin.serialization.builtins.RunKt"
|
||||
jvmArgs("-Didea.io.use.nio2=true")
|
||||
args(
|
||||
outDir.relativeTo(projectDir),
|
||||
*inDirs.map { it.relativeTo(projectDir) }.toTypedArray()
|
||||
pathRelativeToWorkingDir(outDir),
|
||||
*inDirs.map(::pathRelativeToWorkingDir).toTypedArray()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -174,9 +174,6 @@ fun JavaExec.buildKLib(
|
||||
outDir: File,
|
||||
commonSources: List<File>
|
||||
) {
|
||||
|
||||
fun File.pathRelativeToWorkingDir(): String = absoluteFile.relativeTo(workingDir).path
|
||||
|
||||
inputs.files(sources)
|
||||
.withPathSensitivity(PathSensitivity.RELATIVE)
|
||||
|
||||
@@ -186,10 +183,10 @@ fun JavaExec.buildKLib(
|
||||
classpath = jsIrKlibCli
|
||||
main = "org.jetbrains.kotlin.ir.backend.js.GenerateJsIrKlibKt"
|
||||
workingDir = rootDir
|
||||
args = sources.map { it.pathRelativeToWorkingDir() } +
|
||||
listOf("-n", moduleName, "-o", outDir.pathRelativeToWorkingDir()) +
|
||||
dependencies.flatMap { listOf("-d", it.pathRelativeToWorkingDir()) } +
|
||||
commonSources.flatMap { listOf("-c", it.pathRelativeToWorkingDir()) }
|
||||
args = sources.map(::pathRelativeToWorkingDir) +
|
||||
listOf("-n", moduleName, "-o", pathRelativeToWorkingDir(outDir)) +
|
||||
dependencies.flatMap { listOf("-d", pathRelativeToWorkingDir(it)) } +
|
||||
commonSources.flatMap { listOf("-c", pathRelativeToWorkingDir(it)) }
|
||||
|
||||
dependsOn(":compiler:cli-js-klib:jar")
|
||||
passClasspathInJar()
|
||||
|
||||
Reference in New Issue
Block a user