mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -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")
|
@Parameter(names = arrayOf("--noIncrementalKotlin"), description = "Disable incremental Kotlin compilation")
|
||||||
var noIncrementalKotlin: Boolean = false
|
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
|
var sequential: Boolean = false
|
||||||
|
|
||||||
@Parameter(names = arrayOf("--server"), description = "Run in server mode")
|
@Parameter(names = arrayOf("--server"), description = "Run in server mode")
|
||||||
|
|
|
@ -27,8 +27,13 @@ class BuildScriptConfig {
|
||||||
@Directive
|
@Directive
|
||||||
fun buildFileClasspath(vararg bfc: String) = newBuildFileClasspath(*bfc)
|
fun buildFileClasspath(vararg bfc: String) = newBuildFileClasspath(*bfc)
|
||||||
|
|
||||||
// The following settings modify the compiler used to compile the build file.
|
/** Options passed to Kobalt */
|
||||||
// Projects should use kotlinCompiler { compilerVersion } to configure the Kotin compiler for their source files.
|
@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 kobaltCompilerVersion : String? = null
|
||||||
var kobaltCompilerRepo: String? = null
|
var kobaltCompilerRepo: String? = null
|
||||||
var kobaltCompilerFlags: String? = null
|
var kobaltCompilerFlags: String? = null
|
||||||
|
|
|
@ -118,5 +118,11 @@ class Kobalt {
|
||||||
get() = Duration.parse( kobaltProperties.getProperty(PROPERTY_KOBALT_VERSION_CHECK_TIMEOUT) ?: "P1D")
|
get() = Duration.parse( kobaltProperties.getProperty(PROPERTY_KOBALT_VERSION_CHECK_TIMEOUT) ?: "P1D")
|
||||||
|
|
||||||
fun findPlugin(name: String) = Plugins.findPlugin(name)
|
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 {
|
} else {
|
||||||
val allProjects = projectFinder.initForBuildFile(buildFile, args)
|
val allProjects = projectFinder.initForBuildFile(buildFile, args)
|
||||||
|
|
||||||
|
addOptionsFromBuild(args, Kobalt.optionsFromBuild)
|
||||||
if (args.listTemplates) {
|
if (args.listTemplates) {
|
||||||
// --listTemplates
|
// --listTemplates
|
||||||
Templates().displayTemplates(pluginInfo)
|
Templates().displayTemplates(pluginInfo)
|
||||||
|
@ -213,6 +214,15 @@ private class Main @Inject constructor(
|
||||||
return result
|
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 {
|
private fun findBuildFile(): File {
|
||||||
val deprecatedLocation = File(Constants.BUILD_FILE_NAME)
|
val deprecatedLocation = File(Constants.BUILD_FILE_NAME)
|
||||||
val result: File =
|
val result: File =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue