mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Remove public.
This commit is contained in:
parent
62b193f378
commit
48bbdfd1ff
13 changed files with 21 additions and 31 deletions
|
@ -6,7 +6,7 @@ import com.beust.kobalt.api.annotation.Directive
|
||||||
import com.beust.kobalt.internal.JvmCompilerPlugin
|
import com.beust.kobalt.internal.JvmCompilerPlugin
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
public fun project(vararg projects: Project, init: Project.() -> Unit): Project {
|
fun project(vararg projects: Project, init: Project.() -> Unit): Project {
|
||||||
return Project("").apply {
|
return Project("").apply {
|
||||||
init()
|
init()
|
||||||
(Kobalt.findPlugin(JvmCompilerPlugin.PLUGIN_NAME) as JvmCompilerPlugin)
|
(Kobalt.findPlugin(JvmCompilerPlugin.PLUGIN_NAME) as JvmCompilerPlugin)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.net.URLClassLoader
|
||||||
* Will probably be made obsolete by making the wrapper a standalone module instead of
|
* Will probably be made obsolete by making the wrapper a standalone module instead of
|
||||||
* being inside Kobalt itself.
|
* being inside Kobalt itself.
|
||||||
*/
|
*/
|
||||||
public class ParentLastClassLoader(val classpath: List<URL>)
|
class ParentLastClassLoader(val classpath: List<URL>)
|
||||||
: ClassLoader(Thread.currentThread().contextClassLoader) {
|
: ClassLoader(Thread.currentThread().contextClassLoader) {
|
||||||
private val childClassLoader: ChildURLClassLoader
|
private val childClassLoader: ChildURLClassLoader
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public class ParentLastClassLoader(val classpath: List<URL>)
|
||||||
* This class makes it possible to call findClass on a classloader
|
* This class makes it possible to call findClass on a classloader
|
||||||
*/
|
*/
|
||||||
private class FindClassClassLoader(parent: ClassLoader) : ClassLoader(parent) {
|
private class FindClassClassLoader(parent: ClassLoader) : ClassLoader(parent) {
|
||||||
override public fun findClass(name: String) = super.findClass(name)
|
override fun findClass(name: String) = super.findClass(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@ public class ParentLastClassLoader(val classpath: List<URL>)
|
||||||
private class ChildURLClassLoader(urls: Array<URL>, val realParent: FindClassClassLoader)
|
private class ChildURLClassLoader(urls: Array<URL>, val realParent: FindClassClassLoader)
|
||||||
: URLClassLoader(urls, null) {
|
: URLClassLoader(urls, null) {
|
||||||
|
|
||||||
override public fun findClass(name: String) : Class<*> {
|
override fun findClass(name: String) : Class<*> {
|
||||||
try {
|
try {
|
||||||
// first try to use the URLClassLoader findClass
|
// first try to use the URLClassLoader findClass
|
||||||
return super.findClass(name)
|
return super.findClass(name)
|
||||||
|
@ -43,7 +43,7 @@ public class ParentLastClassLoader(val classpath: List<URL>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override public @Synchronized fun loadClass(name: String, resolve: Boolean) : Class<*> {
|
override @Synchronized fun loadClass(name: String, resolve: Boolean) : Class<*> {
|
||||||
try {
|
try {
|
||||||
// first we try to find a class inside the child classloader
|
// first we try to find a class inside the child classloader
|
||||||
return childClassLoader.findClass(name)
|
return childClassLoader.findClass(name)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.beust.kobalt.maven
|
||||||
import java.util.concurrent.Future
|
import java.util.concurrent.Future
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
public class CompletedFuture<T>(val value: T) : Future<T> {
|
class CompletedFuture<T>(val value: T) : Future<T> {
|
||||||
override fun cancel(mayInterruptIfRunning: Boolean) = true
|
override fun cancel(mayInterruptIfRunning: Boolean) = true
|
||||||
override fun get(): T = value
|
override fun get(): T = value
|
||||||
override fun get(timeout: Long, unit: TimeUnit): T = value
|
override fun get(timeout: Long, unit: TimeUnit): T = value
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.io.File
|
||||||
import java.io.InputStreamReader
|
import java.io.InputStreamReader
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class Gpg {
|
class Gpg {
|
||||||
val COMMANDS = listOf("gpg", "gpg2")
|
val COMMANDS = listOf("gpg", "gpg2")
|
||||||
|
|
||||||
fun findGpgCommand() : String? {
|
fun findGpgCommand() : String? {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.beust.kobalt.maven
|
package com.beust.kobalt.maven
|
||||||
|
|
||||||
open public class LocalDep(override val mavenId: MavenId, open val localRepo: LocalRepo)
|
open class LocalDep(override val mavenId: MavenId, open val localRepo: LocalRepo)
|
||||||
: SimpleDep(mavenId) {
|
: SimpleDep(mavenId) {
|
||||||
|
|
||||||
fun toAbsoluteJarFilePath(v: String) = localRepo.toFullPath(toJarFile(v))
|
fun toAbsoluteJarFilePath(v: String) = localRepo.toFullPath(toJarFile(v))
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.zip.ZipEntry
|
||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
import java.util.zip.ZipOutputStream
|
import java.util.zip.ZipOutputStream
|
||||||
|
|
||||||
public class JarUtils {
|
class JarUtils {
|
||||||
companion object {
|
companion object {
|
||||||
val DEFAULT_HANDLER: (Exception) -> Unit = { ex: Exception ->
|
val DEFAULT_HANDLER: (Exception) -> Unit = { ex: Exception ->
|
||||||
// Ignore duplicate entry exceptions
|
// Ignore duplicate entry exceptions
|
||||||
|
@ -150,7 +150,7 @@ class IncludedFile(val fromOriginal: From, val toOriginal: To, val specs: List<I
|
||||||
val from: String get() = fromOriginal.path.replace("\\", "/")
|
val from: String get() = fromOriginal.path.replace("\\", "/")
|
||||||
fun to(s: String) = File(if (toOriginal.isCurrentDir()) s else KFiles.joinDir(to, s))
|
fun to(s: String) = File(if (toOriginal.isCurrentDir()) s else KFiles.joinDir(to, s))
|
||||||
val to: String get() = toOriginal.path.replace("\\", "/")
|
val to: String get() = toOriginal.path.replace("\\", "/")
|
||||||
override public fun toString() = toString("IncludedFile",
|
override fun toString() = toString("IncludedFile",
|
||||||
"files - ", specs.map { it.toString() },
|
"files - ", specs.map { it.toString() },
|
||||||
"from", from,
|
"from", from,
|
||||||
"to", to)
|
"to", to)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.beust.kobalt.misc
|
package com.beust.kobalt.misc
|
||||||
|
|
||||||
public data class Node<T>(val value: T) {
|
data class Node<T>(val value: T) {
|
||||||
val children = arrayListOf<Node<T>>()
|
val children = arrayListOf<Node<T>>()
|
||||||
var parent: Node<T>? = null
|
var parent: Node<T>? = null
|
||||||
|
|
||||||
public fun addChildren(values: List<Node<T>>) {
|
fun addChildren(values: List<Node<T>>) {
|
||||||
values.forEach {
|
values.forEach {
|
||||||
it.parent = this
|
it.parent = this
|
||||||
children.add(it)
|
children.add(it)
|
||||||
|
@ -15,12 +15,12 @@ public data class Node<T>(val value: T) {
|
||||||
println(s)
|
println(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun dump(r: T, children: List<Node<T>>, indent: Int) {
|
fun dump(r: T, children: List<Node<T>>, indent: Int) {
|
||||||
p(" ".repeat(indent) + r)
|
p(" ".repeat(indent) + r)
|
||||||
children.forEach { dump(it.value, it.children, indent + 2) }
|
children.forEach { dump(it.value, it.children, indent + 2) }
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun dump(indent: Int = 0) {
|
fun dump(indent: Int = 0) {
|
||||||
dump(value, children, indent)
|
dump(value, children, indent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import javax.inject.Inject
|
||||||
* 1) Extract the repos() and plugins() statements in a separate .kt and compile it into preBuildScript.jar.
|
* 1) Extract the repos() and plugins() statements in a separate .kt and compile it into preBuildScript.jar.
|
||||||
* 2) Actually build the whole Build.kt file after adding to the classpath whatever phase 1 found (plugins, repos)
|
* 2) Actually build the whole Build.kt file after adding to the classpath whatever phase 1 found (plugins, repos)
|
||||||
*/
|
*/
|
||||||
public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val buildFiles: List<BuildFile>,
|
class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val buildFiles: List<BuildFile>,
|
||||||
@Assisted val pluginInfo: PluginInfo, val files: KFiles, val plugins: Plugins,
|
@Assisted val pluginInfo: PluginInfo, val files: KFiles, val plugins: Plugins,
|
||||||
val dependencyManager: DependencyManager, val pluginProperties: PluginProperties,
|
val dependencyManager: DependencyManager, val pluginProperties: PluginProperties,
|
||||||
val executors: KobaltExecutors, val buildScriptUtil: BuildScriptUtil, val settings: KobaltSettings,
|
val executors: KobaltExecutors, val buildScriptUtil: BuildScriptUtil, val settings: KobaltSettings,
|
||||||
|
|
|
@ -65,7 +65,7 @@ open class MainModule(val args: Args, val settings: KobaltSettings) : AbstractMo
|
||||||
// bindListener(Matchers.any(), object: TypeListener {
|
// bindListener(Matchers.any(), object: TypeListener {
|
||||||
// override fun <I> hear(typeLiteral: TypeLiteral<I>?, typeEncounter: TypeEncounter<I>?) {
|
// override fun <I> hear(typeLiteral: TypeLiteral<I>?, typeEncounter: TypeEncounter<I>?) {
|
||||||
// val bean = object: InjectionListener<I> {
|
// val bean = object: InjectionListener<I> {
|
||||||
// override public fun afterInjection(injectee: I) {
|
// override fun afterInjection(injectee: I) {
|
||||||
// if (Scopes.isCircularProxy(injectee)) {
|
// if (Scopes.isCircularProxy(injectee)) {
|
||||||
// println("CYCLE: " + typeLiteral?.getRawType()?.getName());
|
// println("CYCLE: " + typeLiteral?.getRawType()?.getName());
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -72,7 +72,7 @@ class JavaPlugin @Inject constructor(val javaCompiler: JavaCompiler, override va
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
public fun javaProject(vararg projects: Project, init: Project.() -> Unit): Project {
|
fun javaProject(vararg projects: Project, init: Project.() -> Unit): Project {
|
||||||
return Project().apply {
|
return Project().apply {
|
||||||
warn("javaProject{} is deprecated, please use project{}")
|
warn("javaProject{} is deprecated, please use project{}")
|
||||||
init()
|
init()
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.testng.annotations.Guice
|
||||||
open class KobaltTest {
|
open class KobaltTest {
|
||||||
companion object {
|
companion object {
|
||||||
@BeforeSuite
|
@BeforeSuite
|
||||||
public fun bs() {
|
fun bs() {
|
||||||
Kobalt.INJECTOR = com.google.inject.Guice.createInjector(TestModule())
|
Kobalt.INJECTOR = com.google.inject.Guice.createInjector(TestModule())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,17 +29,17 @@ class DependencyTest @Inject constructor(val executors: KobaltExecutors) {
|
||||||
private var executor: ExecutorService by Delegates.notNull()
|
private var executor: ExecutorService by Delegates.notNull()
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public fun bc() {
|
fun bc() {
|
||||||
executor = executors.newExecutor("DependencyTest", 5)
|
executor = executors.newExecutor("DependencyTest", 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public fun ac() {
|
fun ac() {
|
||||||
executor.shutdown()
|
executor.shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "dpVersions")
|
@Test(dataProvider = "dpVersions")
|
||||||
public fun versionSorting(k: String, v: String) {
|
fun versionSorting(k: String, v: String) {
|
||||||
val dep1 = Versions.toLongVersion(k)
|
val dep1 = Versions.toLongVersion(k)
|
||||||
val dep2 = Versions.toLongVersion(v)
|
val dep2 = Versions.toLongVersion(v)
|
||||||
Assert.assertTrue(dep1.compareTo(dep2) < 0)
|
Assert.assertTrue(dep1.compareTo(dep2) < 0)
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
package com.beust.kobalt.maven
|
|
||||||
|
|
||||||
//import org.junit.Test
|
|
||||||
//
|
|
||||||
//public class JUnitTest {
|
|
||||||
// @Test
|
|
||||||
// public fun simpleTestForJUnit() {
|
|
||||||
// println("Works")
|
|
||||||
// }
|
|
||||||
//}
|
|
Loading…
Add table
Add a link
Reference in a new issue