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