Skip to content

Commit

Permalink
guicify (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo authored Dec 15, 2024
1 parent 5a4d136 commit ad63ac5
Show file tree
Hide file tree
Showing 23 changed files with 201 additions and 9 deletions.
6 changes: 6 additions & 0 deletions maven-scm-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>

<!-- Test -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.scm.ScmBranch;
import org.apache.maven.scm.ScmException;
Expand Down Expand Up @@ -138,12 +137,6 @@ public abstract class AbstractScmMojo extends AbstractMojo {
@Parameter(property = "excludes")
private String excludes;

@Component
private ScmManager manager;

@Component
private SettingsDecrypter settingsDecrypter;

/**
* The base directory.
*/
Expand Down Expand Up @@ -186,6 +179,15 @@ public abstract class AbstractScmMojo extends AbstractMojo {
@Deprecated
private String workItem;

private final ScmManager manager;

private final SettingsDecrypter settingsDecrypter;

protected AbstractScmMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
this.manager = manager;
this.settingsDecrypter = settingsDecrypter;
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
if (systemProperties != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.IOException;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.command.add.AddScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;

/**
* Add a file set to the project.
Expand All @@ -33,6 +37,12 @@
*/
@Mojo(name = "add", aggregator = true)
public class AddMojo extends AbstractScmMojo {

@Inject
public AddMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
super.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.File;

import org.apache.commons.lang3.StringUtils;
Expand All @@ -26,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.scm.ScmResult;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.settings.crypto.SettingsDecrypter;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
Expand All @@ -40,6 +44,7 @@
*/
@Mojo(name = "bootstrap", requiresProject = false)
public class BootstrapMojo extends CheckoutMojo {

/**
* The goals to run on the clean checkout of a project for the bootstrap goal.
* If none are specified, then the default goal for the project is executed.
Expand Down Expand Up @@ -69,6 +74,11 @@ public class BootstrapMojo extends CheckoutMojo {
@Parameter(property = "mavenHome", defaultValue = "${maven.home}")
private File mavenHome;

@Inject
public BootstrapMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
super.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.IOException;

import org.apache.maven.plugin.MojoExecutionException;
Expand All @@ -26,8 +28,10 @@
import org.apache.maven.scm.ScmBranchParameters;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.command.branch.BranchScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;

/**
* Branch the project.
Expand Down Expand Up @@ -68,6 +72,11 @@ public class BranchMojo extends AbstractScmMojo {
@Parameter(property = "pinExternals", defaultValue = "false")
private boolean pinExternals;

@Inject
public BranchMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
super.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
Expand All @@ -33,8 +35,10 @@
import org.apache.maven.scm.command.changelog.ChangeLogScmRequest;
import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
import org.apache.maven.scm.command.changelog.ChangeLogSet;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.provider.ScmProvider;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;

/**
* Dump changelog contents to console. It is mainly used to test maven-scm-api's changelog command.
Expand Down Expand Up @@ -125,6 +129,11 @@ public class ChangeLogMojo extends AbstractScmMojo {
@Parameter(property = "numDays")
private Integer numDays;

@Inject
public ChangeLogMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.IOException;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.command.status.StatusScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;

/**
* This mojo will fail the build if there is any local modifications
Expand All @@ -50,6 +54,11 @@ public class CheckLocalModificationsMojo extends AbstractScmMojo {
@Parameter(property = "scm.checkLocalModification.skip", defaultValue = "false")
private boolean skip;

@Inject
public CheckLocalModificationsMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

public void execute() throws MojoExecutionException {
if (skip) {
getLog().info("check-local-modification execution has been skipped");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.IOException;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.command.checkin.CheckInScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;

/**
* Commit changes to the configured scm url.
Expand Down Expand Up @@ -58,6 +62,11 @@ public class CheckinMojo extends AbstractScmMojo {
@Parameter(property = "scmVersion")
private String scmVersion;

@Inject
public CheckinMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
super.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.File;
import java.io.IOException;

Expand All @@ -27,7 +29,9 @@
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;
import org.codehaus.plexus.util.FileUtils;

/**
Expand Down Expand Up @@ -72,6 +76,11 @@ public class CheckoutMojo extends AbstractScmMojo {
*/
private ScmResult checkoutResult;

@Inject
public CheckoutMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
super.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.File;
import java.io.IOException;

Expand All @@ -26,7 +28,9 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.command.diff.DiffScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;
import org.codehaus.plexus.util.FileUtils;

/**
Expand Down Expand Up @@ -66,6 +70,11 @@ public class DiffMojo extends AbstractScmMojo {
@Parameter(property = "outputFile", defaultValue = "${project.artifactId}.diff")
private File outputFile;

@Inject
public DiffMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
super.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.IOException;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.command.edit.EditScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;

/**
* Edit/lock a set of files.
Expand All @@ -33,6 +37,12 @@
*/
@Mojo(name = "edit", aggregator = true)
public class EditMojo extends AbstractScmMojo {

@Inject
public EditMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
super.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.File;
import java.io.IOException;

Expand All @@ -27,7 +29,9 @@
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.command.export.ExportScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;
import org.codehaus.plexus.util.FileUtils;

/**
Expand Down Expand Up @@ -61,6 +65,11 @@ public class ExportMojo extends AbstractScmMojo {
@Parameter(property = "skipExportIfExists", defaultValue = "false")
private boolean skipExportIfExists = false;

@Inject
public ExportMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
super.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.scm.plugin;

import javax.inject.Inject;

import java.io.IOException;

import org.apache.maven.plugin.MojoExecutionException;
Expand All @@ -26,7 +28,9 @@
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFile;
import org.apache.maven.scm.command.list.ListScmResult;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.repository.ScmRepository;
import org.apache.maven.settings.crypto.SettingsDecrypter;

/**
* Get the list of project files.
Expand All @@ -53,6 +57,11 @@ public class ListMojo extends AbstractScmMojo {
@Parameter(property = "recursive", defaultValue = "true")
private boolean recursive = true;

@Inject
public ListMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) {
super(manager, settingsDecrypter);
}

/** {@inheritDoc} */
public void execute() throws MojoExecutionException {
super.execute();
Expand Down
Loading

0 comments on commit ad63ac5

Please sign in to comment.