mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Optimize splits.
This commit is contained in:
parent
9bb3b11128
commit
160cbbcfda
7 changed files with 11 additions and 11 deletions
|
@ -15,7 +15,7 @@ class KobaltContext(val args: Args) {
|
||||||
val profiles = arrayListOf<String>()
|
val profiles = arrayListOf<String>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
args.profiles?.split(",")?.filterNotNull()?.forEach {
|
args.profiles?.split(',')?.filterNotNull()?.forEach {
|
||||||
profiles.add(it)
|
profiles.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ class TaskManager @Inject constructor(val args: Args,
|
||||||
constructor(project: String, task: String) : this(project + ":" + task)
|
constructor(project: String, task: String) : this(project + ":" + task)
|
||||||
|
|
||||||
val project: String?
|
val project: String?
|
||||||
get() = if (id.contains(":")) id.split(":")[0] else null
|
get() = if (id.contains(':')) id.split(':')[0] else null
|
||||||
val taskName: String
|
val taskName: String
|
||||||
get() = if (id.contains(":")) id.split(":")[1] else id
|
get() = if (id.contains(':')) id.split(':')[1] else id
|
||||||
|
|
||||||
fun matches(projectName: String) = project == null || project == projectName
|
fun matches(projectName: String) = project == null || project == projectName
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class MavenId private constructor(val groupId: String, val artifactId: String, v
|
||||||
val classifier: String?, val version: String?) {
|
val classifier: String?, val version: String?) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun isMavenId(id: String) = with(id.split(":")) {
|
fun isMavenId(id: String) = with(id.split(':')) {
|
||||||
size >= 3 && size <= 5
|
size >= 3 && size <= 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class Versions {
|
||||||
}
|
}
|
||||||
|
|
||||||
return normalizedVersion
|
return normalizedVersion
|
||||||
.split(".")
|
.split('.')
|
||||||
.take(3)
|
.take(3)
|
||||||
.map {
|
.map {
|
||||||
val s = CharMatcher.inRange('0', '9').or(CharMatcher.`is`('.')).retainFrom(it)
|
val s = CharMatcher.inRange('0', '9').or(CharMatcher.`is`('.')).retainFrom(it)
|
||||||
|
@ -107,7 +107,7 @@ class Version(val version: String, val snapshotTimestamp: String? = null): Compa
|
||||||
var lowerExclusive = version.startsWith("(")
|
var lowerExclusive = version.startsWith("(")
|
||||||
var upperExclusive = version.endsWith(")")
|
var upperExclusive = version.endsWith(")")
|
||||||
|
|
||||||
val split = version.drop(1).dropLast(1).split(",")
|
val split = version.drop(1).dropLast(1).split(',')
|
||||||
|
|
||||||
val lower = Version.of(split[0].substring(1))
|
val lower = Version.of(split[0].substring(1))
|
||||||
val upper = if(split.size > 1) {
|
val upper = if(split.size > 1) {
|
||||||
|
|
|
@ -73,10 +73,10 @@ private class Main @Inject constructor(
|
||||||
val dependencies = arrayListOf<IClasspathDependency>()
|
val dependencies = arrayListOf<IClasspathDependency>()
|
||||||
args.pluginIds?.let {
|
args.pluginIds?.let {
|
||||||
// We want this call to go to the network if no version was specified, so set localFirst to false
|
// We want this call to go to the network if no version was specified, so set localFirst to false
|
||||||
dependencies.addAll(it.split(",").map { dependencyManager.create(it) })
|
dependencies.addAll(it.split(',').map { dependencyManager.create(it) })
|
||||||
}
|
}
|
||||||
args.pluginJarFiles?.let {
|
args.pluginJarFiles?.let {
|
||||||
dependencies.addAll(it.split(",").map { FileDependency(it) })
|
dependencies.addAll(it.split(',').map { FileDependency(it) })
|
||||||
}
|
}
|
||||||
if (dependencies.size > 0) {
|
if (dependencies.size > 0) {
|
||||||
val urls = dependencies.map { it.jarFile.get().toURI().toURL() }
|
val urls = dependencies.map { it.jarFile.get().toURI().toURL() }
|
||||||
|
@ -187,7 +187,7 @@ private class Main @Inject constructor(
|
||||||
}
|
}
|
||||||
} else if (args.dependencies != null) {
|
} else if (args.dependencies != null) {
|
||||||
// --resolve
|
// --resolve
|
||||||
resolveDependency.run(args.dependencies!!.split(",").toList())
|
resolveDependency.run(args.dependencies!!.split(',').toList())
|
||||||
} else if (args.tasks) {
|
} else if (args.tasks) {
|
||||||
// --tasks
|
// --tasks
|
||||||
displayTasks()
|
displayTasks()
|
||||||
|
|
|
@ -21,7 +21,7 @@ class ProjectGenerator @Inject constructor(val pluginInfo: PluginInfo){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
args.templates?.split(",")?.forEach { templateName ->
|
args.templates?.split(',')?.forEach { templateName ->
|
||||||
val template = map[templateName]
|
val template = map[templateName]
|
||||||
if (template != null) {
|
if (template != null) {
|
||||||
log(2, "Running template $templateName")
|
log(2, "Running template $templateName")
|
||||||
|
|
|
@ -73,7 +73,7 @@ class KobaltServer @Inject constructor(@Assisted val force: Boolean, @Assisted @
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
val processName = ManagementFactory.getRuntimeMXBean().name
|
val processName = ManagementFactory.getRuntimeMXBean().name
|
||||||
val pid = processName.split("@")[0]
|
val pid = processName.split('@')[0]
|
||||||
Properties().apply {
|
Properties().apply {
|
||||||
put(KEY_PORT, port.toString())
|
put(KEY_PORT, port.toString())
|
||||||
put(KEY_PID, pid)
|
put(KEY_PID, pid)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue