##// END OF EJS Templates
migrating to new project plugin 1.0.1-rc1
cin -
r88:e1b55471dd6f ts-plugin
parent child
Show More
@@ -1,145 +1,105
1 plugins {
1 plugins {
2 id "org.implab.gradle-typescript" version "1.0-SNAPSHOT"
2 id "org.implab.gradle-typescript" version "1.0.1-rc1"
3 }
3 }
4
4
5 // Ссли вСрсия явно Π½Π΅ Π·Π°Π΄Π°Π½Ρ‹ вычисляСм Π΅Π΅ ΠΈΠ· тэга Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ v.{num}***
5 // Ссли вСрсия явно Π½Π΅ Π·Π°Π΄Π°Π½Ρ‹ вычисляСм Π΅Π΅ ΠΈΠ· тэга Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ v.{num}***
6 // Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚ΠΎΠΌ Π±ΡƒΠ΄Π΅Ρ‚ вСрсия '{num}.{distance}' Π³Π΄Π΅ distance - расстояниС ΠΎΡ‚
6 // Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚ΠΎΠΌ Π±ΡƒΠ΄Π΅Ρ‚ вСрсия '{num}.{distance}' Π³Π΄Π΅ distance - расстояниС ΠΎΡ‚
7 // Ρ‚Π΅ΠΊΡƒΡ‰Π΅ΠΉ Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ Π΄ΠΎ Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ с тэгом
7 // Ρ‚Π΅ΠΊΡƒΡ‰Π΅ΠΉ Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ Π΄ΠΎ Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ с тэгом
8 def tagDistance = 0;
8 def tagDistance = 0;
9 def isRelease = false;
9 def isRelease = false;
10
10
11 if (!version) {
11 if (!version) {
12
12
13 def rev = ["hg", "log", "-r", ".", "--template", "{latesttag('re:^v') % '{tag}-{distance}'}"].execute().text.trim();
13 def rev = ["hg", "log", "-r", ".", "--template", "{latesttag('re:^v') % '{tag}-{distance}'}"].execute().text.trim();
14
14
15 def tagVersion;
15 def tagVersion;
16
16
17 def match = (rev =~ /^v(\d+\.\d+\.\d+).*-(\d+)$/);
17 def match = (rev =~ /^v(\d+\.\d+\.\d+).*-(\d+)$/);
18
18
19 if (match.size()) {
19 if (match.size()) {
20 tagVersion = match[0][1];
20 tagVersion = match[0][1];
21 tagDistance = match[0][2].toInteger();
21 tagDistance = match[0][2].toInteger();
22 } else {
22 } else {
23 throw new Exception("A version must be specied");
23 throw new Exception("A version must be specied");
24 }
24 }
25
25
26 version = tagVersion;
26 version = tagVersion;
27
27
28 if (tagDistance > 0)
28 if (tagDistance > 0)
29 version++;
29 version++;
30 } else {
30 } else {
31 println "explicit version: $version";
31 println "explicit version: $version";
32 }
32 }
33
33
34 if (hasProperty('versionSuffix') && versionSuffix) {
34 if (hasProperty('versionSuffix') && versionSuffix) {
35 version += "-$versionSuffix"
35 version += "-$versionSuffix"
36 }
36 }
37
37
38 if(!npmName)
38 if(!npmName)
39 npmName = name;
39 npmName = name;
40
40
41 if (hasProperty('release')) {
41 if (hasProperty('release')) {
42 isRelease = (release != 'false')
42 isRelease = (release != 'false')
43 } else {
43 } else {
44 isRelease = (tagDistance == 0);
44 isRelease = (tagDistance == 0);
45 }
45 }
46
46
47 if(!["amd", "commonjs", "system", "umd", "es6", "esnext"].contains(jsmodule))
47 if(!["amd", "commonjs", "system", "umd", "es6", "esnext"].contains(jsmodule))
48 throw new Exception("Invalid jsmodule specified: $jsmodule");
48 throw new Exception("Invalid jsmodule specified: $jsmodule");
49 if(!["es3", "es5", "es6", "es2016", "es2017", "esnext"].contains(target))
49 if(!["es3", "es5", "es6", "es2016", "es2017", "esnext"].contains(target))
50 throw new Exception("Invalid target specified: $target")
50 throw new Exception("Invalid target specified: $target")
51
51
52 def targetLibs = [
52 def targetLibs = [
53 "es3" : ["es5", "es2015.promise", "es2015.symbol", "dom", "scripthost"],
53 "es3" : ["es5", "es2015.promise", "es2015.symbol", "dom", "scripthost"],
54 "es5" : ["es5", "es2015.promise", "es2015.symbol", "dom", "scripthost"]
54 "es5" : ["es5", "es2015.promise", "es2015.symbol", "dom", "scripthost"]
55 ];
55 ];
56
56
57 ext {
57 ext {
58 packageName = "@$npmScope/$npmName"
58 packageName = "@$npmScope/$npmName"
59 }
59 }
60
60
61 def srcDir = "$projectDir/src"
62 def typingsDir = "$srcDir/typings"
63 def distDir = "$buildDir/dist"
64 def testDir = "$buildDir/test"
65 def jstarget = target;
61 def jstarget = target;
66
62
67 sources {
63 sources {
68
64
69 }
65 }
70
66
71 typescript {
67 typescript {
72 compilerOptions {
68 compilerOptions {
73 lib = targetLibs[target] ?: [target, "dom"]
69 lib = targetLibs[target] ?: [target, "dom"]
74 target = jstarget
70 target = jstarget
75 module = jsmodule
71 module = jsmodule
76 types = []
72 types = []
77 }
73 }
78 tsLintCmd = "tslint"
74 tsLintCmd = "tslint"
79 esLintCmd = "eslint"
75 esLintCmd = "eslint"
80 npmCmd = "npm"
76 npmCmd = "npm"
81 }
77 }
82
78
83 task printVersion {
79 task printVersion {
84 doLast {
80 doLast {
85 println "version: $version";
81 println "version: $version";
86 println "isRelease: $isRelease, tagDistance: $tagDistance";
82 println "isRelease: $isRelease, tagDistance: $tagDistance";
87 println "packageName: $packageName";
83 println "packageName: $packageName";
88 println "bundle: ${pack.outputs.files.join(',')}";
84 println "bundle: ${npmPack.outputs.files.join(',')}";
89 println "target: $target";
85 println "target: $jstarget";
90 println "module: $jsmodule";
86 println "module: $jsmodule";
91 }
87 }
92 }
88 }
93
89
94 task clean {
90 task clean {
95 doLast {
91 doLast {
96 delete buildDir
92 delete buildDir
97 delete typingsDir
98 }
99 }
100
101 task _initBuild {
102 mustRunAfter clean
103
104 def buildInfoFile = "$buildDir/platform";
105 inputs.property('target',target);
106 inputs.property('jsmodule',jsmodule);
107 outputs.file(buildInfoFile);
108
109 doLast {
110 delete buildDir
111 mkdir buildDir
112
113 def f = new File(buildInfoFile);
114 f << "$target-$jsmodule";
115 }
93 }
116 }
94 }
117
95
118 /*
96 npmPackMeta {
119 task _installLocalCjsDependency(dependsOn: [buildTestCjs, "_packageMeta"], type: Exec) {
97 meta {
120 inputs.file("$distDir/package.json")
98 name = "@$npmScope/$npmName"
121 outputs.upToDateWhen {
122 new File("$testDir/$packageName").exists()
123 }
99 }
124
125 workingDir testDir
126
127 commandLine 'npm', 'install', '--no-save', '--force', distDir
128 }
100 }
129
101
130 task _test(dependsOn: [buildTest], type: Exec) {
131 if (jsmodule == "amd")
132 dependsOn buildTestAmd
133 if (jsmodule == "commonjs") {
134 dependsOn buildTestCjs
135 dependsOn _installLocalCjsDependency
136 }
137
138 commandLine 'node', "$testDir/run-tests.js"
139 }
140 */
141
142 task markRelease(type: Exec) {
102 task markRelease(type: Exec) {
143 onlyIf { tagDistance > 1 }
103 onlyIf { tagDistance > 1 }
144 commandLine "hg", "tag", "v$version";
104 commandLine "hg", "tag", "v$version";
145 } No newline at end of file
105 }
General Comments 0
You need to be logged in to leave comments. Login now