Skip to content

Commit

Permalink
Merge pull request #21 from RandyLarson/DotnetPackAndVersionUpdate
Browse files Browse the repository at this point in the history
Dotnet pack and version update
  • Loading branch information
kaspersorensen authored Jul 21, 2017
2 parents 939242b + 12be1a9 commit 492a5bd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions plugin/src/main/java/org/eobjects/build/CsProjFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ public void setVersion(String version) {

setVersionPart("VersionPrefix", versionPrefix, "VersionSuffix");
setVersionPart("VersionSuffix", versionSuffix, "VersionPrefix");
// Remove the Version tag if it exists.
setVersionPart("Version", null, null);
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions plugin/src/main/java/org/eobjects/build/DotnetPackMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
final PluginHelper helper = getPluginHelper();
for (File subDirectory : helper.getProjectDirectories()) {
final String output = helper.getNugetPackageDir(subDirectory).getPath();
helper.executeCommand(subDirectory, "dotnet", "pack", "-o", output, "-c", helper.getBuildConfiguration(),
"--version-suffix", version);
helper.executeCommand(subDirectory, "dotnet", "pack", "-o", output, "-c", helper.getBuildConfiguration());

final DotnetProjectFile projectFile = getPluginHelper().getProjectFile(subDirectory);

Expand Down
4 changes: 2 additions & 2 deletions plugin/src/test/java/org/eobjects/build/CsProjFileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void testGetDependencies() {

@Test
public void testGetVersion() {
assertThat(file1_xUnit.getVersion()).isNull();
assertThat(file1_xUnit.getVersion()).isEqualTo("LegacyVersionToBeRemoved");
assertThat(file2_msTest.getVersion()).isNull();
assertThat(file3_webApp.getVersion()).isNotNull().isEqualTo("1.3.1-alpha");
}
Expand Down Expand Up @@ -86,7 +86,7 @@ public void testUpdateVersion() throws Exception {
}
Files.copy(file1_xUnit.getFile().toPath(), testFile.toPath());

assertThat(getVersion(testFile)).isNull();
assertThat(getVersion(testFile)).isEqualTo("LegacyVersionToBeRemoved");

final DotnetProjectFile projectFile = new CsProjFile(testFile, null);
projectFile.setVersion("42.1337.0");
Expand Down
1 change: 1 addition & 0 deletions plugin/src/test/resources/example1-xunit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<Version>LegacyVersionToBeRemoved</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 492a5bd

Please sign in to comment.