Skip to content

Commit

Permalink
set version in clean goal - allows for reading version in csproj file…
Browse files Browse the repository at this point in the history
… from target directory
  • Loading branch information
jschwarz-eitco-de committed Jun 14, 2024
1 parent 2ff7c60 commit 69a56d5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/main/java/de/eitco/cicd/dotnet/AbstractDotnetMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ protected DotnetExecutor newExecutor(boolean ignoreResult) {
workingDirectory,
dotnetExecutable,
targetDirectory,
projectVersion,
getLog(),
ignoreResult
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/eitco/cicd/dotnet/BuildMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public class BuildMojo extends AbstractDotnetMojo {
@Override
public void execute() throws MojoExecutionException {

newExecutor().build(projectVersion, assemblyVersion, vendor, configurationName);
newExecutor().build(assemblyVersion, vendor, configurationName);
}
}
3 changes: 1 addition & 2 deletions src/main/java/de/eitco/cicd/dotnet/CleanMojo.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package de.eitco.cicd.dotnet;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;

@Mojo(name = "clean", defaultPhase = LifecyclePhase.CLEAN)
public class CleanMojo extends AbstractDotnetMojo {

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
public void execute() throws MojoExecutionException {

newExecutor().clean();
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/de/eitco/cicd/dotnet/DotnetExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public record DotnetExecutor(
File workingDirectory,
File executable,
File targetDirectory,
Log log,
String version, Log log,
boolean ignoreResult
) {

Expand Down Expand Up @@ -126,7 +126,7 @@ private void retry(int times, List<String> parameters) throws MojoExecutionExcep
execute(defaultOptions(), parameters, Set.of());
}

public void build(String version, String assemblyVersion, String vendor, String configuration) throws MojoExecutionException {
public void build(String assemblyVersion, String vendor, String configuration) throws MojoExecutionException {

List<String> parameters = new ArrayList<>(List.of("build", "-p:Version=" + version));

Expand All @@ -145,7 +145,7 @@ public void build(String version, String assemblyVersion, String vendor, String
retry(1, parameters);
}

public void pack(String version, String vendor, String description, String repositoryUrl) throws MojoExecutionException {
public void pack(String vendor, String description, String repositoryUrl) throws MojoExecutionException {

List<String> parameters = new ArrayList<>(List.of(
"pack",
Expand Down Expand Up @@ -235,6 +235,6 @@ private static void appendCredentials(String username, String apiToken, List<Str

public void clean() throws MojoExecutionException {

execute("clean");
execute("clean", "-p:Version=" + version);
}
}
2 changes: 1 addition & 1 deletion src/main/java/de/eitco/cicd/dotnet/PackMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public class PackMojo extends AbstractDotnetMojo {
@Override
public void execute() throws MojoExecutionException {

newExecutor().pack(projectVersion, vendor, description, repositoryUrl);
newExecutor().pack(vendor, description, repositoryUrl);
}
}

0 comments on commit 69a56d5

Please sign in to comment.