diff --git a/tmp/Build.kt b/tmp/Build.kt new file mode 100644 index 00000000..4dc140cd --- /dev/null +++ b/tmp/Build.kt @@ -0,0 +1,170 @@ + +import com.beust.kobalt.* +import com.beust.kobalt.api.* +import com.beust.kobalt.api.annotation.Task +import com.beust.kobalt.plugin.application.application +import com.beust.kobalt.plugin.java.* +import com.beust.kobalt.plugin.kotlin.* +import com.beust.kobalt.plugin.packaging.assemble +import com.beust.kobalt.plugin.publish.github +import com.beust.kobalt.plugin.publish.jcenter +import com.beust.kobalt.test +import java.io.File +import java.nio.file.Files +import java.nio.file.Paths +import java.nio.file.StandardCopyOption + +val r = repos("http://dl.bintray.com/kotlin/kotlinx.dom") + +val wrapper = javaProject { + name = "kobalt-wrapper" + version = readVersion() + directory = "modules/wrapper" + + javaCompiler { + args("-source", "1.7", "-target", "1.7") + } + + assemble { + jar { + name = projectName + ".jar" + manifest { + attributes("Main-Class", "com.beust.kobalt.wrapper.Main") + } + } + } + + application { + mainClass = "com.beust.kobalt.wrapper.Main" + } +} + + +val kobaltPluginApi = kotlinProject { + name = "kobalt-plugin-api" + group = "com.beust" + artifactId = name + version = readVersion() + directory = "modules/kobalt-plugin-api" + description = "A build system in Kotlin" + url = "http://beust.com/kobalt" + licenses = arrayListOf(License("Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0")) + scm = Scm(url = "http://github.com/cbeust/kobalt", + connection = "https://github.com/cbeust/kobalt.git", + developerConnection = "git@github.com:cbeust/kobalt.git") + + dependenciesTest { + compile("org.testng:testng:6.9.9") + } + + dependencies { + compile("org.jetbrains.kotlinx:kotlinx.dom:0.0.4", + + "com.beust:jcommander:1.48", + "com.squareup.okhttp:okhttp:2.5.0", + "com.google.inject:guice:4.0", + "com.google.inject.extensions:guice-assistedinject:4.0", + "javax.inject:javax.inject:1", + "com.google.guava:guava:19.0-rc2", + "org.apache.maven:maven-model:3.3.3", + "io.reactivex:rxjava:1.0.16", + "com.google.code.gson:gson:2.4", + "com.squareup.retrofit:retrofit:1.9.0" + ) + } + + + 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") + } + + assemble { + mavenJars { + fatJar = true + manifest { + attributes("Main-Class", "com.beust.kobalt.MainKt") + } + } + zip { + include("kobaltw") + include(from("$buildDirectory/libs"), to("kobalt/wrapper"), + "$projectName-$version.jar") + include(from("modules/wrapper/$buildDirectory/libs"), to("kobalt/wrapper"), + "$projectName-wrapper.jar") + } + } + + kotlinCompiler { + args("-nowarn") + } + + jcenter { + publish = true + } + + github { + file("$buildDirectory/libs/$name-$version.zip", "$name/$version/$name-$version.zip") + } +} + +fun readVersion() : String { + val p = java.util.Properties() + var localFile = java.io.File("src/main/resources/kobalt.properties") + if (! localFile.exists()) { + localFile = File(homeDir("kotlin", "kobalt", "src/main/resources/kobalt.properties")) + } + p.load(java.io.FileReader(localFile)) + return p.getProperty("kobalt.version") +} + +@Task(name = "copyVersionForWrapper", runBefore = arrayOf("assemble"), runAfter = arrayOf("compile"), description = "") +fun taskCopyVersionForWrapper(project: Project) : TaskResult { + if (project.name == "kobalt-wrapper") { + val toString = "modules/wrapper/kobaltBuild/classes" + File(toString).mkdirs() + val from = Paths.get("src/main/resources/kobalt.properties") + val to = Paths.get("$toString/kobalt.properties") + Files.copy(from, + to, + StandardCopyOption.REPLACE_EXISTING) + } + return TaskResult() +} diff --git a/tmp/create-new-world b/tmp/create-new-world new file mode 100755 index 00000000..1e57db49 --- /dev/null +++ b/tmp/create-new-world @@ -0,0 +1,22 @@ +rm -rf modules/kobalt-plugin-api + +mkdir -p modules/kobalt-plugin-api/src + +mkdir -p modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt +for i in api internal kotlin maven misc +do + mv src/main/kotlin/com/beust/kobalt/$i modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt +done +mv src/main/kotlin/com/beust/kobalt/*kt modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt + +for i in Main.kt +do + mv modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/$i src/main/kotlin/com/beust/kobalt +done + +#mv modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/app src/main/kotlin/com/beust/kobalt + + +cp /Users/beust/t/kobalt-plugin-api.iml modules/kobalt-plugin-api + +# return File(homeDir("kotlin", "kobalt", "classes", "production", "kobalt-plugin-api")).absolutePath diff --git a/tmp/kobalt-plugin-api.iml b/tmp/kobalt-plugin-api.iml new file mode 100644 index 00000000..271abfef --- /dev/null +++ b/tmp/kobalt-plugin-api.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tmp/kobalt__Compile_.xml b/tmp/kobalt__Compile_.xml new file mode 100644 index 00000000..bf42a5b9 --- /dev/null +++ b/tmp/kobalt__Compile_.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tmp/org_testng_testng_6_9_10.xml b/tmp/org_testng_testng_6_9_10.xml new file mode 100644 index 00000000..14beb49b --- /dev/null +++ b/tmp/org_testng_testng_6_9_10.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file