build.gradle
70 lines
| 1.7 KiB
| text/x-groovy
|
GroovyLexer
|
|
r0 | plugins { | |
| id "org.implab.gradle-typescript" version "1.3.4" | |||
| id "org.implab.gradle-mercurial" version "1.0.1" | |||
| } | |||
| if (!symbols in ['local', 'pack', 'none']) | |||
| throw new Exception("The symbols property value is invalid: $symbols"); | |||
| if (!flavour in ['browser', 'node']) | |||
| throw new Exception("The flavour property value is invalid: $flavour"); | |||
| ext { | |||
| packageName = flavour == 'browser' ? "@$npmScope/$name-amd" : "@$npmScope/$name" | |||
| lint = project.hasProperty('lint') ? project.lint ?: true : false | |||
| } | |||
| mercurial { | |||
| preReleasePolicy { it | |||
| .addPatch(versionDistance) | |||
| .withPreRelease('dev') | |||
| .withMeta(changeset) | |||
| } | |||
| applyVersioningPolicy() | |||
| } | |||
| typescript { | |||
| compilerOptions { | |||
| types = [] | |||
| declaration = true | |||
| experimentalDecorators = true | |||
| strict = true | |||
|
|
r1 | module = "commonjs" | |
| target = "es5" | |||
| lib = ["es2015", "dom", "scripthost"] | |||
|
|
r0 | } | |
| tscCmd = "$projectDir/node_modules/.bin/tsc" | |||
| tsLintCmd = "$projectDir/node_modules/.bin/tslint" | |||
| esLintCmd = "$projectDir/node_modules/.bin/eslint" | |||
| } | |||
| tasks.matching{ it.name =~ /^lint/ }.configureEach { | |||
| onlyIf { lint } | |||
| } | |||
| if (symbols == 'local') { | |||
| tasks.matching{ it.name =~ /^configureTs/ }.configureEach { | |||
| compilerOptions { | |||
| sourceRoot = "file://" + it.rootDir | |||
| } | |||
| } | |||
| } | |||
|
|
r1 | task packSources { | |
| } | |||
|
|
r0 | printVersion { | |
| doLast { | |||
| println "packageName: $packageName"; | |||
| println "flavour: $flavour"; | |||
| println "target: $typescript.compilerOptions.target"; | |||
| println "module: $typescript.compilerOptions.module"; | |||
| println "lint: $lint"; | |||
| println "symbols: $symbols"; | |||
| } | |||
| } | |||
|
|
r1 | ||
| test { | |||
| commandLine "npx", "mocha", "${->typescript.testDir.get()}"; | |||
| } |
