Skip to content

Commit

Permalink
Merge pull request #16 from ndeloof/master
Browse files Browse the repository at this point in the history
JENKINS-14247
  • Loading branch information
Vlatombe committed Dec 7, 2012
2 parents 35996f3 + 3cc8793 commit c7adb78
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 27 deletions.
8 changes: 3 additions & 5 deletions pom.xml
@@ -1,9 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jvnet.hudson.plugins</groupId>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.392</version>
<version>1.424</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -62,13 +62,11 @@
<build>
<plugins>
<plugin>
<groupId>org.jvnet.hudson.tools</groupId>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<version>1.53</version>
<extensions>true</extensions>
<configuration>
<compatibleSinceVersion>1.0</compatibleSinceVersion>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
Expand Down
Expand Up @@ -295,7 +295,7 @@ public String[] getBranchNames(){
* @throws InterruptedException
* @throws IOException
*/
public String[] getViewPaths(VariableResolver<String> variableResolver, AbstractBuild build, Launcher launcher) throws IOException, InterruptedException {
public String[] getViewPaths(VariableResolver<String> variableResolver, AbstractBuild build, Launcher launcher) throws IOException, InterruptedException {
return getViewPaths(variableResolver, build, launcher, false);
}

Expand Down Expand Up @@ -573,7 +573,7 @@ public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspa
// Calculate revision state from the beginning, it will enable to reuse load rules
build.addAction(calcRevisionsFromBuild(build, launcher, listener));

// Create actions
// Create actions
CheckoutAction checkoutAction = createCheckOutAction(variableResolver, clearToolLauncher, build);
SaveChangeLogAction saveChangeLogAction = createSaveChangeLogAction(clearToolLauncher);
build.addAction(new ClearCaseDataAction());
Expand Down Expand Up @@ -735,7 +735,8 @@ protected Date getBuildTime(Run<?, ?> lastBuild) {
* @return a clear tool launcher that uses Hudson for launching commands
*/
public ClearToolLauncher createClearToolLauncher(TaskListener listener, FilePath workspace, Launcher launcher) {
return new HudsonClearToolLauncher(PluginImpl.BASE_DESCRIPTOR.getCleartoolExe(), getDescriptor().getDisplayName(), listener, workspace, launcher);
String cleartoolExe = PluginImpl.BASE_DESCRIPTOR.getCleartoolExe(launcher.getComputer().getNode(), listener);
return new HudsonClearToolLauncher(cleartoolExe, getDescriptor().getDisplayName(), listener, workspace, launcher);
}

protected ClearTool createClearTool(VariableResolver<String> variableResolver, ClearToolLauncher launcher) {
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/hudson/plugins/clearcase/ClearCaseInstallation.java
Expand Up @@ -77,9 +77,17 @@ public ClearCaseInstallation forNode(Node node, TaskListener log) throws IOExcep
return new ClearCaseInstallation(translateFor(node, log));
}

public String getCleartoolExe(Node node, TaskListener listener) throws IOException, InterruptedException {
public String getCleartoolExe(Node node, TaskListener listener) {
ClearCaseInstallation installation = this;
installation = installation.forNode(node, listener);
try {
installation = installation.forNode(node, listener);
} catch (InterruptedException e) {
listener.getLogger().println("Failed to resolve node's ClearCase installation path : " + e.getMessage());
throw new RuntimeException("\"Failed to resolve node's ClearCase installation", e);
} catch (IOException e) {
listener.getLogger().println("Failed to resolve node's ClearCase installation path : " + e.getMessage());
throw new RuntimeException("\"Failed to resolve node's ClearCase installation", e);
}
if (StringUtils.isNotBlank(installation.getHome())) {
// If an installation is specified, use it
return PathUtil.convertPathForOS(installation.getHome() + "/" + CLEARTOOL_EXE, node.createLauncher(listener).decorateFor(node).isUnix());
Expand Down
15 changes: 2 additions & 13 deletions src/main/java/hudson/plugins/clearcase/ClearCaseSCM.java
Expand Up @@ -119,7 +119,7 @@ public ClearCaseSCM(String branch, String label, boolean extractConfigSpec, Stri
this.doNotUpdateConfigSpec = doNotUpdateConfigSpec;
this.useTimeRule = useTimeRule;
}


public ClearCaseSCM(String branch, String label, String configspec, String viewTag, boolean useupdate, String loadRules, boolean usedynamicview, String viewdrive, String mkviewoptionalparam,
boolean filterOutDestroySubBranchEvent, boolean doNotUpdateConfigSpec, boolean rmviewonrename) {
this(branch, label, false, null, false, null, configspec, viewTag, useupdate, false, loadRules, false, null, usedynamicview, viewdrive, mkviewoptionalparam, filterOutDestroySubBranchEvent,
Expand Down Expand Up @@ -411,9 +411,6 @@ public static class ClearCaseScmDescriptor extends SCMDescriptor<ClearCaseSCM> i
private String defaultWinDynStorageDir;
private String defaultUnixDynStorageDir;

@CopyOnWrite
private volatile ClearCaseInstallation[] installations = new ClearCaseInstallation[0];

public ClearCaseScmDescriptor() {
super(ClearCaseSCM.class, null);
load();
Expand All @@ -433,7 +430,7 @@ public String getCleartoolExe() {
return cleartoolExe;
}

public String getCleartoolExe(Node node, TaskListener listener) throws IOException, InterruptedException {
public String getCleartoolExe(Node node, TaskListener listener) {
return Hudson.getInstance().getDescriptorByType(ClearCaseInstallation.DescriptorImpl.class).getInstallation().getCleartoolExe(node, listener);
}

Expand Down Expand Up @@ -619,14 +616,6 @@ public void doListViews(StaplerRequest req, StaplerResponse rsp) throws IOExcept
baos.writeTo(rsp.getOutputStream());
}

public ClearCaseInstallation[] getInstallations() {
return this.installations;
}

public void setInstallations(ClearCaseInstallation[] installations) {
this.installations = installations;
save();
}
}

@Override
Expand Down
Expand Up @@ -274,7 +274,7 @@ protected SaveChangeLogAction createSaveChangeLogAction(ClearToolLauncher launch
return new UcmSaveChangeLogAction();
}

public ClearTool createClearTool(AbstractBuild<?, ?> build, Launcher launcher) {
public ClearTool createClearTool(AbstractBuild<?, ?> build, Launcher launcher) throws IOException, InterruptedException {
BuildVariableResolver variableResolver = new BuildVariableResolver(build);
ClearToolLauncher clearToolLauncher = createClearToolLauncher(launcher.getListener(), build.getWorkspace(), launcher);
return createClearTool(variableResolver, clearToolLauncher);
Expand Down
Expand Up @@ -396,8 +396,6 @@ private void demoteBaseline(ClearTool clearTool, String baselineName)
/**
* Retrieve the read/write component list with PVOB
*
* @param clearToolLauncher
* @param filePath
* @return the read/write component like 'DeskCore@\P_ORC DeskShared@\P_ORC build_Product@\P_ORC'
* @throws IOException
* @throws InterruptedException
Expand All @@ -424,7 +422,6 @@ private List<String> getReadWriteComponent(ClearTool clearTool, String viewTag)
/**
* Get the component binding to the baseline
*
* @param clearToolLauncher
* @param baselineName the baseline name like 'deskCore_3.2-146_2008-11-14_18-07-22.3543@\P_ORC'
* @return the component name like 'Desk_Core@\P_ORC'
* @throws InterruptedException
Expand Down

0 comments on commit c7adb78

Please sign in to comment.