From b53df9bcce2e576504169cd3da251a7bc01a3e1a Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 5 May 2016 21:26:33 -0800 Subject: [PATCH 01/29] Add a "group" to the tasks. --- .../kotlin/com/beust/kobalt/BasePluginTask.kt | 3 ++- .../com/beust/kobalt/api/ITaskContributor.kt | 1 + .../kotlin/com/beust/kobalt/api/PluginTask.kt | 2 ++ .../com/beust/kobalt/api/TaskContributor.kt | 6 ++++-- .../beust/kobalt/api/annotation/Annotations.kt | 12 ++++++++++++ .../beust/kobalt/internal/JvmCompilerPlugin.kt | 16 ++++++++++------ .../com/beust/kobalt/internal/TaskManager.kt | 13 +++++++------ .../beust/kobalt/app/remote/DependencyData.kt | 4 ++-- .../plugin/application/ApplicationPlugin.kt | 2 +- .../kobalt/plugin/packaging/PackagingPlugin.kt | 5 +++-- 10 files changed, 44 insertions(+), 20 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/BasePluginTask.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/BasePluginTask.kt index 855d4271..e55f1b2a 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/BasePluginTask.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/BasePluginTask.kt @@ -4,8 +4,9 @@ import com.beust.kobalt.api.IPlugin import com.beust.kobalt.api.PluginTask import com.beust.kobalt.api.Project -public abstract class BasePluginTask(override val plugin: IPlugin, +abstract class BasePluginTask(override val plugin: IPlugin, override val name: String, override val doc: String, + override val group: String, override val project: Project) : PluginTask() diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/ITaskContributor.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/ITaskContributor.kt index 113b0257..48f5173c 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/ITaskContributor.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/ITaskContributor.kt @@ -12,6 +12,7 @@ interface ITaskContributor : IContributor { } class DynamicTask(override val plugin: IPlugin, override val name: String, override val doc: String, + override val group: String, override val project: Project, val dependsOn: List = listOf(), val reverseDependsOn: List = listOf(), diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/PluginTask.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/PluginTask.kt index a2d2b7b7..b416f96b 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/PluginTask.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/PluginTask.kt @@ -8,11 +8,13 @@ interface ITask : Callable> { val project: Project val name: String val doc: String + val group: String } abstract class PluginTask : ITask { override val name: String = "" override open val doc: String = "" + override open val group: String = "other" override fun toString() = project.name + ":" + name } diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/TaskContributor.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/TaskContributor.kt index 0d1c1333..2cae53fa 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/TaskContributor.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/TaskContributor.kt @@ -23,6 +23,7 @@ class TaskContributor @Inject constructor(val incrementalManagerFactory: Increme * depends on variants of that task. */ fun addVariantTasks(plugin: IPlugin, project: Project, context: KobaltContext, taskName: String, + group: String, dependsOn: List = emptyList(), reverseDependsOn : List = emptyList(), runBefore : List = emptyList(), @@ -30,7 +31,7 @@ class TaskContributor @Inject constructor(val incrementalManagerFactory: Increme runTask: (Project) -> TaskResult) { Variant.allVariants(project).forEach { variant -> val variantTaskName = variant.toTask(taskName) - dynamicTasks.add(DynamicTask(plugin, variantTaskName, variantTaskName, project, + dynamicTasks.add(DynamicTask(plugin, variantTaskName, variantTaskName, group, project, dependsOn = dependsOn.map { variant.toTask(it) }, reverseDependsOn = reverseDependsOn.map { variant.toTask(it) }, runBefore = runBefore.map { variant.toTask(it) }, @@ -43,6 +44,7 @@ class TaskContributor @Inject constructor(val incrementalManagerFactory: Increme } fun addIncrementalVariantTasks(plugin: IPlugin, project: Project, context: KobaltContext, taskName: String, + group: String, dependsOn: List = emptyList(), reverseDependsOn : List = emptyList(), runBefore : List = emptyList(), @@ -50,7 +52,7 @@ class TaskContributor @Inject constructor(val incrementalManagerFactory: Increme runTask: (Project) -> IncrementalTaskInfo) { Variant.allVariants(project).forEach { variant -> val variantTaskName = variant.toTask(taskName) - dynamicTasks.add(DynamicTask(plugin, variantTaskName, variantTaskName, project, + dynamicTasks.add(DynamicTask(plugin, variantTaskName, variantTaskName, group, project, dependsOn = dependsOn.map { variant.toTask(it) }, reverseDependsOn = reverseDependsOn.map { variant.toTask(it) }, runBefore = runBefore.map { variant.toTask(it) }, diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/annotation/Annotations.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/annotation/Annotations.kt index ff93b05d..baa87322 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/annotation/Annotations.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/annotation/Annotations.kt @@ -8,9 +8,15 @@ annotation class Directive @Retention(AnnotationRetention.RUNTIME) annotation class Task( + /* This task's name */ val name: String, + + /* The documentation for this task */ val description: String = "", + /** Used to show the task in the correct group in the IDE */ + val group: String = "other", + /** Dependency: tasks this task depends on */ val dependsOn: Array = arrayOf(), @@ -29,9 +35,15 @@ annotation class Task( @Retention(AnnotationRetention.RUNTIME) annotation class IncrementalTask( + /* This task's name */ val name: String, + + /* The documentation for this task */ val description: String = "", + /** Used to show the task in the correct group in the IDE */ + val group: String = "other", + /** Dependency: tasks this task depends on */ val dependsOn: Array = arrayOf(), diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt index 4f418343..db4519c0 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/JvmCompilerPlugin.kt @@ -48,6 +48,10 @@ open class JvmCompilerPlugin @Inject constructor( const val TASK_TEST = "test" const val DOCS_DIRECTORY = "docs/javadoc" + + const val GROUP_TEST = "test" + const val GROUP_BUILD = "build" + const val GROUP_DOCUMENTATION = "documentation" } override val name: String = PLUGIN_NAME @@ -64,7 +68,7 @@ open class JvmCompilerPlugin @Inject constructor( override fun apply(project: Project, context: KobaltContext) { super.apply(project, context) // cleanUpActors() - taskContributor.addIncrementalVariantTasks(this, project, context, "compile", + taskContributor.addIncrementalVariantTasks(this, project, context, "compile", GROUP_BUILD, runTask = { taskCompile(project) }) // @@ -77,7 +81,7 @@ open class JvmCompilerPlugin @Inject constructor( project.testConfigs.forEach { config -> val taskName = if (config.name.isEmpty()) TASK_TEST else TASK_TEST + config.name - taskManager.addTask(this, project, taskName, + taskManager.addTask(this, project, taskName, group = GROUP_TEST, dependsOn = listOf(JvmCompilerPlugin.TASK_COMPILE, JvmCompilerPlugin.TASK_COMPILE_TEST), task = { taskTest(project, config.name)} ) } @@ -98,7 +102,7 @@ open class JvmCompilerPlugin @Inject constructor( } } - @Task(name = TASK_CLEAN, description = "Clean the project") + @Task(name = TASK_CLEAN, description = "Clean the project", group = GROUP_BUILD) fun taskClean(project: Project): TaskResult { java.io.File(project.directory, project.buildDirectory).let { dir -> if (!dir.deleteRecursively()) { @@ -139,7 +143,7 @@ open class JvmCompilerPlugin @Inject constructor( } } - @IncrementalTask(name = TASK_COMPILE_TEST, description = "Compile the tests", + @IncrementalTask(name = TASK_COMPILE_TEST, description = "Compile the tests", group = GROUP_BUILD, dependsOn = arrayOf(TASK_COMPILE)) fun taskCompileTest(project: Project): IncrementalTaskInfo { sourceTestDirectories.addAll(context.variant.sourceDirectories(project, context, SourceSet.of(isTest = true))) @@ -155,7 +159,7 @@ open class JvmCompilerPlugin @Inject constructor( ) } - @IncrementalTask(name = JvmCompilerPlugin.TASK_COMPILE, description = "Compile the project", + @IncrementalTask(name = JvmCompilerPlugin.TASK_COMPILE, description = "Compile the project", group = GROUP_BUILD, runAfter = arrayOf(TASK_CLEAN)) fun taskCompile(project: Project): IncrementalTaskInfo { // Generate the BuildConfig before invoking sourceDirectories() since that call @@ -243,7 +247,7 @@ open class JvmCompilerPlugin @Inject constructor( project.projectProperties.put(DEPENDENT_PROJECTS, allProjects) } - @Task(name = "doc", description = "Generate the documentation for the project") + @Task(name = "doc", description = "Generate the documentation for the project", group = GROUP_DOCUMENTATION) fun taskJavadoc(project: Project): TaskResult { val docGenerator = ActorUtils.selectAffinityActor(project, context, context.pluginInfo.docContributors) if (docGenerator != null) { diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt index 8f902b7c..bd117f8b 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/TaskManager.kt @@ -430,6 +430,7 @@ class TaskManager @Inject constructor(val args: Args, private val taskAnnotations = arrayListOf() class TaskAnnotation(val method: Method, val plugin: IPlugin, val name: String, val description: String, + val group: String, val dependsOn: Array, val reverseDependsOn: Array, val runBefore: Array, val runAfter: Array, val alwaysRunAfter: Array, @@ -441,7 +442,7 @@ class TaskManager @Inject constructor(val args: Args, * Invoking a @Task means simply calling the method and returning its returned TaskResult. */ fun toTaskAnnotation(method: Method, plugin: IPlugin, ta: Task) - = TaskAnnotation(method, plugin, ta.name, ta.description, ta.dependsOn, ta.reverseDependsOn, + = TaskAnnotation(method, plugin, ta.name, ta.description, ta.group, ta.dependsOn, ta.reverseDependsOn, ta.runBefore, ta.runAfter, ta.alwaysRunAfter, { project -> method.invoke(plugin, project) as TaskResult @@ -452,7 +453,7 @@ class TaskManager @Inject constructor(val args: Args, * of the returned IncrementalTaskInfo. */ fun toTaskAnnotation(method: Method, plugin: IPlugin, ta: IncrementalTask) - = TaskAnnotation(method, plugin, ta.name, ta.description, ta.dependsOn, ta.reverseDependsOn, + = TaskAnnotation(method, plugin, ta.name, ta.description, ta.group, ta.dependsOn, ta.reverseDependsOn, ta.runBefore, ta.runAfter, ta.alwaysRunAfter, incrementalManagerFactory.create().toIncrementalTaskClosure(ta.name, { project -> method.invoke(plugin, project) as IncrementalTaskInfo @@ -481,7 +482,7 @@ class TaskManager @Inject constructor(val args: Args, private fun installDynamicTasks(projects: List) { dynamicTasks.forEach { task -> projects.filter { task.plugin.accept(it) }.forEach { project -> - addTask(task.plugin, project, task.name, task.doc, + addTask(task.plugin, project, task.name, task.doc, task.group, task.dependsOn, task.reverseDependsOn, task.runBefore, task.runAfter, task.alwaysRunAfter, task.closure) } @@ -504,13 +505,13 @@ class TaskManager @Inject constructor(val args: Args, private fun addAnnotationTask(plugin: IPlugin, project: Project, annotation: TaskAnnotation, task: (Project) -> TaskResult) { - addTask(plugin, project, annotation.name, annotation.description, + addTask(plugin, project, annotation.name, annotation.description, annotation.group, annotation.dependsOn.toList(), annotation.reverseDependsOn.toList(), annotation.runBefore.toList(), annotation.runAfter.toList(), annotation.alwaysRunAfter.toList(), task) } - fun addTask(plugin: IPlugin, project: Project, name: String, description: String = "", + fun addTask(plugin: IPlugin, project: Project, name: String, description: String = "", group: String, dependsOn: List = listOf(), reverseDependsOn: List = listOf(), runBefore: List = listOf(), @@ -518,7 +519,7 @@ class TaskManager @Inject constructor(val args: Args, alwaysRunAfter: List = listOf(), task: (Project) -> TaskResult) { annotationTasks.add( - object : BasePluginTask(plugin, name, description, project) { + object : BasePluginTask(plugin, name, description, group, project) { override fun call(): TaskResult2 { val taskResult = task(project) return TaskResult2(taskResult.success, taskResult.errorMessage, this) diff --git a/src/main/kotlin/com/beust/kobalt/app/remote/DependencyData.kt b/src/main/kotlin/com/beust/kobalt/app/remote/DependencyData.kt index a7ff91fa..7a4f4eec 100644 --- a/src/main/kotlin/com/beust/kobalt/app/remote/DependencyData.kt +++ b/src/main/kotlin/com/beust/kobalt/app/remote/DependencyData.kt @@ -56,7 +56,7 @@ class DependencyData @Inject constructor(val executors: KobaltExecutors, val dep val sources = project.sourceDirectories.partition { KFiles.isResource(it) } val tests = project.sourceDirectoriesTest.partition { KFiles.isResource(it) } val allTasks = taskManager.tasksByNames(project).values().map { - TaskData(it.name, it.doc) + TaskData(it.name, it.doc, it.group) } projectDatas.add(ProjectData(project.name, project.directory, dependentProjects, compileDependencies, testDependencies, @@ -72,7 +72,7 @@ class DependencyData @Inject constructor(val executors: KobaltExecutors, val dep // class DependencyData(val id: String, val scope: String, val path: String) - class TaskData(val name: String, val description: String) + class TaskData(val name: String, val description: String, val group: String) class ProjectData(val name: String, val directory: String, val dependentProjects: List, diff --git a/src/main/kotlin/com/beust/kobalt/plugin/application/ApplicationPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/application/ApplicationPlugin.kt index a4855109..38aa114e 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/application/ApplicationPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/application/ApplicationPlugin.kt @@ -48,7 +48,7 @@ class ApplicationPlugin @Inject constructor(val configActor: ConfigActor Date: Thu, 5 May 2016 21:30:19 -0800 Subject: [PATCH 02/29] 0.762. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 3a8216b4..026cac5f 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.761 \ No newline at end of file +kobalt.version=0.762 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index b8c33d34..ff68f33d 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.761 +kobalt.version=0.762 From e6ba79e96d2fe42cdf3e23a6147832dfda061285 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 5 May 2016 21:49:26 -0800 Subject: [PATCH 03/29] Fixes the -d bug when running tests. Fixes https://github.com/cbeust/kobalt/issues/189 --- .../src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt index 0fad304c..16188c0c 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt @@ -74,7 +74,7 @@ abstract class GenericTestRunner: ITestRunnerContributor { } // JVM flags from the interceptors (these overwrite flags instead of just adding to the list) - var interceptedArgs = ArrayList(flagsFromContributors) + var interceptedArgs = ArrayList(jvmFlags + flagsFromContributors) pluginInfo.testJvmFlagInterceptors.forEach { val newFlags = it.testJvmFlagsFor(project, context, interceptedArgs) interceptedArgs.clear() From d878ce1913adc4569fdb167e90db308c21a64346 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 5 May 2016 21:49:41 -0800 Subject: [PATCH 04/29] 0.763. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 026cac5f..0133590e 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.762 \ No newline at end of file +kobalt.version=0.763 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index ff68f33d..22326689 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.762 +kobalt.version=0.763 From b56178e8a054f6071953102e6e9cfe5e843bfcf5 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 5 May 2016 23:00:11 -0800 Subject: [PATCH 05/29] Fix the initial import problem when using plug-ins. --- .../main/kotlin/com/beust/kobalt/Plugins.kt | 6 +++-- .../beust/kobalt/internal/KobaltPluginXml.kt | 26 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Plugins.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Plugins.kt index 1c1d9dd1..c31837b0 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Plugins.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Plugins.kt @@ -14,6 +14,7 @@ import com.beust.kobalt.misc.log import com.google.inject.Provider import java.lang.reflect.Method import java.lang.reflect.Modifier +import java.net.URLClassLoader import java.util.* import java.util.jar.JarFile import javax.inject.Inject @@ -148,7 +149,7 @@ class Plugins @Inject constructor (val taskManagerProvider : Provider() - fun installPlugins(dependencies: List, classLoader: ClassLoader) { + fun installPlugins(dependencies: List, scriptClassLoader: ClassLoader) { val executor = executors.newExecutor("Plugins", 5) dependencies.forEach { // @@ -161,7 +162,8 @@ class Plugins @Inject constructor (val taskManagerProvider : Provider() val projectContributors = arrayListOf() val classpathContributors = arrayListOf() @@ -112,16 +113,24 @@ class PluginInfo(val xml: KobaltPluginXml, val classLoader: ClassLoader?) { /** * Read a general kobalt-plugin.xml. */ - fun readPluginXml(ins: InputStream, classLoader: ClassLoader? = null): PluginInfo { + fun readPluginXml(ins: InputStream, pluginClassLoader: ClassLoader? = null, + classLoader: ClassLoader? = null): PluginInfo { val jaxbContext = JAXBContext.newInstance(KobaltPluginXml::class.java) - val kotlinPlugin: KobaltPluginXml = jaxbContext.createUnmarshaller().unmarshal(ins) + val kobaltPlugin: KobaltPluginXml = jaxbContext.createUnmarshaller().unmarshal(ins) as KobaltPluginXml - log(2, "Parsed plugin XML file, found: " + kotlinPlugin.name) - return PluginInfo(kotlinPlugin, classLoader) + log(2, "Parsed plugin XML file, found: " + kobaltPlugin.name) + val result = + try { + PluginInfo(kobaltPlugin, pluginClassLoader, classLoader) + } catch(ex: Exception) { + throw KobaltException("Couldn't create PluginInfo: " + ex.message, ex) + } + return result } - fun readPluginXml(s: String, classLoader: ClassLoader? = null) - = readPluginXml(ByteArrayInputStream(s.toByteArray(Charsets.UTF_8)), classLoader) + fun readPluginXml(s: String, pluginClassLoader: ClassLoader?, scriptClassLoader: ClassLoader? = null) + = readPluginXml(ByteArrayInputStream(s.toByteArray(Charsets.UTF_8)), pluginClassLoader, + scriptClassLoader) } init { @@ -132,7 +141,8 @@ class PluginInfo(val xml: KobaltPluginXml, val classLoader: ClassLoader?) { } fun forName(className: String) = - if (classLoader != null) classLoader.loadClass(className) + if (pluginClassLoader != null) pluginClassLoader.loadClass(className) + else if (classLoader != null) classLoader.loadClass(className) else Class.forName(className) // From 168d6359899c168e1eb821c5c9c31a1d6ca0b500 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 5 May 2016 23:00:21 -0800 Subject: [PATCH 06/29] Send an actual error to the plug-in. --- src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt b/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt index 4e871cfc..b37e6209 100644 --- a/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt +++ b/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt @@ -40,12 +40,13 @@ class SparkServer(val initCallback: (String) -> List, val cleanUpCallba dependencyData.dependenciesDataFor(buildFile, args) } catch(ex: Exception) { - "Error: " + ex.message + DependencyData.GetDependenciesData(emptyList(), ex.message) } finally { cleanUpCallback() } } else { - "error" + DependencyData.GetDependenciesData(emptyList(), + "buildFile wasn't passed in the query parameter") } cleanUpCallback() result From a425dfb85584b60ae6a28f6406681a852b2f70db Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 5 May 2016 23:01:51 -0800 Subject: [PATCH 07/29] 0.764. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 0133590e..0be21777 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.763 \ No newline at end of file +kobalt.version=0.764 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index 22326689..3b136115 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.763 +kobalt.version=0.764 From 38b2379227ddb8c693e8811a39a4ddfa3119606d Mon Sep 17 00:00:00 2001 From: Kevin Mas Ruiz Date: Fri, 6 May 2016 20:42:57 +0200 Subject: [PATCH 08/29] add classifier when need --- .../kotlin/com/beust/kobalt/maven/LocalRepo.kt | 2 +- .../main/kotlin/com/beust/kobalt/maven/MavenId.kt | 15 ++++++++------- .../kotlin/com/beust/kobalt/maven/PomGenerator.kt | 5 +++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/LocalRepo.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/LocalRepo.kt index e42cc75d..5077d5b9 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/LocalRepo.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/LocalRepo.kt @@ -39,7 +39,7 @@ open class LocalRepo @Inject constructor(val kobaltSettings: KobaltSettings) { v2.compareTo(v1) // we want the most recent at position 0 }) val result = directories[0].name - val newDep = LocalDep(MavenId.create(groupId, artifactId, packaging, result), this) + val newDep = LocalDep(MavenId.create(groupId, artifactId, packaging, null, result), this) if (existsPom(newDep, result) && existsJar(newDep, result)) { return result } diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/MavenId.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/MavenId.kt index e80d5925..1ab12db7 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/MavenId.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/MavenId.kt @@ -14,11 +14,11 @@ import org.eclipse.aether.artifact.DefaultArtifact * usually means "latest version") but it doesn't handle version ranges yet. */ class MavenId private constructor(val groupId: String, val artifactId: String, val packaging: String?, - val version: String?) { + val classifier: String?, val version: String?) { companion object { fun isMavenId(id: String) = with(id.split(":")) { - size == 3 || size == 4 + size >= 3 && size <= 5 } fun isRangedVersion(s: String): Boolean { @@ -29,7 +29,7 @@ class MavenId private constructor(val groupId: String, val artifactId: String, v * Similar to create(MavenId) but don't run IMavenIdInterceptors. */ fun createNoInterceptors(id: String) : MavenId = DefaultArtifact(id).run { - MavenId(groupId, artifactId, extension, version) + MavenId(groupId, artifactId, extension, classifier, version) } fun toKobaltId(id: String) = if (id.endsWith(":")) id + "(0,]" else id @@ -51,18 +51,19 @@ class MavenId private constructor(val groupId: String, val artifactId: String, v return interceptedMavenId } - fun create(groupId: String, artifactId: String, packaging: String?, version: String?) = - create(toId(groupId, artifactId, packaging, version)) + fun create(groupId: String, artifactId: String, packaging: String?, classifier: String?, version: String?) = + create(toId(groupId, artifactId, packaging, classifier, version)) - fun toId(groupId: String, artifactId: String, packaging: String? = null, version: String?) = + fun toId(groupId: String, artifactId: String, packaging: String? = null, classifier: String? = null, version: String?) = "$groupId:$artifactId" + (if (packaging != null && packaging != "") ":$packaging" else "") + + (if (classifier != null && classifier != "") ":$classifier" else "") + ":$version" } val hasVersion = version != null - val toId = MavenId.toId(groupId, artifactId, packaging, version) + val toId = MavenId.toId(groupId, artifactId, packaging, classifier, version) } diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/PomGenerator.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/PomGenerator.kt index 460ccc4e..2ccc9250 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/PomGenerator.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/PomGenerator.kt @@ -56,10 +56,11 @@ public class PomGenerator @Inject constructor(@Assisted val project: Project) { val buildDir = KFiles.makeDir(project.directory, project.buildDirectory) val outputDir = KFiles.makeDir(buildDir.path, "libs") - val mavenId = MavenId.create(project.group!!, project.artifactId!!, project.packaging, project.version!!) + val NO_CLASSIFIER = null + val mavenId = MavenId.create(project.group!!, project.artifactId!!, project.packaging, NO_CLASSIFIER, project.version!!) val pomFile = SimpleDep(mavenId).toPomFileName() val outputFile = File(outputDir, pomFile) outputFile.writeText(s.toString(), Charset.defaultCharset()) log(1, " Created $outputFile") } -} \ No newline at end of file +} From f100f9bd623c9b72e69558b20e0f403b09404941 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 6 May 2016 00:40:53 -0800 Subject: [PATCH 09/29] 0.766. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 0be21777..1116470e 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.764 \ No newline at end of file +kobalt.version=0.766 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index 3b136115..18eba2f5 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.764 +kobalt.version=0.766 From 268b9a400f5dc2b7c38dfd85e5b35c026af092b4 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 6 May 2016 01:13:02 -0800 Subject: [PATCH 10/29] Relative compile dependencies should be resolved correctly. Related to https://github.com/cbeust/kobalt-intellij-plugin/issues/24 --- .../com/beust/kobalt/api/KobaltContext.kt | 6 ++++++ .../beust/kobalt/internal/build/BuildFile.kt | 5 +++++ .../beust/kobalt/maven/DependencyManager.kt | 20 +++++++++++++++++-- .../com/beust/kobalt/app/BuildFileCompiler.kt | 9 +++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt index 5a9cba74..292bb255 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/KobaltContext.kt @@ -7,6 +7,7 @@ import com.beust.kobalt.internal.KobaltSettings import com.beust.kobalt.internal.PluginInfo import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.misc.KobaltExecutors +import java.io.File class KobaltContext(val args: Args) { var variant: Variant = Variant() @@ -47,4 +48,9 @@ class InternalContext { * will be disabled. */ var buildFileOutOfDate: Boolean = false + + /** + * The absolute directory of the current project. + */ + var absoluteDir: File? = null } \ No newline at end of file diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt index e4efb9e9..d7f8e831 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt @@ -23,4 +23,9 @@ class BuildFile(val path: Path, val name: String, val realPath: Path = path) { val dotKobaltDir: File get() = File(directory.parentFile.parentFile, KFiles.KOBALT_DOT_DIR).apply { mkdirs() } + + /** + * @return the absolute directory of this build file, assuming the build file is in $project/kobalt/src/Build.kt + */ + val absoluteDir = path.parent.parent.parent.toFile() } diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/DependencyManager.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/DependencyManager.kt index 968056b6..6085ad61 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/DependencyManager.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/maven/DependencyManager.kt @@ -7,6 +7,7 @@ import com.beust.kobalt.maven.dependency.FileDependency import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.KobaltExecutors import com.beust.kobalt.misc.log +import com.beust.kobalt.misc.warn import com.google.common.collect.ArrayListMultimap import java.io.File import java.util.* @@ -30,7 +31,15 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors, val val path = if (project?.directory != null) { val idPath = id.substring(FileDependency.PREFIX_FILE.length) if (! File(idPath).isAbsolute) { - File(project!!.directory, idPath) + // If the project directory is relative, we might not be in the correct directory to locate + // that file, so we'll use the absolute directory deduced from the build file path. Pick + // the first one that produces an actual file + val result = listOf(File(project!!.directory), Kobalt.context?.internalContext?.absoluteDir).map { + File(it, idPath) + }.first { + it.exists() + } + result } else { File(idPath) } @@ -119,7 +128,14 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors, val } } - val result2 = reorderDependencies(result).filter { + val reordered = reorderDependencies(result) + + val nonexistent = reordered.filter{ ! it.jarFile.get().exists() } + if (nonexistent.any()) { + warn("Nonexistent dependencies: $nonexistent") + } + + val result2 = reordered.filter { // Only keep existent files (nonexistent files are probably optional dependencies or parent poms // that point to other poms but don't have a jar file themselves) it.jarFile.get().exists() diff --git a/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt b/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt index 47918c44..58ee7438 100644 --- a/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt +++ b/src/main/kotlin/com/beust/kobalt/app/BuildFileCompiler.kt @@ -73,6 +73,11 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b val pluginUrls = parsedBuildFile.pluginUrls val buildScriptJarFile = File(KFiles.findBuildScriptLocation(buildFile, SCRIPT_JAR)) + // + // Save the current build script absolute directory + // + context.internalContext.absoluteDir = buildFile.absoluteDir + // If the script jar files were generated by a different version, wipe them in case the API // changed in-between buildScriptJarFile.parentFile.let { dir -> @@ -96,6 +101,10 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b errorTaskResult = taskResult } } + + // Clear the absolute dir + context.internalContext.absoluteDir = null + } val pluginUrls = parsedBuildFiles.flatMap { it.pluginUrls } return FindProjectResult(projects, pluginUrls, if (errorTaskResult != null) errorTaskResult!! else TaskResult()) From 899ea666ea68862a266c28acddf681bb6ca94b5b Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 6 May 2016 01:14:41 -0800 Subject: [PATCH 11/29] 0.767. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 1116470e..a4bb4348 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.766 \ No newline at end of file +kobalt.version=0.767 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index 18eba2f5..043911f4 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.766 +kobalt.version=0.767 From 73cf2a9ab6e059fbb847169f2120b5ffd673bf4f Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 6 May 2016 01:41:10 -0800 Subject: [PATCH 12/29] Forgot to add these contributors. --- .../com/beust/kobalt/internal/KobaltPluginXml.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt index 3fa77f17..6864d5a2 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt @@ -176,8 +176,17 @@ class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?, if (this is IIncrementalAssemblyContributor) incrementalAssemblyContributors.add(this) // Not documented yet - if (this is ITestJvmFlagContributor) testJvmFlagContributors.add(this) + if (this is ITestJvmFlagContributor) { + println("ADDING CONTRIBUTOR $this") + testJvmFlagContributors.add(this) + } if (this is ITestJvmFlagInterceptor) testJvmFlagInterceptors.add(this) + + if (it.contains("CoverageAgent")) { + val rec = this + println("IS: " + (rec is ITestJvmFlagContributor)) + println("DONOTCOMMIT") + } } } } @@ -199,7 +208,7 @@ class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?, } /** - * Populate pluginInfo with what was found in the plug-in's kobalt-plugin.xml + * Add the content of @param[pluginInfo] to this pluginInfo. */ fun addPluginInfo(pluginInfo: PluginInfo) { log(2, "Found new plug-in, adding it to pluginInfo: $pluginInfo") @@ -226,6 +235,7 @@ class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?, buildConfigContributors.addAll(pluginInfo.buildConfigContributors) assemblyContributors.addAll(pluginInfo.assemblyContributors) incrementalAssemblyContributors.addAll(pluginInfo.incrementalAssemblyContributors) + testJvmFlagContributors.addAll(pluginInfo.testJvmFlagContributors) testJvmFlagInterceptors.addAll(pluginInfo.testJvmFlagInterceptors) } } From 6e22f7bbafa2e17853ac175abf7220fa93555a0b Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 6 May 2016 01:44:15 -0800 Subject: [PATCH 13/29] Didn't mean to commit this. --- .../com/beust/kobalt/internal/KobaltPluginXml.kt | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt index 6864d5a2..ab0c374b 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt @@ -176,17 +176,8 @@ class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?, if (this is IIncrementalAssemblyContributor) incrementalAssemblyContributors.add(this) // Not documented yet - if (this is ITestJvmFlagContributor) { - println("ADDING CONTRIBUTOR $this") - testJvmFlagContributors.add(this) - } + if (this is ITestJvmFlagContributor) testJvmFlagContributors.add(this) if (this is ITestJvmFlagInterceptor) testJvmFlagInterceptors.add(this) - - if (it.contains("CoverageAgent")) { - val rec = this - println("IS: " + (rec is ITestJvmFlagContributor)) - println("DONOTCOMMIT") - } } } } From 4c141ce767bbdada2ba51a9a7b7b4cd13a0eb057 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 6 May 2016 01:48:10 -0800 Subject: [PATCH 14/29] 0.768. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index a4bb4348..626f4765 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.767 \ No newline at end of file +kobalt.version=0.768 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index 043911f4..344bdedf 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.767 +kobalt.version=0.768 From 475cbcf8f7ffc52c9e78ea0d8d6457f74d536afa Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 6 May 2016 02:23:44 -0800 Subject: [PATCH 15/29] ping command. --- src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt b/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt index b37e6209..ac908e82 100644 --- a/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt +++ b/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt @@ -28,7 +28,7 @@ class SparkServer(val initCallback: (String) -> List, val cleanUpCallba override fun run(port: Int) { Spark.port(port) - Spark.get("/hello", { req, res -> "Hello world" }) + Spark.get("/ping", { req, res -> "The Kobalt server is up and running" }) Spark.get("/v0/getDependencies", "application/json", Route { request, response -> val buildFile = request.queryParams("buildFile") initCallback(buildFile) From 28d6f21c9e9a92149cec5567a25964023876ac84 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 6 May 2016 02:44:36 -0800 Subject: [PATCH 16/29] Fix comment. --- .../main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt index d7f8e831..1665e6d4 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt @@ -25,7 +25,8 @@ class BuildFile(val path: Path, val name: String, val realPath: Path = path) { } /** - * @return the absolute directory of this build file, assuming the build file is in $project/kobalt/src/Build.kt + * @return the absolute directory of this projects' location, assuming the build file is in + * $project/kobalt/src/Build.kt. */ val absoluteDir = path.parent.parent.parent.toFile() } From 36c48b300034a145eb74051b4e344743bb325b6c Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sat, 7 May 2016 06:43:13 -0700 Subject: [PATCH 17/29] Quit command. --- src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt b/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt index ac908e82..e71c10f1 100644 --- a/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt +++ b/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt @@ -29,6 +29,10 @@ class SparkServer(val initCallback: (String) -> List, val cleanUpCallba override fun run(port: Int) { Spark.port(port) Spark.get("/ping", { req, res -> "The Kobalt server is up and running" }) + Spark.get("/quit", { + req, res -> println("Kobalt server quitting...") + Spark.stop() + }) Spark.get("/v0/getDependencies", "application/json", Route { request, response -> val buildFile = request.queryParams("buildFile") initCallback(buildFile) From 6a5c71ecea315e10cc0ab067667e63916dc2c065 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sat, 7 May 2016 07:48:00 -0700 Subject: [PATCH 18/29] Trying to debug the NPE. --- .../kotlin/com/beust/kobalt/internal/build/BuildFile.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt index 1665e6d4..dfa11f6f 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt @@ -1,6 +1,7 @@ package com.beust.kobalt.internal.build import com.beust.kobalt.misc.KFiles +import com.beust.kobalt.misc.log import java.io.File import java.nio.file.Files import java.nio.file.Path @@ -28,5 +29,8 @@ class BuildFile(val path: Path, val name: String, val realPath: Path = path) { * @return the absolute directory of this projects' location, assuming the build file is in * $project/kobalt/src/Build.kt. */ - val absoluteDir = path.parent.parent.parent.toFile() + val absoluteDir : File get() { + log(1, "Current path: $path") + return path.parent.parent.parent.toFile() + } } From 025f2de38eb402ad0a3bceabb53983b0fe2cc188 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sat, 7 May 2016 08:00:42 -0700 Subject: [PATCH 19/29] NPE work. --- .../main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt index dfa11f6f..e8b89078 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt @@ -29,8 +29,8 @@ class BuildFile(val path: Path, val name: String, val realPath: Path = path) { * @return the absolute directory of this projects' location, assuming the build file is in * $project/kobalt/src/Build.kt. */ - val absoluteDir : File get() { + val absoluteDir : File? get() { log(1, "Current path: $path") - return path.parent.parent.parent.toFile() + return path.parent?.parent?.parent?.toFile() } } From 86069ed0ef9dacdf6fdc406cf6d3a4dee81a77ee Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sat, 7 May 2016 08:36:56 -0700 Subject: [PATCH 20/29] Typo. --- .../main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt index e8b89078..f23b1716 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/build/BuildFile.kt @@ -26,7 +26,7 @@ class BuildFile(val path: Path, val name: String, val realPath: Path = path) { } /** - * @return the absolute directory of this projects' location, assuming the build file is in + * @return the absolute directory of this project's location, assuming the build file is in * $project/kobalt/src/Build.kt. */ val absoluteDir : File? get() { From 1d973a2d01d4311631335446365ca3dc7aa08d9a Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sat, 7 May 2016 08:37:11 -0700 Subject: [PATCH 21/29] 0.771. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 626f4765..985028aa 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.768 \ No newline at end of file +kobalt.version=0.771 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index 344bdedf..57874689 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.768 +kobalt.version=0.771 From d084718fd6f54753174555fdf069aeda9873c40c Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sat, 7 May 2016 10:30:37 -0700 Subject: [PATCH 22/29] 0.772. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index 985028aa..a2367e57 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.771 \ No newline at end of file +kobalt.version=0.772 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index 57874689..e578b4b7 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.771 +kobalt.version=0.772 From 2367d7aab66dc00fffc87e241d36815356a27d69 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sun, 8 May 2016 17:39:58 -0700 Subject: [PATCH 23/29] Shut down the Spark server more gracefully. --- .../com/beust/kobalt/app/remote/SparkServer.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt b/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt index e71c10f1..996d4296 100644 --- a/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt +++ b/src/main/kotlin/com/beust/kobalt/app/remote/SparkServer.kt @@ -7,6 +7,7 @@ import com.google.gson.Gson import spark.ResponseTransformer import spark.Route import spark.Spark +import java.util.concurrent.Executors class SparkServer(val initCallback: (String) -> List, val cleanUpCallback: () -> Unit) : KobaltServer .IServer { @@ -29,9 +30,15 @@ class SparkServer(val initCallback: (String) -> List, val cleanUpCallba override fun run(port: Int) { Spark.port(port) Spark.get("/ping", { req, res -> "The Kobalt server is up and running" }) - Spark.get("/quit", { - req, res -> println("Kobalt server quitting...") - Spark.stop() + Spark.get("/quit", { req, res -> + Executors.newFixedThreadPool(1).let { executor -> + executor.submit { + Thread.sleep(1000) + Spark.stop() + executor.shutdown() + } + "ok" + } }) Spark.get("/v0/getDependencies", "application/json", Route { request, response -> val buildFile = request.queryParams("buildFile") From 7ecb0dbd5064688466e8a52076ce89d989c90d37 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sun, 8 May 2016 17:41:13 -0700 Subject: [PATCH 24/29] 0.773. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index a2367e57..a4bead31 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.772 \ No newline at end of file +kobalt.version=0.773 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index e578b4b7..78df3fd9 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.772 +kobalt.version=0.773 From 50ef5e3269825aa64502bf42a2a8fc528c3e7095 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sun, 8 May 2016 22:08:57 -0800 Subject: [PATCH 25/29] [GITHUB-0.772] Bad flags from IJvmTestContributor. Fixes https://github.com/cbeust/kobalt/issues/196 --- .../com/beust/kobalt/internal/GenericRunner.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt index 16188c0c..7da58b79 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt @@ -63,31 +63,31 @@ abstract class GenericTestRunner: ITestRunnerContributor { addAll(testConfig.jvmArgs) add("-classpath") add(classpath.map { it.jarFile.get().absolutePath }.joinToString(File.pathSeparator)) - add(mainClass) } val pluginInfo = Kobalt.INJECTOR.getInstance(PluginInfo::class.java) // JVM flags from the contributors - val flagsFromContributors = pluginInfo.testJvmFlagContributors.flatMap { + val jvmFlagsFromContributors = pluginInfo.testJvmFlagContributors.flatMap { it.testJvmFlagsFor(project, context, jvmFlags) } // JVM flags from the interceptors (these overwrite flags instead of just adding to the list) - var interceptedArgs = ArrayList(jvmFlags + flagsFromContributors) + var interceptedJvmFlags = ArrayList(jvmFlags + jvmFlagsFromContributors) pluginInfo.testJvmFlagInterceptors.forEach { - val newFlags = it.testJvmFlagsFor(project, context, interceptedArgs) - interceptedArgs.clear() - interceptedArgs.addAll(newFlags) + val newFlags = it.testJvmFlagsFor(project, context, interceptedJvmFlags) + interceptedJvmFlags.clear() + interceptedJvmFlags.addAll(newFlags) } - if (interceptedArgs.any()) { - log(2, "Final JVM test flags after running the contributors and interceptors: $interceptedArgs") + if (interceptedJvmFlags.any()) { + log(2, "Final JVM test flags after running the contributors and interceptors: $interceptedJvmFlags") } val allArgs = arrayListOf().apply { add(java!!.absolutePath) - addAll(interceptedArgs) + addAll(interceptedJvmFlags) + add(mainClass) addAll(args) } From 86af9256a2106415c0860e26cb8bd38d70514d3b Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sun, 8 May 2016 22:09:49 -0800 Subject: [PATCH 26/29] 0.774. --- kobalt/wrapper/kobalt-wrapper.properties | 2 +- src/main/resources/kobalt.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties index a4bead31..4c0c3afd 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.773 \ No newline at end of file +kobalt.version=0.774 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index 78df3fd9..88936c80 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.773 +kobalt.version=0.774 From 52e4d404bc451502cb9050a927bb45501ccac24a Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sun, 8 May 2016 23:23:37 -0800 Subject: [PATCH 27/29] Tests for ITestJvmFlag{Contributor,Interceptor}. --- .../beust/kobalt/internal/GenericRunner.kt | 68 ++++++++++------- .../beust/kobalt/internal/KobaltPluginXml.kt | 19 ++++- .../kobalt/internal/GenericRunnerTest.kt | 75 +++++++++++++++++++ 3 files changed, 130 insertions(+), 32 deletions(-) create mode 100644 src/test/kotlin/com/beust/kobalt/internal/GenericRunnerTest.kt diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt index 7da58b79..90266dab 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt @@ -4,6 +4,7 @@ import com.beust.kobalt.* import com.beust.kobalt.api.* import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.log +import com.google.common.annotations.VisibleForTesting import java.io.File import java.util.* @@ -48,8 +49,6 @@ abstract class GenericTestRunner: ITestRunnerContributor { */ fun runTests(project: Project, context: KobaltContext, classpath: List, configName: String) : Boolean { - val jvm = JavaInfo.create(File(SystemProperties.javaBase)) - val java = jvm.javaExecutable var result = false val testConfig = project.testConfigs.firstOrNull { it.name == configName } @@ -58,35 +57,12 @@ abstract class GenericTestRunner: ITestRunnerContributor { val args = args(project, classpath, testConfig) if (args.size > 0) { - // Default JVM args - val jvmFlags = arrayListOf().apply { - addAll(testConfig.jvmArgs) - add("-classpath") - add(classpath.map { it.jarFile.get().absolutePath }.joinToString(File.pathSeparator)) - } - - val pluginInfo = Kobalt.INJECTOR.getInstance(PluginInfo::class.java) - - // JVM flags from the contributors - val jvmFlagsFromContributors = pluginInfo.testJvmFlagContributors.flatMap { - it.testJvmFlagsFor(project, context, jvmFlags) - } - - // JVM flags from the interceptors (these overwrite flags instead of just adding to the list) - var interceptedJvmFlags = ArrayList(jvmFlags + jvmFlagsFromContributors) - pluginInfo.testJvmFlagInterceptors.forEach { - val newFlags = it.testJvmFlagsFor(project, context, interceptedJvmFlags) - interceptedJvmFlags.clear() - interceptedJvmFlags.addAll(newFlags) - } - - if (interceptedJvmFlags.any()) { - log(2, "Final JVM test flags after running the contributors and interceptors: $interceptedJvmFlags") - } - + val java = JavaInfo.create(File(SystemProperties.javaBase)).javaExecutable + val jvmArgs = calculateAllJvmArgs(project, context, testConfig, classpath, + Kobalt.INJECTOR.getInstance (PluginInfo::class.java)) val allArgs = arrayListOf().apply { add(java!!.absolutePath) - addAll(interceptedJvmFlags) + addAll(jvmArgs) add(mainClass) addAll(args) } @@ -113,5 +89,39 @@ abstract class GenericTestRunner: ITestRunnerContributor { } return result } + + /* + ** @return all the JVM flags from contributors and interceptors. + */ + @VisibleForTesting + fun calculateAllJvmArgs(project: Project, context: KobaltContext, + testConfig: TestConfig, classpath: List, pluginInfo: IPluginInfo) : List { + // Default JVM args + val jvmFlags = arrayListOf().apply { + addAll(testConfig.jvmArgs) + add("-classpath") + add(classpath.map { it.jarFile.get().absolutePath }.joinToString(File.pathSeparator)) + } + + // JVM flags from the contributors + val jvmFlagsFromContributors = pluginInfo.testJvmFlagContributors.flatMap { + it.testJvmFlagsFor(project, context, jvmFlags) + } + + // JVM flags from the interceptors (these overwrite flags instead of just adding to the list) + var result = ArrayList(jvmFlags + jvmFlagsFromContributors) + pluginInfo.testJvmFlagInterceptors.forEach { + val newFlags = it.testJvmFlagsFor(project, context, result) + result.clear() + result.addAll(newFlags) + } + + if (result.any()) { + log(2, "Final JVM test flags after running the contributors and interceptors: $result") + } + + return result + } + } diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt index ab0c374b..b062dc62 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/KobaltPluginXml.kt @@ -50,12 +50,22 @@ class ClassNameXml { var className: List = arrayListOf() } +interface IPluginInfo { + val testJvmFlagContributors : List + val testJvmFlagInterceptors : List +} + +open class BasePluginInfo : IPluginInfo { + override val testJvmFlagContributors = arrayListOf() + override val testJvmFlagInterceptors = arrayListOf() +} /** * Turn a KobaltPluginXml (the raw content of kobalt-plugin.xml mapped to POJO's) into a PluginInfo object, which * contains all the contributors instantiated and other information that Kobalt can actually use. Kobalt code that * needs to access plug-in info can then just inject a PluginInfo object. */ -class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?, val classLoader: ClassLoader?) { +class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?, val classLoader: ClassLoader?) + : BasePluginInfo() { val plugins = arrayListOf() val projectContributors = arrayListOf() val classpathContributors = arrayListOf() @@ -80,8 +90,11 @@ class PluginInfo(val xml: KobaltPluginXml, val pluginClassLoader: ClassLoader?, // Not documented yet val buildConfigContributors = arrayListOf() val mavenIdInterceptors = arrayListOf() - val testJvmFlagContributors = arrayListOf() - val testJvmFlagInterceptors = arrayListOf() + + // Note: intentionally repeating them here even though they are defined by our base class so + // that this class always contains the full list of contributors and interceptors + override val testJvmFlagContributors = arrayListOf() + override val testJvmFlagInterceptors = arrayListOf() companion object { /** diff --git a/src/test/kotlin/com/beust/kobalt/internal/GenericRunnerTest.kt b/src/test/kotlin/com/beust/kobalt/internal/GenericRunnerTest.kt new file mode 100644 index 00000000..b23de295 --- /dev/null +++ b/src/test/kotlin/com/beust/kobalt/internal/GenericRunnerTest.kt @@ -0,0 +1,75 @@ +package com.beust.kobalt.internal + +import com.beust.kobalt.Args +import com.beust.kobalt.TestConfig +import com.beust.kobalt.TestModule +import com.beust.kobalt.api.* +import com.beust.kobalt.maven.dependency.FileDependency +import com.beust.kobalt.project +import org.assertj.core.api.Assertions.assertThat +import org.testng.annotations.BeforeClass +import org.testng.annotations.Test +import javax.inject.Inject + + +/** + * Test ITestJvmFlagContributor and ITestJvmFlagInterceptor. + */ +class DependencyTest @Inject constructor() { + private val project : Project get() = project { name = "dummy" } + private val classpath = listOf(FileDependency("/tmp/a.jar")) + private val context = KobaltContext(Args()) + private val contributor = object : ITestJvmFlagContributor { + override fun testJvmFlagsFor(project: Project, context: KobaltContext, + currentFlags: List): List { + return listOf("-agent", "foo") + } + } + private val A_JAR = "/tmp/a.jar" + private val B_JAR = "/tmp/b.jar" + + private val interceptor = object : ITestJvmFlagInterceptor { + override fun testJvmFlagsFor(project: Project, context: KobaltContext, + currentFlags: List): List { + return currentFlags.map { if (it == A_JAR) B_JAR else it } + } + } + + @BeforeClass + fun beforeClass() { + Kobalt.init(TestModule()) + } + + private fun runTest(pluginInfo: IPluginInfo, expected: List) { + val result = TestNgRunner().calculateAllJvmArgs(project, context, TestConfig(project), + classpath, pluginInfo) + assertThat(result).isEqualTo(expected) + } + + @Test + fun noContributorsNoInterceptors() { + runTest(BasePluginInfo(), listOf("-classpath", A_JAR)) + } + + @Test + fun contributorOnly() { + runTest(BasePluginInfo().apply { testJvmFlagContributors.add(contributor) }, + listOf("-classpath", A_JAR, "-agent", "foo")) + } + + @Test + fun interceptorOnly() { + runTest(BasePluginInfo().apply { testJvmFlagInterceptors.add(interceptor) }, + listOf("-classpath", B_JAR)) + } + + @Test + fun contributorAndInterceptor() { + runTest(BasePluginInfo().apply { + testJvmFlagContributors.add(contributor) + testJvmFlagInterceptors.add(interceptor) + }, + listOf("-classpath", B_JAR, "-agent", "foo")) + } +} + From d945d743754a9ffc5c50a715e7fc32d51231a3b1 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sun, 8 May 2016 23:23:44 -0800 Subject: [PATCH 28/29] public. --- src/test/kotlin/com/beust/kobalt/maven/DependencyTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/kotlin/com/beust/kobalt/maven/DependencyTest.kt b/src/test/kotlin/com/beust/kobalt/maven/DependencyTest.kt index cb6a0bec..adc7096f 100644 --- a/src/test/kotlin/com/beust/kobalt/maven/DependencyTest.kt +++ b/src/test/kotlin/com/beust/kobalt/maven/DependencyTest.kt @@ -10,7 +10,7 @@ import javax.inject.Inject import kotlin.properties.Delegates @Guice(modules = arrayOf(TestModule::class)) -public class DependencyTest @Inject constructor(val executors: KobaltExecutors) { +class DependencyTest @Inject constructor(val executors: KobaltExecutors) { @DataProvider fun dpVersions(): Array> { From 72e0caecbfa3f74ea90c5f336b22f30fb498785c Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sun, 8 May 2016 23:24:43 -0800 Subject: [PATCH 29/29] Refactor. --- .../kotlin/com/beust/kobalt/internal/GenericRunnerTest.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/test/kotlin/com/beust/kobalt/internal/GenericRunnerTest.kt b/src/test/kotlin/com/beust/kobalt/internal/GenericRunnerTest.kt index b23de295..fcf04494 100644 --- a/src/test/kotlin/com/beust/kobalt/internal/GenericRunnerTest.kt +++ b/src/test/kotlin/com/beust/kobalt/internal/GenericRunnerTest.kt @@ -16,8 +16,11 @@ import javax.inject.Inject * Test ITestJvmFlagContributor and ITestJvmFlagInterceptor. */ class DependencyTest @Inject constructor() { + private val A_JAR = "/tmp/a.jar" + private val B_JAR = "/tmp/b.jar" + private val project : Project get() = project { name = "dummy" } - private val classpath = listOf(FileDependency("/tmp/a.jar")) + private val classpath = listOf(FileDependency(A_JAR)) private val context = KobaltContext(Args()) private val contributor = object : ITestJvmFlagContributor { override fun testJvmFlagsFor(project: Project, context: KobaltContext, @@ -25,8 +28,6 @@ class DependencyTest @Inject constructor() { return listOf("-agent", "foo") } } - private val A_JAR = "/tmp/a.jar" - private val B_JAR = "/tmp/b.jar" private val interceptor = object : ITestJvmFlagInterceptor { override fun testJvmFlagsFor(project: Project, context: KobaltContext,