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
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findBuildFile(): File {
|
private fun findBuildFile() : File {
|
||||||
val files = arrayListOf("Build.kt", "build.kobalt", KFiles.src("build.kobalt"),
|
val deprecatedLocation = File(Constants.BUILD_FILE_NAME)
|
||||||
KFiles.src("Build.kt"))
|
val result: File =
|
||||||
try {
|
if (deprecatedLocation.exists()) {
|
||||||
return files.map {
|
warn(Constants.BUILD_FILE_NAME + " is in a deprecated location, please move it to "
|
||||||
File(SystemProperties.currentDir, it)
|
+ Constants.BUILD_FILE_DIRECTORY)
|
||||||
}.first {
|
deprecatedLocation
|
||||||
it.exists()
|
} else {
|
||||||
|
File(KFiles.joinDir(Constants.BUILD_FILE_DIRECTORY, Constants.BUILD_FILE_NAME))
|
||||||
}
|
}
|
||||||
} catch(ex: NoSuchElementException) {
|
return result
|
||||||
return File(KFiles.joinFileAndMakeDir("kobalt", "src", "Build.kt"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.beust.kobalt.internal.build
|
package com.beust.kobalt.internal.build
|
||||||
|
|
||||||
import com.beust.kobalt.Args
|
import com.beust.kobalt.Args
|
||||||
|
import com.beust.kobalt.Constants
|
||||||
import com.beust.kobalt.KobaltException
|
import com.beust.kobalt.KobaltException
|
||||||
import com.beust.kobalt.Plugins
|
import com.beust.kobalt.Plugins
|
||||||
import com.beust.kobalt.api.Kobalt
|
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
|
// compile it, jar it in buildScript.jar and run it
|
||||||
val modifiedBuildFile = KFiles.createTempFile(".kt")
|
val modifiedBuildFile = KFiles.createTempFile(".kt")
|
||||||
KFiles.saveFile(modifiedBuildFile, parsedBuildFile.buildScriptCode)
|
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)
|
buildScriptJarFile, pluginUrls)
|
||||||
val projects = buildScriptUtil.runBuildScriptJarFile(buildScriptJarFile, pluginUrls, context)
|
val projects = buildScriptUtil.runBuildScriptJarFile(buildScriptJarFile, pluginUrls, context)
|
||||||
result.addAll(projects)
|
result.addAll(projects)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.beust.kobalt.internal.remote
|
package com.beust.kobalt.internal.remote
|
||||||
|
|
||||||
import com.beust.kobalt.Args
|
import com.beust.kobalt.Args
|
||||||
|
import com.beust.kobalt.Constants
|
||||||
import com.beust.kobalt.api.IClasspathDependency
|
import com.beust.kobalt.api.IClasspathDependency
|
||||||
import com.beust.kobalt.api.Project
|
import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.internal.PluginInfo
|
import com.beust.kobalt.internal.PluginInfo
|
||||||
|
@ -79,6 +80,7 @@ class GetDependenciesCommand @Inject constructor(val executors: KobaltExecutors,
|
||||||
fun main(argv: Array<String>) {
|
fun main(argv: Array<String>) {
|
||||||
val socket = Socket("localhost", 1234)
|
val socket = Socket("localhost", 1234)
|
||||||
(PrintWriter(socket.outputStream, true)).use { out ->
|
(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