Skip to content

Commit cb55df8

Browse files
committed
Improvements \o/.
Upgraded dependencies. Changed XPath expressions due to upgrade of Xmlbeam.
1 parent 45ce120 commit cb55df8

File tree

12 files changed

+963
-219
lines changed

12 files changed

+963
-219
lines changed

files/sample-pom-modified.xml

Lines changed: 0 additions & 136 deletions
This file was deleted.

infrastructure.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
io.workDir=~/temp/spring-data-shell
22

3-
git.author=Oliver Gierke <ogierke@gopivotal.com>
3+
git.author=Oliver Gierke <ogierke@pivotal.io>

pom.xml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
<parent>
99
<groupId>org.springframework.boot</groupId>
1010
<artifactId>spring-boot-starter-parent</artifactId>
11-
<version>1.0.2.RELEASE</version>
11+
<version>1.2.4.RELEASE</version>
1212
</parent>
1313

1414
<properties>
15+
<java.version>1.8</java.version>
1516
<jar.mainclass>org.springframework.shell.Bootstrap</jar.mainclass>
1617
</properties>
1718

@@ -26,7 +27,7 @@
2627
<groupId>org.springframework</groupId>
2728
<artifactId>spring-web</artifactId>
2829
</dependency>
29-
30+
3031
<dependency>
3132
<groupId>com.fasterxml.jackson.core</groupId>
3233
<artifactId>jackson-databind</artifactId>
@@ -42,30 +43,29 @@
4243
<artifactId>spring-shell</artifactId>
4344
<version>1.1.0.BUILD-SNAPSHOT</version>
4445
</dependency>
45-
46+
4647
<dependency>
4748
<groupId>org.xmlbeam</groupId>
4849
<artifactId>xmlprojector</artifactId>
49-
<version>1.1.4</version>
50+
<version>1.4.7</version>
5051
</dependency>
51-
52+
5253
<dependency>
5354
<groupId>org.apache.commons</groupId>
5455
<artifactId>commons-exec</artifactId>
55-
<version>1.2</version>
56+
<version>1.3</version>
5657
</dependency>
5758

5859
<dependency>
5960
<groupId>org.projectlombok</groupId>
6061
<artifactId>lombok</artifactId>
61-
<version>1.12.4</version>
62+
<version>1.16.4</version>
6263
<scope>provided</scope>
6364
</dependency>
64-
65+
6566
<dependency>
6667
<groupId>org.springframework.plugin</groupId>
6768
<artifactId>spring-plugin-core</artifactId>
68-
<version>1.0.0.RELEASE</version>
6969
</dependency>
7070

7171
<dependency>
@@ -77,18 +77,8 @@
7777
<build>
7878
<plugins>
7979

80-
<plugin>
81-
<groupId>org.apache.maven.plugins</groupId>
82-
<artifactId>maven-compiler-plugin</artifactId>
83-
<configuration>
84-
<source>1.7</source>
85-
<target>1.7</target>
86-
</configuration>
87-
</plugin>
88-
8980
<!-- Shell packaging -->
9081

91-
9282
<plugin>
9383
<groupId>org.codehaus.mojo</groupId>
9484
<artifactId>appassembler-maven-plugin</artifactId>

src/main/java/org/springframework/data/release/git/GitOperations.java

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
*/
1616
package org.springframework.data.release.git;
1717

18+
import lombok.RequiredArgsConstructor;
19+
1820
import java.io.File;
1921
import java.io.IOException;
2022
import java.util.ArrayList;
2123
import java.util.List;
2224
import java.util.concurrent.Future;
2325

24-
import lombok.RequiredArgsConstructor;
25-
2626
import org.springframework.beans.factory.annotation.Autowired;
2727
import org.springframework.core.env.Environment;
2828
import org.springframework.data.release.io.CommandResult;
@@ -37,6 +37,7 @@
3737
import org.springframework.data.release.model.Project;
3838
import org.springframework.data.release.model.Train;
3939
import org.springframework.data.release.model.TrainIteration;
40+
import org.springframework.data.release.utils.CommandUtils;
4041
import org.springframework.data.release.utils.Logger;
4142
import org.springframework.plugin.core.PluginRegistry;
4243
import org.springframework.stereotype.Component;
@@ -49,7 +50,7 @@
4950
* @author Oliver Gierke
5051
*/
5152
@Component
52-
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
53+
@RequiredArgsConstructor(onConstructor = @__(@Autowired) )
5354
public class GitOperations {
5455

5556
private final GitServer server = new GitServer();
@@ -77,7 +78,8 @@ public void reset(TrainIteration train) throws Exception {
7778

7879
Branch branch = Branch.from(module);
7980

80-
os.executeCommand(String.format("git reset --hard origin/%s", branch), module.getProject()).get();
81+
CommandUtils.getCommandResult(
82+
os.executeCommand(String.format("git reset --hard origin/%s", branch), module.getProject()));
8183
}
8284
}
8385

