mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Merge pull request #191 from kmruiz/bug/190-classifier
Add classifier to MavenId
This commit is contained in:
commit
89adedd800
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
|
||||
})
|
||||
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)) {
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ import org.eclipse.aether.artifact.DefaultArtifact
|
|||
* 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?,
|
||||
val version: String?) {
|
||||
val classifier: String?, val version: String?) {
|
||||
|
||||
companion object {
|
||||
fun isMavenId(id: String) = with(id.split(":")) {
|
||||
size == 3 || size == 4
|
||||
size >= 3 && size <= 5
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
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
|
||||
|
@ -51,18 +51,19 @@ class MavenId private constructor(val groupId: String, val artifactId: String, v
|
|||
return interceptedMavenId
|
||||
}
|
||||
|
||||
fun create(groupId: String, artifactId: String, packaging: String?, version: String?) =
|
||||
create(toId(groupId, artifactId, packaging, version))
|
||||
fun create(groupId: String, artifactId: String, packaging: String?, classifier: String?, version: String?) =
|
||||
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" +
|
||||
(if (packaging != null && packaging != "") ":$packaging" else "") +
|
||||
(if (classifier != null && classifier != "") ":$classifier" else "") +
|
||||
":$version"
|
||||
}
|
||||
|
||||
|
||||
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 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 outputFile = File(outputDir, pomFile)
|
||||
outputFile.writeText(s.toString(), Charset.defaultCharset())
|
||||
log(1, " Created $outputFile")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue