Skip to content

Commit

Permalink
[MPIR-446] Update to Maven SCM 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o committed Nov 17, 2023
1 parent 91a065b commit 4d94edc
Show file tree
Hide file tree
Showing 22 changed files with 7 additions and 426 deletions.
35 changes: 1 addition & 34 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ under the License.
<doxiaVersion>1.11.1</doxiaVersion>
<doxiaSitetoolsVersion>1.11.1</doxiaSitetoolsVersion>
<mavenVersion>3.2.5</mavenVersion>
<scmVersion>1.13.0</scmVersion>
<scmVersion>2.0.1</scmVersion>
<aetherVersion>1.0.0.v20140518</aetherVersion>
<sitePluginVersion>3.12.1</sitePluginVersion>
<fluidoSkinVersion>1.11.1</fluidoSkinVersion>
Expand Down Expand Up @@ -236,28 +236,12 @@ under the License.
<artifactId>maven-scm-manager-plexus</artifactId>
<version>${scmVersion}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-hg</artifactId>
<version>${scmVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-perforce</artifactId>
<version>${scmVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-starteam</artifactId>
<version>${scmVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-svn-commons</artifactId>
Expand All @@ -269,23 +253,6 @@ under the License.
<version>${scmVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-cvs-commons</artifactId>
<version>${scmVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-cvsexe</artifactId>
<version>${scmVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-cvsjava</artifactId>
<version>${scmVersion}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-git-commons</artifactId>
Expand Down
194 changes: 4 additions & 190 deletions src/main/java/org/apache/maven/report/projectinfo/ScmReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.scm.manager.ScmManager;
import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository;
import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
import org.apache.maven.scm.provider.hg.repository.HgScmProviderRepository;
import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
import org.apache.maven.scm.provider.starteam.repository.StarteamScmProviderRepository;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.repository.ScmRepository;
import org.codehaus.plexus.i18n.I18N;
Expand Down Expand Up @@ -260,30 +257,14 @@ protected void renderBody() {
private void renderOverviewSection(ScmRepository anonymousRepository, ScmRepository devRepository) {
startSection(getI18nString("overview.title"));

if (isScmSystem(anonymousRepository, "clearcase") || isScmSystem(devRepository, "clearcase")) {
sink.paragraph();
linkPatternedText(getI18nString("clearcase.intro"));
sink.paragraph_();
} else if (isScmSystem(anonymousRepository, "cvs") || isScmSystem(devRepository, "cvs")) {
sink.paragraph();
linkPatternedText(getI18nString("cvs.intro"));
sink.paragraph_();
} else if (isScmSystem(anonymousRepository, "git") || isScmSystem(devRepository, "git")) {
if (isScmSystem(anonymousRepository, "git") || isScmSystem(devRepository, "git")) {
sink.paragraph();
linkPatternedText(getI18nString("git.intro"));
sink.paragraph_();
} else if (isScmSystem(anonymousRepository, "hg") || isScmSystem(devRepository, "hg")) {
sink.paragraph();
linkPatternedText(getI18nString("hg.intro"));
sink.paragraph_();
} else if (isScmSystem(anonymousRepository, "perforce") || isScmSystem(devRepository, "perforce")) {
sink.paragraph();
linkPatternedText(getI18nString("perforce.intro"));
sink.paragraph_();
} else if (isScmSystem(anonymousRepository, "starteam") || isScmSystem(devRepository, "starteam")) {
sink.paragraph();
linkPatternedText(getI18nString("starteam.intro"));
sink.paragraph_();
} else if (isScmSystem(anonymousRepository, "svn") || isScmSystem(devRepository, "svn")) {
sink.paragraph();
linkPatternedText(getI18nString("svn.intro"));
Expand Down Expand Up @@ -323,21 +304,13 @@ private void renderWebAccessSection(String scmUrl) {
* @param anonymousRepository the anonymous repository
*/
private void renderAnonymousAccessSection(ScmRepository anonymousRepository) {
if (isScmSystem(anonymousRepository, "clearcase")
|| isScmSystem(anonymousRepository, "perforce")
|| isScmSystem(anonymousRepository, "starteam")
|| (anonymousConnection == null || anonymousConnection.isEmpty())) {
if (anonymousConnection == null || anonymousConnection.isEmpty()) {
return;
}

startSection(getI18nString("anonymousaccess.title"));

if (anonymousRepository != null && isScmSystem(anonymousRepository, "cvs")) {
CvsScmProviderRepository cvsRepo =
(CvsScmProviderRepository) anonymousRepository.getProviderRepository();

anonymousAccessCVS(cvsRepo);
} else if (anonymousRepository != null && isScmSystem(anonymousRepository, "git")) {
if (anonymousRepository != null && isScmSystem(anonymousRepository, "git")) {
GitScmProviderRepository gitRepo =
(GitScmProviderRepository) anonymousRepository.getProviderRepository();

Expand Down Expand Up @@ -372,30 +345,14 @@ private void renderDeveloperAccessSection(ScmRepository devRepository) {

startSection(getI18nString("devaccess.title"));

if (devRepository != null && isScmSystem(devRepository, "clearcase")) {
developerAccessClearCase();
} else if (devRepository != null && isScmSystem(devRepository, "cvs")) {
CvsScmProviderRepository cvsRepo = (CvsScmProviderRepository) devRepository.getProviderRepository();

developerAccessCVS(cvsRepo);
} else if (devRepository != null && isScmSystem(devRepository, "git")) {
if (devRepository != null && isScmSystem(devRepository, "git")) {
GitScmProviderRepository gitRepo = (GitScmProviderRepository) devRepository.getProviderRepository();

developerAccessGit(gitRepo);
} else if (devRepository != null && isScmSystem(devRepository, "hg")) {
HgScmProviderRepository hgRepo = (HgScmProviderRepository) devRepository.getProviderRepository();

developerAccessMercurial(hgRepo);
} else if (devRepository != null && isScmSystem(devRepository, "perforce")) {
PerforceScmProviderRepository perforceRepo =
(PerforceScmProviderRepository) devRepository.getProviderRepository();

developerAccessPerforce(perforceRepo);
} else if (devRepository != null && isScmSystem(devRepository, "starteam")) {
StarteamScmProviderRepository starteamRepo =
(StarteamScmProviderRepository) devRepository.getProviderRepository();

developerAccessStarteam(starteamRepo);
} else if (devRepository != null && isScmSystem(devRepository, "svn")) {
SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) devRepository.getProviderRepository();

Expand Down Expand Up @@ -423,8 +380,6 @@ private void renderAccessBehindFirewallSection(ScmRepository devRepository) {
paragraph(getI18nString("accessbehindfirewall.svn.intro"));

verbatimText("$ svn checkout " + svnRepo.getUrl() + " " + checkoutDirectoryName);
} else if (devRepository != null && isScmSystem(devRepository, "cvs")) {
linkPatternedText(getI18nString("accessbehindfirewall.cvs.intro"));
} else {
paragraph(getI18nString("accessbehindfirewall.general.intro"));
}
Expand Down Expand Up @@ -453,46 +408,6 @@ private void renderAccessThroughProxySection(ScmRepository anonymousRepository,
}
}

// Clearcase

/**
* Create the documentation to provide an developer access with a <code>Clearcase</code> SCM. For example,
* generate the following command line:
* <p>
* cleartool checkout module
* </p>
*/
private void developerAccessClearCase() {
paragraph(getI18nString("devaccess.clearcase.intro"));

verbatimText("$ cleartool checkout ");
}

// CVS

// CHECKSTYLE_OFF: LineLength
/**
* Create the documentation to provide an anonymous access with a <code>CVS</code> SCM. For example, generate
* the following command line:
* <p>
* cvs -d :pserver:[email protected]:/home/cvspublic login
* </p>
* <p>
* cvs -z3 -d :pserver:[email protected]:/home/cvspublic co maven-plugins/dist
* </p>
*
* @param cvsRepo
* @see <a
* href="https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115">https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115</a>
*/
// CHECKSTYLE_ON: LineLength
private void anonymousAccessCVS(CvsScmProviderRepository cvsRepo) {
paragraph(getI18nString("anonymousaccess.cvs.intro"));

verbatimText("$ cvs -d " + cvsRepo.getCvsRoot() + " login" + LS + "$ cvs -z3 -d " + cvsRepo.getCvsRoot()
+ " co " + cvsRepo.getModule());
}

// Git

private void gitClone(String url) {
Expand Down Expand Up @@ -543,32 +458,6 @@ private void anonymousAccessMercurial(HgScmProviderRepository hgRepo) {
verbatimText("$ hg clone " + hgRepo.getURI());
}

// CHECKSTYLE_OFF: LineLength
/**
* Create the documentation to provide an developer access with a <code>CVS</code> SCM. For example, generate
* the following command line:
* <p>
* cvs -d :pserver:[email protected]:/home/cvs login
* </p>
* <p>
* cvs -z3 -d :ext:[email protected]:/home/cvs co maven-plugins/dist
* </p>
*
* @param cvsRepo
* @see <a
* href="https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115">https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115</a>
*/
// CHECKSTYLE_ON: LineLength
private void developerAccessCVS(CvsScmProviderRepository cvsRepo) {
paragraph(getI18nString("devaccess.cvs.intro"));

// Safety: remove the username if present
String cvsRoot = StringUtils.replace(cvsRepo.getCvsRoot(), cvsRepo.getUser(), "username");

verbatimText(
"$ cvs -d " + cvsRoot + " login" + LS + "$ cvs -z3 -d " + cvsRoot + " co " + cvsRepo.getModule());
}

// Git

/**
Expand Down Expand Up @@ -607,81 +496,6 @@ private void developerAccessMercurial(HgScmProviderRepository hgRepo) {
verbatimText("$ hg clone " + hgRepo.getURI());
}

// Perforce

// CHECKSTYLE_OFF: LineLength
/**
* Create the documentation to provide an developer access with a <code>Perforce</code> SCM. For example,
* generate the following command line:
* <p>
* p4 -H hostname -p port -u username -P password path
* </p>
* <p>
* p4 -H hostname -p port -u username -P password path submit -c changement
* </p>
*
* @param perforceRepo
* @see <a
* href="http://www.perforce.com/perforce/doc.051/manuals/cmdref/index.html">http://www.perforce.com/
* perforce
* /doc.051/manuals/cmdref/index.html</>
*/
// CHECKSTYLE_ON: LineLength
private void developerAccessPerforce(PerforceScmProviderRepository perforceRepo) {
paragraph(getI18nString("devaccess.perforce.intro"));

StringBuilder command = new StringBuilder();
command.append("$ p4");
if (!StringUtils.isEmpty(perforceRepo.getHost())) {
command.append(" -H ").append(perforceRepo.getHost());
}
if (perforceRepo.getPort() > 0) {
command.append(" -p ").append(perforceRepo.getPort());
}
command.append(" -u username");
command.append(" -P password");
command.append(" ");
command.append(perforceRepo.getPath());
command.append(LS);
command.append("$ p4 submit -c \"A comment\"");

verbatimText(command.toString());
}

// Starteam

/**
* Create the documentation to provide an developer access with a <code>Starteam</code> SCM. For example,
* generate the following command line:
* <p>
* stcmd co -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl -is
* </p>
* <p>
* stcmd ci -x -nologo -stop -p myusername:mypassword@myhost:1234/projecturl -f NCI -is
* </p>
*
* @param starteamRepo
*/
private void developerAccessStarteam(StarteamScmProviderRepository starteamRepo) {
paragraph(getI18nString("devaccess.starteam.intro"));

StringBuilder command = new StringBuilder();

// Safety: remove the username/password if present
String fullUrl = StringUtils.replace(starteamRepo.getFullUrl(), starteamRepo.getUser(), "username");
fullUrl = StringUtils.replace(fullUrl, starteamRepo.getPassword(), "password");

command.append("$ stcmd co -x -nologo -stop -p ");
command.append(fullUrl);
command.append(" -is");
command.append(LS);
command.append("$ stcmd ci -x -nologo -stop -p ");
command.append(fullUrl);
command.append(" -f NCI -is");

verbatimText(command.toString());
}

// Subversion

/**
Expand Down
Loading

0 comments on commit 4d94edc

Please sign in to comment.