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