build.gradle
132 lines
| 3.0 KiB
| text/x-groovy
|
GroovyLexer
/ playground / build.gradle
cin
|
r97 | plugins { | |
id "org.implab.gradle-typescript" version "1.3.4" | |||
id "ivy-publish" | |||
} | |||
cin
|
r101 | def container = "djx-playground" | |
cin
|
r97 | configurations { | |
npmLocal | |||
} | |||
dependencies { | |||
npmLocal project(":djx") | |||
} | |||
def bundleDir = fileTree(layout.buildDirectory.dir("bundle")) { | |||
builtBy "bundle" | |||
} | |||
cin
|
r99 | 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; | |||
} | |||
} | |||
} | |||
} | |||
cin
|
r97 | npmInstall { | |
//npmInstall.dependsOn it | |||
cin
|
r99 | dependsOn configurations.npmLocal | |
cin
|
r97 | ||
doFirst { | |||
configurations.npmLocal.each { f -> | |||
exec { | |||
commandLine "npm", "install", f, "--save-dev" | |||
} | |||
} | |||
} | |||
} | |||
cin
|
r99 | clean { | |
doFirst { | |||
delete "$buildDir/bundle" | |||
} | |||
} | |||
cin
|
r97 | ||
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") | |||
cin
|
r99 | pack("@implab/core-amd") | |
cin
|
r110 | into("@js-joda/core") { | |
from(npm.module("@js-joda/core/dist")) | |||
} | |||
cin
|
r97 | pack("dojo") | |
cin
|
r99 | pack("dijit") | |
cin
|
r102 | into("rxjs") { | |
from(npm.module("rxjs/dist/bundles")) | |||
} | |||
cin
|
r99 | from npm.module("requirejs/require.js") | |
cin
|
r97 | } | |
cin
|
r106 | npmPublish { | |
enabled = false | |||
} | |||
cin
|
r97 | task copyApp(type: Copy) { | |
dependsOn assemble | |||
from typescript.assemblyDir | |||
into layout.buildDirectory.dir("bundle/js/app") | |||
} | |||
task bundle { | |||
dependsOn copyModules, processResourcesBundle, copyApp | |||
cin
|
r101 | } | |
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 | |||
cin
|
r97 | } |