Scripting: update scripts in source roots handling
#KT-52525 fixed related to #KT-52735
This commit is contained in:
@@ -170,6 +170,13 @@ val ScriptCompilationConfigurationKeys.sourceFragments by PropertiesCollection.k
|
||||
*/
|
||||
val ScriptCompilationConfigurationKeys.hostConfiguration by PropertiesCollection.key<ScriptingHostConfiguration>(isTransient = true)
|
||||
|
||||
/**
|
||||
* Should the script be always considered standalone
|
||||
* If true, it is ignored when compiled along with other sources (starting from 1.9, according to SkipStandaloneScriptsInSourceRoots language feature)
|
||||
* true by default
|
||||
*/
|
||||
val ScriptCompilationConfigurationKeys.isStandalone by PropertiesCollection.key<Boolean>(true)
|
||||
|
||||
/**
|
||||
* The sub-builder DSL for configuring refinement callbacks
|
||||
*/
|
||||
|
||||
+3
-8
@@ -20,8 +20,8 @@ enum class ScriptAcceptedLocation {
|
||||
Sources, // Under sources roots
|
||||
Tests, // Under test sources roots
|
||||
Libraries, // Under libraries classes or sources
|
||||
Project, // Under project folder, including sources and test sources roots
|
||||
Everywhere;
|
||||
Project, // Project infrastructure: project files excluding source roots
|
||||
Everywhere; // All places in the project
|
||||
}
|
||||
|
||||
val ScriptCompilationConfigurationKeys.ide
|
||||
@@ -30,9 +30,4 @@ val ScriptCompilationConfigurationKeys.ide
|
||||
val IdeScriptCompilationConfigurationKeys.dependenciesSources by PropertiesCollection.key<List<ScriptDependency>>()
|
||||
|
||||
val IdeScriptCompilationConfigurationKeys.acceptedLocations
|
||||
by PropertiesCollection.key(
|
||||
listOf(
|
||||
ScriptAcceptedLocation.Sources,
|
||||
ScriptAcceptedLocation.Tests
|
||||
)
|
||||
)
|
||||
by PropertiesCollection.key(listOf(ScriptAcceptedLocation.Everywhere))
|
||||
|
||||
+4
@@ -156,6 +156,10 @@ private fun ScriptCompilationConfiguration.Builder.propertiesFromTemplate(
|
||||
) {
|
||||
baseClass.replaceOnlyDefault(if (templateClass == baseClassType.fromClass) baseClassType else KotlinType(templateClass))
|
||||
fileExtension.replaceOnlyDefault(mainAnnotation.fileExtension)
|
||||
// TODO: remove this exception when gradle switches to the new definitions and sets the property accordingly
|
||||
if (get(fileExtension) == "gradle.kts") {
|
||||
isStandalone(false)
|
||||
}
|
||||
filePathPattern.replaceOnlyDefault(mainAnnotation.filePathPattern)
|
||||
displayName.replaceOnlyDefault(mainAnnotation.displayName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user