| @@ -0,0 +1,14 | |||
|
|
1 | { | |
|
|
2 | "version": "0.2.0", | |
|
|
3 | "configurations": [ | |
|
|
4 | { | |
|
|
5 | "name": "Launch browser tests", | |
|
|
6 | "type": "node", | |
|
|
7 | "request": "launch", | |
|
|
8 | "program": "${workspaceFolder}/build/test/tests/index.js", | |
|
|
9 | "cwd": "${workspaceFolder}/build/test", | |
|
|
10 | "sourceMaps": true, | |
|
|
11 | "preLaunchTask": "Build browser test" | |
|
|
12 | } | |
|
|
13 | ] | |
|
|
14 | } No newline at end of file | |
| @@ -0,0 +1,15 | |||
|
|
1 | { | |
|
|
2 | "version": "2.0.0", | |
|
|
3 | "command": "./gradlew", | |
|
|
4 | "type": "shell", | |
|
|
5 | "tasks": [ | |
|
|
6 | { | |
|
|
7 | "label": "Build browser test", | |
|
|
8 | "args": [ | |
|
|
9 | "assembleTest", | |
|
|
10 | "-Psymbols=local", | |
|
|
11 | "-Pflavour=browser" | |
|
|
12 | ] | |
|
|
13 | } | |
|
|
14 | ] | |
|
|
15 | } No newline at end of file | |
| @@ -4,18 +4,15 plugins { | |||
|
|
4 | 4 | id "ivy-publish" |
|
|
5 | 5 | } |
|
|
6 | 6 | |
|
|
7 | // если версия явно не заданы вычисляем ее из тэга ревизии v.{num}*** | |
|
|
8 | // результатом будет версия '{num}.{distance}' где distance - расстояние от | |
|
|
9 | // текущей ревизии до ревизии с тэгом | |
|
|
10 | def tagDistance = 0; | |
|
|
7 | if (!symbols in ['local', 'pack', 'none']) | |
|
|
8 | throw new Exception("The symbols property value is invalid: $symbols"); | |
|
|
9 | ||
|
|
10 | if (!flavour in ['browser', 'node']) | |
|
|
11 | throw new Exception("The flavour property value is invalid: $flavour"); | |
|
|
11 | 12 | |
|
|
12 | 13 | ext { |
|
|
13 | packageName = "@$npmScope/$name" | |
|
|
14 | lint = project.hasProperty('lint') ? lint : false | |
|
|
15 | } | |
|
|
16 | ||
|
|
17 | configurations { | |
|
|
18 | ||
|
|
14 | packageName = flavour == 'browser' ? "@$npmScope/$name-amd" : "@$npmScope/$name" | |
|
|
15 | lint = project.hasProperty('lint') ? project.lint : false | |
|
|
19 | 16 | } |
|
|
20 | 17 | |
|
|
21 | 18 | sources { |
| @@ -52,8 +49,21 typescript { | |||
|
|
52 | 49 | compilerOptions { |
|
|
53 | 50 | types = [] |
|
|
54 | 51 | declaration = true |
|
|
55 | sourceMap = true | |
|
|
56 | sourceRoot = "_src" | |
|
|
52 | ||
|
|
53 | if(symbols != 'none') { | |
|
|
54 | sourceMap = true | |
|
|
55 | sourceRoot = "_src" | |
|
|
56 | } | |
|
|
57 | ||
|
|
58 | if (flavour == 'node') { | |
|
|
59 | module = "commonjs" | |
|
|
60 | target = "es2017" | |
|
|
61 | lib = ["es2017", "dom", "scripthost"] | |
|
|
62 | } else if (flavour == 'browser') { | |
|
|
63 | module = "amd" | |
|
|
64 | target = "es5" | |
|
|
65 | lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable" ] | |
|
|
66 | } | |
|
|
57 | 67 | } |
|
|
58 | 68 | tscCmd = "$projectDir/node_modules/.bin/tsc" |
|
|
59 | 69 | tsLintCmd = "$projectDir/node_modules/.bin/tslint" |
| @@ -61,32 +71,31 typescript { | |||
|
|
61 | 71 | npmCmd = "npm" |
|
|
62 | 72 | } |
|
|
63 | 73 | |
|
|
64 | tasks.matching{ it.name =~ /^configureTs/ }.configureEach { | |
|
|
65 | dependsOn "prepare" | |
|
|
66 | } | |
|
|
67 | ||
|
|
68 | 74 | tasks.matching{ it.name =~ /^lint/ }.configureEach { |
|
|
69 | 75 | onlyIf { lint } |
|
|
70 | 76 | } |
|
|
71 | 77 | |
|
|
72 | task prepare { | |
|
|
73 | ||
|
|
78 | if (symbols == 'local') { | |
|
|
79 | tasks.matching{ it.name =~ /^configureTs/ }.configureEach { | |
|
|
80 | compilerOptions { | |
|
|
81 | sourceRoot = "file://" + it.rootDir | |
|
|
82 | } | |
|
|
83 | } | |
|
|
74 | 84 | } |
|
|
75 | 85 | |
|
|
76 | 86 | task printVersion { |
|
|
77 | dependsOn prepare | |
|
|
78 | ||
|
|
79 | 87 | doLast { |
|
|
88 | println "packageName: ${-> packageName}"; | |
|
|
80 | 89 | println "version: ${-> version}"; |
|
|
81 |
println " |
|
|
|
90 | println "flavour: ${-> flavour}"; | |
|
|
82 | 91 | println "target: ${-> typescript.compilerOptions.target}"; |
|
|
83 | 92 | println "module: ${-> typescript.compilerOptions.module}"; |
|
|
93 | println "lint: ${-> lint}"; | |
|
|
94 | println "symbols: ${-> symbols}"; | |
|
|
84 | 95 | } |
|
|
85 | 96 | } |
|
|
86 | 97 | |
|
|
87 | 98 | task clean { |
|
|
88 | prepare.mustRunAfter it | |
|
|
89 | ||
|
|
90 | 99 | doLast { |
|
|
91 | 100 | delete buildDir |
|
|
92 | 101 | } |
| @@ -118,112 +127,68 test { | |||
|
|
118 | 127 | } |
|
|
119 | 128 | |
|
|
120 | 129 | assemble { |
|
|
121 | mustRunAfter sources.amd.output, | |
|
|
122 |
sources. |
|
|
|
123 | ||
|
|
124 | from sources.amd.output.compiledDir | |
|
|
125 | from sources.cjs.output.compiledDir | |
|
|
126 | } | |
|
|
127 | ||
|
|
128 | assembleTest { | |
|
|
129 | mustRunAfter sources.amd.output, | |
|
|
130 | sources.cjs.output, | |
|
|
131 | sources.testAmd.output, | |
|
|
132 | sources.testCjs.output | |
|
|
133 | ||
|
|
134 | from sources.amd.output.compiledDir | |
|
|
135 | from sources.cjs.output.compiledDir | |
|
|
136 | from sources.testAmd.output.compiledDir | |
|
|
137 | from sources.testCjs.output.compiledDir | |
|
|
138 | } | |
|
|
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 | } | |
|
|
130 | if (flavour == 'browser') { | |
|
|
131 | dependsOn sources.amd.output | |
|
|
132 | from sources.amd.output.compiledDir | |
|
|
133 | } | |
|
|
134 | if (flavour == 'node') { | |
|
|
135 | dependsOn sources.cjs.output | |
|
|
136 | from sources.cjs.output.compiledDir | |
|
|
149 | 137 | } |
|
|
150 | 138 | } |
|
|
151 | 139 | |
|
|
152 | task prepareNode { | |
|
|
153 | prepare.mustRunAfter it | |
|
|
140 | assembleTest { | |
|
|
141 | if (flavour == 'browser') { | |
|
|
142 | dependsOn sources.amd.output, sources.testAmd.output | |
|
|
154 | 143 | |
|
|
155 | doLast { | |
|
|
156 | typescript { | |
|
|
157 | compilerOptions { | |
|
|
158 | module = "commonjs" | |
|
|
159 | target = "es2017" | |
|
|
160 | lib = ["es2017", "dom", "scripthost"] | |
|
|
161 | } | |
|
|
162 | } | |
|
|
144 | from sources.amd.output.compiledDir | |
|
|
145 | from sources.testAmd.output.compiledDir | |
|
|
146 | } | |
|
|
147 | if (flavour == 'node') { | |
|
|
148 | dependsOn sources.cjs.output, sources.testCjs.output | |
|
|
149 | ||
|
|
150 | from sources.cjs.output.compiledDir | |
|
|
151 | from sources.testCjs.output.compiledDir | |
|
|
163 | 152 | } |
|
|
164 | 153 | } |
|
|
165 | 154 | |
|
|
166 | task prepareBrowser { | |
|
|
167 | prepare.mustRunAfter it | |
|
|
168 | ||
|
|
169 | doLast { | |
|
|
170 | packageName = "@$npmScope/$project.name-amd" | |
|
|
155 | task npmPackTypings(type: Copy) { | |
|
|
156 | npmPack.dependsOn it | |
|
|
157 | dependsOn sources.main.output | |
|
|
158 | ||
|
|
159 | from sources.main.output.typingsDir | |
|
|
171 | 160 | |
|
|
172 | typescript { | |
|
|
173 | compilerOptions { | |
|
|
174 | module = "amd" | |
|
|
175 | target = "es5" | |
|
|
176 | lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"] | |
|
|
177 | } | |
|
|
178 | } | |
|
|
161 | if (flavour == 'browser') { | |
|
|
162 | dependsOn sources.amd.output | |
|
|
163 | from sources.amd.output.typingsDir | |
|
|
179 | 164 | } |
|
|
180 | } | |
|
|
181 | ||
|
|
182 | task npmPackTypingsAmd(type: Copy) { | |
|
|
183 | dependsOn sources.main.output | |
|
|
184 | dependsOn sources.amd.output | |
|
|
185 | npmPack.mustRunAfter it | |
|
|
186 | ||
|
|
187 | from sources.main.output.typingsDir | |
|
|
188 | from sources.amd.output.typingsDir | |
|
|
165 | if (flavour == 'node') { | |
|
|
166 | dependsOn sources.cjs.output | |
|
|
167 | from sources.cjs.output.typingsDir | |
|
|
168 | } | |
|
|
189 | 169 | |
|
|
190 | 170 | into "${->buildDir}/npm/pack" |
|
|
191 | 171 | } |
|
|
192 | 172 | |
|
|
193 |
task npmPackSources |
|
|
|
173 | task npmPackSources(type: Copy) { | |
|
|
194 | 174 | from sources.main.ts |
|
|
195 | from sources.amd.ts | |
|
|
196 | ||
|
|
197 | npmPack.mustRunAfter it | |
|
|
175 | ||
|
|
176 | if (flavour == 'browser') { | |
|
|
177 | from sources.amd.ts | |
|
|
178 | } | |
|
|
179 | if (flavour == 'node') { | |
|
|
180 | from sources.cjs.ts | |
|
|
181 | } | |
|
|
198 | 182 | |
|
|
199 | 183 | into "${->buildDir}/npm/pack/_src" |
|
|
200 | 184 | } |
|
|
201 | 185 | |
|
|
202 | task assembleBrowser { | |
|
|
203 | dependsOn prepareBrowser, assemble, sources.amd.output | |
|
|
204 | } | |
|
|
205 | ||
|
|
206 | task assembleNode { | |
|
|
207 | dependsOn prepareNode, assemble, sources.cjs.output | |
|
|
208 | } | |
|
|
209 | ||
|
|
210 | task assembleTestBrowser { | |
|
|
211 | dependsOn prepareBrowser, prepareLocalDebug, assembleTest, sources.amd.output, sources.testAmd.output | |
|
|
186 | if (symbols == 'pack') { | |
|
|
187 | npmPack { | |
|
|
188 | dependsOn npmPackSources | |
|
|
189 | } | |
|
|
212 | 190 | } |
|
|
213 | 191 | |
|
|
214 | task testBrowser { | |
|
|
215 | dependsOn prepareBrowser, test, sources.amd.output, sources.testAmd.output | |
|
|
216 | } | |
|
|
217 | ||
|
|
218 | task testNode { | |
|
|
219 | dependsOn prepareNode, test, sources.cjs.output, sources.testCjs.output | |
|
|
220 | } | |
|
|
221 | ||
|
|
222 | task npmPackBrowser { | |
|
|
223 | dependsOn assembleBrowser, npmPack, npmPackSourcesAmd, npmPackTypingsAmd | |
|
|
224 | } | |
|
|
225 | ||
|
|
226 | ||
|
|
227 | 192 | task packJsTar(type: Tar) { |
|
|
228 | 193 | dependsOn assemble; |
|
|
229 | 194 | |
| @@ -4,4 +4,6 author=Implab team | |||
|
|
4 | 4 | description=Dependency injection, logging, simple and fast text processing tools |
|
|
5 | 5 | license=BSD-2-Clause |
|
|
6 | 6 | repository=https://bitbucket.org/implab/implabjs-core |
|
|
7 | npmScope=implab No newline at end of file | |
|
|
7 | npmScope=implab | |
|
|
8 | flavour=browser | |
|
|
9 | symbols=pack No newline at end of file | |
General Comments 0
You need to be logged in to leave comments.
Login now
