Scripts: Check if file is in all script dependencies class files scope instead of searching for module info
^KT-32799 Fixed ^KT-16760 Add test
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
package test;
|
||||
|
||||
public class Task {
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
test.JavaClass().task() {
|
||||
it.outputs
|
||||
}
|
||||
|
||||
// CONFLICTING_MODULE
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
package custom.scriptDefinition
|
||||
|
||||
import java.io.File
|
||||
import kotlin.script.dependencies.*
|
||||
import kotlin.script.experimental.dependencies.*
|
||||
import kotlin.script.templates.ScriptTemplateDefinition
|
||||
import kotlin.script.experimental.location.*
|
||||
|
||||
class TestDependenciesResolver : DependenciesResolver {
|
||||
override fun resolve(
|
||||
scriptContents: ScriptContents,
|
||||
environment: Environment
|
||||
): DependenciesResolver.ResolveResult {
|
||||
return DependenciesResolver.ResolveResult.Success(
|
||||
ScriptDependencies(
|
||||
classpath = listOf(environment["template-classes"] as File)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ScriptExpectedLocations([ScriptExpectedLocation.Everywhere])
|
||||
@ScriptTemplateDefinition(TestDependenciesResolver::class, scriptFilePattern = "script.kts")
|
||||
open class Template
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public interface Action<T> {
|
||||
void execute(T t);
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class JavaClass {
|
||||
public Task task(Action<? super Task> configureAction) {
|
||||
return new Task();
|
||||
}
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class Task {
|
||||
public String getOutputs() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user