KT-41425 Project can not be launched with Gradle runner
93a82060 introduced support of "delegate to Gradle" for Gradle-Kotlin.
This commit fixes an issue known as "Could not get unknown property
'sourceSets' for root project".
This commit is contained in:
+25
-23
@@ -170,33 +170,35 @@ class KotlinGradleAppEnvProvider : GradleExecutionEnvironmentProvider {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
afterEvaluate { project ->
|
afterEvaluate { project ->
|
||||||
def overwrite = project.tasks.findByName(runAppTaskName) != null
|
if (project.path == gradlePath) {
|
||||||
project.tasks.create(name: runAppTaskName, overwrite: overwrite, type: JavaExec) {
|
def overwrite = project.tasks.findByName(runAppTaskName) != null
|
||||||
if (javaExePath) executable = javaExePath
|
project.tasks.create(name: runAppTaskName, overwrite: overwrite, type: JavaExec) {
|
||||||
if (project.pluginManager.hasPlugin("org.jetbrains.kotlin.multiplatform")) {
|
if (javaExePath) executable = javaExePath
|
||||||
project.kotlin.targets.each { target ->
|
if (project.pluginManager.hasPlugin("org.jetbrains.kotlin.multiplatform")) {
|
||||||
target.compilations.each { compilation ->
|
project.kotlin.targets.each { target ->
|
||||||
if (compilation.defaultSourceSetName == sourceSetName) {
|
target.compilations.each { compilation ->
|
||||||
classpath = compilation.output.allOutputs + compilation.runtimeDependencyFiles
|
if (compilation.defaultSourceSetName == sourceSetName) {
|
||||||
|
classpath = compilation.output.allOutputs + compilation.runtimeDependencyFiles
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
classpath = project.sourceSets[sourceSetName].runtimeClasspath
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
classpath = project.sourceSets[sourceSetName].runtimeClasspath
|
|
||||||
}
|
|
||||||
|
|
||||||
main = mainClass
|
main = mainClass
|
||||||
$argsString
|
$argsString
|
||||||
if(_workingDir) workingDir = _workingDir
|
if(_workingDir) workingDir = _workingDir
|
||||||
standardInput = System.in
|
standardInput = System.in
|
||||||
if(javaModuleName) {
|
if(javaModuleName) {
|
||||||
inputs.property('moduleName', javaModuleName)
|
inputs.property('moduleName', javaModuleName)
|
||||||
doFirst {
|
doFirst {
|
||||||
jvmArgs += [
|
jvmArgs += [
|
||||||
'--module-path', classpath.asPath,
|
'--module-path', classpath.asPath,
|
||||||
'--module', javaModuleName + '/' + mainClass
|
'--module', javaModuleName + '/' + mainClass
|
||||||
]
|
]
|
||||||
classpath = files()
|
classpath = files()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user