@@ -100,11 +102,11 @@ public void checkout(TrainIteration iteration) throws Exception {
100102
Tag tag = findTagFor(project, artifactVersion);
101103

102104
if (tag == null) {
103-
throw new IllegalStateException(String.format("No tag found for version %s of project %s, aborting.",
104-
artifactVersion, project));
105+
throw new IllegalStateException(
106+
String.format("No tag found for version %s of project %s, aborting.", artifactVersion, project));
105107
}
106108

107-
os.executeCommand(String.format("git checkout %s", tag), project).get();
109+
CommandUtils.getCommandResult(os.executeCommand(String.format("git checkout %s", tag), project));
108110
}
109111

110112
logger.log(iteration, "Successfully checked out projects.");
@@ -116,10 +118,10 @@ public void prepare(TrainIteration iteration) throws Exception {
116118

117119
Branch branch = Branch.from(module);
118120

119-
update(module.getProject()).get();
121+
CommandUtils.getCommandResult(update(module.getProject()));
120122

121123
String checkoutCommand = String.format("git checkout %s && git pull origin %s", branch, branch);
122-
os.executeCommand(checkoutCommand, module.getProject()).get();
124+
CommandUtils.getCommandResult(os.executeCommand(checkoutCommand, module.getProject()));
123125
}
124126
}
125127

@@ -132,7 +134,7 @@ public void update(Train train) throws Exception {
132134
}
133135

134136
for (Future<CommandResult> execution : executions) {
135-
execution.get();
137+
CommandUtils.getCommandResult(execution);
136138
}
137139
}
138140

@@ -141,14 +143,15 @@ public void push(TrainIteration iteration) throws Exception {
141143
for (ModuleIteration module : iteration) {
142144

143145
Branch branch = Branch.from(module);
144-
os.executeCommand(String.format("git push origin %s", branch), module.getProject()).get();
146+
CommandUtils
147+
.getCommandResult(os.executeCommand(String.format("git push origin %s", branch), module.getProject()));
145148
}
146149
}
147150

148151
public void pushTags(Train train) throws Exception {
149152

150153
for (Module module : train) {
151-
os.executeCommand("git push --tags", module.getProject()).get();
154+
CommandUtils.getCommandResult(os.executeCommand("git push --tags", module.getProject()));
152155
}
153156
}
154157

@@ -198,15 +201,15 @@ public void tagRelease(TrainIteration iteration) throws Exception {
198201
Project project = module.getProject();
199202

200203
String checkoutCommand = String.format("git checkout %s", branch);
201-
os.executeCommand(checkoutCommand, project).get();
204+
CommandUtils.getCommandResult(os.executeCommand(checkoutCommand, project));
202205

203206
String updateCommand = String.format("git pull origin %s", branch);
204-
os.executeCommand(updateCommand, project).get();
207+
CommandUtils.getCommandResult(os.executeCommand(updateCommand, project));
205208

206209
String hash = getReleaseHash(module);
207210
Tag tag = getTags(project).createTag(module);
208211
String tagCommand = String.format("git tag %s %s", tag, hash);
209-
os.executeCommand(tagCommand, project).get();
212+
CommandUtils.getCommandResult(os.executeCommand(tagCommand, project));
210213
}
211214
}
212215

@@ -263,9 +266,9 @@ public void commit(ModuleIteration module, String summary, String details, File.
263266
os.executeCommand(String.format("git add %s", file.getAbsolutePath()), project).get();
264267
}
265268

266-
os.executeCommand(commitCommand, project).get();
269+
CommandUtils.getCommandResult(os.executeCommand(commitCommand, project));
267270
} else {
268-
os.executeCommand(commitCommand.concat(" -a"), project).get();
271+
CommandUtils.getCommandResult(os.executeCommand(commitCommand.concat(" -a"), project));
269272
}
270273
}
271274

@@ -288,8 +291,8 @@ private String getReleaseHash(ModuleIteration module) throws Exception {
288291
}
289292
}
290293

291-
throw new IllegalStateException(String.format("Did not find a release commit for project %s (ticket id %s)",
292-
project, releaseTicket.getId()));
294+
throw new IllegalStateException(
295+
String.format("Did not find a release commit for project %s (ticket id %s)", project, releaseTicket.getId()));
293296
}
294297

295298
/**

src/main/java/org/springframework/data/release/maven/ParentPom.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
*/
2525
public interface ParentPom extends Pom {
2626

27-
@XBWrite("/project/profiles/profile[id=''distribute'']/dependencies/dependency/version")
27+
@XBWrite("/project/profiles/profile[id=\"distribute\"]/dependencies/dependency/version")
2828
void setSharedResourcesVersion(@XBValue ArtifactVersion value);
2929
}

src/main/java/org/springframework/data/release/maven/Pom.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public interface Pom {
4343
@XBWrite("/project/properties/{0}")
4444
void setProperty(String property, @XBValue ArtifactVersion value);
4545

46-
@XBWrite("/project/repositories/repository[id=''{0}'']/id")
46+
@XBWrite("/project/repositories/repository[id=\"{0}\"]/id")
4747
void setRepositoryId(String oldId, @XBValue String newId);
4848

49-
@XBWrite("/project/repositories/repository[id=''{0}'']/url")
49+
@XBWrite("/project/repositories/repository[id=\"{0}\"]/url")
5050
void setRepositoryUrl(String id, @XBValue String url);
5151

5252
/**

0 commit comments

Comments
 (0)