|
|
plugins {
|
|
|
id "org.implab.gradle-typescript" version "1.3.4"
|
|
|
id "ivy-publish"
|
|
|
}
|
|
|
|
|
|
def container = "djx-playground"
|
|
|
|
|
|
configurations {
|
|
|
npmLocal
|
|
|
}
|
|
|
|
|
|
dependencies {
|
|
|
npmLocal project(":djx")
|
|
|
}
|
|
|
|
|
|
def bundleDir = fileTree(layout.buildDirectory.dir("bundle")) {
|
|
|
builtBy "bundle"
|
|
|
}
|
|
|
|
|
|
typescript {
|
|
|
compilerOptions {
|
|
|
lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"]
|
|
|
// listFiles = true
|
|
|
strict = true
|
|
|
types = ["requirejs", "@implab/dojo-typings", "@implab/djx"]
|
|
|
module = "amd"
|
|
|
it.target = "es5"
|
|
|
experimentalDecorators = true
|
|
|
noUnusedLocals = false
|
|
|
jsx = "react"
|
|
|
jsxFactory = "createElement"
|
|
|
moduleResolution = "node"
|
|
|
// dojo-typings are sick
|
|
|
skipLibCheck = true
|
|
|
// traceResolution = true
|
|
|
// baseUrl = "./"
|
|
|
// paths = [ "*": [ "$projectDir/src/typings/*" ] ]
|
|
|
// baseUrl = "$projectDir/src/typings"
|
|
|
// typeRoots = ["$projectDir/src/typings"]
|
|
|
}
|
|
|
tscCmd = "$projectDir/node_modules/.bin/tsc"
|
|
|
tsLintCmd = "$projectDir/node_modules/.bin/tslint"
|
|
|
esLintCmd = "$projectDir/node_modules/.bin/eslint"
|
|
|
}
|
|
|
|
|
|
tasks.matching{ it.name =~ /^configureTs/ }.configureEach {
|
|
|
compilerOptions {
|
|
|
if (symbols != 'none') {
|
|
|
sourceMap = true
|
|
|
switch(symbols) {
|
|
|
case "local":
|
|
|
sourceRoot = ( isWindows ? "file:///" : "file://" ) + it.rootDir
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
task npmInstallLocalDeps {
|
|
|
npmInstall.dependsOn it
|
|
|
dependsOn configurations.npmLocal
|
|
|
|
|
|
doFirst {
|
|
|
configurations.npmLocal.each { f ->
|
|
|
exec {
|
|
|
commandLine "npm", "install", f, "--save-dev"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
clean {
|
|
|
doFirst {
|
|
|
delete "$buildDir/bundle"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
task processResourcesBundle(type: Copy) {
|
|
|
from "src/bundle"
|
|
|
into layout.buildDirectory.dir("bundle")
|
|
|
}
|
|
|
|
|
|
task copyModules(type: Copy) {
|
|
|
dependsOn npmInstall
|
|
|
into layout.buildDirectory.dir("bundle/js");
|
|
|
|
|
|
def pack = { String jsmod ->
|
|
|
into(jsmod) {
|
|
|
from npm.module(jsmod)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
pack("@implab/djx")
|
|
|
pack("@implab/core-amd")
|
|
|
into("@js-joda/core") {
|
|
|
from(npm.module("@js-joda/core/dist"))
|
|
|
}
|
|
|
pack("dojo")
|
|
|
pack("dijit")
|
|
|
into("rxjs") {
|
|
|
from(npm.module("rxjs/dist/bundles"))
|
|
|
}
|
|
|
from npm.module("requirejs/require.js")
|
|
|
}
|
|
|
|
|
|
npmPublish {
|
|
|
enabled = false
|
|
|
}
|
|
|
|
|
|
task copyApp(type: Copy) {
|
|
|
dependsOn assemble
|
|
|
from typescript.assemblyDir
|
|
|
into layout.buildDirectory.dir("bundle/js/app")
|
|
|
}
|
|
|
|
|
|
task bundle {
|
|
|
dependsOn copyModules, processResourcesBundle, copyApp
|
|
|
}
|
|
|
|
|
|
task up(type: Exec) {
|
|
|
dependsOn bundle
|
|
|
commandLine "podman", "run", "--rm", "-d",
|
|
|
"--name", container,
|
|
|
"-p", "2078:80",
|
|
|
"-v", "$buildDir/bundle:/srv/www/htdocs",
|
|
|
"registry.implab.org/implab/apache2:latest"
|
|
|
}
|
|
|
|
|
|
task stop(type: Exec) {
|
|
|
commandLine "podman", "stop", container
|
|
|
}
|