Skip to content

Commit

Permalink
Merge pull request #6 from ndeloof/master
Browse files Browse the repository at this point in the history
JENKINS-10025
  • Loading branch information
johnou committed Jun 2, 2013
2 parents ce005a0 + 6d2408b commit 5490108
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/main/java/hudson/ivy/IvyBuildTrigger.java
Expand Up @@ -261,7 +261,7 @@ public Ivy getIvy(File localFilePath, String propertyFile) {
*/
private ModuleDescriptor getModuleDescriptor(AbstractProject p) {
if (moduleDescriptor == null) {
recomputeModuleDescriptor(p.getSomeBuildWithWorkspace());
moduleDescriptor = recomputeModuleDescriptor(p.getSomeBuildWithWorkspace());
}
return moduleDescriptor;
}
Expand Down Expand Up @@ -302,10 +302,10 @@ private boolean copyFileFromWorkspaceIfNecessary(FilePath workspace, String file
*
* @param b a build this trigger belongs to
*/
private void recomputeModuleDescriptor(AbstractBuild<?,?> b) {
private ModuleDescriptor recomputeModuleDescriptor(AbstractBuild<?,?> b) {
// The build may be null if no build with a workspace was found
if (b == null) {
return;
return null;
}
LOGGER.fine("Recomputing Moduledescriptor for Project "+b.getProject().getFullDisplayName());

Expand All @@ -322,8 +322,7 @@ private void recomputeModuleDescriptor(AbstractBuild<?,?> b) {
catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to access the workspace ivy properties file '"+propertyFile+"'", e);
LOGGER.log(Level.WARNING, "Removing ModuleDescriptor");
setModuleDescriptor(null);
return;
return null;
}
catch (InterruptedException e) {
LOGGER.log(Level.WARNING, "Interupted while accessing the workspace ivy properties file '"+propertyFile+"'", e);
Expand All @@ -337,8 +336,7 @@ private void recomputeModuleDescriptor(AbstractBuild<?,?> b) {

Ivy ivy = getIvy(destDir, propertyFileToLoadIntoIvy);
if (ivy == null) {
setModuleDescriptor(null);
return;
return null;
}

versionMatcher = ivy.getSettings().getVersionMatcher();
Expand All @@ -354,8 +352,7 @@ private void recomputeModuleDescriptor(AbstractBuild<?,?> b) {
catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to access the workspace ivy file '"+ivyDesc+"'", e);
LOGGER.log(Level.WARNING, "Removing ModuleDescriptor");
setModuleDescriptor(null);
return;
return null;
}
catch (InterruptedException e) {
LOGGER.log(Level.WARNING, "Interupted while accessing the workspace ivy file '"+ivyDesc+"'", e);
Expand All @@ -368,13 +365,12 @@ private void recomputeModuleDescriptor(AbstractBuild<?,?> b) {
// Calculate ModuleDescriptor from the backup copy
if (fivyF == null || !fivyF.canRead()) {
LOGGER.log(Level.WARNING, "Cannot read ivy file backup...removing ModuleDescriptor");
setModuleDescriptor(null);
return;
return null;
}

if (moduleDescriptor == null || fivyF.lastModified() > lastmodified) {
lastmodified = fivyF.lastModified();
setModuleDescriptor((ModuleDescriptor) ivy.execute(new IvyCallback(){
return (ModuleDescriptor) ivy.execute(new IvyCallback(){
public Object doInIvyContext(Ivy ivy, IvyContext context) {
try {
return ModuleDescriptorParserRegistry.getInstance().parseDescriptor(ivy.getSettings(),
Expand All @@ -390,8 +386,9 @@ public Object doInIvyContext(Ivy ivy, IvyContext context) {
return null;
}
}
}));
});
}
return null;
}

/**
Expand All @@ -418,7 +415,7 @@ private void setModuleDescriptor(ModuleDescriptor d) {
*/
@Override
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
recomputeModuleDescriptor(build);
setModuleDescriptor(recomputeModuleDescriptor(build));
return true;
}

Expand Down

0 comments on commit 5490108

Please sign in to comment.