use of org.apache.maven.scm.ScmTag in project plugin-compat-tester by jenkinsci.
the class AbstractMultiParentHook method action.
public Map<String, Object> action(Map<String, Object> moreInfo) throws Exception {
PluginCompatTesterConfig config = (PluginCompatTesterConfig) moreInfo.get("config");
UpdateSite.Plugin currentPlugin = (UpdateSite.Plugin) moreInfo.get("plugin");
// We should not execute the hook if using localCheckoutDir
boolean shouldExecuteHook = config.getLocalCheckoutDir() == null || !config.getLocalCheckoutDir().exists();
if (shouldExecuteHook) {
System.out.println("Executing Hook for " + getParentProjectName());
// Determine if we need to run the download; only run for first identified plugin in the series
if (firstRun) {
System.out.println("Preparing for Multimodule checkout");
// Checkout to the parent directory. All other processes will be on the child directory
File parentPath = new File(config.workDirectory.getAbsolutePath() + "/" + getParentFolder());
System.out.println("Checking out from SCM connection URL: " + getParentUrl() + " (" + getParentProjectName() + "-" + currentPlugin.version + ")");
ScmManager scmManager = SCMManagerFactory.getInstance().createScmManager();
ScmRepository repository = scmManager.makeScmRepository(getParentUrl());
CheckOutScmResult result = scmManager.checkOut(repository, new ScmFileSet(parentPath), new ScmTag(getParentProjectName() + "-" + currentPlugin.version));
if (!result.isSuccess()) {
// Throw an exception if there are any download errors.
throw new RuntimeException(result.getProviderMessage() + "||" + result.getCommandOutput());
}
}
// Checkout already happened, don't run through again
moreInfo.put("runCheckout", false);
firstRun = false;
// Change the "download"" directory; after download, it's simply used for reference
File childPath = new File(config.workDirectory.getAbsolutePath() + "/" + getParentFolder() + "/" + getPluginFolderName(currentPlugin));
System.out.println("Child path for " + currentPlugin.getDisplayName() + " " + childPath);
moreInfo.put("checkoutDir", childPath);
moreInfo.put("pluginDir", childPath);
}
return moreInfo;
}
use of org.apache.maven.scm.ScmTag in project maven-plugins by apache.
the class SvnInfoCommandExpanded method createTagCommandLine.
// set scope to protected to allow test to call it directly
protected static Commandline createTagCommandLine(final SvnScmProviderRepository repository, final ScmFileSet fileSet, final String tag, final boolean recursive, final String revision) {
Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(fileSet.getBasedir(), repository);
cl.createArg().setValue("info");
if (recursive) {
cl.createArg().setValue("--recursive");
}
if (StringUtils.isNotEmpty(revision)) {
cl.createArg().setValue("-r");
cl.createArg().setValue(revision);
}
Iterator<File> it = fileSet.getFileList().iterator();
if (!it.hasNext()) {
String tagUrl = SvnTagBranchUtils.resolveTagUrl(repository, new ScmTag(tag));
cl.createArg().setValue(SvnCommandUtils.fixUrl(tagUrl, repository.getUser()));
} else {
while (it.hasNext()) {
File file = it.next();
if (repository == null) {
cl.createArg().setValue(file.getPath());
} else {
// Note: this currently assumes you have the tag base checked out too
String tagUrl = SvnTagBranchUtils.resolveTagUrl(repository, new ScmTag(tag)) + "/" + file.getPath().replace('\\', '/');
cl.createArg().setValue(SvnCommandUtils.fixUrl(tagUrl, repository.getUser()));
}
}
}
return cl;
}
Aggregations