| @@ -1,14 +1,16 | |||||
| 1 | // если версия явно не заданы вычисляем ее из тэга ревизии v.{num}*** |
|
1 | // если версия явно не заданы вычисляем ее из тэга ревизии v.{num}*** | |
| 2 | // результатом будет версия '{num}.{distance}' где distance - расстояние от |
|
2 | // результатом будет версия '{num}.{distance}' где distance - расстояние от | |
| 3 | // текущей ревизии до ревизии с тэгом |
|
3 | // текущей ревизии до ревизии с тэгом | |
|
|
4 | def tagDistance = 0; | |||
|
|
5 | def isRelease = false; | |||
|
|
6 | ||||
| 4 | if (!version) { |
|
7 | if (!version) { | |
| 5 | def tagDistance = 0; |
|
|||
| 6 |
|
8 | |||
| 7 | def rev = ["hg", "log", "-r", ".", "--template", "{latesttag('re:^v') % '{tag}-{distance}'}"].execute().text.trim(); |
|
9 | def rev = ["hg", "log", "-r", ".", "--template", "{latesttag('re:^v') % '{tag}-{distance}'}"].execute().text.trim(); | |
| 8 |
|
10 | |||
| 9 | def tagVersion; |
|
11 | def tagVersion; | |
| 10 |
|
12 | |||
| 11 | def match = (rev =~ /^v(\d+\.\d+).*-(\d+)$/); |
|
13 | def match = (rev =~ /^v(\d+\.\d+\.\d+).*-(\d+)$/); | |
| 12 |
|
14 | |||
| 13 | if (match.size()) { |
|
15 | if (match.size()) { | |
| 14 | tagVersion = match[0][1]; |
|
16 | tagVersion = match[0][1]; | |
| @@ -17,7 +19,10 if (!version) { | |||||
| 17 | throw new Exception("A version must be specied"); |
|
19 | throw new Exception("A version must be specied"); | |
| 18 | } |
|
20 | } | |
| 19 |
|
21 | |||
| 20 |
version = |
|
22 | version = tagVersion; | |
|
|
23 | ||||
|
|
24 | if (tagDistance > 0) | |||
|
|
25 | version++; | |||
| 21 | } else { |
|
26 | } else { | |
| 22 | println "explicit version: $version"; |
|
27 | println "explicit version: $version"; | |
| 23 | } |
|
28 | } | |
| @@ -29,6 +34,12 if (hasProperty('versionSuffix') && vers | |||||
| 29 | if(!npmName) |
|
34 | if(!npmName) | |
| 30 | npmName = name; |
|
35 | npmName = name; | |
| 31 |
|
36 | |||
|
|
37 | if (hasProperty('release')) { | |||
|
|
38 | isRelease = (release != 'false') | |||
|
|
39 | } else { | |||
|
|
40 | isRelease = (tagDistance == 0); | |||
|
|
41 | } | |||
|
|
42 | ||||
| 32 | if(!["amd", "commonjs", "system", "umd", "es6", "esnext"].contains(jsmodule)) |
|
43 | if(!["amd", "commonjs", "system", "umd", "es6", "esnext"].contains(jsmodule)) | |
| 33 | throw new Exception("Invalid jsmodule specified: $jsmodule"); |
|
44 | throw new Exception("Invalid jsmodule specified: $jsmodule"); | |
| 34 | if(!["es3", "es5", "es6", "es2016", "es2017", "esnext"].contains(target)) |
|
45 | if(!["es3", "es5", "es6", "es2016", "es2017", "esnext"].contains(target)) | |
| @@ -121,11 +132,12 def createSoursetTasks = { String name, | |||||
| 121 |
|
132 | |||
| 122 | task printVersion { |
|
133 | task printVersion { | |
| 123 | doLast { |
|
134 | doLast { | |
| 124 | println "version: $version" |
|
135 | println "version: $version"; | |
| 125 | println "packageName: $packageName" |
|
136 | println "isRelease: $isRelease, tagDistance: $tagDistance"; | |
| 126 | println "bundle: ${pack.outputs.files.join(',')}" |
|
137 | println "packageName: $packageName"; | |
| 127 | println "target: $target" |
|
138 | println "bundle: ${pack.outputs.files.join(',')}"; | |
| 128 |
println " |
|
139 | println "target: $target"; | |
|
|
140 | println "module: $jsmodule"; | |||
| 129 | } |
|
141 | } | |
| 130 | } |
|
142 | } | |
| 131 |
|
143 | |||
| @@ -252,4 +264,9 task publish(dependsOn: [build, _package | |||||
| 252 | workingDir distDir |
|
264 | workingDir distDir | |
| 253 |
|
265 | |||
| 254 | commandLine 'npm', 'publish', '--access', 'public' |
|
266 | commandLine 'npm', 'publish', '--access', 'public' | |
|
|
267 | } | |||
|
|
268 | ||||
|
|
269 | task markRelease(type: Exec) { | |||
|
|
270 | onlyIf { tagDistance > 1 } | |||
|
|
271 | commandLine "hg", "tag", "v$version"; | |||
| 255 | } No newline at end of file |
|
272 | } | |
General Comments 0
You need to be logged in to leave comments.
Login now
