Skip to content

Commit

Permalink
use puppeteer-based svg rendering in gradle build
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Sep 11, 2020
1 parent a975e5d commit d26e86a
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions build.gradle
Expand Up @@ -4,6 +4,7 @@ import org.apache.tools.ant.filters.*
plugins {
id 'base'
id 'java-library'
id "com.github.node-gradle.node" version "3.0.0-rc2"
}


Expand All @@ -12,6 +13,12 @@ ext.architecture = "linux-x86_64" // TODO make adjustable
ext.toolDir = "$buildDir/tools"
ext.xmlDir = file('data/xml', PathValidation.DIRECTORY)

node {
download = true
workDir = file("$toolDir/node")
}


if (!project.hasProperty('dataDir')) {
def dataDirCandidate = rootProject.file('data/xml')
if (dataDirCandidate.isDirectory())
Expand Down Expand Up @@ -61,6 +68,7 @@ configurations {
exist
}


dependencies {
compile group: 'net.sf.saxon', name: 'Saxon-HE', version: '10.2'
implementation 'org.nanohttpd:nanohttpd-webserver:2.2.0'
Expand Down Expand Up @@ -101,7 +109,8 @@ task copySource(type: CopyWithSymlink) {

task generateSVGs(type: JavaExec) {
description "Generates SVGs of diplomatic transcripts and overlays"
dependsOn installTools
// dependsOn installTools
dependsOn npmInstall
dependsOn classes
dependsOn copyWeb // there are symlinks from svg_rendering/page to build/www. Probably not the best solution.

Expand All @@ -112,11 +121,16 @@ task generateSVGs(type: JavaExec) {
environment 'LC_ALL', 'en_US.UTF-8'
environment 'SLIMERJSLAUNCHER', "$toolDir/firefox/firefox"

def setupTask = tasks.getByName('nodeSetup')
def nodeDir = setupTask.nodeDir.get().file('bin/node').toString()

systemProperties([
'phantomjs.binary': "$toolDir/slimerjs-1.0.0/slimerjs" ,
'node.binary' : "$nodeDir",
'node.script' : "${rootDir}/render-multi-pages.js",
// 'phantomjs.binary': "$toolDir/slimerjs-1.0.0/slimerjs" ,
'faust.diplo.target': buildDir
])
systemProperties(project.properties.findAll {key, value -> key.matches('^faust\\.diplo\\..*')})
])
systemProperties(project.properties.findAll { key, value -> key.matches('^faust\\.diplo\\..*') })

classpath sourceSets.main.runtimeClasspath
main 'net.faustedition.gen.DiplomaticConversion'
Expand Down

0 comments on commit d26e86a

Please sign in to comment.