build.gradle
107 lines
| 2.4 KiB
| text/x-groovy
|
GroovyLexer
/ playground / build.gradle
cin
|
r97 | plugins { | |
id "org.implab.gradle-typescript" version "1.3.4" | |||
id "ivy-publish" | |||
} | |||
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
|
r97 | pack("dojo") | |
cin
|
r99 | pack("dijit") | |
from npm.module("requirejs/require.js") | |||
cin
|
r97 | } | |
task copyApp(type: Copy) { | |||
dependsOn assemble | |||
from typescript.assemblyDir | |||
into layout.buildDirectory.dir("bundle/js/app") | |||
} | |||
task bundle { | |||
dependsOn copyModules, processResourcesBundle, copyApp | |||
} |