|
1 |
| -def getGitRef() { |
2 |
| - try { |
3 |
| - def stdout = new ByteArrayOutputStream() |
4 |
| - exec { |
5 |
| - commandLine 'git', 'rev-parse', '--short', 'HEAD' |
6 |
| - standardOutput = stdout |
7 |
| - } |
8 |
| - return stdout.toString().trim() |
9 |
| - } catch (Throwable e) { |
10 |
| - return "unknown" |
11 |
| - } |
12 |
| -} |
13 |
| - |
14 |
| -def parseConfig(String configFile) { |
15 |
| - file(configFile).withReader { |
16 |
| - def prop = new Properties() |
17 |
| - prop.load(it) |
18 |
| - return new ConfigSlurper().parse(prop) |
19 |
| - } |
20 |
| -} |
21 |
| - |
22 |
| -def writePom() { |
23 |
| - return new Action<XmlProvider>() { |
24 |
| - @Override |
25 |
| - void execute(XmlProvider xmlProvider) { |
26 |
| - def node = xmlProvider.asNode() |
| 1 | +def writePom(config) { |
| 2 | + return { xmlProvider -> |
| 3 | + def node = xmlProvider.asNode() |
27 | 4 |
|
28 |
| - node.appendNode("description", config.info.description) |
29 |
| - node.appendNode("inceptionYear", config.info.inceptionYear) |
30 |
| - node.appendNode("packaging", config.packaging) |
31 |
| - new Node(node, "organization") |
32 |
| - .appendNode("name", config.info.organization.name) |
33 |
| - } |
| 5 | + node.appendNode("description", config["info.description"]) |
| 6 | + node.appendNode("inceptionYear", config["info.inceptionYear"]) |
| 7 | + node.appendNode("packaging", config["packaging"]) |
| 8 | + node.appendNode("organisation") |
| 9 | + .appendNode("name", config["info.organization.name"]) |
34 | 10 | }
|
35 | 11 | }
|
36 | 12 |
|
37 | 13 | // Fucking gradle
|
38 | 14 | ext {
|
39 |
| - getGitRef = this.&getGitRef |
40 |
| - parseConfig = this.&parseConfig |
41 | 15 | writePom = this.&writePom
|
42 | 16 | }
|
0 commit comments