-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change HtmlSanityCheckTask.sourceDocuments to a org.gradle.api.file.F…
…ileCollection to benefit from finding and filtering capabilities of the FileCollection API. (#267) Fixes #264.
- Loading branch information
1 parent
5042576
commit 6dc5e59
Showing
9 changed files
with
65 additions
and
418 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
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
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
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
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 |
---|---|---|
|
@@ -2,11 +2,12 @@ package org.aim42.htmlsanitycheck | |
|
||
import org.aim42.htmlsanitycheck.check.AllCheckers | ||
import org.gradle.api.DefaultTask | ||
|
||
// see end-of-file for license information | ||
import org.gradle.api.GradleException | ||
import org.gradle.api.file.FileCollection | ||
import org.gradle.api.tasks.* | ||
|
||
// see end-of-file for license information | ||
|
||
/** | ||
* Entry class for the gradle-plugin. | ||
* Handles parameter-passing from gradle build scripts, | ||
|
@@ -19,9 +20,8 @@ class HtmlSanityCheckTask extends DefaultTask { | |
|
||
// | ||
// we support checking several named files | ||
@Optional | ||
@Input | ||
Set<String> sourceDocuments | ||
@InputFiles | ||
FileCollection sourceDocuments | ||
|
||
// or all (html) files in a directory | ||
@InputDirectory | ||
|
@@ -99,10 +99,18 @@ class HtmlSanityCheckTask extends DefaultTask { | |
|
||
} | ||
|
||
/** | ||
* entry point for several html sanity checks | ||
* @author Gernot Starke <[email protected]> | ||
*/ | ||
void setSourceDir(File sourceDir) { | ||
this.sourceDir = sourceDir | ||
if (sourceDocuments == null) { | ||
sourceDocuments = project.fileTree(sourceDir) | ||
sourceDocuments.include('**/*.html') | ||
} | ||
} | ||
|
||
/** | ||
* entry point for several html sanity checks | ||
* @author Gernot Starke <[email protected]> | ||
*/ | ||
@TaskAction | ||
public void sanityCheckHtml() { | ||
|
||
|
@@ -131,7 +139,7 @@ class HtmlSanityCheckTask extends DefaultTask { | |
logger.info("allFilesToCheck" + allFilesToCheck.toString(), "") | ||
|
||
// create an AllChecksRunner... | ||
def allChecksRunner = new AllChecksRunner( myConfig ) | ||
def allChecksRunner = new AllChecksRunner(myConfig) | ||
|
||
// ... and perform the actual checks | ||
def allChecks = allChecksRunner.performAllChecks() | ||
|
@@ -166,7 +174,7 @@ See ${checkingResultsDir} for a detailed report.""" | |
Configuration tmpConfig = new Configuration() | ||
|
||
tmpConfig.with { | ||
addConfigurationItem(Configuration.ITEM_NAME_sourceDocuments, sourceDocuments) | ||
addConfigurationItem(Configuration.ITEM_NAME_sourceDocuments, sourceDocuments.files) | ||
addConfigurationItem(Configuration.ITEM_NAME_sourceDir, sourceDir) | ||
addConfigurationItem(Configuration.ITEM_NAME_checkingResultsDir, checkingResultsDir) | ||
addConfigurationItem(Configuration.ITEM_NAME_junitResultsDir, junitResultsDir) | ||
|
Oops, something went wrong.