Merge pull request 'Get rid of the annoying log message “done”' (#495) from remove-annoying-log-message into main
This commit is contained in:
commit
6e6a5ce191
2 changed files with 56 additions and 2 deletions
55
build.gradle
55
build.gradle
|
@ -42,6 +42,10 @@ allprojects {
|
|||
|
||||
version = distVersion()
|
||||
|
||||
configurations {
|
||||
lessCss
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.commonmark:commonmark:0.24.0'
|
||||
implementation 'org.commonmark:commonmark-ext-autolink:0.24.0'
|
||||
|
@ -50,7 +54,7 @@ dependencies {
|
|||
implementation 'org.jsoup:jsoup:1.18.3'
|
||||
implementation 'rome:rome:1.0'
|
||||
|
||||
implementation('org.lesscss:lesscss:1.7.0.1.1') {
|
||||
lessCss('org.lesscss:lesscss:1.7.0.1.1') {
|
||||
exclude group: 'org.mozilla', module: 'rhino'
|
||||
exclude group: 'org.slf4j', module: 'slf4j-api'
|
||||
exclude group: 'org.slf4j', module: 'slf4j-simple'
|
||||
|
@ -319,3 +323,52 @@ tasks.register('distTar', Tar) {
|
|||
destinationDirectory = file(outputDir)
|
||||
archiveFileName = outputFile
|
||||
}
|
||||
|
||||
// Task to patch the lesscss JAR file
|
||||
// This task modifies the lessc-rhino-1.7.0.js file in the JAR to comment out an annoying console.log statement (“done”)
|
||||
def patchLessCssJar = tasks.register('patchLessCssJar') {
|
||||
def name = 'lesscss-1.7.0.1.1'
|
||||
def targetFile = 'META-INF/lessc-rhino-1.7.0.js' // File to patch
|
||||
def tempDir = file("${buildDir}/${name}") // Temporary directory for extraction
|
||||
def patchedJar = file("${buildDir}/${name}-patched.jar") // Output patched JAR
|
||||
|
||||
outputs.file patchedJar
|
||||
|
||||
doLast {
|
||||
if (tempDir.exists()) {
|
||||
tempDir.deleteDir()
|
||||
}
|
||||
tempDir.mkdirs()
|
||||
|
||||
def jarFile = configurations.lessCss.find {
|
||||
it.name.contains(name)
|
||||
}
|
||||
|
||||
println "Patching $jarFile…"
|
||||
ant.unzip(src: jarFile, dest: tempDir)
|
||||
|
||||
def targetFilePath = new File(tempDir, targetFile)
|
||||
def content = targetFilePath.text
|
||||
content = content.replace('console.log("done")', '// console.log("done")')
|
||||
targetFilePath.text = content
|
||||
|
||||
ant.zip(destfile: patchedJar) {
|
||||
fileset(dir: tempDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the patchLessCssJar task runs before the classes task
|
||||
tasks.named('build').configure {
|
||||
dependsOn patchLessCssJar
|
||||
}
|
||||
|
||||
// Exclude the original lesscss JAR from the runtime classpath
|
||||
// and include the patched JAR instead
|
||||
configurations.runtimeClasspath {
|
||||
exclude group: 'org.lesscss', module: 'lesscss'
|
||||
|
||||
dependencies {
|
||||
runtimeOnly(patchLessCssJar.map { it.outputs.files })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,8 @@ String.ELLIPSIS = '…';
|
|||
|
||||
app.addRepository(app.dir + '/../lib/jdom-1.0.jar');
|
||||
app.addRepository(app.dir + '/../lib/jsoup-1.18.3.jar');
|
||||
app.addRepository(app.dir + '/../lib/lesscss-1.7.0.1.1.jar');
|
||||
// See the patchLessCssJar task in build.gradle
|
||||
app.addRepository(app.dir + '/../lib/lesscss-1.7.0.1.1-patched.jar');
|
||||
app.addRepository(app.dir + '/../lib/rome-1.0.jar');
|
||||
|
||||
app.addRepository('modules/core/Global.js');
|
||||
|
|
Loading…
Add table
Reference in a new issue