| @@ -1,2 +1,2 | |||||
| 1 | group=org.implab.gradle |
|
1 | group=org.implab.gradle | |
| 2 |
version=1.0. |
|
2 | version=1.0.1 No newline at end of file | |
| @@ -1,172 +1,171 | |||||
| 1 | package org.implab.gradle.mercurial; |
|
1 | package org.implab.gradle.mercurial; | |
| 2 |
|
2 | |||
| 3 | import java.nio.charset.Charset; |
|
3 | import java.nio.charset.Charset; | |
| 4 | import java.util.ArrayList; |
|
4 | import java.util.ArrayList; | |
| 5 | import java.util.Collections; |
|
5 | import java.util.Collections; | |
| 6 | import java.util.List; |
|
6 | import java.util.List; | |
| 7 | import java.util.Objects; |
|
7 | import java.util.Objects; | |
| 8 | import java.util.Optional; |
|
8 | import java.util.Optional; | |
| 9 | import java.util.function.Function; |
|
9 | import java.util.function.Function; | |
| 10 | import java.util.regex.Matcher; |
|
10 | import java.util.regex.Matcher; | |
| 11 | import java.util.regex.Pattern; |
|
11 | import java.util.regex.Pattern; | |
| 12 |
|
12 | |||
| 13 | import org.gradle.api.Project; |
|
13 | import org.gradle.api.Project; | |
| 14 | import org.implab.gradle.Utils; |
|
|||
| 15 |
|
14 | |||
| 16 | import groovy.lang.Closure; |
|
15 | import groovy.lang.Closure; | |
| 17 |
|
16 | |||
| 18 | public class MercurialExtension { |
|
17 | public class MercurialExtension { | |
| 19 | private static final String COMMIT_INFO_TEMPLATE = "{latesttag('re:^v') % '{ifeq(tag,'null','',tag)}:{distance}'}:{branch}:{node|short}"; |
|
18 | private static final String COMMIT_INFO_TEMPLATE = "{latesttag('re:^v') % '{ifeq(tag,'null','',tag)}:{distance}'}:{branch}:{node|short}"; | |
| 20 |
|
19 | |||
| 21 | private static final Pattern versionPattern = Pattern.compile("^(?:v[\\-_\\.]?)?(.*)"); |
|
20 | private static final Pattern versionPattern = Pattern.compile("^(?:v[\\-_\\.]?)?(.*)"); | |
| 22 |
|
21 | |||
| 23 | private final Project project; |
|
22 | private final Project project; | |
| 24 |
|
23 | |||
| 25 | private Charset outputCharset = Charset.defaultCharset(); |
|
24 | private Charset outputCharset = Charset.defaultCharset(); | |
| 26 |
|
25 | |||
| 27 | private WorkspaceInfo workspaceInfo; |
|
26 | private WorkspaceInfo workspaceInfo; | |
| 28 |
|
27 | |||
| 29 | private String hgCmd = "hg"; |
|
28 | private String hgCmd = "hg"; | |
| 30 |
|
29 | |||
| 31 | private String stagingBookmark = "staging"; |
|
30 | private String stagingBookmark = "staging"; | |
| 32 |
|
31 | |||
| 33 | private String releaseBookmark = "prod"; |
|
32 | private String releaseBookmark = "prod"; | |
| 34 |
|
33 | |||
| 35 | private SemVersion defaultWorkspaceVersion = new SemVersion(0, 0, 1, "dev", null); |
|
34 | private SemVersion defaultWorkspaceVersion = new SemVersion(0, 0, 1, "dev", null); | |
| 36 |
|
35 | |||
| 37 | private Function<SemVersion, SemVersion> preReleasePolicy; |
|
36 | private Function<SemVersion, SemVersion> preReleasePolicy; | |
| 38 |
|
37 | |||
| 39 | public MercurialExtension(Project project) { |
|
38 | public MercurialExtension(Project project) { | |
| 40 | Objects.requireNonNull(project); |
|
39 | Objects.requireNonNull(project); | |
| 41 |
|
40 | |||
| 42 | this.project = project; |
|
41 | this.project = project; | |
| 43 | } |
|
42 | } | |
| 44 |
|
43 | |||
| 45 | public String hg(String... args) { |
|
44 | public String hg(String... args) { | |
| 46 | List<String> commandLine = new ArrayList<>(); |
|
45 | List<String> commandLine = new ArrayList<>(); | |
| 47 | commandLine.add(hgCmd); |
|
46 | commandLine.add(hgCmd); | |
| 48 | Collections.addAll(commandLine, args); |
|
47 | Collections.addAll(commandLine, args); | |
| 49 |
|
48 | |||
| 50 | return Utils.execCmd(commandLine, outputCharset.name()); |
|
49 | return Utils.execCmd(commandLine, outputCharset.name()); | |
| 51 | } |
|
50 | } | |
| 52 |
|
51 | |||
| 53 | public String getReleaseBookmark() { |
|
52 | public String getReleaseBookmark() { | |
| 54 | return releaseBookmark; |
|
53 | return releaseBookmark; | |
| 55 | } |
|
54 | } | |
| 56 |
|
55 | |||
| 57 | public void setReleaseBookmark(String value) { |
|
56 | public void setReleaseBookmark(String value) { | |
| 58 | if(value == null) |
|
57 | if(value == null) | |
| 59 | throw new IllegalArgumentException(); |
|
58 | throw new IllegalArgumentException(); | |
| 60 | releaseBookmark = value; |
|
59 | releaseBookmark = value; | |
| 61 | } |
|
60 | } | |
| 62 |
|
61 | |||
| 63 | public String getStagingBookmark() { |
|
62 | public String getStagingBookmark() { | |
| 64 | return stagingBookmark; |
|
63 | return stagingBookmark; | |
| 65 | } |
|
64 | } | |
| 66 |
|
65 | |||
| 67 | public void setStagingBookmark(String value) { |
|
66 | public void setStagingBookmark(String value) { | |
| 68 | if(value == null) |
|
67 | if(value == null) | |
| 69 | throw new IllegalArgumentException(); |
|
68 | throw new IllegalArgumentException(); | |
| 70 | stagingBookmark = value; |
|
69 | stagingBookmark = value; | |
| 71 | } |
|
70 | } | |
| 72 |
|
71 | |||
| 73 | public Charset getOutputCharset() { |
|
72 | public Charset getOutputCharset() { | |
| 74 | return outputCharset; |
|
73 | return outputCharset; | |
| 75 | } |
|
74 | } | |
| 76 |
|
75 | |||
| 77 | public void setOutputCharset(Charset outputCharset) { |
|
76 | public void setOutputCharset(Charset outputCharset) { | |
| 78 | this.outputCharset = Optional.ofNullable(outputCharset).orElseGet(Charset::defaultCharset); |
|
77 | this.outputCharset = Optional.ofNullable(outputCharset).orElseGet(Charset::defaultCharset); | |
| 79 | } |
|
78 | } | |
| 80 |
|
79 | |||
| 81 | public void setOutputCharset(String outputCharset) { |
|
80 | public void setOutputCharset(String outputCharset) { | |
| 82 | this.outputCharset = Optional.ofNullable(outputCharset).map(x -> Charset.forName(x)) |
|
81 | this.outputCharset = Optional.ofNullable(outputCharset).map(x -> Charset.forName(x)) | |
| 83 | .orElseGet(Charset::defaultCharset); |
|
82 | .orElseGet(Charset::defaultCharset); | |
| 84 | } |
|
83 | } | |
| 85 |
|
84 | |||
| 86 | public String getHgCmd() { |
|
85 | public String getHgCmd() { | |
| 87 | return hgCmd; |
|
86 | return hgCmd; | |
| 88 | } |
|
87 | } | |
| 89 |
|
88 | |||
| 90 | public void setHgCmd(String hgCmd) { |
|
89 | public void setHgCmd(String hgCmd) { | |
| 91 | this.hgCmd = hgCmd; |
|
90 | this.hgCmd = hgCmd; | |
| 92 | } |
|
91 | } | |
| 93 |
|
92 | |||
| 94 | public WorkspaceInfo getWorkspaceInfo() { |
|
93 | public WorkspaceInfo getWorkspaceInfo() { | |
| 95 | if (workspaceInfo == null) |
|
94 | if (workspaceInfo == null) | |
| 96 | workspaceInfo = loadWorkspaceInfo(); |
|
95 | workspaceInfo = loadWorkspaceInfo(); | |
| 97 | return workspaceInfo; |
|
96 | return workspaceInfo; | |
| 98 | } |
|
97 | } | |
| 99 |
|
98 | |||
| 100 | public SemVersion getWorkspaceVersion() { |
|
99 | public SemVersion getWorkspaceVersion() { | |
| 101 | return tryParseVersion(getWorkspaceInfo().getVersionTag()).orElse(defaultWorkspaceVersion); |
|
100 | return tryParseVersion(getWorkspaceInfo().getVersionTag()).orElse(defaultWorkspaceVersion); | |
| 102 | } |
|
101 | } | |
| 103 |
|
102 | |||
| 104 | private SemVersion defaultPreReleasePolicy(SemVersion version) { |
|
103 | private SemVersion defaultPreReleasePolicy(SemVersion version) { | |
| 105 | String changeset = getWorkspaceInfo().getChangeset(); |
|
104 | String changeset = getWorkspaceInfo().getChangeset(); | |
| 106 | return version.addPatch(1).withPreRelease("snapshot").withMeta(changeset); |
|
105 | return version.addPatch(1).withPreRelease("snapshot").withMeta(changeset); | |
| 107 | } |
|
106 | } | |
| 108 |
|
107 | |||
| 109 | public void preReleasePolicy(Closure<SemVersion> policy) { |
|
108 | public void preReleasePolicy(Closure<SemVersion> policy) { | |
| 110 | if (policy == null) |
|
109 | if (policy == null) | |
| 111 | throw new IllegalArgumentException(); |
|
110 | throw new IllegalArgumentException(); | |
| 112 |
|
111 | |||
| 113 | this.preReleasePolicy = x -> { |
|
112 | this.preReleasePolicy = x -> { | |
| 114 | policy.setDelegate(getWorkspaceInfo()); |
|
113 | policy.setDelegate(getWorkspaceInfo()); | |
| 115 | policy.setResolveStrategy(Closure.DELEGATE_FIRST); |
|
114 | policy.setResolveStrategy(Closure.DELEGATE_FIRST); | |
| 116 | return policy.call(x); |
|
115 | return policy.call(x); | |
| 117 | }; |
|
116 | }; | |
| 118 | } |
|
117 | } | |
| 119 |
|
118 | |||
| 120 | public void preReleasePolicy(Function<SemVersion, SemVersion> policy) { |
|
119 | public void preReleasePolicy(Function<SemVersion, SemVersion> policy) { | |
| 121 | if (policy == null) |
|
120 | if (policy == null) | |
| 122 | throw new IllegalArgumentException(); |
|
121 | throw new IllegalArgumentException(); | |
| 123 | this.preReleasePolicy = policy; |
|
122 | this.preReleasePolicy = policy; | |
| 124 | } |
|
123 | } | |
| 125 |
|
124 | |||
| 126 | public void applyVersioningPolicy() { |
|
125 | public void applyVersioningPolicy() { | |
| 127 | Object version = project.getVersion(); |
|
126 | Object version = project.getVersion(); | |
| 128 | if (version == null || version.toString().isBlank() |
|
127 | if (version == null || version.toString().isBlank() | |
| 129 | || version.toString().equalsIgnoreCase(Project.DEFAULT_VERSION)) { |
|
128 | || version.toString().equalsIgnoreCase(Project.DEFAULT_VERSION)) { | |
| 130 | // if the version isn't specified |
|
129 | // if the version isn't specified | |
| 131 | int distance = getWorkspaceInfo().getVersionDistance(); |
|
130 | int distance = getWorkspaceInfo().getVersionDistance(); | |
| 132 |
|
131 | |||
| 133 | // the current workspace is not tagged with the version |
|
132 | // the current workspace is not tagged with the version | |
| 134 | if (distance > 0) { |
|
133 | if (distance > 0) { | |
| 135 | SemVersion preReleaseVersion = Optional.ofNullable(preReleasePolicy) |
|
134 | SemVersion preReleaseVersion = Optional.ofNullable(preReleasePolicy) | |
| 136 | .orElse(this::defaultPreReleasePolicy) |
|
135 | .orElse(this::defaultPreReleasePolicy) | |
| 137 | .apply(getWorkspaceVersion()); |
|
136 | .apply(getWorkspaceVersion()); | |
| 138 |
|
137 | |||
| 139 | project.setVersion(preReleaseVersion); |
|
138 | project.setVersion(preReleaseVersion); | |
| 140 | } else { |
|
139 | } else { | |
| 141 | project.setVersion(getWorkspaceVersion()); |
|
140 | project.setVersion(getWorkspaceVersion()); | |
| 142 | } |
|
141 | } | |
| 143 | } else { |
|
142 | } else { | |
| 144 | project.setVersion(SemVersion.toSemVersion(version, false)); |
|
143 | project.setVersion(SemVersion.toSemVersion(version, false)); | |
| 145 | } |
|
144 | } | |
| 146 | } |
|
145 | } | |
| 147 |
|
146 | |||
| 148 | String[] queryLogInfo() { |
|
147 | String[] queryLogInfo() { | |
| 149 | return hg("log", "-r", ".", "--template", COMMIT_INFO_TEMPLATE).split(":"); |
|
148 | return hg("log", "-r", ".", "--template", COMMIT_INFO_TEMPLATE).split(":"); | |
| 150 | } |
|
149 | } | |
| 151 |
|
150 | |||
| 152 | WorkspaceInfo loadWorkspaceInfo() { |
|
151 | WorkspaceInfo loadWorkspaceInfo() { | |
| 153 | boolean isDirty = checkIsDirty(); |
|
152 | boolean isDirty = checkIsDirty(); | |
| 154 | String[] info = queryLogInfo(); |
|
153 | String[] info = queryLogInfo(); | |
| 155 | return new WorkspaceInfo(info[0], Integer.parseInt(info[1]), info[2], info[3], isDirty); |
|
154 | return new WorkspaceInfo(info[0], Integer.parseInt(info[1]), info[2], info[3], isDirty); | |
| 156 | } |
|
155 | } | |
| 157 |
|
156 | |||
| 158 | boolean checkIsDirty() { |
|
157 | boolean checkIsDirty() { | |
| 159 | return !hg("status", "-mard").isBlank(); |
|
158 | return !hg("status", "-mard").isBlank(); | |
| 160 | } |
|
159 | } | |
| 161 |
|
160 | |||
| 162 | Optional<SemVersion> tryParseVersion(String version) { |
|
161 | Optional<SemVersion> tryParseVersion(String version) { | |
| 163 | if (version == null) |
|
162 | if (version == null) | |
| 164 | return Optional.empty(); |
|
163 | return Optional.empty(); | |
| 165 |
|
164 | |||
| 166 | Matcher m = versionPattern.matcher(version); |
|
165 | Matcher m = versionPattern.matcher(version); | |
| 167 | boolean isMatch = m.matches(); |
|
166 | boolean isMatch = m.matches(); | |
| 168 |
|
167 | |||
| 169 | return isMatch ? SemVersion.tryParseLax(m.group(1)) : Optional.empty(); |
|
168 | return isMatch ? SemVersion.tryParseLax(m.group(1)) : Optional.empty(); | |
| 170 | } |
|
169 | } | |
| 171 |
|
170 | |||
| 172 | } |
|
171 | } | |
| @@ -1,114 +1,114 | |||||
| 1 | package org.implab.gradle; |
|
1 | package org.implab.gradle.mercurial; | |
| 2 |
|
2 | |||
| 3 | import java.io.ByteArrayOutputStream; |
|
3 | import java.io.ByteArrayOutputStream; | |
| 4 | import java.io.Closeable; |
|
4 | import java.io.Closeable; | |
| 5 | import java.io.File; |
|
5 | import java.io.File; | |
| 6 | import java.io.FileOutputStream; |
|
6 | import java.io.FileOutputStream; | |
| 7 | import java.io.IOException; |
|
7 | import java.io.IOException; | |
| 8 | import java.io.InputStream; |
|
8 | import java.io.InputStream; | |
| 9 | import java.io.OutputStream; |
|
9 | import java.io.OutputStream; | |
| 10 | import java.util.List; |
|
10 | import java.util.List; | |
| 11 | import java.util.Scanner; |
|
11 | import java.util.Scanner; | |
| 12 |
|
12 | |||
| 13 | import org.gradle.api.Action; |
|
13 | import org.gradle.api.Action; | |
| 14 | import groovy.json.JsonGenerator; |
|
14 | import groovy.json.JsonGenerator; | |
| 15 | import groovy.json.JsonOutput; |
|
15 | import groovy.json.JsonOutput; | |
| 16 | import groovy.json.JsonGenerator.Converter; |
|
16 | import groovy.json.JsonGenerator.Converter; | |
| 17 | import groovy.lang.Closure; |
|
17 | import groovy.lang.Closure; | |
| 18 |
|
18 | |||
| 19 | public final class Utils { |
|
19 | public final class Utils { | |
| 20 | public static void redirectIO(final InputStream src, final Action<String> consumer) { |
|
20 | public static void redirectIO(final InputStream src, final Action<String> consumer) { | |
| 21 | new Thread(() -> { |
|
21 | new Thread(() -> { | |
| 22 | try (Scanner sc = new Scanner(src)) { |
|
22 | try (Scanner sc = new Scanner(src)) { | |
| 23 | while (sc.hasNextLine()) { |
|
23 | while (sc.hasNextLine()) { | |
| 24 | consumer.execute(sc.nextLine()); |
|
24 | consumer.execute(sc.nextLine()); | |
| 25 | } |
|
25 | } | |
| 26 | } |
|
26 | } | |
| 27 | }).start(); |
|
27 | }).start(); | |
| 28 | } |
|
28 | } | |
| 29 |
|
29 | |||
| 30 | public static String execCmd(List<String> args, String charset) { |
|
30 | public static String execCmd(List<String> args, String charset) { | |
| 31 | if (args == null || args.size() == 0) |
|
31 | if (args == null || args.size() == 0) | |
| 32 | throw new IllegalArgumentException(); |
|
32 | throw new IllegalArgumentException(); | |
| 33 |
|
33 | |||
| 34 | ProcessBuilder builder = new ProcessBuilder(args); |
|
34 | ProcessBuilder builder = new ProcessBuilder(args); | |
| 35 |
|
35 | |||
| 36 | Process p; |
|
36 | Process p; | |
| 37 | try { |
|
37 | try { | |
| 38 | p = builder.start(); |
|
38 | p = builder.start(); | |
| 39 |
|
39 | |||
| 40 | String output = readAll(p.getInputStream(), charset); |
|
40 | String output = readAll(p.getInputStream(), charset); | |
| 41 |
|
41 | |||
| 42 | int code = p.waitFor(); |
|
42 | int code = p.waitFor(); | |
| 43 | if (code != 0) |
|
43 | if (code != 0) | |
| 44 | throw new RuntimeException(String.format("The process `%s` failed with code: %s", args.get(0), code)); |
|
44 | throw new RuntimeException(String.format("The process `%s` failed with code: %s", args.get(0), code)); | |
| 45 |
|
45 | |||
| 46 | return output; |
|
46 | return output; | |
| 47 | } catch (IOException | InterruptedException e) { |
|
47 | } catch (IOException | InterruptedException e) { | |
| 48 | throw new RuntimeException(String.format("Failed to execute `%s`", args.get(0)), e); |
|
48 | throw new RuntimeException(String.format("Failed to execute `%s`", args.get(0)), e); | |
| 49 | } |
|
49 | } | |
| 50 |
|
50 | |||
| 51 | } |
|
51 | } | |
| 52 |
|
52 | |||
| 53 | public static void redirectIO(final InputStream src, final File file) { |
|
53 | public static void redirectIO(final InputStream src, final File file) { | |
| 54 | new Thread(() -> { |
|
54 | new Thread(() -> { | |
| 55 | try (OutputStream out = new FileOutputStream(file)) { |
|
55 | try (OutputStream out = new FileOutputStream(file)) { | |
| 56 | src.transferTo(out); |
|
56 | src.transferTo(out); | |
| 57 | } catch (Exception e) { |
|
57 | } catch (Exception e) { | |
| 58 | // silence! |
|
58 | // silence! | |
| 59 | } |
|
59 | } | |
| 60 | }).start(); |
|
60 | }).start(); | |
| 61 | } |
|
61 | } | |
| 62 |
|
62 | |||
| 63 | public static String readAll(final InputStream src) throws IOException { |
|
63 | public static String readAll(final InputStream src) throws IOException { | |
| 64 | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|
64 | ByteArrayOutputStream out = new ByteArrayOutputStream(); | |
| 65 | src.transferTo(out); |
|
65 | src.transferTo(out); | |
| 66 | return out.toString(); |
|
66 | return out.toString(); | |
| 67 | } |
|
67 | } | |
| 68 |
|
68 | |||
| 69 | public static String readAll(final InputStream src, String charset) throws IOException { |
|
69 | public static String readAll(final InputStream src, String charset) throws IOException { | |
| 70 | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|
70 | ByteArrayOutputStream out = new ByteArrayOutputStream(); | |
| 71 | src.transferTo(out); |
|
71 | src.transferTo(out); | |
| 72 | return out.toString(charset); |
|
72 | return out.toString(charset); | |
| 73 | } |
|
73 | } | |
| 74 |
|
74 | |||
| 75 | public static JsonGenerator createDefaultJsonGenerator() { |
|
75 | public static JsonGenerator createDefaultJsonGenerator() { | |
| 76 | return new JsonGenerator.Options() |
|
76 | return new JsonGenerator.Options() | |
| 77 | .excludeNulls() |
|
77 | .excludeNulls() | |
| 78 | .addConverter(new Converter() { |
|
78 | .addConverter(new Converter() { | |
| 79 | public boolean handles(Class<?> type) { |
|
79 | public boolean handles(Class<?> type) { | |
| 80 | return (File.class == type); |
|
80 | return (File.class == type); | |
| 81 | } |
|
81 | } | |
| 82 |
|
82 | |||
| 83 | public Object convert(Object value, String key) { |
|
83 | public Object convert(Object value, String key) { | |
| 84 | return ((File) value).getPath(); |
|
84 | return ((File) value).getPath(); | |
| 85 | } |
|
85 | } | |
| 86 | }) |
|
86 | }) | |
| 87 | .build(); |
|
87 | .build(); | |
| 88 | } |
|
88 | } | |
| 89 |
|
89 | |||
| 90 | public static void closeSilent(Closeable handle) { |
|
90 | public static void closeSilent(Closeable handle) { | |
| 91 | try { |
|
91 | try { | |
| 92 | handle.close(); |
|
92 | handle.close(); | |
| 93 | } catch (Exception e) { |
|
93 | } catch (Exception e) { | |
| 94 | // silence! |
|
94 | // silence! | |
| 95 | } |
|
95 | } | |
| 96 | } |
|
96 | } | |
| 97 |
|
97 | |||
| 98 | public static String toJsonPretty(Object value) { |
|
98 | public static String toJsonPretty(Object value) { | |
| 99 | return JsonOutput.prettyPrint(createDefaultJsonGenerator().toJson(value)); |
|
99 | return JsonOutput.prettyPrint(createDefaultJsonGenerator().toJson(value)); | |
| 100 | } |
|
100 | } | |
| 101 |
|
101 | |||
| 102 | public static boolean isNullOrEmptyString(String value) { |
|
102 | public static boolean isNullOrEmptyString(String value) { | |
| 103 | return (value == null || value.length() == 0); |
|
103 | return (value == null || value.length() == 0); | |
| 104 | } |
|
104 | } | |
| 105 |
|
105 | |||
| 106 | public static <T> Action<T> wrapClosure(Closure<?> closure) { |
|
106 | public static <T> Action<T> wrapClosure(Closure<?> closure) { | |
| 107 | return x -> { |
|
107 | return x -> { | |
| 108 | closure.setDelegate(x); |
|
108 | closure.setDelegate(x); | |
| 109 | closure.setResolveStrategy(Closure.DELEGATE_FIRST); |
|
109 | closure.setResolveStrategy(Closure.DELEGATE_FIRST); | |
| 110 | closure.call(x); |
|
110 | closure.call(x); | |
| 111 | }; |
|
111 | }; | |
| 112 | } |
|
112 | } | |
| 113 |
|
113 | |||
| 114 | } |
|
114 | } | |
| @@ -1,84 +1,84 | |||||
| 1 | package org.implab.gradle.mercurial.tasks; |
|
1 | package org.implab.gradle.mercurial.tasks; | |
| 2 |
|
2 | |||
| 3 | import java.io.IOException; |
|
3 | import java.io.IOException; | |
| 4 | import java.util.ArrayList; |
|
4 | import java.util.ArrayList; | |
| 5 | import java.util.List; |
|
5 | import java.util.List; | |
| 6 |
|
6 | |||
| 7 | import javax.inject.Inject; |
|
7 | import javax.inject.Inject; | |
| 8 |
|
8 | |||
| 9 | import org.gradle.api.DefaultTask; |
|
9 | import org.gradle.api.DefaultTask; | |
| 10 | import org.gradle.api.model.ObjectFactory; |
|
10 | import org.gradle.api.model.ObjectFactory; | |
| 11 | import org.gradle.api.provider.ListProperty; |
|
11 | import org.gradle.api.provider.ListProperty; | |
| 12 | import org.gradle.api.provider.Property; |
|
12 | import org.gradle.api.provider.Property; | |
| 13 | import org.gradle.api.tasks.Internal; |
|
13 | import org.gradle.api.tasks.Internal; | |
| 14 | import org.gradle.api.tasks.TaskAction; |
|
14 | import org.gradle.api.tasks.TaskAction; | |
| 15 | import org.implab.gradle.Utils; |
|
|||
| 16 | import org.implab.gradle.mercurial.MercurialExtension; |
|
15 | import org.implab.gradle.mercurial.MercurialExtension; | |
|
|
16 | import org.implab.gradle.mercurial.Utils; | |||
| 17 |
|
17 | |||
| 18 | public class HgBookmark extends DefaultTask { |
|
18 | public class HgBookmark extends DefaultTask { | |
| 19 |
|
19 | |||
| 20 | private final Property<String> cliCmd; |
|
20 | private final Property<String> cliCmd; | |
| 21 |
|
21 | |||
| 22 | private final Property<Boolean> inactive; |
|
22 | private final Property<Boolean> inactive; | |
| 23 |
|
23 | |||
| 24 | private final Property<Boolean> force; |
|
24 | private final Property<Boolean> force; | |
| 25 |
|
25 | |||
| 26 | private final ListProperty<String> bookmarks; |
|
26 | private final ListProperty<String> bookmarks; | |
| 27 |
|
27 | |||
| 28 | private String commandOutput; |
|
28 | private String commandOutput; | |
| 29 |
|
29 | |||
| 30 | @Internal |
|
30 | @Internal | |
| 31 | protected MercurialExtension getMercurialExtension() { |
|
31 | protected MercurialExtension getMercurialExtension() { | |
| 32 | return getProject().getExtensions().getByType(MercurialExtension.class); |
|
32 | return getProject().getExtensions().getByType(MercurialExtension.class); | |
| 33 | } |
|
33 | } | |
| 34 |
|
34 | |||
| 35 | @Inject |
|
35 | @Inject | |
| 36 | public HgBookmark(ObjectFactory factory) { |
|
36 | public HgBookmark(ObjectFactory factory) { | |
| 37 | cliCmd = factory.property(String.class); |
|
37 | cliCmd = factory.property(String.class); | |
| 38 | inactive = factory.property(Boolean.class); |
|
38 | inactive = factory.property(Boolean.class); | |
| 39 | force = factory.property(Boolean.class); |
|
39 | force = factory.property(Boolean.class); | |
| 40 | bookmarks = factory.listProperty(String.class); |
|
40 | bookmarks = factory.listProperty(String.class); | |
| 41 | cliCmd.convention(getMercurialExtension().getHgCmd()); |
|
41 | cliCmd.convention(getMercurialExtension().getHgCmd()); | |
| 42 |
|
42 | |||
| 43 | onlyIf(t -> !getBookmarks().get().isEmpty()); |
|
43 | onlyIf(t -> !getBookmarks().get().isEmpty()); | |
| 44 | } |
|
44 | } | |
| 45 |
|
45 | |||
| 46 | @Internal |
|
46 | @Internal | |
| 47 | public Property<Boolean> getInactive() { |
|
47 | public Property<Boolean> getInactive() { | |
| 48 | return inactive; |
|
48 | return inactive; | |
| 49 | } |
|
49 | } | |
| 50 |
|
50 | |||
| 51 | @Internal |
|
51 | @Internal | |
| 52 | public Property<Boolean> getForce() { |
|
52 | public Property<Boolean> getForce() { | |
| 53 | return force; |
|
53 | return force; | |
| 54 | } |
|
54 | } | |
| 55 |
|
55 | |||
| 56 | @Internal |
|
56 | @Internal | |
| 57 | public String getCommandOutput() { |
|
57 | public String getCommandOutput() { | |
| 58 | return commandOutput; |
|
58 | return commandOutput; | |
| 59 | } |
|
59 | } | |
| 60 |
|
60 | |||
| 61 | @Internal |
|
61 | @Internal | |
| 62 | public ListProperty<String> getBookmarks() { |
|
62 | public ListProperty<String> getBookmarks() { | |
| 63 | return bookmarks; |
|
63 | return bookmarks; | |
| 64 | } |
|
64 | } | |
| 65 |
|
65 | |||
| 66 | @TaskAction |
|
66 | @TaskAction | |
| 67 | public void Run() throws IOException, InterruptedException, Exception { |
|
67 | public void Run() throws IOException, InterruptedException, Exception { | |
| 68 | List<String> commandLine = new ArrayList<>(); |
|
68 | List<String> commandLine = new ArrayList<>(); | |
| 69 |
|
69 | |||
| 70 | commandLine.add(cliCmd.get()); |
|
70 | commandLine.add(cliCmd.get()); | |
| 71 | commandLine.add("bookmark"); |
|
71 | commandLine.add("bookmark"); | |
| 72 | if(inactive.isPresent()) |
|
72 | if(inactive.isPresent()) | |
| 73 | commandLine.add("-i"); |
|
73 | commandLine.add("-i"); | |
| 74 | if(force.isPresent()) |
|
74 | if(force.isPresent()) | |
| 75 | commandLine.add("-f"); |
|
75 | commandLine.add("-f"); | |
| 76 |
|
76 | |||
| 77 | commandLine.addAll(bookmarks.get()); |
|
77 | commandLine.addAll(bookmarks.get()); | |
| 78 |
|
78 | |||
| 79 | getLogger().info("Starting: {}", commandLine); |
|
79 | getLogger().info("Starting: {}", commandLine); | |
| 80 |
|
80 | |||
| 81 | commandOutput = Utils.execCmd(commandLine, getMercurialExtension().getOutputCharset().name()); |
|
81 | commandOutput = Utils.execCmd(commandLine, getMercurialExtension().getOutputCharset().name()); | |
| 82 | } |
|
82 | } | |
| 83 |
|
83 | |||
| 84 | } |
|
84 | } | |
| @@ -1,76 +1,76 | |||||
| 1 | package org.implab.gradle.mercurial.tasks; |
|
1 | package org.implab.gradle.mercurial.tasks; | |
| 2 |
|
2 | |||
| 3 | import java.io.IOException; |
|
3 | import java.io.IOException; | |
| 4 | import java.util.ArrayList; |
|
4 | import java.util.ArrayList; | |
| 5 | import java.util.List; |
|
5 | import java.util.List; | |
| 6 |
|
6 | |||
| 7 | import javax.inject.Inject; |
|
7 | import javax.inject.Inject; | |
| 8 |
|
8 | |||
| 9 | import org.gradle.api.DefaultTask; |
|
9 | import org.gradle.api.DefaultTask; | |
| 10 | import org.gradle.api.model.ObjectFactory; |
|
10 | import org.gradle.api.model.ObjectFactory; | |
| 11 | import org.gradle.api.provider.ListProperty; |
|
11 | import org.gradle.api.provider.ListProperty; | |
| 12 | import org.gradle.api.provider.Property; |
|
12 | import org.gradle.api.provider.Property; | |
| 13 | import org.gradle.api.tasks.Internal; |
|
13 | import org.gradle.api.tasks.Internal; | |
| 14 | import org.gradle.api.tasks.TaskAction; |
|
14 | import org.gradle.api.tasks.TaskAction; | |
| 15 | import org.implab.gradle.Utils; |
|
|||
| 16 | import org.implab.gradle.mercurial.MercurialExtension; |
|
15 | import org.implab.gradle.mercurial.MercurialExtension; | |
|
|
16 | import org.implab.gradle.mercurial.Utils; | |||
| 17 |
|
17 | |||
| 18 | public class HgTag extends DefaultTask { |
|
18 | public class HgTag extends DefaultTask { | |
| 19 |
|
19 | |||
| 20 | private final Property<String> cliCmd; |
|
20 | private final Property<String> cliCmd; | |
| 21 |
|
21 | |||
| 22 | private final Property<Boolean> force; |
|
22 | private final Property<Boolean> force; | |
| 23 |
|
23 | |||
| 24 | private final ListProperty<String> tags; |
|
24 | private final ListProperty<String> tags; | |
| 25 |
|
25 | |||
| 26 | private String commandOutput; |
|
26 | private String commandOutput; | |
| 27 |
|
27 | |||
| 28 | @Internal |
|
28 | @Internal | |
| 29 | protected MercurialExtension getMercurialExtension() { |
|
29 | protected MercurialExtension getMercurialExtension() { | |
| 30 | return getProject().getExtensions().getByType(MercurialExtension.class); |
|
30 | return getProject().getExtensions().getByType(MercurialExtension.class); | |
| 31 | } |
|
31 | } | |
| 32 |
|
32 | |||
| 33 | @Inject |
|
33 | @Inject | |
| 34 | public HgTag(ObjectFactory factory) { |
|
34 | public HgTag(ObjectFactory factory) { | |
| 35 | cliCmd = factory.property(String.class); |
|
35 | cliCmd = factory.property(String.class); | |
| 36 | force = factory.property(Boolean.class); |
|
36 | force = factory.property(Boolean.class); | |
| 37 | tags = factory.listProperty(String.class); |
|
37 | tags = factory.listProperty(String.class); | |
| 38 | cliCmd.convention(getMercurialExtension().getHgCmd()); |
|
38 | cliCmd.convention(getMercurialExtension().getHgCmd()); | |
| 39 |
|
39 | |||
| 40 | onlyIf(t -> !getTags().get().isEmpty()); |
|
40 | onlyIf(t -> !getTags().get().isEmpty()); | |
| 41 | } |
|
41 | } | |
| 42 |
|
42 | |||
| 43 | @Internal |
|
43 | @Internal | |
| 44 | public Property<Boolean> getForce() { |
|
44 | public Property<Boolean> getForce() { | |
| 45 | return force; |
|
45 | return force; | |
| 46 | } |
|
46 | } | |
| 47 |
|
47 | |||
| 48 | @Internal |
|
48 | @Internal | |
| 49 | public String getCommandOutput() { |
|
49 | public String getCommandOutput() { | |
| 50 | return commandOutput; |
|
50 | return commandOutput; | |
| 51 | } |
|
51 | } | |
| 52 |
|
52 | |||
| 53 | @Internal |
|
53 | @Internal | |
| 54 | public ListProperty<String> getTags() { |
|
54 | public ListProperty<String> getTags() { | |
| 55 | return tags; |
|
55 | return tags; | |
| 56 | } |
|
56 | } | |
| 57 |
|
57 | |||
| 58 | @TaskAction |
|
58 | @TaskAction | |
| 59 | public void Run() throws IOException, InterruptedException, Exception { |
|
59 | public void Run() throws IOException, InterruptedException, Exception { | |
| 60 | List<String> commandLine = new ArrayList<>(); |
|
60 | List<String> commandLine = new ArrayList<>(); | |
| 61 |
|
61 | |||
| 62 | commandLine.add(cliCmd.get()); |
|
62 | commandLine.add(cliCmd.get()); | |
| 63 |
|
63 | |||
| 64 | commandLine.add("tag"); |
|
64 | commandLine.add("tag"); | |
| 65 |
|
65 | |||
| 66 | if(force.isPresent()) |
|
66 | if(force.isPresent()) | |
| 67 | commandLine.add("-f"); |
|
67 | commandLine.add("-f"); | |
| 68 |
|
68 | |||
| 69 | commandLine.addAll(tags.get()); |
|
69 | commandLine.addAll(tags.get()); | |
| 70 |
|
70 | |||
| 71 | getLogger().info("Starting: {}", commandLine); |
|
71 | getLogger().info("Starting: {}", commandLine); | |
| 72 |
|
72 | |||
| 73 | commandOutput = Utils.execCmd(commandLine, getMercurialExtension().getOutputCharset().name()); |
|
73 | commandOutput = Utils.execCmd(commandLine, getMercurialExtension().getOutputCharset().name()); | |
| 74 | } |
|
74 | } | |
| 75 |
|
75 | |||
| 76 | } |
|
76 | } | |
| @@ -1,70 +1,70 | |||||
| 1 | package org.implab.gradle.mercurial.tasks; |
|
1 | package org.implab.gradle.mercurial.tasks; | |
| 2 |
|
2 | |||
| 3 | import java.io.IOException; |
|
3 | import java.io.IOException; | |
| 4 | import java.util.ArrayList; |
|
4 | import java.util.ArrayList; | |
| 5 | import java.util.List; |
|
5 | import java.util.List; | |
| 6 |
|
6 | |||
| 7 | import org.gradle.api.DefaultTask; |
|
7 | import org.gradle.api.DefaultTask; | |
| 8 | import org.gradle.api.provider.Property; |
|
8 | import org.gradle.api.provider.Property; | |
| 9 | import org.gradle.api.provider.Provider; |
|
9 | import org.gradle.api.provider.Provider; | |
| 10 | import org.gradle.api.tasks.Internal; |
|
10 | import org.gradle.api.tasks.Internal; | |
| 11 | import org.gradle.api.tasks.TaskAction; |
|
11 | import org.gradle.api.tasks.TaskAction; | |
| 12 | import org.implab.gradle.Utils; |
|
|||
| 13 | import org.implab.gradle.mercurial.MercurialExtension; |
|
12 | import org.implab.gradle.mercurial.MercurialExtension; | |
|
|
13 | import org.implab.gradle.mercurial.Utils; | |||
| 14 |
|
14 | |||
| 15 | public class HgTask extends DefaultTask { |
|
15 | public class HgTask extends DefaultTask { | |
| 16 |
|
16 | |||
| 17 | private final Property<String> cliCmd; |
|
17 | private final Property<String> cliCmd; | |
| 18 |
|
18 | |||
| 19 | private List<Provider<String>> commandArgs; |
|
19 | private List<Provider<String>> commandArgs; | |
| 20 |
|
20 | |||
| 21 | private String commandOutput; |
|
21 | private String commandOutput; | |
| 22 |
|
22 | |||
| 23 | @Internal |
|
23 | @Internal | |
| 24 | protected MercurialExtension getMercurialExtension() { |
|
24 | protected MercurialExtension getMercurialExtension() { | |
| 25 | return getProject().getExtensions().getByType(MercurialExtension.class); |
|
25 | return getProject().getExtensions().getByType(MercurialExtension.class); | |
| 26 | } |
|
26 | } | |
| 27 |
|
27 | |||
| 28 | public HgTask() { |
|
28 | public HgTask() { | |
| 29 | cliCmd = getProject().getObjects().property(String.class); |
|
29 | cliCmd = getProject().getObjects().property(String.class); | |
| 30 | cliCmd.convention(getMercurialExtension().getHgCmd()); |
|
30 | cliCmd.convention(getMercurialExtension().getHgCmd()); | |
| 31 |
|
31 | |||
| 32 | } |
|
32 | } | |
| 33 |
|
33 | |||
| 34 | @Internal |
|
34 | @Internal | |
| 35 | public String getCommandOutput() { |
|
35 | public String getCommandOutput() { | |
| 36 | return commandOutput; |
|
36 | return commandOutput; | |
| 37 | } |
|
37 | } | |
| 38 |
|
38 | |||
| 39 | public void clearCommandArgs() { |
|
39 | public void clearCommandArgs() { | |
| 40 | commandArgs.clear(); |
|
40 | commandArgs.clear(); | |
| 41 | } |
|
41 | } | |
| 42 |
|
42 | |||
| 43 | public void commandArgs(Object... args) { |
|
43 | public void commandArgs(Object... args) { | |
| 44 | for (Object arg : args) { |
|
44 | for (Object arg : args) { | |
| 45 | if (arg == null) |
|
45 | if (arg == null) | |
| 46 | continue; |
|
46 | continue; | |
| 47 | if (arg instanceof Provider<?>) |
|
47 | if (arg instanceof Provider<?>) | |
| 48 | commandArgs.add(((Provider<?>) arg).map(x -> x.toString())); |
|
48 | commandArgs.add(((Provider<?>) arg).map(x -> x.toString())); | |
| 49 | else |
|
49 | else | |
| 50 | commandArgs.add(getProject().getProviders().provider(() -> arg.toString())); |
|
50 | commandArgs.add(getProject().getProviders().provider(() -> arg.toString())); | |
| 51 | } |
|
51 | } | |
| 52 | } |
|
52 | } | |
| 53 |
|
53 | |||
| 54 | @TaskAction |
|
54 | @TaskAction | |
| 55 | public void Run() throws IOException, InterruptedException, Exception { |
|
55 | public void Run() throws IOException, InterruptedException, Exception { | |
| 56 | List<String> commandLine = new ArrayList<>(); |
|
56 | List<String> commandLine = new ArrayList<>(); | |
| 57 |
|
57 | |||
| 58 | commandLine.add(cliCmd.get()); |
|
58 | commandLine.add(cliCmd.get()); | |
| 59 |
|
59 | |||
| 60 | for (Provider<String> arg : commandArgs) { |
|
60 | for (Provider<String> arg : commandArgs) { | |
| 61 | if (arg.isPresent()) |
|
61 | if (arg.isPresent()) | |
| 62 | commandLine.add(arg.get()); |
|
62 | commandLine.add(arg.get()); | |
| 63 | } |
|
63 | } | |
| 64 |
|
64 | |||
| 65 | getLogger().info("Starting: ", commandLine); |
|
65 | getLogger().info("Starting: ", commandLine); | |
| 66 |
|
66 | |||
| 67 | commandOutput = Utils.execCmd(commandLine, getMercurialExtension().getOutputCharset().name()); |
|
67 | commandOutput = Utils.execCmd(commandLine, getMercurialExtension().getOutputCharset().name()); | |
| 68 | } |
|
68 | } | |
| 69 |
|
69 | |||
| 70 | } |
|
70 | } | |
| @@ -1,120 +1,120 | |||||
| 1 | # Mercurial build integration |
|
1 | # Mercurial build integration | |
| 2 |
|
2 | |||
| 3 | ## SYNOPSIS |
|
3 | ## SYNOPSIS | |
| 4 |
|
4 | |||
| 5 | ```groovy |
|
5 | ```groovy | |
| 6 |
|
6 | |||
| 7 | plugins { |
|
7 | plugins { | |
| 8 |
id 'org.implab.gradle-mercurial' version '1.0. |
|
8 | id 'org.implab.gradle-mercurial' version '1.0.1' // specify the latest version | |
| 9 | } |
|
9 | } | |
| 10 |
|
10 | |||
| 11 | mercurial { |
|
11 | mercurial { | |
| 12 | releaseBookmark = 'prod' |
|
12 | releaseBookmark = 'prod' | |
| 13 |
|
13 | |||
| 14 | preReleasePolicy { it |
|
14 | preReleasePolicy { it | |
| 15 | // this is the default behaviour |
|
15 | // this is the default behaviour | |
| 16 | .addPatch(1) |
|
16 | .addPatch(1) | |
| 17 | .withPreRelease('snapshot') |
|
17 | .withPreRelease('snapshot') | |
| 18 |
.withMeta( |
|
18 | .withMeta(changeset) | |
| 19 | } |
|
19 | } | |
| 20 |
|
20 | |||
| 21 | // get version from repository and apply it to the project |
|
21 | // get version from repository and apply it to the project | |
| 22 | applyVersioningPolicy() |
|
22 | applyVersioningPolicy() | |
| 23 | } |
|
23 | } | |
| 24 |
|
24 | |||
| 25 | ``` |
|
25 | ``` | |
| 26 |
|
26 | |||
| 27 | ## DESCRIPTION |
|
27 | ## DESCRIPTION | |
| 28 |
|
28 | |||
| 29 | ### `semver(versionString)` |
|
29 | ### `semver(versionString)` | |
| 30 |
|
30 | |||
| 31 | Parses the specified version string and returns the semantic version object |
|
31 | Parses the specified version string and returns the semantic version object | |
| 32 |
|
32 | |||
| 33 | ### `mercurial(Closure configure)` |
|
33 | ### `mercurial(Closure configure)` | |
| 34 |
|
34 | |||
| 35 | The extension added by the plugin to the project. Apply this plugin to the |
|
35 | The extension added by the plugin to the project. Apply this plugin to the | |
| 36 | root project and use the `mercurial { ... }` section to configure the |
|
36 | root project and use the `mercurial { ... }` section to configure the | |
| 37 | versioning. |
|
37 | versioning. | |
| 38 |
|
38 | |||
| 39 | See the description below for more details about settings. |
|
39 | See the description below for more details about settings. | |
| 40 |
|
40 | |||
| 41 | #### `hgCmd` |
|
41 | #### `hgCmd` | |
| 42 |
|
42 | |||
| 43 | The command which will be executed to perform the mercurial commands. |
|
43 | The command which will be executed to perform the mercurial commands. | |
| 44 | The default value is `hg`. |
|
44 | The default value is `hg`. | |
| 45 |
|
45 | |||
| 46 | #### `outputCharset` |
|
46 | #### `outputCharset` | |
| 47 |
|
47 | |||
| 48 | The charset for the `hgCmd` output, this property defaults |
|
48 | The charset for the `hgCmd` output, this property defaults | |
| 49 | to the default charset of the operating system. |
|
49 | to the default charset of the operating system. | |
| 50 |
|
50 | |||
| 51 | #### `hg(...args)` |
|
51 | #### `hg(...args)` | |
| 52 |
|
52 | |||
| 53 | Executes the mercurial command, returns the command output as text. |
|
53 | Executes the mercurial command, returns the command output as text. | |
| 54 |
|
54 | |||
| 55 | #### `workspaceInfo` (read-only) |
|
55 | #### `workspaceInfo` (read-only) | |
| 56 |
|
56 | |||
| 57 | Returns the information about current workspace, see description |
|
57 | Returns the information about current workspace, see description | |
| 58 | below for details. |
|
58 | below for details. | |
| 59 |
|
59 | |||
| 60 | #### `workspaceVersion` |
|
60 | #### `workspaceVersion` | |
| 61 |
|
61 | |||
| 62 | Returns the semantic version obtained from the repository. Querying |
|
62 | Returns the semantic version obtained from the repository. Querying | |
| 63 | this property will lead querying the workspace info. |
|
63 | this property will lead querying the workspace info. | |
| 64 |
|
64 | |||
| 65 | #### `applyVersioningPolicy()` |
|
65 | #### `applyVersioningPolicy()` | |
| 66 |
|
66 | |||
| 67 | Reads the workspace information and sets the version of the project |
|
67 | Reads the workspace information and sets the version of the project | |
| 68 | according to settings. |
|
68 | according to settings. | |
| 69 |
|
69 | |||
| 70 | If the version was specified using properties, then the specified |
|
70 | If the version was specified using properties, then the specified | |
| 71 | version will take preceding over the calculated one. |
|
71 | version will take preceding over the calculated one. | |
| 72 |
|
72 | |||
| 73 | #### `preReleasePolicy(Closure<SemVersion> config)` |
|
73 | #### `preReleasePolicy(Closure<SemVersion> config)` | |
| 74 |
|
74 | |||
| 75 | The closure which is used to calculate the version of the project |
|
75 | The closure which is used to calculate the version of the project | |
| 76 | when the current commit isn't marked with a version tag. |
|
76 | when the current commit isn't marked with a version tag. | |
| 77 |
|
77 | |||
| 78 | The default behaviour is to increment the patch version and |
|
78 | The default behaviour is to increment the patch version and | |
| 79 | to set the pre-release suffix to `'snapshot'`. |
|
79 | to set the pre-release suffix to `'snapshot'`. | |
| 80 |
|
80 | |||
| 81 | ### `WorkspaceInfo` |
|
81 | ### `WorkspaceInfo` | |
| 82 |
|
82 | |||
| 83 | This class encapsulates information about the current workspace. |
|
83 | This class encapsulates information about the current workspace. | |
| 84 | All properties are read-only. |
|
84 | All properties are read-only. | |
| 85 |
|
85 | |||
| 86 | #### `versionTag` |
|
86 | #### `versionTag` | |
| 87 |
|
87 | |||
| 88 | The original version tag from the repository before parsing. |
|
88 | The original version tag from the repository before parsing. | |
| 89 |
|
89 | |||
| 90 | #### `changeSet` |
|
90 | #### `changeSet` | |
| 91 |
|
91 | |||
| 92 | The changeset id of the current workspace. |
|
92 | The changeset id of the current workspace. | |
| 93 |
|
93 | |||
| 94 | #### `versionDistance` |
|
94 | #### `versionDistance` | |
| 95 |
|
95 | |||
| 96 | The distance in commits to the versionTag |
|
96 | The distance in commits to the versionTag | |
| 97 |
|
97 | |||
| 98 | #### `branch` |
|
98 | #### `branch` | |
| 99 |
|
99 | |||
| 100 | The name of the current sources branch. |
|
100 | The name of the current sources branch. | |
| 101 |
|
101 | |||
| 102 | #### `isDirty` |
|
102 | #### `isDirty` | |
| 103 |
|
103 | |||
| 104 | This flag indicates uncommited changes to the workspace. This flag is useful |
|
104 | This flag indicates uncommited changes to the workspace. This flag is useful | |
| 105 | to control some pipelines which run locally on developer machines. |
|
105 | to control some pipelines which run locally on developer machines. | |
| 106 |
|
106 | |||
| 107 | ## TASKS |
|
107 | ## TASKS | |
| 108 |
|
108 | |||
| 109 | ### `release` |
|
109 | ### `release` | |
| 110 |
|
110 | |||
| 111 | Marks this commit with current version and pre-release suffix removed and |
|
111 | Marks this commit with current version and pre-release suffix removed and | |
| 112 | moves the `release` bookmark to it. |
|
112 | moves the `release` bookmark to it. | |
| 113 |
|
113 | |||
| 114 | ### `staging` |
|
114 | ### `staging` | |
| 115 |
|
115 | |||
| 116 | Marks this commit with current version and moves the `staging` bookmark to it. |
|
116 | Marks this commit with current version and moves the `staging` bookmark to it. | |
| 117 |
|
117 | |||
| 118 | ### `printVersion` |
|
118 | ### `printVersion` | |
| 119 |
|
119 | |||
| 120 | Prints the current version. |
|
120 | Prints the current version. | |
General Comments 0
You need to be logged in to leave comments.
Login now
