mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Merge branch 'master' of https://github.com/cbeust/kobalt
This commit is contained in:
commit
7a63f88ba5
1 changed files with 7 additions and 11 deletions
|
@ -100,15 +100,13 @@ open class BaseTest(val compilerFactory: BuildFileCompiler.IFactory? = null) {
|
||||||
val projectName = "p" + Math.abs(Random().nextInt())
|
val projectName = "p" + Math.abs(Random().nextInt())
|
||||||
val version = "1.0"
|
val version = "1.0"
|
||||||
|
|
||||||
fun createFile(root: File, f: String, text: String) : File {
|
fun createFile(root: File, f: String, text: String) = File(root, f).apply {
|
||||||
val file = File(root, f)
|
parentFile.mkdirs()
|
||||||
file.parentFile.mkdirs()
|
writeText(text)
|
||||||
file.writeText(text)
|
|
||||||
return file
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createFile(root, "kobalt/src/Build.kt",
|
createFile(root, "kobalt/src/Build.kt",
|
||||||
projectInfo.buildFile.text(root.absolutePath, projectName, version))
|
projectInfo.buildFile.text(KFiles.fixSlashes(root.absolutePath), projectName, version))
|
||||||
|
|
||||||
projectInfo.files.forEach {
|
projectInfo.files.forEach {
|
||||||
createFile(root, it.path, it.content)
|
createFile(root, it.path, it.content)
|
||||||
|
@ -116,18 +114,16 @@ open class BaseTest(val compilerFactory: BuildFileCompiler.IFactory? = null) {
|
||||||
return ProjectDescription(root, projectName, version)
|
return ProjectDescription(root, projectName, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
class LaunchProjectResult(val projectInfo: ProjectInfo, val projectDescription: ProjectDescription,
|
class LaunchProjectResult(val projectDescription: ProjectDescription, val result: Int)
|
||||||
val result: Int)
|
|
||||||
|
|
||||||
fun launchProject(projectInfo: ProjectInfo, commandLine: Array<String>) : LaunchProjectResult {
|
fun launchProject(projectInfo: ProjectInfo, commandLine: Array<String>) : LaunchProjectResult {
|
||||||
val project = createProject(projectInfo)
|
val project = createProject(projectInfo)
|
||||||
println("Project: $project")
|
|
||||||
val main = Kobalt.INJECTOR.getInstance(Main::class.java)
|
val main = Kobalt.INJECTOR.getInstance(Main::class.java)
|
||||||
val args = Args()
|
val args = Args()
|
||||||
val jc = JCommander(args).apply { parse(*commandLine) }
|
val jc = JCommander(args).apply { parse(*commandLine) }
|
||||||
args.buildFile = project.file.absolutePath + "/kobalt/src/Build.kt"
|
args.buildFile = KFiles.fixSlashes(project.file.absolutePath) + "/kobalt/src/Build.kt"
|
||||||
val result = Main.launchMain(main, jc, args, arrayOf("assemble"))
|
val result = Main.launchMain(main, jc, args, arrayOf("assemble"))
|
||||||
return LaunchProjectResult(projectInfo, project, result)
|
return LaunchProjectResult(project, result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue