mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
add classifier when need
This commit is contained in:
parent
a425dfb855
commit
38b2379227
3 changed files with 12 additions and 10 deletions
|
@ -39,7 +39,7 @@ open class LocalRepo @Inject constructor(val kobaltSettings: KobaltSettings) {
|
||||||
v2.compareTo(v1) // we want the most recent at position 0
|
v2.compareTo(v1) // we want the most recent at position 0
|
||||||
})
|
})
|
||||||
val result = directories[0].name
|
val result = directories[0].name
|
||||||
val newDep = LocalDep(MavenId.create(groupId, artifactId, packaging, result), this)
|
val newDep = LocalDep(MavenId.create(groupId, artifactId, packaging, null, result), this)
|
||||||
if (existsPom(newDep, result) && existsJar(newDep, result)) {
|
if (existsPom(newDep, result) && existsJar(newDep, result)) {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@ import org.eclipse.aether.artifact.DefaultArtifact
|
||||||
* usually means "latest version") but it doesn't handle version ranges yet.
|
* usually means "latest version") but it doesn't handle version ranges yet.
|
||||||
*/
|
*/
|
||||||
class MavenId private constructor(val groupId: String, val artifactId: String, val packaging: String?,
|
class MavenId private constructor(val groupId: String, val artifactId: String, val packaging: 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 == 4
|
size >= 3 && size <= 5
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isRangedVersion(s: String): Boolean {
|
fun isRangedVersion(s: String): Boolean {
|
||||||
|
@ -29,7 +29,7 @@ class MavenId private constructor(val groupId: String, val artifactId: String, v
|
||||||
* Similar to create(MavenId) but don't run IMavenIdInterceptors.
|
* Similar to create(MavenId) but don't run IMavenIdInterceptors.
|
||||||
*/
|
*/
|
||||||
fun createNoInterceptors(id: String) : MavenId = DefaultArtifact(id).run {
|
fun createNoInterceptors(id: String) : MavenId = DefaultArtifact(id).run {
|
||||||
MavenId(groupId, artifactId, extension, version)
|
MavenId(groupId, artifactId, extension, classifier, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toKobaltId(id: String) = if (id.endsWith(":")) id + "(0,]" else id
|
fun toKobaltId(id: String) = if (id.endsWith(":")) id + "(0,]" else id
|
||||||
|
@ -51,18 +51,19 @@ class MavenId private constructor(val groupId: String, val artifactId: String, v
|
||||||
return interceptedMavenId
|
return interceptedMavenId
|
||||||
}
|
}
|
||||||
|
|
||||||
fun create(groupId: String, artifactId: String, packaging: String?, version: String?) =
|
fun create(groupId: String, artifactId: String, packaging: String?, classifier: String?, version: String?) =
|
||||||
create(toId(groupId, artifactId, packaging, version))
|
create(toId(groupId, artifactId, packaging, classifier, version))
|
||||||
|
|
||||||
fun toId(groupId: String, artifactId: String, packaging: String? = null, version: String?) =
|
fun toId(groupId: String, artifactId: String, packaging: String? = null, classifier: String? = null, version: String?) =
|
||||||
"$groupId:$artifactId" +
|
"$groupId:$artifactId" +
|
||||||
(if (packaging != null && packaging != "") ":$packaging" else "") +
|
(if (packaging != null && packaging != "") ":$packaging" else "") +
|
||||||
|
(if (classifier != null && classifier != "") ":$classifier" else "") +
|
||||||
":$version"
|
":$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val hasVersion = version != null
|
val hasVersion = version != null
|
||||||
|
|
||||||
val toId = MavenId.toId(groupId, artifactId, packaging, version)
|
val toId = MavenId.toId(groupId, artifactId, packaging, classifier, version)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,11 @@ public class PomGenerator @Inject constructor(@Assisted val project: Project) {
|
||||||
|
|
||||||
val buildDir = KFiles.makeDir(project.directory, project.buildDirectory)
|
val buildDir = KFiles.makeDir(project.directory, project.buildDirectory)
|
||||||
val outputDir = KFiles.makeDir(buildDir.path, "libs")
|
val outputDir = KFiles.makeDir(buildDir.path, "libs")
|
||||||
val mavenId = MavenId.create(project.group!!, project.artifactId!!, project.packaging, project.version!!)
|
val NO_CLASSIFIER = null
|
||||||
|
val mavenId = MavenId.create(project.group!!, project.artifactId!!, project.packaging, NO_CLASSIFIER, project.version!!)
|
||||||
val pomFile = SimpleDep(mavenId).toPomFileName()
|
val pomFile = SimpleDep(mavenId).toPomFileName()
|
||||||
val outputFile = File(outputDir, pomFile)
|
val outputFile = File(outputDir, pomFile)
|
||||||
outputFile.writeText(s.toString(), Charset.defaultCharset())
|
outputFile.writeText(s.toString(), Charset.defaultCharset())
|
||||||
log(1, " Created $outputFile")
|
log(1, " Created $outputFile")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue