Skip to content

Commit

Permalink
Fixed issues with applying the Doxygen plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ysb33r committed Jun 2, 2014
1 parent dafbfaa commit 2283f53
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 26 deletions.
31 changes: 5 additions & 26 deletions doxygen/src/main/groovy/org/ysb33r/gradle/doxygen/Doxygen.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,17 @@ class Doxygen extends SourceTask {
/** Set some default values in the doxyUpdate
*
*/
@groovy.transform.PackageScope
void setDefaults() {

if (imagePaths.size()) {
doxyUpdate.setProperty('IMAGE_PATH', imagePaths as File[])
}

if(source.files.empty) {
source 'src/main/cpp','src/main/headers','src/main/asm','src/main/objectiveC','src/main/objectiveCpp','src/main/c'
}

doxyUpdate.setProperty('INPUT', source)
doxyUpdate.setProperty('OUTPUT_DIRECTORY', outputDir)

Expand Down Expand Up @@ -258,31 +263,5 @@ class Doxygen extends SourceTask {
}
}

/*
1) Use doxygen to generate a template configuration file:
doxygen [-s] -g [configName]
If - is used for configName doxygen will write to standard output.
2) Use doxygen to update an old configuration file:
doxygen [-s] -u [configName]
3) Use doxygen to generate documentation using an existing configuration file:
doxygen [configName]

If - is used for configName doxygen will read from standard input.
4) Use doxygen to generate a template file controlling the layout of the
generated documentation:
doxygen -l layoutFileName.xml
5) Use doxygen to generate a template style sheet file for RTF, HTML or Latex.
RTF: doxygen -w rtf styleSheetFile
HTML: doxygen -w html headerFile footerFile styleSheetFile [configFile]
LaTeX: doxygen -w latex headerFile footerFile styleSheetFile [configFile]
6) Use doxygen to generate an rtf extensions file
RTF: doxygen -e rtf extensionsFile
*/

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ============================================================================
// (C) Copyright Schalk W. Cronje 2014
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
package org.ysb33r.gradle.doxygen

import org.gradle.api.Plugin
import org.gradle.api.Project

/**
* Created by schalkc on 29/05/2014.
*/
class DoxygenPlugin implements Plugin<Project> {
void apply(Project project) {
project.apply(plugin: 'base')
project.task('doxygen', type: Doxygen, group: 'Documentation')
project.task('createDoxygenTemplates', type: DoxygenTemplateFiles/*, group: 'Documentation'*/)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// ============================================================================
// (C) Copyright Schalk W. Cronje 2014
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================
package org.ysb33r.gradle.doxygen

import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
import org.gradle.process.ExecResult

/**
* Allows for the creation of template files in a location. 'src/doxygen' is the default.
*/
class DoxygenTemplateFiles extends DefaultTask {

/** Location where to generate files into. By default this will be src/doxygen.
*
*/
@Input
File location = new File(project.projectDir,'src/doxygen')

/** Prefix used for naming files. By default it is the name of the project.
*
*/
@Input
String prefix = project.name

/** Location of doxygen executable. By default the search path will be used to find it.
*
*/
@Input
String doxygen = 'doxygen'

@TaskAction
void exec() {
runDoxygen '-l', new File(location,prefix+'LayoutTemplate.xml').absolutePath
runDoxygen '-w', 'rtf', new File(location,prefix+'Style.rtf').absolutePath
runDoxygen '-w', 'html', new File(location,prefix+'Header.html').absolutePath,
new File(location,prefix+'Footer.html').absolutePath,
new File(location,prefix+'.css').absolutePath
runDoxygen '-w', 'latex', new File(location,prefix+'Header.tex').absolutePath,
new File(location,prefix+'Footer.tex').absolutePath,
new File(location,prefix+'Style.tex').absolutePath
runDoxygen '-e', 'rtf', new File(location,prefix+'Extensions.rtf').absolutePath
}

/** Runs the Doxygen executable
*
* @param cmdargs
*/
private void runDoxygen(String... cmdargs) {

cmdargs.add(doxyfile.absolutePath)
ExecResult execResult = project.exec {

executable doxygen
args cmdargs
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// ============================================================================
// (C) Copyright Schalk W. Cronje 2014
//
// This software is licensed under the Apache License 2.0
// See http://www.apache.org/licenses/LICENSE-2.0 for license details
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
//
// ============================================================================

package org.ysb33r.gradle.doxygen

import org.gradle.api.Project
import org.gradle.testfixtures.ProjectBuilder

class DoxygenPluginSpec extends spock.lang.Specification {

Project project = ProjectBuilder.builder().build()

void setup() {
project.apply plugin:'doxygen'
}

def "Can apply Doxygen plugin to project"() {

expect:
project.tasks.doxygen != null
project.tasks.createDoxygenTemplates != null
}

}

0 comments on commit 2283f53

Please sign in to comment.