mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
More complete pom generation.
This commit is contained in:
parent
b7ad814ff0
commit
f602f6996d
3 changed files with 49 additions and 15 deletions
|
@ -5,18 +5,18 @@ import com.beust.kobalt.plugin.kotlin.kotlinProject
|
||||||
import com.beust.kobalt.plugin.packaging.assemble
|
import com.beust.kobalt.plugin.packaging.assemble
|
||||||
import com.beust.kobalt.plugin.kotlin.kotlinCompiler
|
import com.beust.kobalt.plugin.kotlin.kotlinCompiler
|
||||||
import com.beust.kobalt.plugin.publish.jcenter
|
import com.beust.kobalt.plugin.publish.jcenter
|
||||||
import com.beust.kobalt.plugin.linecount.lineCount
|
//import com.beust.kobalt.plugin.linecount.lineCount
|
||||||
|
//
|
||||||
//val repos = repos("https://dl.bintray.com/cbeust/maven/")
|
////val repos = repos("https://dl.bintray.com/cbeust/maven/")
|
||||||
|
//
|
||||||
val plugins = plugins(
|
//val plugins = plugins(
|
||||||
"com.beust.kobalt:kobalt-line-count:0.15"
|
// "com.beust.kobalt:kobalt-line-count:0.15"
|
||||||
// file(homeDir("kotlin/kobalt-line-count/kobaltBuild/libs/kobalt-line-count-0.14.jar"))
|
//// file(homeDir("kotlin/kobalt-line-count/kobaltBuild/libs/kobalt-line-count-0.14.jar"))
|
||||||
)
|
//)
|
||||||
|
//
|
||||||
val lc = lineCount {
|
//val lc = lineCount {
|
||||||
suffix = "**Plugin.kt"
|
// suffix = "**Plugin.kt"
|
||||||
}
|
//}
|
||||||
|
|
||||||
fun readVersion() : String {
|
fun readVersion() : String {
|
||||||
val p = java.util.Properties()
|
val p = java.util.Properties()
|
||||||
|
@ -43,6 +43,13 @@ val kobalt = kotlinProject(wrapper) {
|
||||||
group = "com.beust"
|
group = "com.beust"
|
||||||
artifactId = name
|
artifactId = name
|
||||||
version = readVersion()
|
version = readVersion()
|
||||||
|
description = "A build system in Kotlin"
|
||||||
|
url = "http://beust.com/kobalt"
|
||||||
|
licenses = listOf(com.beust.kobalt.api.License("Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0"))
|
||||||
|
scm = com.beust.kobalt.api.Scm(
|
||||||
|
url = "http://github.com/cbeust/kobalt",
|
||||||
|
connection = "https://github.com/cbeust/kobalt.git",
|
||||||
|
developerConnection = "git@github.com:cbeust/kobalt.git")
|
||||||
|
|
||||||
dependenciesTest {
|
dependenciesTest {
|
||||||
compile("org.testng:testng:6.9.6")
|
compile("org.testng:testng:6.9.6")
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.beust.kobalt.api.annotation.Directive
|
||||||
import com.beust.kobalt.maven.MavenDependency
|
import com.beust.kobalt.maven.MavenDependency
|
||||||
import com.beust.kobalt.maven.IClasspathDependency
|
import com.beust.kobalt.maven.IClasspathDependency
|
||||||
import com.beust.kobalt.misc.KFiles
|
import com.beust.kobalt.misc.KFiles
|
||||||
import com.google.common.base.Preconditions
|
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
open public class Project(
|
open public class Project(
|
||||||
|
@ -16,7 +15,11 @@ open public class Project(
|
||||||
open var artifactId: String? = null,
|
open var artifactId: String? = null,
|
||||||
open var dependencies: Dependencies? = null,
|
open var dependencies: Dependencies? = null,
|
||||||
open var sourceSuffix : String = "",
|
open var sourceSuffix : String = "",
|
||||||
open var compilerInfo : ICompilerInfo ) {
|
open var compilerInfo : ICompilerInfo,
|
||||||
|
open var description : String = "",
|
||||||
|
open var scm : Scm? = null,
|
||||||
|
open var url: String? = null,
|
||||||
|
open var licenses: List<License> = arrayListOf<License>()) {
|
||||||
|
|
||||||
var testArgs: ArrayList<String> = arrayListOf()
|
var testArgs: ArrayList<String> = arrayListOf()
|
||||||
|
|
||||||
|
@ -110,3 +113,14 @@ public class Dependencies(val project: Project, val dependencies: ArrayList<ICla
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Scm(val connection: String, val developerConnection: String, val url: String)
|
||||||
|
|
||||||
|
public class License(val name: String, val url: String) {
|
||||||
|
fun toMavenLicense() : org.apache.maven.model.License {
|
||||||
|
val result = org.apache.maven.model.License()
|
||||||
|
result.name = name
|
||||||
|
result.url = url
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,11 +6,14 @@ import com.beust.kobalt.SystemProperties
|
||||||
import com.google.common.base.Preconditions
|
import com.google.common.base.Preconditions
|
||||||
import com.google.inject.assistedinject.Assisted
|
import com.google.inject.assistedinject.Assisted
|
||||||
import org.apache.maven.model.Developer
|
import org.apache.maven.model.Developer
|
||||||
|
import org.apache.maven.model.License
|
||||||
import org.apache.maven.model.Model
|
import org.apache.maven.model.Model
|
||||||
|
import org.apache.maven.model.Scm
|
||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer
|
import org.apache.maven.model.io.xpp3.MavenXpp3Writer
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.StringWriter
|
import java.io.StringWriter
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
public class PomGenerator @Inject constructor(@Assisted val project: Project) : KobaltLogger {
|
public class PomGenerator @Inject constructor(@Assisted val project: Project) : KobaltLogger {
|
||||||
|
@ -26,6 +29,16 @@ public class PomGenerator @Inject constructor(@Assisted val project: Project) :
|
||||||
artifactId = project.artifactId
|
artifactId = project.artifactId
|
||||||
groupId = project.group
|
groupId = project.group
|
||||||
version = project.version
|
version = project.version
|
||||||
|
description = project.description
|
||||||
|
licenses = project.licenses.map { it.toMavenLicense() }
|
||||||
|
url = project.url
|
||||||
|
scm = Scm().apply {
|
||||||
|
project.scm?.let {
|
||||||
|
url = it.url
|
||||||
|
connection = it.connection
|
||||||
|
developerConnection = it.developerConnection
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
with(Developer()) {
|
with(Developer()) {
|
||||||
name = SystemProperties.username
|
name = SystemProperties.username
|
||||||
|
@ -46,6 +59,6 @@ public class PomGenerator @Inject constructor(@Assisted val project: Project) :
|
||||||
val pomFile = SimpleDep(project.group!!, project.artifactId!!, project.version!!).toPomFileName()
|
val pomFile = SimpleDep(project.group!!, project.artifactId!!, project.version!!).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, "Wrote ${outputFile}")
|
log(1, "Wrote $outputFile")
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue