Skip to content

Commit

Permalink
Merge pull request #283 from oliva123456/master
Browse files Browse the repository at this point in the history
Fix for #282
  • Loading branch information
gernotstarke authored Apr 14, 2021
2 parents 016662e + e5f450b commit 16dc956
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 21 deletions.
14 changes: 5 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ plugins {
id 'groovy'
id 'java'
id "com.gradle.plugin-publish" version "0.9.10"

// to report build results back to gradle.org
id 'com.gradle.build-scan' version '2.2.1'

}

repositories {
Expand All @@ -29,21 +25,21 @@ repositories {

dependencies {

testCompile(
testImplementation(
'junit:junit:4.12',
'org.spockframework:spock-core:1.2-groovy-2.5')

compile gradleApi()

compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.3'
implementation gradleApi()

implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.3'

// since gradle 4.6, annotation processors shall be explicitly declared
// (instead of just having them in the compile-group)
annotationProcessor 'org.apache.logging.log4j:log4j-core:2.3'


// jsoup is our awesome html parser, see jsoup.org
compile group: 'org.jsoup', name: 'jsoup', version: '1.11.3'
implementation group: 'org.jsoup', name: 'jsoup', version: '1.11.3'


} // dependencies
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
HtmlSanityCheck - ChangeLog

V 1.3.snapshot
Jan 2021: try to fix https://github.com/aim42/htmlSanityCheck/issues/282

V.1.0.0-RC-2
Oct 2018: enhanced configurability, fixed several bugs, released version on gradle plugin portal

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 5 additions & 3 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
rootProject.name = 'htmlSanityCheck'
plugins {
// to report build results back to gradle.org
id "com.gradle.enterprise" version "3.5.1"
}

enableFeaturePreview('STABLE_PUBLISHING')
rootProject.name = 'htmlSanityCheck'

include 'docToolchain'

Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ class HtmlSanityCheckTask extends DefaultTask {

// configurable timeout for http-requests (used by @BrokenHttpLinksChecker)
// defaults to 5000 (msecs)
@Optional
// java primitives must not be marked as @Optional
@Input
int httpConnectionTimeout = 5000

// shall localhost-URLs lead to warnings?
@Optional
// java primitives must not be marked as @Optional
@Input
boolean ignoreLocalHost = false

// shall numerical IP addresses lead to warnings?
@Optional
// java primitives must not be marked as @Optional
@Input
boolean ignoreIPAddresses = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
class HtmlSanityCheckTaskFunctionalTest extends Specification {
private final static VALID_HTML = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head></head><body></body><html>"""
private final static INVALID_HTML = """<body><span id="id"/><span id="id"/></body> """
private final static GRADLE_VERSIONS = ['4.9']
private final static GRADLE_VERSIONS = ['6.8.1']

@Rule
final TemporaryFolder testProjectDir = new TemporaryFolder()
Expand All @@ -26,14 +26,19 @@ class HtmlSanityCheckTaskFunctionalTest extends Specification {
def setup() {
buildDir = testProjectDir.newFolder("build")
htmlFile = testProjectDir.newFile("test.html")
// a note on writing paths to the build script on windows:
// - the default file separator is a backslash
// - as the path is written into a quoted string, backslashes should be quoted
// - to avoid string manipulation or similar, we use URIs to avoid the problem
// (URIs consist of / instead of backslashes)
buildFile = testProjectDir.newFile('build.gradle') << """
plugins {
id 'org.aim42.htmlSanityCheck'
}
htmlSanityCheck {
sourceDir = file( "${htmlFile.parent}" )
checkingResultsDir = file( "${buildDir.absolutePath}" )
sourceDir = file( "${htmlFile.parentFile.toURI().path}" )
checkingResultsDir = file( "${buildDir.toURI().path}" )
}
"""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,11 @@ class MissingLocalResourcesCheckerTest extends GroovyTestCase {
final String fname = "fname.html"
File f2 = new File(d2, fname) << HtmlConst.HTML_HEAD

assertEquals("created an artificial file", "d2/fname.html",
f2.canonicalPath - d1.canonicalPath - "/")
assertEquals("created an artificial file",
// unix: /d2/fname.html
// windows: \d2\fname.html
File.separator + "d2" + File.separator + "fname.html",
f2.canonicalPath - d1.canonicalPath)

assertTrue("newly created artificial file exists", f2.exists())

Expand Down

0 comments on commit 16dc956

Please sign in to comment.