mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27: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>()
|
||||
|
||||
init {
|
||||
args.profiles?.split(",")?.filterNotNull()?.forEach {
|
||||
args.profiles?.split(',')?.filterNotNull()?.forEach {
|
||||
profiles.add(it)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,9 @@ class TaskManager @Inject constructor(val args: Args,
|
|||
constructor(project: String, task: String) : this(project + ":" + task)
|
||||
|
||||
val project: String?
|
||||
get() = if (id.contains(":")) id.split(":")[0] else null
|
||||
get() = if (id.contains(':')) id.split(':')[0] else null
|
||||
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
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class MavenId private constructor(val groupId: String, val artifactId: String, v
|
|||
val classifier: String?, val version: String?) {
|
||||
|
||||
companion object {
|
||||
fun isMavenId(id: String) = with(id.split(":")) {
|
||||
fun isMavenId(id: String) = with(id.split(':')) {
|
||||
size >= 3 && size <= 5
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public class Versions {
|
|||
}
|
||||
|
||||
return normalizedVersion
|
||||
.split(".")
|
||||
.split('.')
|
||||
.take(3)
|
||||
.map {
|
||||
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 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 upper = if(split.size > 1) {
|
||||
|
|
|
@ -73,10 +73,10 @@ private class Main @Inject constructor(
|
|||
val dependencies = arrayListOf<IClasspathDependency>()
|
||||
args.pluginIds?.let {
|
||||
// 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 {
|
||||
dependencies.addAll(it.split(",").map { FileDependency(it) })
|
||||
dependencies.addAll(it.split(',').map { FileDependency(it) })
|
||||
}
|
||||
if (dependencies.size > 0) {
|
||||
val urls = dependencies.map { it.jarFile.get().toURI().toURL() }
|
||||
|
@ -187,7 +187,7 @@ private class Main @Inject constructor(
|
|||
}
|
||||
} else if (args.dependencies != null) {
|
||||
// --resolve
|
||||
resolveDependency.run(args.dependencies!!.split(",").toList())
|
||||
resolveDependency.run(args.dependencies!!.split(',').toList())
|
||||
} else if (args.tasks) {
|
||||
// --tasks
|
||||
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]
|
||||
if (template != null) {
|
||||
log(2, "Running template $templateName")
|
||||
|
|
|
@ -73,7 +73,7 @@ class KobaltServer @Inject constructor(@Assisted val force: Boolean, @Assisted @
|
|||
return false
|
||||
} else {
|
||||
val processName = ManagementFactory.getRuntimeMXBean().name
|
||||
val pid = processName.split("@")[0]
|
||||
val pid = processName.split('@')[0]
|
||||
Properties().apply {
|
||||
put(KEY_PORT, port.toString())
|
||||
put(KEY_PID, pid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue