mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 16:07:12 -07:00
Break Kobalt in two projects.
This commit is contained in:
parent
733c4b52b5
commit
3914e92f6d
114 changed files with 114 additions and 98 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -10,3 +10,5 @@ classes
|
||||||
libs
|
libs
|
||||||
.kobalt/
|
.kobalt/
|
||||||
build/
|
build/
|
||||||
|
out
|
||||||
|
.DS_Store
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
|
|
||||||
import com.beust.kobalt.*
|
import com.beust.kobalt.TaskResult
|
||||||
import com.beust.kobalt.api.*
|
import com.beust.kobalt.api.License
|
||||||
|
import com.beust.kobalt.api.Project
|
||||||
|
import com.beust.kobalt.api.Scm
|
||||||
import com.beust.kobalt.api.annotation.Task
|
import com.beust.kobalt.api.annotation.Task
|
||||||
|
import com.beust.kobalt.homeDir
|
||||||
import com.beust.kobalt.plugin.application.application
|
import com.beust.kobalt.plugin.application.application
|
||||||
import com.beust.kobalt.plugin.java.*
|
import com.beust.kobalt.plugin.java.javaCompiler
|
||||||
import com.beust.kobalt.plugin.kotlin.*
|
import com.beust.kobalt.plugin.java.javaProject
|
||||||
|
import com.beust.kobalt.plugin.kotlin.kotlinCompiler
|
||||||
|
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.publish.github
|
import com.beust.kobalt.plugin.publish.github
|
||||||
import com.beust.kobalt.plugin.publish.jcenter
|
import com.beust.kobalt.plugin.publish.jcenter
|
||||||
import com.beust.kobalt.plugin.retrolambda.*
|
import com.beust.kobalt.repos
|
||||||
import com.beust.kobalt.test
|
import com.beust.kobalt.test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
@ -35,25 +40,18 @@ val wrapper = javaProject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// retrolambda {
|
|
||||||
// }
|
|
||||||
|
|
||||||
productFlavor("dev") {
|
|
||||||
}
|
|
||||||
|
|
||||||
buildType("debug") {
|
|
||||||
}
|
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClass = "com.beust.kobalt.wrapper.Main"
|
mainClass = "com.beust.kobalt.wrapper.Main"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val kobalt = kotlinProject(wrapper) {
|
|
||||||
name = "kobalt"
|
val kobaltPluginApi = kotlinProject {
|
||||||
|
name = "kobalt-plugin-api"
|
||||||
group = "com.beust"
|
group = "com.beust"
|
||||||
artifactId = name
|
artifactId = name
|
||||||
version = readVersion()
|
version = readVersion()
|
||||||
|
directory = "modules/kobalt-plugin-api"
|
||||||
description = "A build system in Kotlin"
|
description = "A build system in Kotlin"
|
||||||
url = "http://beust.com/kobalt"
|
url = "http://beust.com/kobalt"
|
||||||
licenses = arrayListOf(License("Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0"))
|
licenses = arrayListOf(License("Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0"))
|
||||||
|
@ -66,30 +64,78 @@ val kobalt = kotlinProject(wrapper) {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile("org.jetbrains.kotlin:kotlin-stdlib:1.0.0-beta-3595",
|
compile("org.jetbrains.kotlinx:kotlinx.dom:0.0.4",
|
||||||
"org.jetbrains.kotlin:kotlin-compiler-embeddable:1.0.0-beta-3595",
|
|
||||||
"org.jetbrains.dokka:dokka-fatjar:0.9.3",
|
|
||||||
"org.jetbrains.kotlinx:kotlinx.dom:0.0.4",
|
|
||||||
|
|
||||||
"com.android.tools.build:builder:2.0.0-alpha3",
|
|
||||||
|
|
||||||
"com.beust:jcommander:1.48",
|
|
||||||
"com.squareup.okhttp:okhttp:2.5.0",
|
"com.squareup.okhttp:okhttp:2.5.0",
|
||||||
"org.jsoup:jsoup:1.8.3",
|
"com.squareup.okio:okio:1.6.0",
|
||||||
"com.google.inject:guice:4.0",
|
"com.google.inject:guice:4.0",
|
||||||
"com.google.inject.extensions:guice-assistedinject:4.0",
|
"com.google.inject.extensions:guice-assistedinject:4.0",
|
||||||
"javax.inject:javax.inject:1",
|
"javax.inject:javax.inject:1",
|
||||||
"com.google.guava:guava:19.0-rc2",
|
"com.google.guava:guava:19.0-rc2",
|
||||||
"org.apache.maven:maven-model:3.3.3",
|
"org.apache.maven:maven-model:3.3.3",
|
||||||
"com.github.spullara.mustache.java:compiler:0.9.1",
|
|
||||||
"io.reactivex:rxjava:1.0.16",
|
"io.reactivex:rxjava:1.0.16",
|
||||||
"com.google.code.gson:gson:2.4",
|
"com.google.code.gson:gson:2.4",
|
||||||
"com.squareup.retrofit:retrofit:1.9.0",
|
"com.squareup.retrofit:retrofit:1.9.0",
|
||||||
"com.squareup.okio:okio:1.6.0"
|
"com.beust:jcommander:1.48"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
assemble {
|
||||||
|
mavenJars {
|
||||||
|
fatJar = true
|
||||||
|
manifest {
|
||||||
|
attributes("Main-Class", "com.beust.kobalt.MainKt")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// install {
|
||||||
|
// libDir = "lib-test"
|
||||||
|
// }
|
||||||
|
|
||||||
|
test {
|
||||||
|
args("-log", "1", "src/test/resources/testng.xml")
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinCompiler {
|
||||||
|
args("-nowarn")
|
||||||
|
}
|
||||||
|
|
||||||
|
jcenter {
|
||||||
|
publish = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val kobaltApp = kotlinProject(kobaltPluginApi, wrapper) {
|
||||||
|
name = "kobalt"
|
||||||
|
group = "com.beust"
|
||||||
|
artifactId = name
|
||||||
|
version = readVersion()
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Used by the plugins
|
||||||
|
compile("com.android.tools.build:builder:2.0.0-alpha3",
|
||||||
|
"org.jetbrains.kotlin:kotlin-compiler-embeddable:1.0.0-beta-3595",
|
||||||
|
"org.jetbrains.dokka:dokka-fatjar:0.9.3")
|
||||||
|
|
||||||
|
// Used by the main app
|
||||||
|
compile("com.github.spullara.mustache.java:compiler:0.9.1",
|
||||||
|
"com.squareup.okhttp:okhttp:2.5.0",
|
||||||
|
"javax.inject:javax.inject:1",
|
||||||
|
"com.google.inject:guice:4.0",
|
||||||
|
"com.google.inject.extensions:guice-assistedinject:4.0",
|
||||||
|
"com.beust:jcommander:1.48",
|
||||||
|
"com.squareup.retrofit:retrofit:1.9.0",
|
||||||
|
"org.apache.maven:maven-model:3.3.3",
|
||||||
|
"org.codehaus.plexus:plexus-utils:3.0.22")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dependenciesTest {
|
||||||
|
compile("org.testng:testng:6.9.9")
|
||||||
|
}
|
||||||
|
|
||||||
assemble {
|
assemble {
|
||||||
mavenJars {
|
mavenJars {
|
||||||
fatJar = true
|
fatJar = true
|
||||||
|
@ -106,33 +152,17 @@ val kobalt = kotlinProject(wrapper) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// install {
|
|
||||||
// libDir = "lib-test"
|
|
||||||
// }
|
|
||||||
|
|
||||||
test {
|
|
||||||
args("-log", "1", "src/test/resources/testng.xml")
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlinCompiler {
|
kotlinCompiler {
|
||||||
args("-nowarn")
|
args("-nowarn")
|
||||||
}
|
}
|
||||||
|
|
||||||
// dokka {
|
jcenter {
|
||||||
// outputFormat = "markdown"
|
publish = true
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// dokka {
|
|
||||||
// outputFormat = "html"
|
|
||||||
// }
|
|
||||||
|
|
||||||
github {
|
github {
|
||||||
file("$buildDirectory/libs/$name-$version.zip", "$name/$version/$name-$version.zip")
|
file("$buildDirectory/libs/$name-$version.zip", "$name/$version/$name-$version.zip")
|
||||||
}
|
}
|
||||||
|
|
||||||
jcenter {
|
|
||||||
publish = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun readVersion() : String {
|
fun readVersion() : String {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
kobalt.version=0.343
|
kobalt.version=0.338
|
13
modules/kobalt-plugin-api/kobalt-plugin-api.iml
Normal file
13
modules/kobalt-plugin-api/kobalt-plugin-api.iml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" name="kobalt (Compile)" level="project" />
|
||||||
|
<orderEntry type="library" name="kobalt-plugin-api (Compile)" level="project" />
|
||||||
|
<orderEntry type="library" scope="TEST" name="kobalt-plugin-api (Test)" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
|
@ -1,6 +1,7 @@
|
||||||
package com.beust.kobalt
|
package com.beust.kobalt
|
||||||
|
|
||||||
import com.beust.kobalt.api.IClasspathDependency
|
import com.beust.kobalt.api.IClasspathDependency
|
||||||
|
import com.beust.kobalt.maven.LocalRepo
|
||||||
import com.beust.kobalt.maven.MavenId
|
import com.beust.kobalt.maven.MavenId
|
||||||
import com.beust.kobalt.maven.RepoFinder
|
import com.beust.kobalt.maven.RepoFinder
|
||||||
import com.beust.kobalt.maven.SimpleDep
|
import com.beust.kobalt.maven.SimpleDep
|
||||||
|
@ -13,7 +14,7 @@ import java.util.*
|
||||||
/**
|
/**
|
||||||
* Display information about a Maven id.
|
* Display information about a Maven id.
|
||||||
*/
|
*/
|
||||||
class ResolveDependency @Inject constructor(val repoFinder: RepoFinder) {
|
class ResolveDependency @Inject constructor(val repoFinder: RepoFinder, val localRepo: LocalRepo) {
|
||||||
val increment = 8
|
val increment = 8
|
||||||
val leftFirst = "\u2558"
|
val leftFirst = "\u2558"
|
||||||
val leftMiddle = "\u255f"
|
val leftMiddle = "\u255f"
|
||||||
|
@ -35,7 +36,8 @@ class ResolveDependency @Inject constructor(val repoFinder: RepoFinder) {
|
||||||
|
|
||||||
val simpleDep = SimpleDep(MavenId.create(id))
|
val simpleDep = SimpleDep(MavenId.create(id))
|
||||||
val url = repoResult.hostConfig.url + simpleDep.toJarFile(repoResult)
|
val url = repoResult.hostConfig.url + simpleDep.toJarFile(repoResult)
|
||||||
AsciiArt.logBox(listOf(id, url).map { " $it" }, {s -> println(s) })
|
val localFile = localRepo.toFullPath(simpleDep.toJarFile(repoResult))
|
||||||
|
AsciiArt.logBox(listOf(id, url, localFile).map { " $it" }, {s -> println(s) })
|
||||||
|
|
||||||
display(root.children)
|
display(root.children)
|
||||||
println("")
|
println("")
|
|
@ -32,22 +32,26 @@ public class DepFactory @Inject constructor(val localRepo: LocalRepo,
|
||||||
return FileDependency(id.substring(FileDependency.PREFIX_FILE.length))
|
return FileDependency(id.substring(FileDependency.PREFIX_FILE.length))
|
||||||
} else {
|
} else {
|
||||||
val mavenId = MavenId.create(id)
|
val mavenId = MavenId.create(id)
|
||||||
var version = mavenId.version
|
var tentativeVersion = mavenId.version
|
||||||
var packaging = mavenId.packaging
|
var packaging = mavenId.packaging
|
||||||
var repoResult: RepoFinder.RepoResult?
|
var repoResult: RepoFinder.RepoResult?
|
||||||
|
|
||||||
if (version == null || MavenId.isRangedVersion(version)) {
|
val version =
|
||||||
var localVersion: String? = version
|
if (tentativeVersion != null && ! MavenId.isRangedVersion(tentativeVersion)) tentativeVersion
|
||||||
if (localFirst) localVersion = localRepo.findLocalVersion(mavenId.groupId, mavenId.artifactId, mavenId.packaging)
|
else {
|
||||||
if (!localFirst || localVersion == null) {
|
var localVersion: String? = tentativeVersion
|
||||||
repoResult = remoteRepo.findCorrectRepo(id)
|
if (localFirst) localVersion = localRepo.findLocalVersion(mavenId.groupId, mavenId.artifactId, mavenId.packaging)
|
||||||
if (!repoResult.found) {
|
if (localFirst && localVersion != null) {
|
||||||
throw KobaltException("Couldn't resolve $id")
|
localVersion
|
||||||
} else {
|
} else {
|
||||||
version = repoResult.version?.version
|
repoResult = remoteRepo.findCorrectRepo(id)
|
||||||
|
if (!repoResult.found) {
|
||||||
|
throw KobaltException("Couldn't resolve $id")
|
||||||
|
} else {
|
||||||
|
repoResult.version?.version
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return MavenDependency(MavenId.create(mavenId.groupId, mavenId.artifactId, packaging, version),
|
return MavenDependency(MavenId.create(mavenId.groupId, mavenId.artifactId, packaging, version),
|
||||||
executor, localRepo, remoteRepo, pomFactory, downloadManager)
|
executor, localRepo, remoteRepo, pomFactory, downloadManager)
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue