##// END OF EJS Templates
working on build.gradle
cin -
r92:a4a8e6f7b095 ts-plugin
parent child
Show More
@@ -1,142 +1,194
1 plugins {
1 plugins {
2 id "org.implab.gradle-typescript" version "1.0.1-rc1"
2 id "org.implab.gradle-typescript" version "1.0.1-rc2"
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
9
10 if (!version) {
10 if (!version) {
11
11
12 def rev = ["hg", "log", "-r", ".", "--template", "{latesttag('re:^v') % '{tag}-{distance}'}"].execute().text.trim();
12 def rev = ["hg", "log", "-r", ".", "--template", "{latesttag('re:^v') % '{tag}-{distance}'}"].execute().text.trim();
13
13
14 def tagVersion;
14 def tagVersion;
15
15
16 def match = (rev =~ /^v(\d+\.\d+\.\d+).*-(\d+)$/);
16 def match = (rev =~ /^v(\d+\.\d+\.\d+).*-(\d+)$/);
17
17
18 if (match.size()) {
18 if (match.size()) {
19 tagVersion = match[0][1];
19 tagVersion = match[0][1];
20 tagDistance = match[0][2].toInteger();
20 tagDistance = match[0][2].toInteger();
21 } else {
21 } else {
22 throw new Exception("A version must be specied");
22 throw new Exception("A version must be specied");
23 }
23 }
24
24
25 version = tagVersion;
25 version = tagVersion;
26
26
27 if (tagDistance > 0)
27 if (tagDistance > 0)
28 version++;
28 version++;
29 } else {
29 } else {
30 println "explicit version: $version";
30 println "explicit version: $version";
31 }
31 }
32
32
33 if (hasProperty('versionSuffix') && versionSuffix) {
33 if (hasProperty('versionSuffix') && versionSuffix) {
34 version += "-$versionSuffix"
34 version += "-$versionSuffix"
35 }
35 }
36
36
37 if(! jsmodule in ["amd", "commonjs", "system", "umd", "es6", "esnext"])
38 throw new Exception("Invalid jsmodule specified: $jsmodule");
39 if(! target in ["es3", "es5", "es6", "es2016", "es2017", "esnext"])
40 throw new Exception("Invalid target specified: $target")
41
42 ext {
37 ext {
43 packageName = "@$npmScope/$npmName"
38 packageName = "@$npmScope/$npmName"
44 }
39 }
45
40
46 def jstarget = target;
47
48 sources {
41 sources {
49 amd {
42 amd {
50 typings {
43 typings {
51 srcDir main.output.typingsDir
44 srcDir main.output.typingsDir
52 }
45 }
53 }
46 }
54
47
55 cjs {
48 cjs {
56 typings {
49 typings {
57 srcDir main.output.typingsDir
50 srcDir main.output.typingsDir
58 }
51 }
59 }
52 }
60
53
61 testAmd {
54 testAmd {
62 typings {
55 typings {
63 srcDir main.output.typingsDir
56 srcDir main.output.typingsDir
64 srcDir amd.output.typingsDir
57 srcDir amd.output.typingsDir
65 srcDir test.output.typingsDir
58 srcDir test.output.typingsDir
66 }
59 }
67 }
60 }
68
61
69 testCjs {
62 testCjs {
70 typings {
63 typings {
71 srcDir main.output.typingsDir
64 srcDir main.output.typingsDir
72 srcDir cjs.output.typingsDir
65 srcDir cjs.output.typingsDir
73 srcDir test.output.typingsDir
66 srcDir test.output.typingsDir
74 }
67 }
75 }
68 }
76 }
69 }
77
70
78 typescript {
71 typescript {
79 compilerOptions {
72 compilerOptions {
80 lib = [target, "dom", "scripthost"]
81 if (jstarget in ["es5", "es3"])
82 lib += ["es2015.promise", "es2015.symbol", "es2015.iterable"]
83
84 target = jstarget
85 module = jsmodule
86 types = []
73 types = []
87 declaration = true
74 declaration = true
88 listFiles = true
75 listFiles = true
89
90 }
76 }
91 tscCmd = "$projectDir/node_modules/.bin/tsc"
77 tscCmd = "$projectDir/node_modules/.bin/tsc"
92 tsLintCmd = "$projectDir/node_modules/.bin/tslint"
78 tsLintCmd = "$projectDir/node_modules/.bin/tslint"
93 esLintCmd = "$projectDir/node_modules/.bin/eslint"
79 esLintCmd = "$projectDir/node_modules/.bin/eslint"
94 npmCmd = "npm"
80 npmCmd = "npm"
95 }
81 }
96
82
83 task prepare {
84
85 }
86
97 task printVersion {
87 task printVersion {
88 dependsOn prepare
89
98 doLast {
90 doLast {
99 println "version: $version";
91 println "version: ${-> version}";
100 println "tagDistance: $tagDistance";
92 println "tagDistance: ${-> tagDistance}";
101 println "packageName: $packageName";
93 println "packageName: ${-> packageName}";
102 println "target: $jstarget";
94 println "target: ${-> typescript.compilerOptions.target}";
103 println "module: $jsmodule";
95 println "module: ${-> typescript.compilerOptions.module}";
104 }
96 }
105 }
97 }
106
98
107 task clean {
99 task clean {
108 doLast {
100 doLast {
109 delete buildDir
101 delete buildDir
110 }
102 }
111 }
103 }
112
104
113 npmPackMeta {
105 npmPackMeta {
114 meta {
106 meta {
115 name = packageName
107 name = packageName
116 }
108 }
117 }
109 }
118
110
119 compileTsAmd {
111 configureTsCjs {
120 dependsOn sources.main.output
112 dependsOn sources.main.output
121 }
113 }
122
114
123 configureTsAmd {
115 configureTsAmd {
116 dependsOn sources.main.output
124 compilerOptions {
117 compilerOptions {
125 types += [ "requirejs", "dojo-typings" ]
118 types += [ "requirejs", "dojo-typings" ]
126 }
119 }
127 }
120 }
128
121
129 test {
122 test {
130 workingDir layout.buildDirectory.dir("test");
123 workingDir layout.buildDirectory.dir("test");
131 commandLine "node", "tests/index.js"
124 commandLine "node", "tests/index.js"
132 }
125 }
133
126
134 assembleTest {
127 task assembleTestAmd {
135 dependsOn sources.main.output
136 dependsOn sources.amd.output
128 dependsOn sources.amd.output
137 dependsOn sources.testAmd.output
129 dependsOn sources.testAmd.output
138
130
131 doLast {
132 assembleTest {
133 from(sources.amd.output.compiledDir)
134 from(sources.testAmd.output.compiledDir)
135 }
136 }
137 }
138
139 assembleTest {
140 mustRunAfter assembleTestAmd
141 dependsOn sources.main.output
139 from(sources.main.output.compiledDir)
142 from(sources.main.output.compiledDir)
140 from(sources.amd.output.compiledDir)
143 }
141 from(sources.testAmd.output.compiledDir)
144
145
146
147 task prepareTargetEs5 {
148 doLast {
149 typescript {
150 compilerOptions {
151 target = "es5"
152 lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"]
153 }
154 }
155 }
156 }
157
158 task prepareTargetEsNext {
159 doLast {
160 typescript {
161 compilerOptions {
162 target = "esnext"
163 lib = ["esnext", "dom", "scripthost"]
164 }
165 }
166 }
167 }
168
169 task prepareNode {
170 dependsOn prepareTargetEsNext
171 doLast {
172 typescript {
173 compilerOptions {
174 target = "esnext"
175 module = "commonjs"
176 }
177 }
178 }
179 }
180
181 task prepareBrowser {
182 dependsOn prepareTargetEs5
183 doLast {
184 typescript {
185 compilerOptions {
186 module = "requirejs"
187 }
188 }
189 }
190 }
191
192 prepare {
193 mustRunAfter prepareNode, prepareBrowser
142 } No newline at end of file
194 }
@@ -1,9 +1,7
1 version=
1 version=
2 author=Implab team
2 author=Implab team
3 jsmodule=amd
4 target=es5
5 description=Dependency injection, logging, simple and fast text template engine
3 description=Dependency injection, logging, simple and fast text template engine
6 license=BSD-2-Clause
4 license=BSD-2-Clause
7 repository=https://bitbucket.org/implab/implabjs-core
5 repository=https://bitbucket.org/implab/implabjs-core
8 npmScope=implab
6 npmScope=implab
9 npmName=core-amd No newline at end of file
7 npmName=core-amd
General Comments 0
You need to be logged in to leave comments. Login now