mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Fix the duplicate sources problem.
This commit is contained in:
parent
7c20a0313f
commit
0da885e094
6 changed files with 12 additions and 12 deletions
|
@ -44,7 +44,7 @@ open public class Project(
|
||||||
return sources
|
return sources
|
||||||
}
|
}
|
||||||
|
|
||||||
var sourceDirectories : ArrayList<String> = arrayListOf()
|
var sourceDirectories : HashSet<String> = hashSetOf()
|
||||||
get() = if (field.isEmpty()) projectInfo.defaultSourceDirectories else field
|
get() = if (field.isEmpty()) projectInfo.defaultSourceDirectories else field
|
||||||
set(value) {
|
set(value) {
|
||||||
field = value
|
field = value
|
||||||
|
@ -57,7 +57,7 @@ open public class Project(
|
||||||
return sources
|
return sources
|
||||||
}
|
}
|
||||||
|
|
||||||
var sourceDirectoriesTest : ArrayList<String> = arrayListOf()
|
var sourceDirectoriesTest : HashSet<String> = hashSetOf()
|
||||||
get() = if (field.isEmpty()) projectInfo.defaultTestDirectories
|
get() = if (field.isEmpty()) projectInfo.defaultTestDirectories
|
||||||
else field
|
else field
|
||||||
set(value) {
|
set(value) {
|
||||||
|
@ -94,7 +94,7 @@ open public class Project(
|
||||||
val projectName: String get() = name
|
val projectName: String get() = name
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Sources(val project: Project, val sources: ArrayList<String>) {
|
public class Sources(val project: Project, val sources: HashSet<String>) {
|
||||||
@Directive
|
@Directive
|
||||||
public fun path(vararg paths: String) {
|
public fun path(vararg paths: String) {
|
||||||
sources.addAll(paths)
|
sources.addAll(paths)
|
||||||
|
|
|
@ -12,8 +12,8 @@ import java.util.*
|
||||||
* Abstract base class for the build generators that use build-template.mustache.
|
* Abstract base class for the build generators that use build-template.mustache.
|
||||||
*/
|
*/
|
||||||
abstract class BuildGenerator : IInitContributor {
|
abstract class BuildGenerator : IInitContributor {
|
||||||
abstract val defaultSourceDirectories : ArrayList<String>
|
abstract val defaultSourceDirectories : HashSet<String>
|
||||||
abstract val defaultTestDirectories : ArrayList<String>
|
abstract val defaultTestDirectories : HashSet<String>
|
||||||
abstract val directive : String
|
abstract val directive : String
|
||||||
abstract val name : String
|
abstract val name : String
|
||||||
abstract val fileMatch : (String) -> Boolean
|
abstract val fileMatch : (String) -> Boolean
|
||||||
|
|
|
@ -6,6 +6,6 @@ import java.util.*
|
||||||
* Data that is useful for projects to have but should not be specified in the DSL.
|
* Data that is useful for projects to have but should not be specified in the DSL.
|
||||||
*/
|
*/
|
||||||
interface IProjectInfo {
|
interface IProjectInfo {
|
||||||
val defaultSourceDirectories: ArrayList<String>
|
val defaultSourceDirectories: HashSet<String>
|
||||||
val defaultTestDirectories: ArrayList<String>
|
val defaultTestDirectories: HashSet<String>
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class JavaPlugin @Inject constructor(
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findSourceFiles(dir: String, sourceDirectories: List<String>): List<String> {
|
private fun findSourceFiles(dir: String, sourceDirectories: Collection<String>): List<String> {
|
||||||
val projectDir = File(dir)
|
val projectDir = File(dir)
|
||||||
return files.findRecursively(projectDir,
|
return files.findRecursively(projectDir,
|
||||||
sourceDirectories.map { File(it) }) { it: String -> it.endsWith(".java") }
|
sourceDirectories.map { File(it) }) { it: String -> it.endsWith(".java") }
|
||||||
|
|
|
@ -5,6 +5,6 @@ import com.google.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class JavaProjectInfo : IProjectInfo {
|
class JavaProjectInfo : IProjectInfo {
|
||||||
override val defaultSourceDirectories = arrayListOf("src/main/java", "src/main/resources")
|
override val defaultSourceDirectories = hashSetOf("src/main/java", "src/main/resources")
|
||||||
override val defaultTestDirectories = arrayListOf("src/test/java", "src/test/resources")
|
override val defaultTestDirectories = hashSetOf("src/test/java", "src/test/resources")
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.google.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class KotlinProjectInfo : IProjectInfo {
|
class KotlinProjectInfo : IProjectInfo {
|
||||||
override val defaultSourceDirectories = arrayListOf("src/main/kotlin", "src/main/resources")
|
override val defaultSourceDirectories = hashSetOf("src/main/kotlin", "src/main/resources")
|
||||||
override val defaultTestDirectories = arrayListOf("src/test/kotlin", "src/test/resources")
|
override val defaultTestDirectories = hashSetOf("src/test/kotlin", "src/test/resources")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue