mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Add javaCompiler so the wrapper can be compiled with 1.7.
This commit is contained in:
parent
84118bfd69
commit
552e3b9180
2 changed files with 31 additions and 2 deletions
|
@ -2,11 +2,13 @@ import com.beust.kobalt.*
|
|||
import com.beust.kobalt.api.License
|
||||
import com.beust.kobalt.api.Scm
|
||||
import com.beust.kobalt.internal.test
|
||||
import com.beust.kobalt.plugin.java.javaCompiler
|
||||
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.kotlin.kotlinCompiler
|
||||
import com.beust.kobalt.plugin.publish.jcenter
|
||||
|
||||
//import com.beust.kobalt.plugin.linecount.lineCount
|
||||
//val plugins = plugins(
|
||||
// "com.beust.kobalt:kobalt-line-count:0.15"
|
||||
|
@ -28,6 +30,10 @@ val wrapper = javaProject {
|
|||
version = readVersion()
|
||||
directory = homeDir("kotlin/kobalt/modules/wrapper")
|
||||
|
||||
javaCompiler {
|
||||
args("-source", "1.7", "-target", "1.7")
|
||||
}
|
||||
|
||||
assemble {
|
||||
jar {
|
||||
name = projectName + ".jar"
|
||||
|
|
|
@ -15,6 +15,8 @@ import com.beust.kobalt.maven.LocalRepo
|
|||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.KobaltExecutors
|
||||
import com.beust.kobalt.misc.log
|
||||
import com.beust.kobalt.plugin.kotlin.KotlinCompilerConfig
|
||||
import com.beust.kobalt.plugin.kotlin.KotlinPlugin
|
||||
import java.io.File
|
||||
import java.nio.file.Paths
|
||||
import java.util.*
|
||||
|
@ -60,6 +62,7 @@ public class JavaPlugin @Inject constructor(
|
|||
args.add("-classpath")
|
||||
args.add(stringClasspath.joinToString(File.pathSeparator))
|
||||
}
|
||||
args.addAll(compilerArgs)
|
||||
args.addAll(sourceFiles)
|
||||
|
||||
val pb = ProcessBuilder(args)
|
||||
|
@ -155,8 +158,13 @@ public class JavaPlugin @Inject constructor(
|
|||
return result
|
||||
}
|
||||
|
||||
}
|
||||
private val compilerArgs = arrayListOf<String>()
|
||||
|
||||
fun addCompilerArgs(vararg args: String) {
|
||||
compilerArgs.addAll(args)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Directive
|
||||
public fun javaProject(init: JavaProject.() -> Unit): JavaProject {
|
||||
|
@ -164,3 +172,18 @@ public fun javaProject(init: JavaProject.() -> Unit): JavaProject {
|
|||
pd.init()
|
||||
return pd
|
||||
}
|
||||
|
||||
class JavaCompilerConfig {
|
||||
fun args(vararg options: String) {
|
||||
(Kobalt.findPlugin("java") as JavaPlugin).addCompilerArgs(*options)
|
||||
}
|
||||
}
|
||||
|
||||
@Directive
|
||||
fun Project.javaCompiler(init: JavaCompilerConfig.() -> Unit) : JavaCompilerConfig {
|
||||
with (JavaCompilerConfig()) {
|
||||
init()
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue