##// END OF EJS Templates
Working on build, vs code tasks
cin -
r98:2e1aa35d6371 ts-plugin
parent child
Show More
@@ -1,236 +1,260
1 plugins {
1 plugins {
2 id "org.implab.gradle-typescript" version "1.0.1-rc3"
2 id "org.implab.gradle-typescript" version "1.0.1-rc3"
3 id "org.implab.gradle-hg"
3 id "org.implab.gradle-hg"
4 id "ivy-publish"
4 id "ivy-publish"
5 }
5 }
6
6
7 // Ссли вСрсия явно Π½Π΅ Π·Π°Π΄Π°Π½Ρ‹ вычисляСм Π΅Π΅ ΠΈΠ· тэга Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ v.{num}***
7 // Ссли вСрсия явно Π½Π΅ Π·Π°Π΄Π°Π½Ρ‹ вычисляСм Π΅Π΅ ΠΈΠ· тэга Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ v.{num}***
8 // Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚ΠΎΠΌ Π±ΡƒΠ΄Π΅Ρ‚ вСрсия '{num}.{distance}' Π³Π΄Π΅ distance - расстояниС ΠΎΡ‚
8 // Ρ€Π΅Π·ΡƒΠ»ΡŒΡ‚Π°Ρ‚ΠΎΠΌ Π±ΡƒΠ΄Π΅Ρ‚ вСрсия '{num}.{distance}' Π³Π΄Π΅ distance - расстояниС ΠΎΡ‚
9 // Ρ‚Π΅ΠΊΡƒΡ‰Π΅ΠΉ Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ Π΄ΠΎ Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ с тэгом
9 // Ρ‚Π΅ΠΊΡƒΡ‰Π΅ΠΉ Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ Π΄ΠΎ Ρ€Π΅Π²ΠΈΠ·ΠΈΠΈ с тэгом
10 def tagDistance = 0;
10 def tagDistance = 0;
11
11
12 ext {
12 ext {
13 packageName = "@$npmScope/$name"
13 packageName = "@$npmScope/$name"
14 lint = project.hasProperty('lint') ? lint : false
14 lint = project.hasProperty('lint') ? lint : false
15 }
15 }
16
16
17 configurations {
17 configurations {
18
18
19 }
19 }
20
20
21 sources {
21 sources {
22 amd {
22 amd {
23 typings {
23 typings {
24 srcDir main.output.typingsDir
24 srcDir main.output.typingsDir
25 }
25 }
26 }
26 }
27
27
28 cjs {
28 cjs {
29 typings {
29 typings {
30 srcDir main.output.typingsDir
30 srcDir main.output.typingsDir
31 }
31 }
32 }
32 }
33
33
34 testAmd {
34 testAmd {
35 typings {
35 typings {
36 srcDir main.output.typingsDir
36 srcDir main.output.typingsDir
37 srcDir amd.output.typingsDir
37 srcDir amd.output.typingsDir
38 srcDir test.output.typingsDir
38 srcDir test.output.typingsDir
39 }
39 }
40 }
40 }
41
41
42 testCjs {
42 testCjs {
43 typings {
43 typings {
44 srcDir main.output.typingsDir
44 srcDir main.output.typingsDir
45 srcDir cjs.output.typingsDir
45 srcDir cjs.output.typingsDir
46 srcDir test.output.typingsDir
46 srcDir test.output.typingsDir
47 }
47 }
48 }
48 }
49 }
49 }
50
50
51 typescript {
51 typescript {
52 compilerOptions {
52 compilerOptions {
53 types = []
53 types = []
54 declaration = true
54 declaration = true
55 sourceMap = true
55 sourceMap = true
56 sourceRoot = "."
56 sourceRoot = "_src"
57 }
57 }
58 tscCmd = "$projectDir/node_modules/.bin/tsc"
58 tscCmd = "$projectDir/node_modules/.bin/tsc"
59 tsLintCmd = "$projectDir/node_modules/.bin/tslint"
59 tsLintCmd = "$projectDir/node_modules/.bin/tslint"
60 esLintCmd = "$projectDir/node_modules/.bin/eslint"
60 esLintCmd = "$projectDir/node_modules/.bin/eslint"
61 npmCmd = "npm"
61 npmCmd = "npm"
62 }
62 }
63
63
64 tasks.matching{ it.name =~ /^configureTs/ }.configureEach {
64 tasks.matching{ it.name =~ /^configureTs/ }.configureEach {
65 dependsOn "prepare"
65 dependsOn "prepare"
66 }
66 }
67
67
68 tasks.matching{ it.name =~ /^lint/ }.configureEach {
68 tasks.matching{ it.name =~ /^lint/ }.configureEach {
69 onlyIf { lint }
69 onlyIf { lint }
70 }
70 }
71
71
72 task prepare {
72 task prepare {
73
73
74 }
74 }
75
75
76 task printVersion {
76 task printVersion {
77 dependsOn prepare
77 dependsOn prepare
78
78
79 doLast {
79 doLast {
80 println "version: ${-> version}";
80 println "version: ${-> version}";
81 println "packageName: ${-> packageName}";
81 println "packageName: ${-> packageName}";
82 println "target: ${-> typescript.compilerOptions.target}";
82 println "target: ${-> typescript.compilerOptions.target}";
83 println "module: ${-> typescript.compilerOptions.module}";
83 println "module: ${-> typescript.compilerOptions.module}";
84 }
84 }
85 }
85 }
86
86
87 task clean {
87 task clean {
88 prepare.mustRunAfter it
88 prepare.mustRunAfter it
89
89
90 doLast {
90 doLast {
91 delete buildDir
91 delete buildDir
92 }
92 }
93 }
93 }
94
94
95 npmPackMeta {
95 npmPackMeta {
96 meta {
96 meta {
97 name = packageName
97 name = packageName
98 }
98 }
99 }
99 }
100
100
101 configureTsCjs {
101 configureTsCjs {
102 dependsOn sources.main.output
102 dependsOn sources.main.output
103 compilerOptions {
103 compilerOptions {
104 types += [ "node" ]
104 types += [ "node" ]
105 }
105 }
106 }
106 }
107
107
108 configureTsAmd {
108 configureTsAmd {
109 dependsOn sources.main.output
109 dependsOn sources.main.output
110 compilerOptions {
110 compilerOptions {
111 types += [ "requirejs", "dojo-typings" ]
111 types += [ "requirejs", "dojo-typings" ]
112 }
112 }
113 }
113 }
114
114
115 test {
115 test {
116 workingDir layout.buildDirectory.dir("test");
116 workingDir layout.buildDirectory.dir("test");
117 commandLine "node", "tests/index.js"
117 commandLine "node", "tests/index.js"
118 }
118 }
119
119
120 assemble {
120 assemble {
121 mustRunAfter sources.amd.output,
122 sources.cjs.output
123
121 from sources.amd.output.compiledDir
124 from sources.amd.output.compiledDir
122 from sources.cjs.output.compiledDir
125 from sources.cjs.output.compiledDir
123 }
126 }
124
127
125 assembleTest {
128 assembleTest {
129 mustRunAfter sources.amd.output,
130 sources.cjs.output,
131 sources.testAmd.output,
132 sources.testCjs.output
133
126 from sources.amd.output.compiledDir
134 from sources.amd.output.compiledDir
127 from sources.cjs.output.compiledDir
135 from sources.cjs.output.compiledDir
128 from sources.testAmd.output.compiledDir
136 from sources.testAmd.output.compiledDir
129 from sources.testCjs.output.compiledDir
137 from sources.testCjs.output.compiledDir
130 }
138 }
131
139
140 task prepareLocalDebug {
141 prepare.mustRunAfter it
142
143 doLast {
144 tasks.matching{ it.name =~ /^configureTs/ }.configureEach {
145 compilerOptions {
146 sourceRoot = "file://" + it.rootDir
147 }
148 }
149 }
150 }
151
132 task prepareNode {
152 task prepareNode {
133 prepare.mustRunAfter it
153 prepare.mustRunAfter it
134
154
135 doLast {
155 doLast {
136 typescript {
156 typescript {
137 compilerOptions {
157 compilerOptions {
138 module = "commonjs"
158 module = "commonjs"
139 target = "es2017"
159 target = "es2017"
140 lib = ["es2017", "dom", "scripthost"]
160 lib = ["es2017", "dom", "scripthost"]
141 }
161 }
142 }
162 }
143 }
163 }
144 }
164 }
145
165
146 task prepareBrowser {
166 task prepareBrowser {
147 prepare.mustRunAfter it
167 prepare.mustRunAfter it
148
168
149 doLast {
169 doLast {
150 packageName = "@$npmScope/$project.name-amd"
170 packageName = "@$npmScope/$project.name-amd"
151
171
152 typescript {
172 typescript {
153 compilerOptions {
173 compilerOptions {
154 module = "amd"
174 module = "amd"
155 target = "es5"
175 target = "es5"
156 lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"]
176 lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"]
157 }
177 }
158 }
178 }
159 }
179 }
160 }
180 }
161
181
162 task npmPackTypingsAmd(type: Copy) {
182 task npmPackTypingsAmd(type: Copy) {
163 dependsOn sources.main.output
183 dependsOn sources.main.output
164 dependsOn sources.amd.output
184 dependsOn sources.amd.output
165 npmPack.mustRunAfter it
185 npmPack.mustRunAfter it
166
186
167 from sources.main.output.typingsDir
187 from sources.main.output.typingsDir
168 from sources.amd.output.typingsDir
188 from sources.amd.output.typingsDir
169
189
170 into "${->buildDir}/npm/pack"
190 into "${->buildDir}/npm/pack"
171 }
191 }
172
192
173 task npmPackSourcesAmd(type: Copy) {
193 task npmPackSourcesAmd(type: Copy) {
174 from sources.main.ts
194 from sources.main.ts
175 from sources.amd.ts
195 from sources.amd.ts
176
196
177 npmPack.mustRunAfter it
197 npmPack.mustRunAfter it
178
198
179 into "${->buildDir}/npm/pack"
199 into "${->buildDir}/npm/pack/_src"
180 }
200 }
181
201
182 task assembleBrowser {
202 task assembleBrowser {
183 dependsOn prepareBrowser, assemble, sources.amd.output
203 dependsOn prepareBrowser, assemble, sources.amd.output
184 }
204 }
185
205
186 task assembleNode {
206 task assembleNode {
187 dependsOn prepareNode, assemble, sources.cjs.output
207 dependsOn prepareNode, assemble, sources.cjs.output
188 }
208 }
189
209
210 task assembleTestBrowser {
211 dependsOn prepareBrowser, prepareLocalDebug, assembleTest, sources.amd.output, sources.testAmd.output
212 }
213
190 task testBrowser {
214 task testBrowser {
191 dependsOn prepareBrowser, test, sources.amd.output, sources.testAmd.output
215 dependsOn prepareBrowser, test, sources.amd.output, sources.testAmd.output
192 }
216 }
193
217
194 task testNode {
218 task testNode {
195 dependsOn prepareNode, test, sources.cjs.output, sources.testCjs.output
219 dependsOn prepareNode, test, sources.cjs.output, sources.testCjs.output
196 }
220 }
197
221
198 task npmPackBrowser {
222 task npmPackBrowser {
199 dependsOn assembleBrowser, npmPack, npmPackSourcesAmd, npmPackTypingsAmd
223 dependsOn assembleBrowser, npmPack, npmPackSourcesAmd, npmPackTypingsAmd
200 }
224 }
201
225
202
226
203 task packJsTar(type: Tar) {
227 task packJsTar(type: Tar) {
204 dependsOn assemble;
228 dependsOn assemble;
205
229
206 archiveBaseName = provider { packageName }
230 archiveBaseName = provider { packageName }
207
231
208 destinationDirectory = buildDir
232 destinationDirectory = buildDir
209 archiveClassifier = provider { typescript.compilerOptions.module }
233 archiveClassifier = provider { typescript.compilerOptions.module }
210 compression = Compression.GZIP
234 compression = Compression.GZIP
211
235
212 from(assemble.outputs)
236 from(assemble.outputs)
213
237
214 doLast {
238 doLast {
215 println archiveName;
239 println archiveName;
216 }
240 }
217 }
241 }
218
242
219 task packTypingsTar(type: Tar) {
243 task packTypingsTar(type: Tar) {
220 }
244 }
221
245
222 publishing {
246 publishing {
223 publications {
247 publications {
224 local(IvyPublication) {
248 local(IvyPublication) {
225 artifact(packJsTar) {
249 artifact(packJsTar) {
226 type = "js"
250 type = "js"
227 }
251 }
228 }
252 }
229 }
253 }
230
254
231 repositories {
255 repositories {
232 ivy {
256 ivy {
233 url "ivy-repo"
257 url "ivy-repo"
234 }
258 }
235 }
259 }
236 } No newline at end of file
260 }
General Comments 0
You need to be logged in to leave comments. Login now