mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Deprecate Build.kt in the root dir.
This commit is contained in:
parent
d71cdf7010
commit
4fb726be91
4 changed files with 22 additions and 13 deletions
6
src/main/kotlin/com/beust/kobalt/Constants.kt
Normal file
6
src/main/kotlin/com/beust/kobalt/Constants.kt
Normal file
|
@ -0,0 +1,6 @@
|
|||
package com.beust.kobalt
|
||||
|
||||
object Constants {
|
||||
val BUILD_FILE_NAME = "Build.kt"
|
||||
val BUILD_FILE_DIRECTORY = "kobalt/src"
|
||||
}
|
|
@ -251,17 +251,16 @@ private class Main @Inject constructor(
|
|||
return result
|
||||
}
|
||||
|
||||
private fun findBuildFile(): File {
|
||||
val files = arrayListOf("Build.kt", "build.kobalt", KFiles.src("build.kobalt"),
|
||||
KFiles.src("Build.kt"))
|
||||
try {
|
||||
return files.map {
|
||||
File(SystemProperties.currentDir, it)
|
||||
}.first {
|
||||
it.exists()
|
||||
}
|
||||
} catch(ex: NoSuchElementException) {
|
||||
return File(KFiles.joinFileAndMakeDir("kobalt", "src", "Build.kt"))
|
||||
private fun findBuildFile() : File {
|
||||
val deprecatedLocation = File(Constants.BUILD_FILE_NAME)
|
||||
val result: File =
|
||||
if (deprecatedLocation.exists()) {
|
||||
warn(Constants.BUILD_FILE_NAME + " is in a deprecated location, please move it to "
|
||||
+ Constants.BUILD_FILE_DIRECTORY)
|
||||
deprecatedLocation
|
||||
} else {
|
||||
File(KFiles.joinDir(Constants.BUILD_FILE_DIRECTORY, Constants.BUILD_FILE_NAME))
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.beust.kobalt.internal.build
|
||||
|
||||
import com.beust.kobalt.Args
|
||||
import com.beust.kobalt.Constants
|
||||
import com.beust.kobalt.KobaltException
|
||||
import com.beust.kobalt.Plugins
|
||||
import com.beust.kobalt.api.Kobalt
|
||||
|
@ -78,7 +79,8 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b
|
|||
// compile it, jar it in buildScript.jar and run it
|
||||
val modifiedBuildFile = KFiles.createTempFile(".kt")
|
||||
KFiles.saveFile(modifiedBuildFile, parsedBuildFile.buildScriptCode)
|
||||
maybeCompileBuildFile(context, BuildFile(Paths.get(modifiedBuildFile.path), "Modified Build.kt"),
|
||||
maybeCompileBuildFile(context, BuildFile(Paths.get(modifiedBuildFile.path),
|
||||
"Modified ${Constants.BUILD_FILE_NAME}"),
|
||||
buildScriptJarFile, pluginUrls)
|
||||
val projects = buildScriptUtil.runBuildScriptJarFile(buildScriptJarFile, pluginUrls, context)
|
||||
result.addAll(projects)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.beust.kobalt.internal.remote
|
||||
|
||||
import com.beust.kobalt.Args
|
||||
import com.beust.kobalt.Constants
|
||||
import com.beust.kobalt.api.IClasspathDependency
|
||||
import com.beust.kobalt.api.Project
|
||||
import com.beust.kobalt.internal.PluginInfo
|
||||
|
@ -79,6 +80,7 @@ class GetDependenciesCommand @Inject constructor(val executors: KobaltExecutors,
|
|||
fun main(argv: Array<String>) {
|
||||
val socket = Socket("localhost", 1234)
|
||||
(PrintWriter(socket.outputStream, true)).use { out ->
|
||||
out.println("""{ "name" : "getDependencies", "buildFile": "/Users/beust/kotlin/kobalt/kobalt/src/Build.kt"}""")
|
||||
out.println("""{ "name" : "getDependencies", "buildFile":
|
||||
"/Users/beust/kotlin/kobalt/kobalt/src/${Constants.BUILD_FILE_NAME}"}""")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue