From 15efe61a7425c6ac9b3018abb401ca5821f89928 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 2 Feb 2016 21:20:05 +0400 Subject: [PATCH 1/6] Use the suffix. --- .../src/main/kotlin/com/beust/kobalt/Variant.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt index 3d9380d1..3b57d68c 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt @@ -56,12 +56,12 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null, // // The ordering of files is: 1) build type 2) product flavor 3) default buildType.let { - val dir = File(KFiles.joinDir("src", it.name, project.projectInfo.sourceDirectory)) + val dir = File(KFiles.joinDir("src", it.name, suffix)) log(3, "Adding source for build type ${it.name}: ${dir.path}") result.add(dir) } productFlavor.let { - val dir = File(KFiles.joinDir("src", it.name, project.projectInfo.sourceDirectory)) + val dir = File(KFiles.joinDir("src", it.name, suffix)) log(3, "Adding source for product flavor ${it.name}: ${dir.path}") result.add(dir) } From 93415868b07ff855cb2ef284498da20ccb05b38a Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 2 Feb 2016 21:30:29 +0400 Subject: [PATCH 2/6] Refactoring toward mixed mode. --- .../src/main/kotlin/com/beust/kobalt/Variant.kt | 5 +++-- .../kotlin/com/beust/kobalt/internal/ProjectInfo.kt | 11 ++++++++--- .../kotlin/com/beust/kobalt/plugin/java/JavaPlugin.kt | 2 +- .../com/beust/kobalt/plugin/java/JavaProjectInfo.kt | 4 ++-- .../com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt | 2 +- .../beust/kobalt/plugin/kotlin/KotlinProjectInfo.kt | 4 ++-- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt index 3b57d68c..12a2c01b 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt @@ -36,8 +36,9 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null, fun resDirectories(project: Project) : List = sourceDirectories(project, "res") - fun sourceDirectories(project: Project) : List = - sourceDirectories(project, project.projectInfo.sourceDirectory) + fun sourceDirectories(project: Project) = project.projectInfo.sourceSuffixes.flatMap { + sourceDirectories(project, it) + } /** * suffix is either "java" (to find source files) or "res" (to find resources) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ProjectInfo.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ProjectInfo.kt index 300be5a2..81971559 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ProjectInfo.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ProjectInfo.kt @@ -7,12 +7,15 @@ import com.beust.kobalt.api.KobaltContext import com.beust.kobalt.api.Project import java.util.* +class LanguageInfo(val name: String, val suffix : String = name) + /** * Data that is useful for projects to have but should not be specified in the DSL. */ interface IProjectInfo { - /** Used to determine the last directory segment of the flavored sources, e.g. src/main/JAVA */ - val sourceDirectory : String + val languageInfos: List + + val sourceSuffixes: List val defaultSourceDirectories: HashSet val defaultTestDirectories: HashSet @@ -37,9 +40,11 @@ interface IProjectInfo { fun dependsOnDirtyProjects(project: Project) = project.projectInfo.dependsOn.any { it.projectInfo.isDirty } } -abstract class BaseProjectInfo : IProjectInfo { +abstract class BaseProjectInfo(override val languageInfos: List) : IProjectInfo { abstract fun generate(field: BuildConfigField) : String + override val sourceSuffixes = languageInfos.map { it.suffix } + fun generate(type: String, name: String, value: Any) = generate(BuildConfigField(type, name, value)) fun generateFieldsFromContributors(project: Project, context: KobaltContext) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/java/JavaPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/java/JavaPlugin.kt index f3a21975..2b3b1aa1 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/java/JavaPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/java/JavaPlugin.kt @@ -37,7 +37,7 @@ class JavaPlugin @Inject constructor( // IDocContributor override fun affinity(project: Project, context: KobaltContext) = - if (project.sourceSuffix == ".java") 1 else 0 + if (project.sourceDirectories.any { it.contains("java") }) 1 else 0 override fun generateDoc(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult { val result = diff --git a/src/main/kotlin/com/beust/kobalt/plugin/java/JavaProjectInfo.kt b/src/main/kotlin/com/beust/kobalt/plugin/java/JavaProjectInfo.kt index 6084e94d..11f55760 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/java/JavaProjectInfo.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/java/JavaProjectInfo.kt @@ -6,11 +6,11 @@ import com.beust.kobalt.api.BuildConfigField import com.beust.kobalt.api.KobaltContext import com.beust.kobalt.api.Project import com.beust.kobalt.internal.BaseProjectInfo +import com.beust.kobalt.internal.LanguageInfo import com.google.inject.Singleton @Singleton -class JavaProjectInfo : BaseProjectInfo() { - override val sourceDirectory = "java" +class JavaProjectInfo : BaseProjectInfo(listOf(LanguageInfo("java", "java"))) { override val defaultSourceDirectories = hashSetOf("src/main/java", "src/main/resources", "src/main/res") override val defaultTestDirectories = hashSetOf("src/test/java", "src/test/resources", "src/test/res") diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt index 2dee776e..6158236c 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt @@ -125,7 +125,7 @@ class KotlinPlugin @Inject constructor( // ICompilerContributor override fun affinity(project: Project, context: KobaltContext) = - if (project.sourceSuffix == ".kt") 1 else 0 + if (project.sourceDirectories.any { it.contains("kotlin") }) 2 else 0 override fun compile(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult { val result = diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinProjectInfo.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinProjectInfo.kt index ebdf70e1..9d951583 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinProjectInfo.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinProjectInfo.kt @@ -6,11 +6,11 @@ import com.beust.kobalt.api.BuildConfigField import com.beust.kobalt.api.KobaltContext import com.beust.kobalt.api.Project import com.beust.kobalt.internal.BaseProjectInfo +import com.beust.kobalt.internal.LanguageInfo import com.google.inject.Singleton @Singleton -class KotlinProjectInfo : BaseProjectInfo() { - override val sourceDirectory = "kotlin" +class KotlinProjectInfo : BaseProjectInfo(listOf(LanguageInfo("kotlin", "kt"))) { override val defaultSourceDirectories = hashSetOf("src/main/kotlin", "src/main/resources", "src/main/res") override val defaultTestDirectories = hashSetOf("src/test/kotlin", "src/test/resources", "src/test/res") From b474c2de37e86802a53049a25fd6b9c1b3515a79 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 2 Feb 2016 22:58:53 +0400 Subject: [PATCH 3/6] Mixed language projects. --- .../main/kotlin/com/beust/kobalt/Variant.kt | 16 ++-- .../beust/kobalt/api/ICompilerContributor.kt | 3 +- .../kotlin/com/beust/kobalt/api/Project.kt | 1 - .../com/beust/kobalt/internal/ActorUtils.kt | 7 ++ .../kobalt/internal/JvmCompilerPlugin.kt | 84 +++++++++---------- .../com/beust/kobalt/internal/ProjectInfo.kt | 10 +-- .../beust/kobalt/plugin/java/JavaPlugin.kt | 5 +- .../kobalt/plugin/java/JavaProjectInfo.kt | 3 +- .../kobalt/plugin/kotlin/KotlinPlugin.kt | 5 +- .../kobalt/plugin/kotlin/KotlinProjectInfo.kt | 3 +- .../plugin/packaging/PackagingPlugin.kt | 2 +- 11 files changed, 73 insertions(+), 66 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt index 12a2c01b..f6e6274c 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/Variant.kt @@ -1,6 +1,7 @@ package com.beust.kobalt import com.beust.kobalt.api.* +import com.beust.kobalt.internal.ActorUtils import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.log import java.io.File @@ -34,11 +35,14 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null, return result } - fun resDirectories(project: Project) : List = sourceDirectories(project, "res") - - fun sourceDirectories(project: Project) = project.projectInfo.sourceSuffixes.flatMap { + fun sourceDirectories(project: Project, context: KobaltContext) : List { + val compilers = ActorUtils.selectAffinityActors(project, context, context.pluginInfo.compilerContributors) + val sourceSuffixes = compilers.flatMap { it.sourceSuffixes } + val result = sourceSuffixes.flatMap { sourceDirectories(project, it) - } + }.toHashSet() + return result.toList() + } /** * suffix is either "java" (to find source files) or "res" (to find resources) @@ -141,7 +145,9 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null, // that directory will be added when trying to find recursively all the sources in it generatedSourceDirectory = File(result.relativeTo(File(project.directory))) val outputGeneratedSourceDirectory = File(result, pkg.replace('.', File.separatorChar)) - val outputDir = File(outputGeneratedSourceDirectory, "BuildConfig" + project.sourceSuffix) + val compilers = ActorUtils.selectAffinityActors(project, context, context.pluginInfo.compilerContributors) + val outputDir = File(outputGeneratedSourceDirectory, + "BuildConfig" + compilers[0].sourceSuffixes[0]) KFiles.saveFile(outputDir, code) log(2, "Generated ${outputDir.path}") return result diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/ICompilerContributor.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/ICompilerContributor.kt index 1de85643..4372d1ec 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/ICompilerContributor.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/ICompilerContributor.kt @@ -1,9 +1,8 @@ package com.beust.kobalt.api import com.beust.kobalt.TaskResult -import com.beust.kobalt.api.IClasspathDependency -import java.io.File interface ICompilerContributor : IProjectAffinity { + val sourceSuffixes: List fun compile(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult } diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Project.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Project.kt index 17dca103..a01ad682 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Project.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Project.kt @@ -16,7 +16,6 @@ open class Project( @Directive open var artifactId: String? = null, @Directive open var packaging: String? = null, @Directive open var dependencies: Dependencies? = null, - @Directive open var sourceSuffix : String = "", @Directive open var description : String = "", @Directive open var scm : Scm? = null, @Directive open var url: String? = null, diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ActorUtils.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ActorUtils.kt index 6216ecfb..42aac9e2 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ActorUtils.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ActorUtils.kt @@ -13,6 +13,13 @@ class ActorUtils { fun selectAffinityActor(project: Project, context: KobaltContext, actors: List) = actors.maxBy { it.affinity(project, context) } + /** + * Return all the plug-in actors with a non zero affinity sorted from the highest to the lowest. + */ + fun selectAffinityActors(project: Project, context: KobaltContext, actors: List) + = actors.filter { it.affinity(project, context) > 0 } + .sortedByDescending { it.affinity(project, context) } + /** * Return the plug-in actor with the highest affinity. */ 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 bd74d8a2..e96d1764 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 @@ -138,34 +138,6 @@ abstract class JvmCompilerPlugin @Inject constructor( project.projectProperties.put(COMPILER_ARGS, arrayListOf(*args)) } - fun isOutdated(project: Project, context: KobaltContext, actionInfo: CompilerActionInfo): Boolean { - fun stripSourceDir(sourceFile: String): String { - project.sourceDirectories.forEach { - val d = listOf(project.directory, it).joinToString("/") - if (sourceFile.startsWith(d)) return sourceFile.substring(d.length + 1) - } - throw KobaltException("Couldn't strip source dir from $sourceFile") - } - - fun stripSuffix(sourceFile: String): String { - val index = sourceFile.indexOf(project.sourceSuffix) - if (index >= 0) return sourceFile.substring(0, index) - else return sourceFile - } - - actionInfo.sourceFiles.map { it.replace("\\", "/") }.forEach { sourceFile -> - val stripped = stripSourceDir(sourceFile) - val classFile = File(KFiles.joinDir(project.directory, project.classesDir(context), - toClassFile(stripSuffix(stripped)))) - if (!classFile.exists() || File(sourceFile).lastModified() > classFile.lastModified()) { - log(2, "Outdated $sourceFile $classFile " + Date(File(sourceFile).lastModified()) + - " " + classFile.lastModified()) - return true - } - } - return false - } - @IncrementalTask(name = JvmCompilerPlugin.TASK_COMPILE, description = "Compile the project") fun taskCompile(project: Project): IncrementalTaskInfo { val inputChecksum = Md5.toMd5Directories(project.sourceDirectories.map { @@ -182,18 +154,32 @@ abstract class JvmCompilerPlugin @Inject constructor( private fun doTaskCompile(project: Project): TaskResult { // Set up the source files now that we have the variant - sourceDirectories.addAll(context.variant.sourceDirectories(project)) + sourceDirectories.addAll(context.variant.sourceDirectories(project, context)) val sourceDirectory = context.variant.maybeGenerateBuildConfig(project, context) if (sourceDirectory != null) { sourceDirectories.add(sourceDirectory) } - val info = createCompilerActionInfo(project, context, isTest = false) - val compiler = ActorUtils.selectAffinityActor(project, context, context.pluginInfo.compilerContributors) - if (compiler != null) { - return compiler.compile(project, context, info) - } else { +// val info = createCompilerActionInfo(project, context, isTest = false) +// val compiler = ActorUtils.selectAffinityActor(project, context, context.pluginInfo.compilerContributors) + val results = arrayListOf() + val compilers = ActorUtils.selectAffinityActors(project, context, context.pluginInfo.compilerContributors) + + var failedResult: TaskResult? = null + if (compilers.isEmpty()) { throw KobaltException("Couldn't find any compiler for project ${project.name}") + } else { + compilers.forEach { compiler -> + val info = createCompilerActionInfo(project, context, isTest = false, + sourceSuffixes = compiler.sourceSuffixes) + val thisResult = compiler.compile(project, context, info) + results.add(thisResult) + if (! thisResult.success && failedResult == null) { + failedResult = thisResult + } + } + return if (failedResult != null) failedResult!! + else results[0] } } @@ -214,8 +200,13 @@ abstract class JvmCompilerPlugin @Inject constructor( fun taskJavadoc(project: Project): TaskResult { val docGenerator = ActorUtils.selectAffinityActor(project, context, context.pluginInfo.docContributors) if (docGenerator != null) { - return docGenerator.generateDoc(project, context, createCompilerActionInfo(project, context, - isTest = false)) + val compilers = ActorUtils.selectAffinityActors(project, context, context.pluginInfo.compilerContributors) + var result: TaskResult? = null + compilers.forEach { compiler -> + result = docGenerator.generateDoc(project, context, createCompilerActionInfo(project, context, + isTest = false, sourceSuffixes = compiler.sourceSuffixes)) + } + return result!! } else { warn("Couldn't find any doc contributor for project ${project.name}") return TaskResult() @@ -234,8 +225,8 @@ abstract class JvmCompilerPlugin @Inject constructor( * Create a CompilerActionInfo (all the information that a compiler needs to know) for the given parameters. * Runs all the contributors and interceptors relevant to that task. */ - protected fun createCompilerActionInfo(project: Project, context: KobaltContext, isTest: Boolean): - CompilerActionInfo { + protected fun createCompilerActionInfo(project: Project, context: KobaltContext, isTest: Boolean, + sourceSuffixes: List): CompilerActionInfo { copyResources(project, JvmCompilerPlugin.SOURCE_SET_MAIN) val fullClasspath = if (isTest) dependencyManager.testDependencies(project, context) @@ -271,14 +262,23 @@ abstract class JvmCompilerPlugin @Inject constructor( File(project.directory, it.path).exists() } - // Now that we have the final list of source dirs, find source files in them val sourceFiles = files.findRecursively(projectDirectory, sourceDirectories, - { it.endsWith(project.sourceSuffix) }) + { file -> sourceSuffixes.any { file.endsWith(it) }}) .map { File(projectDirectory, it).path } + // Special treatment if we are compiling Kotlin files and the project also has a java source + // directory. In this case, also pass that java source directory to the Kotlin compiler as is + // so that it can parse its symbols + val extraSourceFiles = arrayListOf() + if (sourceSuffixes.any { it.contains("kt")}) { + project.sourceDirectories.forEach { + if (it.contains("java")) extraSourceFiles.add(it) + } + } + // Finally, alter the info with the compiler interceptors before returning it - val initialActionInfo = CompilerActionInfo(projectDirectory.path, classpath, sourceFiles, buildDirectory, - emptyList()) + val initialActionInfo = CompilerActionInfo(projectDirectory.path, classpath, sourceFiles + extraSourceFiles, + buildDirectory, emptyList()) val result = context.pluginInfo.compilerInterceptors.fold(initialActionInfo, { ai, interceptor -> interceptor.intercept(project, context, ai) }) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ProjectInfo.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ProjectInfo.kt index 81971559..093bc45e 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ProjectInfo.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/ProjectInfo.kt @@ -7,16 +7,10 @@ import com.beust.kobalt.api.KobaltContext import com.beust.kobalt.api.Project import java.util.* -class LanguageInfo(val name: String, val suffix : String = name) - /** * Data that is useful for projects to have but should not be specified in the DSL. */ interface IProjectInfo { - val languageInfos: List - - val sourceSuffixes: List - val defaultSourceDirectories: HashSet val defaultTestDirectories: HashSet @@ -40,11 +34,9 @@ interface IProjectInfo { fun dependsOnDirtyProjects(project: Project) = project.projectInfo.dependsOn.any { it.projectInfo.isDirty } } -abstract class BaseProjectInfo(override val languageInfos: List) : IProjectInfo { +abstract class BaseProjectInfo : IProjectInfo { abstract fun generate(field: BuildConfigField) : String - override val sourceSuffixes = languageInfos.map { it.suffix } - fun generate(type: String, name: String, value: Any) = generate(BuildConfigField(type, name, value)) fun generateFieldsFromContributors(project: Project, context: KobaltContext) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/java/JavaPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/java/JavaPlugin.kt index 2b3b1aa1..f9590864 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/java/JavaPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/java/JavaPlugin.kt @@ -52,12 +52,15 @@ class JavaPlugin @Inject constructor( override fun doTaskCompileTest(project: Project): TaskResult { copyResources(project, JvmCompilerPlugin.SOURCE_SET_TEST) - val compilerActionInfo = createCompilerActionInfo(project, context, isTest = true) + val compilerActionInfo = createCompilerActionInfo(project, context, isTest = true, + sourceSuffixes = sourceSuffixes) val result = javaCompiler.compile(project, context, compilerActionInfo) return result } // ICompilerContributor + override val sourceSuffixes = listOf("java") + override fun compile(project: Project, context: KobaltContext, info: CompilerActionInfo) : TaskResult { val result = if (info.sourceFiles.size > 0) { diff --git a/src/main/kotlin/com/beust/kobalt/plugin/java/JavaProjectInfo.kt b/src/main/kotlin/com/beust/kobalt/plugin/java/JavaProjectInfo.kt index 11f55760..4f47d9ec 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/java/JavaProjectInfo.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/java/JavaProjectInfo.kt @@ -6,11 +6,10 @@ import com.beust.kobalt.api.BuildConfigField import com.beust.kobalt.api.KobaltContext import com.beust.kobalt.api.Project import com.beust.kobalt.internal.BaseProjectInfo -import com.beust.kobalt.internal.LanguageInfo import com.google.inject.Singleton @Singleton -class JavaProjectInfo : BaseProjectInfo(listOf(LanguageInfo("java", "java"))) { +class JavaProjectInfo : BaseProjectInfo() { override val defaultSourceDirectories = hashSetOf("src/main/java", "src/main/resources", "src/main/res") override val defaultTestDirectories = hashSetOf("src/test/java", "src/test/resources", "src/test/res") diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt index 6158236c..b0870435 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinPlugin.kt @@ -76,8 +76,9 @@ class KotlinPlugin @Inject constructor( copyResources(project, JvmCompilerPlugin.SOURCE_SET_TEST) val projectDir = File(project.directory) + val sourceFiles = files.findRecursively(projectDir, project.sourceDirectoriesTest.map { File(it) }) - { it: String -> it.endsWith(project.sourceSuffix) } + { file: String -> sourceSuffixes.any { file.endsWith(it) } } .map { File(projectDir, it).absolutePath } val result = @@ -124,6 +125,8 @@ class KotlinPlugin @Inject constructor( // ICompilerContributor + override val sourceSuffixes = listOf("kt") + override fun affinity(project: Project, context: KobaltContext) = if (project.sourceDirectories.any { it.contains("kotlin") }) 2 else 0 diff --git a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinProjectInfo.kt b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinProjectInfo.kt index 9d951583..8ba851bd 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinProjectInfo.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/kotlin/KotlinProjectInfo.kt @@ -6,11 +6,10 @@ import com.beust.kobalt.api.BuildConfigField import com.beust.kobalt.api.KobaltContext import com.beust.kobalt.api.Project import com.beust.kobalt.internal.BaseProjectInfo -import com.beust.kobalt.internal.LanguageInfo import com.google.inject.Singleton @Singleton -class KotlinProjectInfo : BaseProjectInfo(listOf(LanguageInfo("kotlin", "kt"))) { +class KotlinProjectInfo : BaseProjectInfo() { override val defaultSourceDirectories = hashSetOf("src/main/kotlin", "src/main/resources", "src/main/res") override val defaultTestDirectories = hashSetOf("src/test/kotlin", "src/test/resources", "src/test/res") diff --git a/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt index 8121c861..96550cdd 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt @@ -276,7 +276,7 @@ class PackageConfig(val project: Project) : AttributeHolder { jar { name = "${project.name}-${project.version}-sources.jar" project.sourceDirectories.forEach { - include(from(it), to(""), glob("**${project.sourceSuffix}")) + include(from(it), to(""), glob("src/**")) } } jar { From ddea0e191de7d70b59c62625194e990dd88741f1 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 2 Feb 2016 23:03:44 +0400 Subject: [PATCH 4/6] Tests for mixed projects. --- .../projects/javaFirst/kobalt/src/Build.kt | 27 ++++++++++++++++++ .../kobalt/wrapper/kobalt-wrapper.jar | Bin 0 -> 7253 bytes .../kobalt/wrapper/kobalt-wrapper.properties | 1 + src/test/resources/projects/javaFirst/kobaltw | 2 ++ .../src/main/java/example/JavaClass.java | 8 ++++++ .../src/main/kotlin/example/KotlinMain.kt | 6 ++++ .../projects/kotlinFirst/kobalt/src/Build.kt | 27 ++++++++++++++++++ .../kobalt/wrapper/kobalt-wrapper.jar | Bin 0 -> 7253 bytes .../kobalt/wrapper/kobalt-wrapper.properties | 1 + .../resources/projects/kotlinFirst/kobaltw | 2 ++ .../src/main/java/example/JavaMain.java | 8 ++++++ .../src/main/kotlin/example/KotlinClass.kt | 11 +++++++ 12 files changed, 93 insertions(+) create mode 100644 src/test/resources/projects/javaFirst/kobalt/src/Build.kt create mode 100644 src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.jar create mode 100644 src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.properties create mode 100755 src/test/resources/projects/javaFirst/kobaltw create mode 100644 src/test/resources/projects/javaFirst/src/main/java/example/JavaClass.java create mode 100644 src/test/resources/projects/javaFirst/src/main/kotlin/example/KotlinMain.kt create mode 100644 src/test/resources/projects/kotlinFirst/kobalt/src/Build.kt create mode 100644 src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.jar create mode 100644 src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.properties create mode 100755 src/test/resources/projects/kotlinFirst/kobaltw create mode 100644 src/test/resources/projects/kotlinFirst/src/main/java/example/JavaMain.java create mode 100644 src/test/resources/projects/kotlinFirst/src/main/kotlin/example/KotlinClass.kt diff --git a/src/test/resources/projects/javaFirst/kobalt/src/Build.kt b/src/test/resources/projects/javaFirst/kobalt/src/Build.kt new file mode 100644 index 00000000..3bc14f76 --- /dev/null +++ b/src/test/resources/projects/javaFirst/kobalt/src/Build.kt @@ -0,0 +1,27 @@ +import com.beust.kobalt.* +import com.beust.kobalt.plugin.packaging.assemble +import com.beust.kobalt.plugin.kotlin.* + +val repos = repos() + + +val p = kotlinProject { + + name = "mixed" + group = "com.example" + artifactId = name + version = "0.1" + + sourceDirectories { + path("src/main/java", "src/main/kotlin") + } + + assemble { + jar { + fatJar = true + manifest { + attributes("Main-Class", "example.KotlinMainKt") + } + } + } +} diff --git a/src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.jar b/src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..6a522ad566ff2bce900acc37143915563289dfd4 GIT binary patch literal 7253 zcma)>Wl$VU*QN)T;O>L~!F_Od7~FM`;6XDu!3h%F-C-a=GPnm14#6#W&@5OnMBK=({jeHC0?^1G8)X4D3M&` zSxca}>D;CuUneKHg|-+4!&A@2#vFuX3*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`L!k*$p!C4oW~InS>rZz??AuA& zqL!eHKuWHkNhw7RpK|{rV(R}x X@!D!==>LSE{2hybSEs*00Kk6(lL3xA literal 0 HcmV?d00001 diff --git a/src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.properties b/src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.properties new file mode 100644 index 00000000..b19139e9 --- /dev/null +++ b/src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.properties @@ -0,0 +1 @@ +kobalt.version=0.406 diff --git a/src/test/resources/projects/javaFirst/kobaltw b/src/test/resources/projects/javaFirst/kobaltw new file mode 100755 index 00000000..1fd228db --- /dev/null +++ b/src/test/resources/projects/javaFirst/kobaltw @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +java -jar $(dirname $0)/kobalt/wrapper/kobalt-wrapper.jar $* diff --git a/src/test/resources/projects/javaFirst/src/main/java/example/JavaClass.java b/src/test/resources/projects/javaFirst/src/main/java/example/JavaClass.java new file mode 100644 index 00000000..12f0cfd2 --- /dev/null +++ b/src/test/resources/projects/javaFirst/src/main/java/example/JavaClass.java @@ -0,0 +1,8 @@ +package example; + +public class JavaClass { + public void run() { + System.out.println("JavaClass run()"); + } +} + diff --git a/src/test/resources/projects/javaFirst/src/main/kotlin/example/KotlinMain.kt b/src/test/resources/projects/javaFirst/src/main/kotlin/example/KotlinMain.kt new file mode 100644 index 00000000..297283ea --- /dev/null +++ b/src/test/resources/projects/javaFirst/src/main/kotlin/example/KotlinMain.kt @@ -0,0 +1,6 @@ +package example + +fun main(argv: Array) { + println("KotlinMain calling JavaClass().run()") + JavaClass().run() +} diff --git a/src/test/resources/projects/kotlinFirst/kobalt/src/Build.kt b/src/test/resources/projects/kotlinFirst/kobalt/src/Build.kt new file mode 100644 index 00000000..3bc14f76 --- /dev/null +++ b/src/test/resources/projects/kotlinFirst/kobalt/src/Build.kt @@ -0,0 +1,27 @@ +import com.beust.kobalt.* +import com.beust.kobalt.plugin.packaging.assemble +import com.beust.kobalt.plugin.kotlin.* + +val repos = repos() + + +val p = kotlinProject { + + name = "mixed" + group = "com.example" + artifactId = name + version = "0.1" + + sourceDirectories { + path("src/main/java", "src/main/kotlin") + } + + assemble { + jar { + fatJar = true + manifest { + attributes("Main-Class", "example.KotlinMainKt") + } + } + } +} diff --git a/src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.jar b/src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..6a522ad566ff2bce900acc37143915563289dfd4 GIT binary patch literal 7253 zcma)>Wl$VU*QN)T;O>L~!F_Od7~FM`;6XDu!3h%F-C-a=GPnm14#6#W&@5OnMBK=({jeHC0?^1G8)X4D3M&` zSxca}>D;CuUneKHg|-+4!&A@2#vFuX3*+Iq^I+rsal1p{!5T}U^xZc-1+Q2l@0mFB zDo92g3Ct@sqGnI04D#iLD^%i_zQyjVN-v48#yiZjg{5azR7Lwg1Ej!)oRbFv%RF;g zqpOe%Bb82Fs8OU}#i{i8AnqEgxKO(vsj&0cAA`<*U*g<$$;gW)4@Tw4quk7!x;cA1 zzl|NkZ*#<#W=)C)1{;6(klB}bg+ph6;7b@T$4`szJPar#SfN|G#Y(`(zGt!9Fp9iQ zABxrwHl0{2IbSkw%Iblg3Csq|@3@2B8`Dj_eaKfqaQRE{B)O08h*O0a?VLD01nI22 zpn8^hT~v0C5B4e=2`Y0sB!{kkI!giutJ*(^B;8g&{`8c7ccz7K@ZokEOM@qAd} z5q!$v3^GA|Y98uIxhAbYbdP)xPq6gvCk;ONDSb-6cgB+N{Q1lh_*4`3JQQMtpyv)K zd}d2p0tSPBgtXt{KD7=#&)oJ_OYwMn>1P`=uL3%p*ym2lKqU+z3!ovAtPGlV=a z(6`)SOfsdwO5wmRz)Y+9q2Jp{tbCz=#`Q}dZ67ajEAO6iDXn;TeL=l8a_NQA>(1Zk zNNU1+VxMjNS&2ZOZO3Yi+rmZ{NoadJN*A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fa2ITus%)qdV7;fe@m!fov3c`4J9FU6#O|rXw6@-~<^jC=K7~cF zrx8@QKeG`K4WV|0U5i~X#n5r+NhWfjRPOj6?Yi5GOZ#$gap_gg7&~51H>-iGJo4*c zWNK?kJAAZ`*B|b!_$7*H3cil-9}8Q!wX{$5j;E)-xN@bdl|S?6&UnW%`IFnUcU^z- z$O+56m~<_|Q6#D59S`n>y}|&R($8#Vf8}?ctyMTvYcA|W6}w?=de}@w$-ICJV?otnGuTF_NN5x zyGsFagQAP1LG}nF_Vx(-{I)D?ylH{0vjiPTj{By%*+^UU1#eX#pT9_ye2$SfH5(m< zml(d&x~;kUD0=r46I47u6YrrCyEW}Ar|=D;S8$Ho*JQISeDP-Jn(C%;-=UN0#&c0E z!<&Jo?rwqjk}LgoO0Do&2wQQUZ&P*kxYNE`W$`n`L!k*$p!C4oW~InS>rZz??AuA& zqL!eHKuWHkNhw7RpK|{rV(R}x X@!D!==>LSE{2hybSEs*00Kk6(lL3xA literal 0 HcmV?d00001 diff --git a/src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.properties b/src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.properties new file mode 100644 index 00000000..b19139e9 --- /dev/null +++ b/src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.properties @@ -0,0 +1 @@ +kobalt.version=0.406 diff --git a/src/test/resources/projects/kotlinFirst/kobaltw b/src/test/resources/projects/kotlinFirst/kobaltw new file mode 100755 index 00000000..1fd228db --- /dev/null +++ b/src/test/resources/projects/kotlinFirst/kobaltw @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +java -jar $(dirname $0)/kobalt/wrapper/kobalt-wrapper.jar $* diff --git a/src/test/resources/projects/kotlinFirst/src/main/java/example/JavaMain.java b/src/test/resources/projects/kotlinFirst/src/main/java/example/JavaMain.java new file mode 100644 index 00000000..e569b824 --- /dev/null +++ b/src/test/resources/projects/kotlinFirst/src/main/java/example/JavaMain.java @@ -0,0 +1,8 @@ +package example; + +public class JavaMain { + public static void main(String[] argv) { + System.out.println("JavaMain calling into Kotlin"); + new KotlinClass().run(); + } +} \ No newline at end of file diff --git a/src/test/resources/projects/kotlinFirst/src/main/kotlin/example/KotlinClass.kt b/src/test/resources/projects/kotlinFirst/src/main/kotlin/example/KotlinClass.kt new file mode 100644 index 00000000..611d2c87 --- /dev/null +++ b/src/test/resources/projects/kotlinFirst/src/main/kotlin/example/KotlinClass.kt @@ -0,0 +1,11 @@ +package example + +import kotlin.io.* + +class KotlinClass { + fun run() { + println("KotlinClass run()") + } +} + + From 8765c6707c9f0f2a1ed1e92730d64a69f0afb52a Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 2 Feb 2016 23:08:44 +0400 Subject: [PATCH 5/6] Update tests to 0.408. --- .../projects/javaFirst/kobalt/wrapper/kobalt-wrapper.properties | 2 +- .../kotlinFirst/kobalt/wrapper/kobalt-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.properties b/src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.properties index b19139e9..4955abc4 100644 --- a/src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.properties +++ b/src/test/resources/projects/javaFirst/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.406 +kobalt.version=0.408 \ No newline at end of file diff --git a/src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.properties b/src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.properties index b19139e9..4955abc4 100644 --- a/src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.properties +++ b/src/test/resources/projects/kotlinFirst/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.406 +kobalt.version=0.408 \ No newline at end of file From 6e3ce70f233b9236a166ff3ad4dd2544e0720f3d Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Tue, 2 Feb 2016 23:08:54 +0400 Subject: [PATCH 6/6] 0.408. --- 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 5e75246b..4955abc4 100644 --- a/kobalt/wrapper/kobalt-wrapper.properties +++ b/kobalt/wrapper/kobalt-wrapper.properties @@ -1 +1 @@ -kobalt.version=0.407 \ No newline at end of file +kobalt.version=0.408 \ No newline at end of file diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index 1bfab0ca..909aab53 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.407 +kobalt.version=0.408