Skip to content

Commit

Permalink
Merge pull request #5 from kbriggs/bugfix-JENKINS-18154
Browse files Browse the repository at this point in the history
[JENKINS-18154] Use correct HTML output with folderWhereYouRunDoxygen
  • Loading branch information
gboissinot committed May 31, 2013
2 parents e05b4e9 + b5cf9da commit 8a61bf9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/main/java/hudson/plugins/doxygen/DoxygenDirectoryParser.java
Expand Up @@ -136,14 +136,10 @@ public Boolean invoke(File f, VirtualChannel channel) throws IOException, Interr
if (outputHTML == null || outputHTML.trim().length() == 0) {
outputHTML = "html";
LOGGER.log(Level.INFO, "The " + DOXYGEN_KEY_HTML_OUTPUT + " tag is not present or is left blank." + DOXYGEN_DEFAULT_HTML_OUTPUT + " will be used as the default path.");
} else {
// Check if folderWhereYouRunDoxygen is specified, because then the gen dir is calculated relative to it
if ((this.folderWhereYouRunDoxygen != null) && (!this.folderWhereYouRunDoxygen.isEmpty())) {
doxyGenDir = (folderWhereYouRunDoxygen + File.separator + outputHTML);
} else {
doxyGenDir = (doxyGenDir != null) ? (doxyGenDir + File.separator + outputHTML) : outputHTML;
}
}
doxyGenDir = (doxyGenDir != null) ? (doxyGenDir + File.separator + outputHTML) :
(this.folderWhereYouRunDoxygen != null) && (!this.folderWhereYouRunDoxygen.isEmpty()) ?
(this.folderWhereYouRunDoxygen + File.separator + outputHTML) : outputHTML;

final String finalComputedDoxygenDir = doxyGenDir.replace('\\', '/');
Boolean absolute = isDirectoryAbsolute(base, finalComputedDoxygenDir);
Expand Down
38 changes: 38 additions & 0 deletions src/test/java/hudson/plugins/doxygen/DoxygenArchiverTest.java
Expand Up @@ -190,6 +190,44 @@ public void retrieveDoxygenFromLoadFileWithValidInput() throws Exception {
classContext.assertIsSatisfied();
context.assertIsSatisfied();
}


@Test
public void retrieveDoxygenFromLoadFileWithWhereRun() throws Exception {

String whereRun = "testWhereRun";

//Create the doxyfile with content in the temporary workspace
FilePath doxyfileDir = new FilePath(workspace,whereRun);
FilePath doxyfilePath = doxyfileDir.child("Doxyfile");
doxyfileDir.mkdirs();
FileOutputStream fos = new FileOutputStream(new File(doxyfilePath.toURI()));
fos.write(readAsString("Doxyfile").getBytes());
fos.close();

//Create the generated doxygen directory
String commandDoxygenGeneratedDirectoryName="html-out/html";
FilePath doxygenDir=new FilePath(doxyfileDir,commandDoxygenGeneratedDirectoryName);
doxygenDir.mkdirs();


DoxygenDirectoryParser doxygenDirectoryParser =
new DoxygenDirectoryParser(DoxygenArchiverDescriptor.DOXYGEN_DOXYFILE_PUBLISHTYPE ,doxyfilePath.toString(),"",whereRun);

classContext.checking(new Expectations() {
{
ignoring(taskListener).getLogger();
will(returnValue(new PrintStream(new ByteArrayOutputStream())));
}
});

FilePath resultDoxygenDirectory = doxygenDirectoryParser.invoke(parentFile, virtualChannel);
assertEquals("The computed doxygen directory is not correct", doxygenDir.toURI(),resultDoxygenDirectory.toURI());


classContext.assertIsSatisfied();
context.assertIsSatisfied();
}

@Test
public void pathIsRelativeWhenNoParent() throws Exception {
Expand Down

0 comments on commit 8a61bf9

Please sign in to comment.