| @@ -1,5 +1,5 | |||||
| 1 | plugins { |
|
1 | plugins { | |
| 2 |
id "org.implab.gradle-typescript" version "1. |
|
2 | id "org.implab.gradle-typescript" version "1.1.0" | |
| 3 | id "org.implab.gradle-hg" |
|
3 | id "org.implab.gradle-hg" | |
| 4 | id "ivy-publish" |
|
4 | id "ivy-publish" | |
| 5 | } |
|
5 | } | |
| @@ -12,7 +12,7 if (!flavour in ['browser', 'node']) | |||||
| 12 |
|
12 | |||
| 13 | ext { |
|
13 | ext { | |
| 14 | packageName = flavour == 'browser' ? "@$npmScope/$name-amd" : "@$npmScope/$name" |
|
14 | packageName = flavour == 'browser' ? "@$npmScope/$name-amd" : "@$npmScope/$name" | |
| 15 | lint = project.hasProperty('lint') ? project.lint : false |
|
15 | lint = project.hasProperty('lint') ? project.lint ?: true : false | |
| 16 | } |
|
16 | } | |
| 17 |
|
17 | |||
| 18 | sources { |
|
18 | sources { | |
| @@ -68,6 +68,9 typescript { | |||||
| 68 | tscCmd = "$projectDir/node_modules/.bin/tsc" |
|
68 | tscCmd = "$projectDir/node_modules/.bin/tsc" | |
| 69 | tsLintCmd = "$projectDir/node_modules/.bin/tslint" |
|
69 | tsLintCmd = "$projectDir/node_modules/.bin/tslint" | |
| 70 | esLintCmd = "$projectDir/node_modules/.bin/eslint" |
|
70 | esLintCmd = "$projectDir/node_modules/.bin/eslint" | |
|
|
71 | } | |||
|
|
72 | ||||
|
|
73 | npm { | |||
| 71 |
|
|
74 | npmCmd = "npm" | |
| 72 | } |
|
75 | } | |
| 73 |
|
76 | |||
| @@ -85,13 +88,13 if (symbols == 'local') { | |||||
| 85 |
|
88 | |||
| 86 | task printVersion { |
|
89 | task printVersion { | |
| 87 | doLast { |
|
90 | doLast { | |
| 88 |
println "packageName: $ |
|
91 | println "packageName: $packageName"; | |
| 89 |
println "version: $ |
|
92 | println "version: $version"; | |
| 90 |
println "flavour: $ |
|
93 | println "flavour: $flavour"; | |
| 91 |
println "target: $ |
|
94 | println "target: $typescript.compilerOptions.target"; | |
| 92 |
println "module: $ |
|
95 | println "module: $typescript.compilerOptions.module"; | |
| 93 |
println "lint: $ |
|
96 | println "lint: $lint"; | |
| 94 |
println "symbols: $ |
|
97 | println "symbols: $symbols"; | |
| 95 | } |
|
98 | } | |
| 96 | } |
|
99 | } | |
| 97 |
|
100 | |||
| @@ -130,10 +133,12 assemble { | |||||
| 130 | if (flavour == 'browser') { |
|
133 | if (flavour == 'browser') { | |
| 131 | dependsOn sources.amd.output |
|
134 | dependsOn sources.amd.output | |
| 132 | from sources.amd.output.compiledDir |
|
135 | from sources.amd.output.compiledDir | |
|
|
136 | from sources.amd.resources | |||
| 133 | } |
|
137 | } | |
| 134 | if (flavour == 'node') { |
|
138 | if (flavour == 'node') { | |
| 135 | dependsOn sources.cjs.output |
|
139 | dependsOn sources.cjs.output | |
| 136 | from sources.cjs.output.compiledDir |
|
140 | from sources.cjs.output.compiledDir | |
|
|
141 | from sources.cjs.resources | |||
| 137 | } |
|
142 | } | |
| 138 | } |
|
143 | } | |
| 139 |
|
144 | |||
| @@ -143,17 +148,32 assembleTest { | |||||
| 143 |
|
148 | |||
| 144 | from sources.amd.output.compiledDir |
|
149 | from sources.amd.output.compiledDir | |
| 145 | from sources.testAmd.output.compiledDir |
|
150 | from sources.testAmd.output.compiledDir | |
|
|
151 | from sources.amd.resources | |||
|
|
152 | from sources.testAmd.resources | |||
| 146 | } |
|
153 | } | |
| 147 | if (flavour == 'node') { |
|
154 | if (flavour == 'node') { | |
| 148 | dependsOn sources.cjs.output, sources.testCjs.output |
|
155 | dependsOn sources.cjs.output, sources.testCjs.output | |
| 149 |
|
156 | |||
| 150 | from sources.cjs.output.compiledDir |
|
157 | from sources.cjs.output.compiledDir | |
| 151 | from sources.testCjs.output.compiledDir |
|
158 | from sources.testCjs.output.compiledDir | |
|
|
159 | from sources.cjs.resources | |||
|
|
160 | from sources.testCjs.resources | |||
|
|
161 | } | |||
|
|
162 | } | |||
|
|
163 | ||||
|
|
164 | typings { | |||
|
|
165 | if (flavour == 'browser') { | |||
|
|
166 | dependsOn sources.amd.output | |||
|
|
167 | from sources.amd.output.typingsDir | |||
|
|
168 | } | |||
|
|
169 | if (flavour == 'node') { | |||
|
|
170 | dependsOn sources.cjs.output | |||
|
|
171 | from sources.cjs.output.typingsDir | |||
| 152 | } |
|
172 | } | |
| 153 | } |
|
173 | } | |
| 154 |
|
174 | |||
| 155 | task npmPackTypings(type: Copy) { |
|
175 | task npmPackTypings(type: Copy) { | |
| 156 | npmPack.dependsOn it |
|
176 | npmPackContents.dependsOn it | |
| 157 | dependsOn sources.main.output |
|
177 | dependsOn sources.main.output | |
| 158 |
|
178 | |||
| 159 | from sources.main.output.typingsDir |
|
179 | from sources.main.output.typingsDir | |
| @@ -167,11 +187,14 task npmPackTypings(type: Copy) { | |||||
| 167 | from sources.cjs.output.typingsDir |
|
187 | from sources.cjs.output.typingsDir | |
| 168 | } |
|
188 | } | |
| 169 |
|
189 | |||
| 170 | into "${->buildDir}/npm/pack" |
|
190 | into npm.packageDir | |
| 171 | } |
|
191 | } | |
| 172 |
|
192 | |||
| 173 | task npmPackSources(type: Copy) { |
|
193 | task npmPackSources(type: Copy) { | |
| 174 | from sources.main.ts |
|
194 | from sources.main.ts | |
|
|
195 | if (symbols == 'pack') { | |||
|
|
196 | npmPackContents.dependsOn npmPackSources | |||
|
|
197 | } | |||
| 175 |
|
198 | |||
| 176 | if (flavour == 'browser') { |
|
199 | if (flavour == 'browser') { | |
| 177 | from sources.amd.ts |
|
200 | from sources.amd.ts | |
| @@ -180,14 +203,10 task npmPackSources(type: Copy) { | |||||
| 180 | from sources.cjs.ts |
|
203 | from sources.cjs.ts | |
| 181 | } |
|
204 | } | |
| 182 |
|
205 | |||
| 183 | into "${->buildDir}/npm/pack/_src" |
|
206 | into npm.packageDir.dir("_src") | |
| 184 | } |
|
207 | } | |
| 185 |
|
208 | |||
| 186 | if (symbols == 'pack') { |
|
209 | ||
| 187 | npmPack { |
|
|||
| 188 | dependsOn npmPackSources |
|
|||
| 189 | } |
|
|||
| 190 | } |
|
|||
| 191 |
|
210 | |||
| 192 | task packJsTar(type: Tar) { |
|
211 | task packJsTar(type: Tar) { | |
| 193 | dependsOn assemble; |
|
212 | dependsOn assemble; | |
General Comments 0
You need to be logged in to leave comments.
Login now
