forked from ysb33r/gnumake-gradle-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issues with applying the Doxygen plugin
- Loading branch information
Showing
5 changed files
with
133 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
doxygen/src/main/groovy/org/ysb33r/gradle/doxygen/DoxygenPlugin.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'*/) | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
doxygen/src/main/groovy/org/ysb33r/gradle/doxygen/DoxygenTemplateFiles.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
doxygen/src/test/groovy/org/ysb33r/gradle/doxygen/DoxygenPluginSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
|
||
} | ||
|