##// END OF EJS Templates
wip migrating on new typescript build plugin
wip migrating on new typescript build plugin

File last commit:

r174:b00d3153045c default
r174:b00d3153045c default
Show More
build.gradle
110 lines | 2.5 KiB | text/x-groovy | GroovyLexer
plugins {
id "org.implab.gradle-typescript"
id "org.implab.gradle-npm-package"
id "ivy-publish"
}
typescript {
useTsc npm.bin("tsc")
compilerOptions {
incremental = true
}
}
def typingsFromMain = {
sets {
named("compileOnlyTypings") {
srcDir main.output("typings")
}
}
}
variants {
configureEach { variant ->
def sourceSetLocation = { setName, self ->
self.sourceSetDir = layout.projectDirectory.dir("src/${setName}")
self.outputsDir = layout.buildDirectory.dir("${variant.name}/${setName}")
}
def main = sources.register("${variant.name}Main", sourceSetLocation.curry("main"))
def test = sources.register("${variant.name}Test", sourceSetLocation.curry("test"))
sourceSets {
add(main) {
role "main"
}
add(test) {
role "test"
}
}
}
register("browser") {
def srcAmd = sources.register("amd", typingsFromMain)
def srcTestAmd = sources.register("testAmd", typingsFromMain)
// advice to all TypescriptCompile tasks
typescriptCompile {
baseTsConfig = file("src/tsconfig.browser.json")
}
// creates npmPackBrowser, npmPublishBrowser
npmPackage {
usePackageJson()
metadata {
name = "@implab/core-amd"
}
content {
from sourceSets.byRoles("main").allOutputs()
}
}
sourceSets {
add(srcAmd) {
role "main"
}
add(srcTestAmd) {
role "test"
}
}
}
register("node") {
def srcCjs = sources.register("cjs", typingsFromMain)
def srcTestCjs = sources.register("testCjs", typingsFromMain)
compileTasks {
baseTsConfig = file("src/tsconfig.node.json")
}
npmPackage {
name = "@implab/core"
}
sourceSets {
add srcAmd
add srcTestAmd
}
}
npmPackage {
usePackageJson()
metadata {
name = "@implab/core"
version = project.provider { project.version.toString() }
}
}
publishing {
publications {
local(IvyPublication) {
artifact(packJsTar) {
type = "js"
}
}
}
repositories {
ivy {
url "ivy-repo"
}
}
}