1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-25 16:07:12 -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()
@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 " +
"dependencies")

View file

@ -1,12 +1,17 @@
package com.beust.kobalt
import com.beust.jcommander.JCommander
import com.beust.kobalt.api.*
import com.beust.kobalt.app.*
import com.beust.kobalt.api.Kobalt
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.internal.PluginInfo
import com.beust.kobalt.internal.TaskManager
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.kobaltLog
import com.beust.kobalt.wrapper.Main
@ -38,12 +43,10 @@ class Options @Inject constructor(
fun run(jc: JCommander, args: Args, argv: Array<String>): Int {
val p = if (args.buildFile != null) File(args.buildFile) else File(".")
// 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
val allProjects =
if (buildSources.exists()) projectFinder.initForBuildFile(buildSources, args)
else emptyList<Project>()
val allProjects = projectFinder.initForBuildFile(buildSources, args)
// Modify `args` with options found in buildScript { kobaltOptions(...) }, if any
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.internal.PluginInfo
import com.beust.kobalt.internal.build.BuildSources
import com.beust.kobalt.internal.build.IBuildSources
import com.beust.kobalt.misc.kobaltLog
import com.google.inject.Inject
import java.util.*
@ -15,7 +16,7 @@ import java.util.*
class ProjectFinder @Inject constructor(val buildFileCompilerFactory: BuildFileCompiler.IFactory,
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)
.compileBuildFiles(args)
if (! findProjectResult.taskResult.success) {