mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Filter non existent source directory.
This commit is contained in:
parent
8eb804f486
commit
397b60b60a
3 changed files with 48 additions and 304 deletions
|
@ -11,7 +11,6 @@ import com.beust.kobalt.internal.IncrementalManager
|
||||||
import com.beust.kobalt.internal.KobaltSettings
|
import com.beust.kobalt.internal.KobaltSettings
|
||||||
import com.beust.kobalt.internal.ParallelLogger
|
import com.beust.kobalt.internal.ParallelLogger
|
||||||
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.IBuildSources
|
import com.beust.kobalt.internal.build.IBuildSources
|
||||||
import com.beust.kobalt.internal.build.VersionFile
|
import com.beust.kobalt.internal.build.VersionFile
|
||||||
import com.beust.kobalt.maven.DependencyManager
|
import com.beust.kobalt.maven.DependencyManager
|
||||||
|
@ -76,97 +75,63 @@ class BuildFileCompiler @Inject constructor(@Assisted("buildSources") val buildS
|
||||||
return projectResult
|
return projectResult
|
||||||
}
|
}
|
||||||
|
|
||||||
val parsedBuildFiles = arrayListOf<_ParsedBuildFile>()
|
|
||||||
|
|
||||||
class FindProjectResult(val context: KobaltContext, val projects: List<Project>, val pluginUrls: List<URL>,
|
class FindProjectResult(val context: KobaltContext, val projects: List<Project>, val pluginUrls: List<URL>,
|
||||||
val taskResult: TaskResult)
|
val taskResult: TaskResult)
|
||||||
|
|
||||||
// private fun findProjects(context: KobaltContext): FindProjectResult {
|
|
||||||
// buildFiles.run(File(".").absolutePath, context)
|
|
||||||
// val pluginUrls = Plugins.dynamicPlugins.map { it.jarFile.get().toURI().toURL()}
|
|
||||||
// val projects = listOf<Project>()
|
|
||||||
// val result = FindProjectResult(context, projects, pluginUrls, TaskResult())
|
|
||||||
// return result
|
|
||||||
// }
|
|
||||||
|
|
||||||
private fun findProjects(context: KobaltContext): FindProjectResult {
|
private fun findProjects(context: KobaltContext): FindProjectResult {
|
||||||
val root = buildSources.root
|
val root = buildSources.root
|
||||||
var errorTaskResult: TaskResult? = null
|
var errorTaskResult: TaskResult? = null
|
||||||
val projects = arrayListOf<Project>()
|
val projects = arrayListOf<Project>()
|
||||||
run {
|
|
||||||
// buildFiles.forEach { buildFile ->
|
|
||||||
|
|
||||||
// Parse kobalt/src/Build.kt
|
// Parse the build files in kobalt/src/*.kt, which will analyze all the buildScriptInfo{} sections
|
||||||
// val parsedBuildFile = parseBuildFile(context, buildSources)
|
// and possibly add new source build directories. The output of this process is a new Build.kt
|
||||||
// parsedBuildFiles.add(parsedBuildFile)
|
// file that contains the aggregation of all the build files with the profiles applied and with
|
||||||
// val pluginUrls = parsedBuildFile.pluginUrls
|
// the included build files inserted at the correct line.
|
||||||
// val buildScriptJarFile = File(KFiles.findBuildScriptLocation(buildSources, SCRIPT_JAR))
|
val newBuildKt = buildFiles.parseBuildFiles(root.absolutePath, context)
|
||||||
|
|
||||||
val newBuildKt = buildFiles.run(root.absolutePath, context)
|
//
|
||||||
|
// Save the current build script absolute directory
|
||||||
|
//
|
||||||
|
context.internalContext.absoluteDir = buildSources.root
|
||||||
|
|
||||||
//
|
// If buildScript.jar was generated by a different version, wipe them it case the API
|
||||||
// Save the current build script absolute directory
|
// changed in-between
|
||||||
//
|
val buildScriptJarDir = KFiles.findBuildScriptDir(root.absolutePath)
|
||||||
context.internalContext.absoluteDir = buildSources.root
|
buildScriptJarDir.let { dir ->
|
||||||
|
if (! VersionFile.isSameVersionFile(dir)) {
|
||||||
// If the script jar files were generated by a different version, wipe them in case the API
|
kobaltLog(1, "Detected new installation, wiping $dir")
|
||||||
// changed in-between
|
dir.listFiles().map(File::delete)
|
||||||
val buildScriptJarDir = KFiles.findBuildScriptDir(root.absolutePath)
|
|
||||||
buildScriptJarDir.let { dir ->
|
|
||||||
if (! VersionFile.isSameVersionFile(dir)) {
|
|
||||||
kobaltLog(1, "Detected new installation, wiping $dir")
|
|
||||||
dir.listFiles().map(File::delete)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val buildScriptJarFile = File(KFiles.findBuildScriptDir(root.absolutePath), SCRIPT_JAR)
|
|
||||||
|
|
||||||
//
|
|
||||||
// Compile the newly generated Build.kt file
|
|
||||||
//
|
|
||||||
val pluginUrls = Plugins.dynamicPlugins.map { it.jarFile.get().toURI().toURL() }
|
|
||||||
val containsProfiles = false
|
|
||||||
val taskResult = maybeCompileBuildFile(context, listOf(newBuildKt.absolutePath),
|
|
||||||
buildScriptJarFile, pluginUrls, context.internalContext.forceRecompile,
|
|
||||||
containsProfiles)
|
|
||||||
|
|
||||||
//
|
|
||||||
// Now that Build.kt has been parsed, we might have additional build files (buildSources will
|
|
||||||
// return additional build files) so we parse again.
|
|
||||||
//
|
|
||||||
// Kobalt.buildSourceDirs.forEach { dir ->
|
|
||||||
// val additionalSourceFiles = BuildSources(File(dir))
|
|
||||||
// val newParsedBuildFile = parseBuildFile(context, additionalSourceFiles)
|
|
||||||
//
|
|
||||||
// // Write the modified Build.kt (e.g. maybe profiles were applied) to a temporary file,
|
|
||||||
// // compile it, jar it in buildScript.jar and run it
|
|
||||||
// val modifiedBuildFile = KFiles.createTempBuildFileInTempDirectory(deleteOnExit = true)
|
|
||||||
// KFiles.saveFile(modifiedBuildFile, newParsedBuildFile.nonBuildScriptCode)
|
|
||||||
// val taskResult = maybeCompileBuildFile(context, listOf(modifiedBuildFile.path),
|
|
||||||
// buildScriptJarFile, pluginUrls, context.internalContext.forceRecompile,
|
|
||||||
// newParsedBuildFile.containsProfiles)
|
|
||||||
if (taskResult.success) {
|
|
||||||
projects.addAll(buildScriptUtil.runBuildScriptJarFile(buildScriptJarFile, pluginUrls, context))
|
|
||||||
} else {
|
|
||||||
if (errorTaskResult == null) {
|
|
||||||
errorTaskResult = taskResult
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the absolute dir
|
|
||||||
context.internalContext.absoluteDir = null
|
|
||||||
|
|
||||||
}
|
}
|
||||||
val pluginUrls = parsedBuildFiles.flatMap { it.pluginUrls }
|
|
||||||
return FindProjectResult(context, projects, pluginUrls,
|
|
||||||
if (errorTaskResult != null) errorTaskResult!! else TaskResult())
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun maybeCompileBuildFile(context: KobaltContext, buildSources: BuildSources, buildScriptJarFile: File,
|
val buildScriptJarFile = File(KFiles.findBuildScriptDir(root.absolutePath), SCRIPT_JAR)
|
||||||
pluginUrls: List<URL>, forceRecompile: Boolean, containsProfiles: Boolean) : TaskResult
|
|
||||||
= maybeCompileBuildFile(context, buildSources.findSourceFiles().map { it.path }, buildScriptJarFile,
|
//
|
||||||
pluginUrls, forceRecompile, containsProfiles)
|
// Compile the newly generated Build.kt file
|
||||||
|
//
|
||||||
|
val pluginUrls = Plugins.dynamicPlugins.map { it.jarFile.get().toURI().toURL() }
|
||||||
|
val containsProfiles = false
|
||||||
|
val taskResult = maybeCompileBuildFile(context, listOf(newBuildKt.absolutePath),
|
||||||
|
buildScriptJarFile, pluginUrls, context.internalContext.forceRecompile,
|
||||||
|
containsProfiles)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Run the new Build.kt
|
||||||
|
//
|
||||||
|
if (taskResult.success) {
|
||||||
|
projects.addAll(buildScriptUtil.runBuildScriptJarFile(buildScriptJarFile, pluginUrls, context))
|
||||||
|
} else {
|
||||||
|
if (errorTaskResult == null) {
|
||||||
|
errorTaskResult = taskResult
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the absolute dir
|
||||||
|
context.internalContext.absoluteDir = null
|
||||||
|
|
||||||
|
return FindProjectResult(context, projects, pluginUrls,
|
||||||
|
if (errorTaskResult != null) errorTaskResult else TaskResult())
|
||||||
|
}
|
||||||
|
|
||||||
fun maybeCompileBuildFile(context: KobaltContext, sourceFiles: List<String>, buildScriptJarFile: File,
|
fun maybeCompileBuildFile(context: KobaltContext, sourceFiles: List<String>, buildScriptJarFile: File,
|
||||||
pluginUrls: List<URL>, forceRecompile: Boolean, containsProfiles: Boolean) : TaskResult {
|
pluginUrls: List<URL>, forceRecompile: Boolean, containsProfiles: Boolean) : TaskResult {
|
||||||
|
@ -208,12 +173,4 @@ class BuildFileCompiler @Inject constructor(@Assisted("buildSources") val buildS
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate the script file with only the plugins()/repos() directives and run it. Then return
|
|
||||||
* - the source code for the modified Build.kt (after profiles are applied)
|
|
||||||
* - the URL's of all the plug-ins that were found.
|
|
||||||
*/
|
|
||||||
// private fun _parseBuildFile(context: KobaltContext, buildSources: IBuildSources) =
|
|
||||||
// _ParsedBuildFile(buildSources, context, buildScriptUtil, dependencyManager, files)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ fun main(argv: Array<String>) {
|
||||||
context.pluginInfo = PluginInfo(KobaltPluginXml(), null, null)
|
context.pluginInfo = PluginInfo(KobaltPluginXml(), null, null)
|
||||||
Kobalt.init(MainModule(args, KobaltSettings.readSettingsXml()))
|
Kobalt.init(MainModule(args, KobaltSettings.readSettingsXml()))
|
||||||
val bf = Kobalt.INJECTOR.getInstance(BuildFiles::class.java)
|
val bf = Kobalt.INJECTOR.getInstance(BuildFiles::class.java)
|
||||||
bf.run(homeDir("kotlin/klaxon/"), context)
|
bf.parseBuildFiles(homeDir("kotlin/klaxon/"), context)
|
||||||
}
|
}
|
||||||
|
|
||||||
class BuildFiles @Inject constructor(val factory: BuildFileCompiler.IFactory,
|
class BuildFiles @Inject constructor(val factory: BuildFileCompiler.IFactory,
|
||||||
|
@ -67,7 +67,8 @@ class BuildFiles @Inject constructor(val factory: BuildFileCompiler.IFactory,
|
||||||
val result = arrayListOf<File>()
|
val result = arrayListOf<File>()
|
||||||
|
|
||||||
val sourceDirs = arrayListOf<String>().apply { add(root + File.separator + KOBALT_SRC) }.map(::File)
|
val sourceDirs = arrayListOf<String>().apply { add(root + File.separator + KOBALT_SRC) }.map(::File)
|
||||||
sourceDirs.forEach { dir ->
|
// It's possible for no build file to be present (e.g. testing)
|
||||||
|
sourceDirs.filter { it.exists() }.forEach { dir ->
|
||||||
result.addAll(findFiles(dir, { it.name.endsWith(".kt") }))
|
result.addAll(findFiles(dir, { it.name.endsWith(".kt") }))
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
@ -76,7 +77,7 @@ class BuildFiles @Inject constructor(val factory: BuildFileCompiler.IFactory,
|
||||||
/**
|
/**
|
||||||
* @return the new Build.kt
|
* @return the new Build.kt
|
||||||
*/
|
*/
|
||||||
fun run(projectDir: String, context: KobaltContext) : File {
|
fun parseBuildFiles(projectDir: String, context: KobaltContext) : File {
|
||||||
val sourceDirs = arrayListOf<String>().apply { add(projectDir + File.separator + KOBALT_SRC) }
|
val sourceDirs = arrayListOf<String>().apply { add(projectDir + File.separator + KOBALT_SRC) }
|
||||||
val map = hashMapOf<File, AnalyzedBuildFile>()
|
val map = hashMapOf<File, AnalyzedBuildFile>()
|
||||||
val newSourceDirs = arrayListOf<IncludedBuildSourceDir>()
|
val newSourceDirs = arrayListOf<IncludedBuildSourceDir>()
|
||||||
|
|
|
@ -1,214 +0,0 @@
|
||||||
package com.beust.kobalt.app
|
|
||||||
|
|
||||||
import com.beust.kobalt.api.KobaltContext
|
|
||||||
import com.beust.kobalt.api.Project
|
|
||||||
import com.beust.kobalt.internal.build.IBuildSources
|
|
||||||
import com.beust.kobalt.maven.DependencyManager
|
|
||||||
import com.beust.kobalt.misc.BuildScriptInfo
|
|
||||||
import com.beust.kobalt.misc.KFiles
|
|
||||||
import com.beust.kobalt.misc.kobaltLog
|
|
||||||
import com.beust.kobalt.misc.warn
|
|
||||||
import com.google.inject.Singleton
|
|
||||||
import java.net.URL
|
|
||||||
|
|
||||||
@Singleton
|
|
||||||
class _ParsedBuildFile(val buildSources: IBuildSources, val context: KobaltContext, val buildScriptUtil:
|
|
||||||
BuildScriptUtil,
|
|
||||||
val dependencyManager: DependencyManager, val files: KFiles) {
|
|
||||||
private val profileLines = arrayListOf<String>()
|
|
||||||
private val projects = arrayListOf<Project>()
|
|
||||||
private val activeProfiles = arrayListOf<String>()
|
|
||||||
private val nonBuildScript = arrayListOf<String>()
|
|
||||||
|
|
||||||
var containsProfiles = false
|
|
||||||
val pluginUrls = arrayListOf<URL>()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains the addition of all the build files corrected with the active profiles and with
|
|
||||||
* the buildScript{} sections removed.
|
|
||||||
*/
|
|
||||||
val nonBuildScriptCode : String get() = nonBuildScript.joinToString("\n")
|
|
||||||
|
|
||||||
init {
|
|
||||||
// Because profiles may have changed between two builds, we have to delete preBuildScript.jar file
|
|
||||||
// every time and then generate a new one (or skip that phase if no buildScript{} was found in the
|
|
||||||
// buid files)
|
|
||||||
// preBuildScriptJarFile.delete()
|
|
||||||
|
|
||||||
// val buildScriptInfos = parseBuildFile()
|
|
||||||
|
|
||||||
// Only generate preBuildScript.jar if we found at least one buildScript{}
|
|
||||||
// if (buildScriptInfos.isNotEmpty()) {
|
|
||||||
// parseBuildScriptInfo(buildScriptInfos)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// generateFinalBuildFile(buildScriptInfos)
|
|
||||||
}
|
|
||||||
|
|
||||||
// private fun generateFinalBuildFile(buildScriptInfos: List<BuildScriptInfo>) {
|
|
||||||
// //
|
|
||||||
// // Write the build file to `nonBuildScript` excluding the buildScript{} directives since we already ran them
|
|
||||||
// //
|
|
||||||
// var lineNumber = 1
|
|
||||||
// buildSources.findSourceFiles().forEach { buildFile ->
|
|
||||||
// val buildScriptInfo = buildScriptInfos.find { it.file == buildFile }
|
|
||||||
// if (buildFile == buildScriptInfo?.file) {
|
|
||||||
// println("Found file with buildScript in it: " + buildFile)
|
|
||||||
// }
|
|
||||||
// buildFile.forEachLine() { line ->
|
|
||||||
// if (buildScriptInfo == null || ! buildScriptInfo.isInSection(lineNumber)) {
|
|
||||||
// val cpl = correctProfileLine(line)
|
|
||||||
// if (cpl.startsWith("import")) nonBuildScript.add(0, cpl)
|
|
||||||
// else nonBuildScript.add(cpl)
|
|
||||||
// }
|
|
||||||
// lineNumber++
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the current line matches one of the profiles, turn the declaration into
|
|
||||||
* val profile = true, otherwise return the same line
|
|
||||||
*/
|
|
||||||
fun correctProfileLine(line: String): String {
|
|
||||||
(context.profiles as List<String>).forEach { profile ->
|
|
||||||
val re = Regex(".*va[rl][ \\t]+([a-zA-Z0-9_]+)[ \\t]*.*profile\\(\\).*")
|
|
||||||
val oldRe = Regex(".*va[rl][ \\t]+([a-zA-Z0-9_]+)[ \\t]*=[ \\t]*[tf][ra][ul][es].*")
|
|
||||||
val matcher = re.matchEntire(line)
|
|
||||||
val oldMatcher = oldRe.matchEntire(line)
|
|
||||||
|
|
||||||
fun profileMatch(matcher: MatchResult?) : Pair<Boolean, String?> {
|
|
||||||
val variable = if (matcher != null) matcher.groups[1]?.value else null
|
|
||||||
return Pair(profile == variable, variable)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((matcher != null && matcher.groups.isNotEmpty())
|
|
||||||
|| (oldMatcher != null && oldMatcher.groups.isNotEmpty())) {
|
|
||||||
containsProfiles = true
|
|
||||||
val match = profileMatch(matcher)
|
|
||||||
val oldMatch = profileMatch(oldMatcher)
|
|
||||||
if (match.first || oldMatch.first) {
|
|
||||||
val variable = if (match.first) match.second else oldMatch.second
|
|
||||||
|
|
||||||
if (oldMatch.first) {
|
|
||||||
warn("Old profile syntax detected for \"$line\"," +
|
|
||||||
" please update to \"val $variable by profile()\"")
|
|
||||||
}
|
|
||||||
|
|
||||||
with("val $variable = true") {
|
|
||||||
kobaltLog(2, "Activating profile $profile in build file")
|
|
||||||
activeProfiles.add(profile)
|
|
||||||
profileLines.add(this)
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return line
|
|
||||||
}
|
|
||||||
|
|
||||||
// private fun parseBuildFile() : List<BuildScriptInfo> {
|
|
||||||
// fun applyProfiles(lines: List<String>): List<String> {
|
|
||||||
// val result = arrayListOf<String>()
|
|
||||||
// lines.forEach { line ->
|
|
||||||
// result.add(correctProfileLine(line))
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// return result
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// // Take all the build files and adjust them with the active profiles
|
|
||||||
// //
|
|
||||||
// val buildScriptInfos = arrayListOf<BuildScriptInfo>()
|
|
||||||
// val buildWithCorrectProfiles = arrayListOf<String>()
|
|
||||||
// val buildFiles = buildSources.findSourceFiles()
|
|
||||||
// buildFiles.forEach {
|
|
||||||
// buildWithCorrectProfiles.addAll(applyProfiles(it.readLines()))
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// // Now extract all the `buildScript{}` blocks from all these build files
|
|
||||||
// //
|
|
||||||
// val lsi = BlockExtractor(Pattern.compile("^val.*buildScript.*\\{"), '{', '}')
|
|
||||||
// .extractBlock(it, buildWithCorrectProfiles)
|
|
||||||
// if (lsi != null) buildScriptInfos.add(lsi)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return buildScriptInfos
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate preBuildScript.jar based on the buildScript{} found in the build files.
|
|
||||||
*/
|
|
||||||
// private fun parseBuildScriptInfo(buildScriptInfos: List<BuildScriptInfo>) {
|
|
||||||
// buildScriptInfos.forEach { buildScriptInfo ->
|
|
||||||
// buildScriptInfo.sections.forEach { section ->
|
|
||||||
// val buildScriptSection = (buildScriptInfo.imports +
|
|
||||||
// buildScriptInfo.fullBuildFile.subList(section.start - 1, section.end))
|
|
||||||
// .joinToString("\n")
|
|
||||||
// println("=== Compiling\n" + buildScriptSection + " for line " + (section.start - 1))
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// // Compile and run preBuildScriptCode, which contains all the plugins() calls extracted. This
|
|
||||||
// // will add all the dynamic plugins found in this code to Plugins.dynamicPlugins
|
|
||||||
// //
|
|
||||||
// val buildScriptSourceFile = KFiles.createTempBuildFileInTempDirectory(deleteOnExit = true)
|
|
||||||
// buildScriptSourceFile.writeText(buildScriptSection, Charset.defaultCharset())
|
|
||||||
// kobaltLog(2, "Saved " + KFiles.fixSlashes(buildScriptSourceFile.absolutePath))
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// // Compile to preBuildScript.jar
|
|
||||||
// //
|
|
||||||
//
|
|
||||||
// val dir = preBuildScriptJarFile.parentFile
|
|
||||||
// dir.mkdirs()
|
|
||||||
// val bsJar = java.io.File(dir, "buildScript-" + section.start + ".jar")
|
|
||||||
// generateJarFile(context, listOf(buildScriptSourceFile.path), bsJar)
|
|
||||||
// VersionFile.generateVersionFile(preBuildScriptJarFile.parentFile)
|
|
||||||
// Kobalt.context!!.internalContext.buildFileOutOfDate = true
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// // Run preBuildScript.jar to initialize plugins and repos
|
|
||||||
// //
|
|
||||||
// val currentDirs = arrayListOf<String>().apply { addAll(Kobalt.buildSourceDirs) }
|
|
||||||
// projects.addAll(buildScriptUtil.runBuildScriptJarFile(bsJar, arrayListOf<URL>(), context))
|
|
||||||
// val newDirs = arrayListOf<String>().apply { addAll(Kobalt.buildSourceDirs) }
|
|
||||||
// newDirs.removeAll(currentDirs)
|
|
||||||
// buildScriptInfo.includedBuildSourceDirs.add(IncludedBuildSourceDir(section.start - 1, newDirs))
|
|
||||||
// println("*** ADDED DIRECTORIES " + newDirs)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// // All the plug-ins are now in Plugins.dynamicPlugins, download them if they're not already
|
|
||||||
// //
|
|
||||||
// Plugins.dynamicPlugins.forEach {
|
|
||||||
// pluginUrls.add(it.jarFile.get().toURI().toURL())
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private fun generateJarFile(context: KobaltContext, sourceFiles: List<String>,
|
|
||||||
// buildScriptJarFile: File, originalFile: BuildFile? = null) {
|
|
||||||
// //
|
|
||||||
// // Compile the jar file
|
|
||||||
// //
|
|
||||||
// val kotlinDeps = dependencyManager.calculateDependencies(null, context)
|
|
||||||
// val deps: List<String> = kotlinDeps.map { it.jarFile.get().absolutePath }
|
|
||||||
// val outputJar = File(buildScriptJarFile.absolutePath)
|
|
||||||
// val saved = context.internalContext.noIncrementalKotlin
|
|
||||||
// val result = kotlinCompilePrivate {
|
|
||||||
// classpath(files.kobaltJar)
|
|
||||||
// classpath(deps)
|
|
||||||
// sourceFiles(sourceFiles)
|
|
||||||
// output = outputJar
|
|
||||||
// noIncrementalKotlin = true
|
|
||||||
// }.compile(context = context)
|
|
||||||
// if (! result.success) {
|
|
||||||
// val org = originalFile?.realPath ?: sourceFiles.joinToString(",")
|
|
||||||
// throw KobaltException("Couldn't compile $org:\n" + result.errorMessage)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// context.internalContext.noIncrementalKotlin = saved
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue