Skip to content

Commit

Permalink
Move all Java and most Groovy code to core
Browse files Browse the repository at this point in the history
  • Loading branch information
ascheman committed Oct 11, 2023
1 parent cfec1fd commit fb708b8
Show file tree
Hide file tree
Showing 101 changed files with 47 additions and 37 deletions.
31 changes: 31 additions & 0 deletions htmlSanityCheck-core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repositories {
jcenter()
// mavenCentral()
}

apply plugin: 'java'
apply plugin: 'groovy'

dependencies {

testImplementation(
'junit:junit:4.12',
'org.spockframework:spock-core:1.3-groovy-2.5',
'org.slf4j:slf4j-simple:2.0.7'
)

// implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.1'
implementation "org.slf4j:slf4j-api:2.0.7"

// jsoup is our awesome html parser, see jsoup.org
implementation group: 'org.jsoup', name: 'jsoup', version: '1.16.1'
implementation 'org.codehaus.groovy:groovy-all:2.5.22'
implementation 'org.codehaus.groovy:groovy-dateutil:2.5.22'
}

processResources {
exclude '**/*.png'
inputs.property "version", project.version
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [version: project.version])
println "after processResources config, version= ${project.version}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class Configuration {
* We need at least one html file as input, maybe several
* @param configuration instance
*
* srcDocs needs to be of type {@link org.gradle.api.file.FileCollection}
* srcDocs needs to be of type {@link FileCollection}
* to be Gradle-compliant
*/
Boolean isValid() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.aim42.htmlsanitycheck

import junit.framework.TestCase
import org.aim42.htmlsanitycheck.check.AllCheckers
import org.aim42.htmlsanitycheck.collect.SinglePageResults
import org.junit.Test
Expand Down Expand Up @@ -37,16 +38,16 @@ class AllChecksRunnerTest extends GroovyTestCase {
// title = "hsc"
int expected = AllCheckers.checkerClazzes.size()

assertEquals("expected $expected kinds of checks", expected, pageResults.singleCheckResults.size())
TestCase.assertEquals("expected $expected kinds of checks", expected, pageResults.singleCheckResults.size())

assertEquals("expected 0 items checked", 0, pageResults.nrOfItemsCheckedOnPage())
TestCase.assertEquals("expected 0 items checked", 0, pageResults.nrOfItemsCheckedOnPage())

assertEquals("expected 0 findings", 0, pageResults.nrOfFindingsOnPage())
TestCase.assertEquals("expected 0 findings", 0, pageResults.nrOfFindingsOnPage())

assertEquals("expected hsc title", "hsc", pageResults.pageTitle)
TestCase.assertEquals("expected hsc title", "hsc", pageResults.pageTitle)

String tmpFileName = tmpFile.name
assertEquals("expected $tmpFileName as fileName", tmpFileName, pageResults.pageFileName )
TestCase.assertEquals("expected $tmpFileName as fileName", tmpFileName, pageResults.pageFileName )
}


Expand All @@ -69,9 +70,9 @@ class AllChecksRunnerTest extends GroovyTestCase {
SinglePageResults pageResults = allChecksRunner.performChecksForOneFile( tmpFile )

int expected = AllCheckers.checkerClazzes.size()
assertEquals("expected $expected kinds of checks", expected, pageResults.singleCheckResults.size())
TestCase.assertEquals("expected $expected kinds of checks", expected, pageResults.singleCheckResults.size())

assertEquals("expected 2 findings", 2, pageResults.nrOfFindingsOnPage())
TestCase.assertEquals("expected 2 findings", 2, pageResults.nrOfFindingsOnPage())

}

Expand All @@ -86,7 +87,7 @@ class AllChecksRunnerTest extends GroovyTestCase {
allChecksRunner = new AllChecksRunner(myConfig)
SinglePageResults pageResults = allChecksRunner.performChecksForOneFile(tmpFile)

assertEquals(1, pageResults.singleCheckResults.size())
TestCase.assertEquals(1, pageResults.singleCheckResults.size())
}

}
Expand Down
26 changes: 2 additions & 24 deletions htmlSanityCheck-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,11 @@ dependencies {
'junit:junit:4.12',
'org.spockframework:spock-core:1.3-groovy-2.5')

implementation gradleApi()

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

// 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.17.1'


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

implementation gradleApi()

implementation project(":htmlSanityCheck-core")
} // dependencies


Expand All @@ -55,7 +47,6 @@ ext {

// tag::BuildPlugins[]
apply plugin: 'groovy'
apply plugin: 'java'

apply plugin: 'java-gradle-plugin'

Expand All @@ -82,19 +73,6 @@ task copyResourceImages(type: Copy) {
into processResources.destinationDir
}

processResources {
exclude '**/*.png'
inputs.property "version", project.version
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [version: project.version])
dependsOn copyResourceImages
println "after processResources config, version= ${project.version}"
}

// ========================================================




// ==========================================================
// if you use htmlSanityCheck locally, publish with
// "gradle publishToMavenLocal"
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ plugins {

rootProject.name = 'htmlSanityCheck'

include ':htmlSanityCheck-core',
':htmlSanityCheck-gradle-plugin'
include 'htmlSanityCheck-core',
'htmlSanityCheck-gradle-plugin'
4 changes: 2 additions & 2 deletions src/docs/arc42/chapters/_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ ifndef::imagesdir[:imagesdir: ../images]
:project-repository-docs-link: https://github.com/aim42/htmlSanityCheck/blob/main/src/docs/
:project-repository-docs-edit-link: https://github.com/aim42/htmlSanityCheck/edit/main/src/docs/

:coresourcepath: {projectRootDir}/src/main/groovy/org/aim42
:coretestpath: {projectRootDir}/src/test/groovy/org/aim42
:coresourcepath: {projectRootDir}/htmlSanityCheck-gradle-plugin/src/main/groovy/org/aim42
:coretestpath: {projectRootDir}/htmlSanityCheck-gradle-plugin/src/test/groovy/org/aim42

:asciidoctor-gradle-plugin-url: https://github.com/asciidoctor/asciidoctor-gradle-plugin

Expand Down

0 comments on commit fb708b8

Please sign in to comment.