1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -07:00

Delete JavaProject/KotlinProject.

This commit is contained in:
Cedric Beust 2016-02-07 16:59:03 -08:00
parent 914f2527a6
commit 403a3eccf4
6 changed files with 12 additions and 73 deletions

View file

@ -9,7 +9,7 @@ import java.io.File
import java.util.* import java.util.*
open class Project( open class Project(
@Directive open var name: String, @Directive open var name: String = "",
@Directive open var version: String? = null, @Directive open var version: String? = null,
@Directive open var directory: String = ".", @Directive open var directory: String = ".",
@Directive open var buildDirectory: String = KFiles.KOBALT_BUILD_DIR, @Directive open var buildDirectory: String = KFiles.KOBALT_BUILD_DIR,

View file

@ -74,8 +74,8 @@ class JavaPlugin @Inject constructor(val javaCompiler: JavaCompiler)
} }
@Directive @Directive
public fun javaProject(vararg projects: Project, init: JavaProject.() -> Unit): JavaProject { public fun javaProject(vararg projects: Project, init: Project.() -> Unit): Project {
return JavaProject().apply { return Project().apply {
warn("javaProject{} is deprecated, please use project{}") warn("javaProject{} is deprecated, please use project{}")
init() init()
(Kobalt.findPlugin(JvmCompilerPlugin.PLUGIN_NAME) as JvmCompilerPlugin) (Kobalt.findPlugin(JvmCompilerPlugin.PLUGIN_NAME) as JvmCompilerPlugin)

View file

@ -1,31 +0,0 @@
package com.beust.kobalt.plugin.java
import com.beust.kobalt.api.Dependencies
import com.beust.kobalt.api.Project
import com.beust.kobalt.api.annotation.Directive
import com.beust.kobalt.misc.toString
public class JavaProject(
@Directive
override var name: String = "",
@Directive
override var version: String? = null,
/** The absolute directory location of this project */
@Directive
override var directory: String = ".",
/** The build directory, relative to the project directory */
@Directive
override var buildDirectory: String = "kobaltBuild",
@Directive
override var group: String? = null,
@Directive
override var artifactId: String? = null,
@Directive
override var dependencies: Dependencies? = null,
@Directive
override var packaging: String? = null)
: Project(name, version, directory, buildDirectory, group, artifactId, packaging, dependencies, ".java") {
override public fun toString() = toString("JavaProject", "name", name)
}

View file

@ -140,8 +140,8 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors)
* @param project: the list of projects that need to be built before this one. * @param project: the list of projects that need to be built before this one.
*/ */
@Directive @Directive
fun kotlinProject(vararg projects: Project, init: KotlinProject.() -> Unit): KotlinProject { fun kotlinProject(vararg projects: Project, init: Project.() -> Unit): Project {
return KotlinProject().apply { return Project().apply {
warn("kotlinProject{} is deprecated, please use project{}") warn("kotlinProject{} is deprecated, please use project{}")
init() init()
(Kobalt.findPlugin(JvmCompilerPlugin.PLUGIN_NAME) as JvmCompilerPlugin) (Kobalt.findPlugin(JvmCompilerPlugin.PLUGIN_NAME) as JvmCompilerPlugin)

View file

@ -1,30 +0,0 @@
package com.beust.kobalt.plugin.kotlin
import com.beust.kobalt.api.Dependencies
import com.beust.kobalt.api.Project
import com.beust.kobalt.api.annotation.Directive
import com.beust.kobalt.misc.toString
public class KotlinProject(
@Directive
override var name: String = "",
@Directive
override var version: String? = null,
/** The absolute directory location of this project */
@Directive
override var directory: String = ".",
/** The build directory, relative to the project directory */
@Directive
override var buildDirectory: String = "kobaltBuild",
@Directive
override var group: String? = null,
@Directive
override var artifactId: String? = name,
@Directive
override var dependencies: Dependencies? = null,
@Directive
override var packaging: String? = null)
: Project(name, version, directory, buildDirectory, group, artifactId, packaging, dependencies, ".kt") {
override public fun toString() = toString("KotlinProject", "name", name)
}

View file

@ -1,8 +1,8 @@
package com.beust.kobalt package com.beust.kobalt
import com.beust.kobalt.api.Project
import com.beust.kobalt.api.buildType import com.beust.kobalt.api.buildType
import com.beust.kobalt.api.productFlavor import com.beust.kobalt.api.productFlavor
import com.beust.kobalt.plugin.java.JavaProject
import org.testng.Assert import org.testng.Assert
import org.testng.annotations.DataProvider import org.testng.annotations.DataProvider
import org.testng.annotations.Test import org.testng.annotations.Test
@ -12,21 +12,21 @@ class VariantTest : KobaltTest() {
@DataProvider(name = "projectVariants") @DataProvider(name = "projectVariants")
fun projectVariants() = arrayOf( fun projectVariants() = arrayOf(
arrayOf(emptySet<String>(), JavaProject().apply { arrayOf(emptySet<String>(), Project().apply {
}), }),
arrayOf(hashSetOf("compileDev"), JavaProject().apply { arrayOf(hashSetOf("compileDev"), Project().apply {
productFlavor("dev") {} productFlavor("dev") {}
}), }),
arrayOf(hashSetOf("compileDev", "compileProd"), JavaProject().apply { arrayOf(hashSetOf("compileDev", "compileProd"), Project().apply {
productFlavor("dev") {} productFlavor("dev") {}
productFlavor("prod") {} productFlavor("prod") {}
}), }),
arrayOf(hashSetOf("compileDevDebug"), JavaProject().apply { arrayOf(hashSetOf("compileDevDebug"), Project().apply {
productFlavor("dev") {} productFlavor("dev") {}
buildType("debug") {} buildType("debug") {}
}), }),
arrayOf(hashSetOf("compileDevRelease", "compileDevDebug", "compileProdDebug", "compileProdRelease"), arrayOf(hashSetOf("compileDevRelease", "compileDevDebug", "compileProdDebug", "compileProdRelease"),
JavaProject().apply { Project().apply {
productFlavor("dev") {} productFlavor("dev") {}
productFlavor("prod") {} productFlavor("prod") {}
buildType("debug") {} buildType("debug") {}
@ -36,7 +36,7 @@ class VariantTest : KobaltTest() {
@Test(dataProvider = "projectVariants", description = @Test(dataProvider = "projectVariants", description =
"Make sure we generate the correct dynamic tasks based on the product flavor and build types.") "Make sure we generate the correct dynamic tasks based on the product flavor and build types.")
fun taskNamesShouldWork(expected: Set<String>, project: JavaProject) { fun taskNamesShouldWork(expected: Set<String>, project: Project) {
val variantNames = HashSet(Variant.allVariants(project).map { it.toTask("compile") }) val variantNames = HashSet(Variant.allVariants(project).map { it.toTask("compile") })
Assert.assertEquals(variantNames, expected) Assert.assertEquals(variantNames, expected)
} }