mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 07:57:12 -07:00
Added kobaltOptions().
This commit is contained in:
parent
c43967bec9
commit
a4282b299a
4 changed files with 28 additions and 3 deletions
|
@ -82,7 +82,11 @@ class Args {
|
|||
@Parameter(names = arrayOf("--noIncrementalKotlin"), description = "Disable incremental Kotlin compilation")
|
||||
var noIncrementalKotlin: Boolean = false
|
||||
|
||||
@Parameter(names = arrayOf("--sequential"), description = "Build all the projects in sequence")
|
||||
companion object {
|
||||
const val SEQUENTIAL = "--sequential"
|
||||
}
|
||||
|
||||
@Parameter(names = arrayOf(Args.SEQUENTIAL), description = "Build all the projects in sequence")
|
||||
var sequential: Boolean = false
|
||||
|
||||
@Parameter(names = arrayOf("--server"), description = "Run in server mode")
|
||||
|
|
|
@ -27,8 +27,13 @@ class BuildScriptConfig {
|
|||
@Directive
|
||||
fun buildFileClasspath(vararg bfc: String) = newBuildFileClasspath(*bfc)
|
||||
|
||||
// The following settings modify the compiler used to compile the build file.
|
||||
// Projects should use kotlinCompiler { compilerVersion } to configure the Kotin compiler for their source files.
|
||||
/** Options passed to Kobalt */
|
||||
@Directive
|
||||
fun kobaltOptions(vararg options: String) = Kobalt.addKobaltOptions(options)
|
||||
|
||||
// The following settings modify the compiler used to compile the build file, which regular users should
|
||||
// probably never need to do. Projects should use kotlinCompiler { compilerVersion } to configure the
|
||||
// Kotin compiler for their source files.
|
||||
var kobaltCompilerVersion : String? = null
|
||||
var kobaltCompilerRepo: String? = null
|
||||
var kobaltCompilerFlags: String? = null
|
||||
|
|
|
@ -118,5 +118,11 @@ class Kobalt {
|
|||
get() = Duration.parse( kobaltProperties.getProperty(PROPERTY_KOBALT_VERSION_CHECK_TIMEOUT) ?: "P1D")
|
||||
|
||||
fun findPlugin(name: String) = Plugins.findPlugin(name)
|
||||
|
||||
val optionsFromBuild = arrayListOf<String>()
|
||||
|
||||
fun addKobaltOptions(options: Array<out String>) {
|
||||
optionsFromBuild.addAll(options)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ private class Main @Inject constructor(
|
|||
} else {
|
||||
val allProjects = projectFinder.initForBuildFile(buildFile, args)
|
||||
|
||||
addOptionsFromBuild(args, Kobalt.optionsFromBuild)
|
||||
if (args.listTemplates) {
|
||||
// --listTemplates
|
||||
Templates().displayTemplates(pluginInfo)
|
||||
|
@ -213,6 +214,15 @@ private class Main @Inject constructor(
|
|||
return result
|
||||
}
|
||||
|
||||
private fun addOptionsFromBuild(args: Args, optionsFromBuild: ArrayList<String>) {
|
||||
optionsFromBuild.forEach {
|
||||
when(it) {
|
||||
Args.SEQUENTIAL -> args.sequential = true
|
||||
else -> throw IllegalArgumentException("Unsupported option found in kobaltOptions(): " + it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun findBuildFile(): File {
|
||||
val deprecatedLocation = File(Constants.BUILD_FILE_NAME)
|
||||
val result: File =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue