1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

Fix build path.

This commit is contained in:
Cedric Beust 2017-03-30 11:49:26 -07:00
parent 577c81a15a
commit 0aae394975
3 changed files with 12 additions and 8 deletions

View file

@ -7,7 +7,7 @@ class Args {
var targets: List<String> = arrayListOf() var targets: List<String> = arrayListOf()
@Parameter(names = arrayOf("-bf", "--buildFile"), description = "The build file") @Parameter(names = arrayOf("-bf", "--buildFile"), description = "The build file")
var buildFile: String? = null var buildFile: String? = "kobalt/src/Build.kt"
@Parameter(names = arrayOf("--checkVersions"), description = "Check if there are any newer versions of the " + @Parameter(names = arrayOf("--checkVersions"), description = "Check if there are any newer versions of the " +
"dependencies") "dependencies")

View file

@ -1,12 +1,17 @@
package com.beust.kobalt package com.beust.kobalt
import com.beust.jcommander.JCommander import com.beust.jcommander.JCommander
import com.beust.kobalt.api.* import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.app.* import com.beust.kobalt.api.PluginTask
import com.beust.kobalt.app.ProjectFinder
import com.beust.kobalt.app.ProjectGenerator
import com.beust.kobalt.app.Templates
import com.beust.kobalt.app.UpdateKobalt
import com.beust.kobalt.app.remote.KobaltServer import com.beust.kobalt.app.remote.KobaltServer
import com.beust.kobalt.internal.PluginInfo import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.TaskManager import com.beust.kobalt.internal.TaskManager
import com.beust.kobalt.internal.build.BuildSources import com.beust.kobalt.internal.build.BuildSources
import com.beust.kobalt.internal.build.SingleFileBuildSources
import com.beust.kobalt.misc.CheckVersions import com.beust.kobalt.misc.CheckVersions
import com.beust.kobalt.misc.kobaltLog import com.beust.kobalt.misc.kobaltLog
import com.beust.kobalt.wrapper.Main import com.beust.kobalt.wrapper.Main
@ -38,12 +43,10 @@ class Options @Inject constructor(
fun run(jc: JCommander, args: Args, argv: Array<String>): Int { fun run(jc: JCommander, args: Args, argv: Array<String>): Int {
val p = if (args.buildFile != null) File(args.buildFile) else File(".") val p = if (args.buildFile != null) File(args.buildFile) else File(".")
// val buildFile = BuildFile(Paths.get(p.absolutePath), p.name) // val buildFile = BuildFile(Paths.get(p.absolutePath), p.name)
val buildSources = BuildSources(File(p.absolutePath)) val buildSources = if (p.isDirectory) BuildSources(p.absoluteFile) else SingleFileBuildSources(p)
var pluginClassLoader = javaClass.classLoader var pluginClassLoader = javaClass.classLoader
val allProjects = val allProjects = projectFinder.initForBuildFile(buildSources, args)
if (buildSources.exists()) projectFinder.initForBuildFile(buildSources, args)
else emptyList<Project>()
// Modify `args` with options found in buildScript { kobaltOptions(...) }, if any // Modify `args` with options found in buildScript { kobaltOptions(...) }, if any
addOptionsFromBuild(args, Kobalt.optionsFromBuild) addOptionsFromBuild(args, Kobalt.optionsFromBuild)

View file

@ -8,6 +8,7 @@ import com.beust.kobalt.api.Kobalt
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.internal.PluginInfo import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.build.BuildSources import com.beust.kobalt.internal.build.BuildSources
import com.beust.kobalt.internal.build.IBuildSources
import com.beust.kobalt.misc.kobaltLog import com.beust.kobalt.misc.kobaltLog
import com.google.inject.Inject import com.google.inject.Inject
import java.util.* import java.util.*
@ -15,7 +16,7 @@ import java.util.*
class ProjectFinder @Inject constructor(val buildFileCompilerFactory: BuildFileCompiler.IFactory, class ProjectFinder @Inject constructor(val buildFileCompilerFactory: BuildFileCompiler.IFactory,
val pluginInfo: PluginInfo, val plugins: Plugins) { val pluginInfo: PluginInfo, val plugins: Plugins) {
fun initForBuildFile(buildSources: BuildSources, args: Args): List<Project> { fun initForBuildFile(buildSources: IBuildSources, args: Args): List<Project> {
val findProjectResult = buildFileCompilerFactory.create(buildSources, pluginInfo) val findProjectResult = buildFileCompilerFactory.create(buildSources, pluginInfo)
.compileBuildFiles(args) .compileBuildFiles(args)
if (! findProjectResult.taskResult.success) { if (! findProjectResult.taskResult.success) {