##// END OF EJS Templates
migrating to new project plugin 1.0.1-rc1
migrating to new project plugin 1.0.1-rc1

File last commit:

r88:e1b55471dd6f ts-plugin
r88:e1b55471dd6f ts-plugin
Show More
build.gradle
104 lines | 2.5 KiB | text/x-groovy | GroovyLexer
plugins {
id "org.implab.gradle-typescript" version "1.0.1-rc1"
}
// если версия явно не заданы вычисляем ее из тэга ревизии v.{num}***
// результатом будет версия '{num}.{distance}' где distance - расстояние от
// текущей ревизии до ревизии с тэгом
def tagDistance = 0;
def isRelease = false;
if (!version) {
def rev = ["hg", "log", "-r", ".", "--template", "{latesttag('re:^v') % '{tag}-{distance}'}"].execute().text.trim();
def tagVersion;
def match = (rev =~ /^v(\d+\.\d+\.\d+).*-(\d+)$/);
if (match.size()) {
tagVersion = match[0][1];
tagDistance = match[0][2].toInteger();
} else {
throw new Exception("A version must be specied");
}
version = tagVersion;
if (tagDistance > 0)
version++;
} else {
println "explicit version: $version";
}
if (hasProperty('versionSuffix') && versionSuffix) {
version += "-$versionSuffix"
}
if(!npmName)
npmName = name;
if (hasProperty('release')) {
isRelease = (release != 'false')
} else {
isRelease = (tagDistance == 0);
}
if(!["amd", "commonjs", "system", "umd", "es6", "esnext"].contains(jsmodule))
throw new Exception("Invalid jsmodule specified: $jsmodule");
if(!["es3", "es5", "es6", "es2016", "es2017", "esnext"].contains(target))
throw new Exception("Invalid target specified: $target")
def targetLibs = [
"es3" : ["es5", "es2015.promise", "es2015.symbol", "dom", "scripthost"],
"es5" : ["es5", "es2015.promise", "es2015.symbol", "dom", "scripthost"]
];
ext {
packageName = "@$npmScope/$npmName"
}
def jstarget = target;
sources {
}
typescript {
compilerOptions {
lib = targetLibs[target] ?: [target, "dom"]
target = jstarget
module = jsmodule
types = []
}
tsLintCmd = "tslint"
esLintCmd = "eslint"
npmCmd = "npm"
}
task printVersion {
doLast {
println "version: $version";
println "isRelease: $isRelease, tagDistance: $tagDistance";
println "packageName: $packageName";
println "bundle: ${npmPack.outputs.files.join(',')}";
println "target: $jstarget";
println "module: $jsmodule";
}
}
task clean {
doLast {
delete buildDir
}
}
npmPackMeta {
meta {
name = "@$npmScope/$npmName"
}
}
task markRelease(type: Exec) {
onlyIf { tagDistance > 1 }
commandLine "hg", "tag", "v$version";
}