File: rebuild.sh

package info (click to toggle)
owasp-java-html-sanitizer 20191001.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 2,580 kB
  • sloc: javascript: 39,520; java: 16,303; xml: 561; sh: 120; makefile: 2
file content (34 lines) | stat: -rwxr-xr-x 891 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
set -e

echo Load html-containment.html?rerun into your browser then copy/paste the
echo JSON dump from the bottom into $PWD/canned-data.json

pushd ..
mvn -f aggregate install -DskipTests=true
popd

perl -i.bak -ne '
$found = 1 if m/^var cannedData = /;
print unless $found;' canned-data.js

python -c 'import json
import sys

json_dump = sys.stdin.read()
json_decoder = json.JSONDecoder()
canned_data, _ = json_decoder.raw_decode(json_dump)
print "var cannedData = %s;" % (
    json.dumps(canned_data, sort_keys=True, indent=2)
    .replace(", \n", ",\n"))' \
< canned-data.json \
>> canned-data.js

mvn package

mvn exec:java \
  -Dexec.mainClass=org.owasp.html.empiricism.JsonToSerializedHtmlElementTables

# TODO: Maybe do this via a genrule in the pom.xml
cp target/HtmlElementTablesCanned.java ../src/main/java/org/owasp/html
echo copied generated source to src directory