Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
98d4238
Merge pull request #5 from transpect/saxon10
mkraetke Oct 5, 2023
d101e2d
Merge pull request #6 from transpect/saxon10
mkraetke Oct 5, 2023
99d1327
remove discontinued epubcheck-extension
mkraetke Oct 6, 2023
98896ef
update distro
mkraetke Oct 13, 2023
fc354cd
update mathtype extension
mkraetke Oct 13, 2023
206de02
update epubcheck extension
mkraetke Jan 9, 2024
ded8f24
update mathtype-extension
mkraetke Jan 9, 2024
6c78c56
sync a bit with https://www.w3.org/TR/xproc/schemas/xproc.rng and htt…
gimsieke Feb 13, 2024
9fb5853
downgrade 1.5.7 => 1.4.1
mkraetke Feb 17, 2024
41ee1dc
fix typo (1.5.)
gimsieke Feb 17, 2024
bb403bc
change xmlresolver revision to 5.2.2
mkraetke Apr 3, 2024
87b7469
sync with svn mirror
gimsieke Jan 26, 2025
ac27893
sync with svn mirror
gimsieke Jan 26, 2025
d8b2b9f
sync with svn mirror
gimsieke Jan 26, 2025
a8e23da
add saxon pe front-end script
gimsieke Feb 7, 2025
9377543
also try to use saxon10pe.jar that resides in projectdir/calabash/sax…
gimsieke Feb 16, 2025
e2ee2bc
update calabash to 1.5.7-120
mkraetke Apr 23, 2025
6251651
rollback to calabash 1.4.1-100
mkraetke Apr 23, 2025
8d8889c
build script to automatically create new calabash/saxon distributions
mkraetke Apr 23, 2025
8943e70
usage function
mkraetke Apr 23, 2025
6745c8a
preserve LF for sh files on Windows
mkraetke Apr 23, 2025
076c1d8
update to most recent commit
gimsieke Jun 25, 2025
a7af34d
switch some to master
gimsieke Jun 25, 2025
9ea7b4d
make saxon.sh compatible with MacOS readlink
gimsieke Jun 25, 2025
3f329a2
JAVA_VERSION: support version output format of version 9+
pglatza Jul 24, 2025
7899c82
JAVA_VERSION: shrink / support version 9+ output format
pglatza Jul 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
5 changes: 0 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[submodule "calabash-distro"]
path = distro
url = https://github.com/transpect/calabash-distro
branch = saxon10
[submodule "extensions/transpect/unzip-extension"]
path = extensions/transpect/unzip-extension
url = https://github.com/transpect/unzip-extension
Expand All @@ -17,13 +16,9 @@
[submodule "extensions/transpect/image-transform-extension"]
path = extensions/transpect/image-transform-extension
url = https://github.com/transpect/image-transform-extension
[submodule "extensions/transpect/epubcheck-extension"]
path = extensions/transpect/epubcheck-extension
url = https://github.com/transpect/epubcheck-extension
[submodule "extensions/transpect/mathtype-extension"]
path = extensions/transpect/mathtype-extension
url = https://github.com/transpect/mathtype-extension
branch = saxon10
[submodule "extensions/transpect/svn-extension"]
path = extensions/transpect/svn-extension
url = https://github.com/transpect/svn-extension
Expand Down
130 changes: 130 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
MAKEFILEDIR = $(dir $(realpath $(lastword $(MAKEFILE_LIST))))

ifeq ($(shell uname -o),Cygwin)
win_path = $(shell cygpath -ma "$(1)")
uri = $(shell echo file:///$(call win_path,$(1)) | sed -r 's/ /%20/g')
else
win_path = $(shell readlink -m "$(1)")
uri = $(shell echo file:$(abspath $(1)) | sed -r 's/ /%20/g')
endif

# Override these variables by declaring them before you include this Makefile from your project’s Makefile.
JAVAC ?= javac
# Since this Makefile will be included, the . directory will be your transpect project directory:
TR_PROJ ?= .
BUILD_DIR ?= $(TR_PROJ)/build
# All non-jar files in these directories (relative to the parent directory, i.e., the transpect project dir)
# will be copied to the build directory. Overwrite in your Makefile.
DIRS ?= calabash a9s cascade conf htmlreports schema schematron xmlcatalog xpl xproc-util xsl xslt-util
MAIN_CLASS ?= MyWrapper
WRAPPER_DIR ?= $(TR_PROJ)/JarWrapper
WRAPPER_TARGET_DIR ?= $(TR_PROJ)/JarWrapper
# Assuming that it is in no package for the time being:
MAIN_CLASS_FILE ?= $(BUILD_DIR)/$(MAIN_CLASS).class
JAR_MANIFEST ?= $(WRAPPER_DIR)/src/Manifest.txt

# These variables pertain to contents of this calabash-frontend repo and should not need be overwritten in your project:
PATCHES_DIR = $(MAKEFILEDIR)/patches/monolithic-jar-builder/java
PATCHED_CLASSES = $(addprefix $(PATCHES_DIR)/,com/xmlcalabash/io/URLDataStore.class)
DISTRO = $(MAKEFILEDIR)/distro
TR_EXT = $(MAKEFILEDIR)/extensions/transpect
# We omit jing-2009111.jar from CALABASH_JARS since a patched jing.jar is contained in RNG_EXTENSION_JARS.
# This one is needed for parsing the command line options of the resulting monolithic Jar:
WRAPPER_JARS = $(MAKEFILEDIR)/lib/commons-cli-1.4.jar
CALABASH_JARS = $(DISTRO)/lib/ant-1.9.4.jar \
$(DISTRO)/lib/ant-launcher-1.9.4.jar \
$(DISTRO)/lib/classindex-3.3.jar \
$(DISTRO)/lib/commons-codec-1.9.jar \
$(DISTRO)/lib/commons-fileupload-1.3.3.jar \
$(DISTRO)/lib/commons-io-2.2.jar \
$(DISTRO)/lib/commons-logging-1.2.jar \
$(DISTRO)/lib/hamcrest-core-1.3.jar \
$(DISTRO)/lib/htmlparser-1.4.jar \
$(DISTRO)/lib/httpclient-4.5.2.jar \
$(DISTRO)/lib/httpcore-4.4.5.jar \
$(DISTRO)/lib/icu4j-49.1.jar \
$(DISTRO)/lib/isorelax-20090621.jar \
$(DISTRO)/lib/javax.servlet-api-3.1.0.jar \
$(DISTRO)/lib/jcl-over-slf4j-1.7.10.jar \
$(DISTRO)/lib/junit-4.12.jar \
$(DISTRO)/lib/log4j-api-2.1.jar \
$(DISTRO)/lib/log4j-core-2.1.jar \
$(DISTRO)/lib/log4j-slf4j-impl-2.1.jar \
$(DISTRO)/lib/msv-core-2013.6.1.jar \
$(DISTRO)/lib/nwalsh-annotations-1.0.0.jar \
$(DISTRO)/lib/org.restlet.ext.fileupload-2.2.2.jar \
$(DISTRO)/lib/org.restlet.ext.slf4j-2.2.2.jar \
$(DISTRO)/lib/org.restlet-2.2.2.jar \
$(DISTRO)/lib/relaxngDatatype-20020414.jar \
$(DISTRO)/lib/slf4j-api-1.7.10.jar \
$(DISTRO)/lib/slf4j-simple-1.7.30.jar \
$(DISTRO)/lib/tagsoup-1.2.1.jar \
$(DISTRO)/lib/xmlresolver-0.14.0.jar \
$(DISTRO)/lib/xsdlib-2013.6.1.jar \
$(DISTRO)/xmlcalabash-1.3.2-100.jar
SAXON_JARS = $(MAKEFILEDIR)/saxon/saxon9he.jar
RNG_EXTENSION_JARS = $(TR_EXT)/rng-extension/jar/ValidateWithRelaxNG.jar \
$(TR_EXT)/rng-extension/lib/jing.jar
UNZIP_EXTENSION_JARS = $(TR_EXT)/unzip-extension/jar/UnZip.jar
# More extensions will go here...

IMAGEIDENTIFY_EXTENSION_JARS = $(TR_EXT)/image-props-extension/jar/ImageIdentify.jar $(TR_EXT)/image-props-extension/lib/xmlgraphics-commons-1.5.jar $(TR_EXT)/image-props-extension/lib/xmpcore-6.0.6.jar $(TR_EXT)/image-props-extension/lib/metadata-extractor-2.14.0.jar $(TR_EXT)/image-props-extension/lib/commons-imaging-1.0-alpha2.jar $(TR_EXT)/image-props-extension/lib/junit-4.12.jar $(TR_EXT)/image-props-extension/lib/hamcrest-core-1.3.jar


#currently you need to use image-props-extension r7125 to run image-identify properly. use the IMAGEIDENITY_EXTENSION_JARS below or debug the on above with the current extension libs
#IMAGEIDENTIFY_EXTENSION_JARS = $(TR_EXT)/image-props-extension/jar/ImageIdentify.jar $(TR_EXT)/image-props-extension/lib/xmlgraphics-commons-1.5.jar $(TR_EXT)/image-props-extension/lib/commons-imaging-1.0-SNAPSHOT.jar

# This variable may be configured again in the including Makefile:
JARS ?= $(WRAPPER_JARS) $(CALABASH_JARS) $(SAXON_JARS) $(RNG_EXTENSION_JARS) $(UNZIP_EXTENSION_JARS) $(IMAGEIDENTIFY_EXTENSION_JARS)

.PHONY: build_jar clean unzip_jars copy_dirs monolithic_jar_patches

usage_jarbuild:
@echo "The purpose of this Makefile is to build a monolithic Jar of your transpect project."
@echo "It is not meant to run your pipelines. A project-specific Makefile may be set up "
@echo "in the containing directory (= transpect project directory) for running your pipelines."
@echo "The main target is 'build_jar'."
@echo "It doesn't clean up before by default; use the 'clean' target for removing intermediate artifacts."
@echo "Include it from the transpect project's Makefile after the first target like this: "
@echo " include calabash/Makefile"
@echo "Some customization (overwriting the JARS, DIRS, and MAIN_CLASS variables, for example) will be inevitable."
@echo "You need to create a source file for the main class in the first place. There is no public example yet."

build_jar: $(BUILD_DIR) unzip_jars monolithic_jar_patches $(MAIN_CLASS_FILE) copy_dirs $(BUILD_DIR)/META-INF/catalog.xml
echo "JARS:" $(JARS);\
echo "DIRS" $(DIRS);\
echo "TRPROJ:" $(TR_PROJ);\
echo "BUILD_DIR:" $(BUILD_DIR);\
echo "WRAPPER_DIR:" $(WRAPPER_DIR);\
echo "JAR_MANIFEST:" $(JAR_MANIFEST);\
echo "WRAPPER_TARGET_DIR:" $(WRAPPER_TARGET_DIR);\
echo "MAIN_CLASS_FILE:" $(MAIN_CLASS_FILE);\
jar cfm $(call win_path,$(WRAPPER_TARGET_DIR)/$(MAIN_CLASS).jar) $(call win_path,$(JAR_MANIFEST)) -C $(call win_path,$(BUILD_DIR)/) .

$(BUILD_DIR):
-mkdir $@

$(BUILD_DIR)/META-INF/catalog.xml: $(MAKEFILEDIR)/xmlcatalog/catalog.forjar.xml
-mkdir $(dir $@)
cp $< $@

$(BUILD_DIR)/%.class: $(WRAPPER_DIR)/src/%.java
# Will be created in no package dir, i.e., immediately in the build directory
$(JAVAC) -cp '$(call win_path,$(BUILD_DIR))' -Xlint:-options -source 1.7 $(call win_path,$<) -d '$(call win_path,$(BUILD_DIR))/' -target 1.7

monolithic_jar_patches: $(PATCHED_CLASSES)
cd $(MAKEFILEDIR)/patches/monolithic-jar-builder/java && find . -name '*.class' -exec cp -u --parents {} $(abspath $(BUILD_DIR)) \;

%.class: %.java
cd $(MAKEFILEDIR)/patches/monolithic-jar-builder/java && $(JAVAC) -cp '$(call win_path,$(BUILD_DIR))' -Xlint:-options -source 1.7 $(call win_path,$<) -target 1.7

unzip_jars: $(JARS)
$(foreach jar,$(JARS),unzip -u -n $(jar) -x META-INF/MANIFEST.MF META-INF/INDEX.LIST META-INF/*.SF -d "$(BUILD_DIR)";)

copy_dirs:
echo $(DIRS) | tr " " "\n" | tar c --exclude=.svn --exclude=.git --exclude='*.jar' -C "$(TR_PROJ)" -T - | tar x -C "$(BUILD_DIR)"

clean:
-rm -r $(BUILD_DIR)/*
find $(MAKEFILEDIR)/patches/monolithic-jar-builder/java -name '*.class' -exec rm {} \;

80 changes: 40 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
# calabash-frontend

Bash and .bat scripts, frequently used extensions, XML catalog for XML Calabash.

You can check out the whole thing using

```
git clone --recursive https://github.com/transpect/calabash-frontend calabash
```

transpect projects usually have their Calabash runtime attached as a submodule or as an svn external. It typically resides in a subdirectory `calabash` of the project. If the project directory is `${pdu}` (in oXygen notation), the Calabash frontend will use an XML catalog `${pdu}/xmlcatalog/catalog.xml` by default. This contains `<nextCatalog>` instructions that read the catalogs of the transpect libraries that the project uses. Catalog resolution is important since the XProc, XSLT, font, … files within the modules will only be addressed by their canonical locations (typically starting with http://transpect.io ).

Attaching this and its submodules as a submodule to a git repo works like this:

```
git submodule add [email protected]:transpect/calabash-frontend.git calabash --recursive
git submodule update --recursive --init
```

If you are using this from an svn-based project, you need to incorporate no less than 5 externals. This is partly because Calabash now is modularized but mainly because we cannot stick `svn:externals` properties to github projects.

The externals are:

```
https://github.com/transpect/calabash-frontend/trunk calabash
https://github.com/transpect/calabash-distro/trunk calabash/distro
https://github.com/transpect/unzip-extension/trunk calabash/extensions/transpect/unzip-extension
https://github.com/transpect/rng-extension/trunk calabash/extensions/transpect/rng-extension
https://github.com/transpect/image-props-extension/trunk calabash/extensions/transpect/image-props-extension
```

You can add more externals under `calabash/extensions` if you need other Calabash extensions, or just put them anywhere you like. In each case, make sure to add the corresponding classpaths to the CLASSPATH environment variable (currently for the `calabash/calabash.sh` invocation only). If the extensions use the new Calabash 1.1 annotation/introspection mechanism, they should be instantly available.

There is a `calabash/calabash.bat` invocation for Windows. Users of Linux, MacOS X or Cygwin should use `calabash/calabash.sh`. Apart from the `$CLASSPATH`, the latter accepts `DEBUG` and `HEAP` as environment variables. Example:

```
HEAP=512m DEBUG=yes calabash/calabash.sh calabash/extensions/transpect/image-props-extension/image-identify-example.xpl
```

Please look at the comments in calabash.sh for a relatively easy, externals-based way to enable commercial versions of Saxon. You need to have a suitable Saxon license file though.
# calabash-frontend
Bash and .bat scripts, frequently used extensions, XML catalog for XML Calabash.
You can check out the whole thing using
```
git clone --recursive https://github.com/transpect/calabash-frontend calabash
```
transpect projects usually have their Calabash runtime attached as a submodule or as an svn external. It typically resides in a subdirectory `calabash` of the project. If the project directory is `${pdu}` (in oXygen notation), the Calabash frontend will use an XML catalog `${pdu}/xmlcatalog/catalog.xml` by default. This contains `<nextCatalog>` instructions that read the catalogs of the transpect libraries that the project uses. Catalog resolution is important since the XProc, XSLT, font, … files within the modules will only be addressed by their canonical locations (typically starting with `http//transpect.io`).
Attaching this and its submodules as a submodule to a git repo works like this:
```
git submodule add [email protected]:transpect/calabash-frontend.git calabash --recursive
git submodule update --recursive --init
```
If you are using this from an svn-based project, you need to incorporate no less than 5 externals. This is partly because Calabash now is modularized but mainly because we cannot stick `svn:externals` properties to github projects.
The externals are:
```
https://github.com/transpect/calabash-frontend/trunk calabash
https://github.com/transpect/calabash-distro/trunk calabash/distro
https://github.com/transpect/unzip-extension/trunk calabash/extensions/transpect/unzip-extension
https://github.com/transpect/rng-extension/trunk calabash/extensions/transpect/rng-extension
https://github.com/transpect/image-props-extension/trunk calabash/extensions/transpect/image-props-extension
```
You can add more externals under `calabash/extensions` if you need other Calabash extensions, or just put them anywhere you like. In each case, make sure to add the corresponding classpaths to the CLASSPATH environment variable (currently for the `calabash/calabash.sh` invocation only). If the extensions use the new Calabash 1.1 annotation/introspection mechanism, they should be instantly available.
There is a `calabash/calabash.bat` invocation for Windows. Users of Linux, MacOS X or Cygwin should use `calabash/calabash.sh`. Apart from the `$CLASSPATH`, the latter accepts `DEBUG` and `HEAP` as environment variables. Example:
```
HEAP=512m DEBUG=yes calabash/calabash.sh calabash/extensions/transpect/image-props-extension/image-identify-example.xpl
```
Please look at the comments in calabash.sh for a relatively easy, externals-based way to enable commercial versions of Saxon. You need to have a suitable Saxon license file though.
118 changes: 118 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#!/bin/bash

function usage {
echo "XML Calabash/Saxon distribution build script"
echo
echo "Please set the XML Calabash and Saxon version as argument, e.g."
echo "$ ./build.sh 1.5.7-120 12.5"
exit -1
}

CALABASH_VERSION=$1
SAXON_VERSION="${2//./-}"
CALABASH_RELEASE_URL=https://github.com/ndw/xmlcalabash1/releases/download
SAXON_HE_RELEASE_URL=https://github.com/Saxonica/Saxon-HE/releases/download
SAXON_PE_RELEASE_URL=https://downloads.saxonica.com/SaxonJ/PE/${2//.*/}
BUILD_DIR_NAME=build
CALABASH_TARGET=$BUILD_DIR_NAME/calabash-frontend
CALABASH_DISTRO_ZIP=$BUILD_DIR_NAME/tmp/xmlcalabash-$CALABASH_VERSION.zip
SAXON_HE_ZIP=$BUILD_DIR_NAME/tmp/SaxonHE${SAXON_VERSION}J.zip
SAXON_PE_ZIP=$BUILD_DIR_NAME/tmp/SaxonPE${SAXON_VERSION}J.zip
BRANCH_NAME=calabash-${CALABASH_VERSION}_saxon-${SAXON_VERSION}

if [ -z "$1" ]; then
usage
fi
if [ -z "$2" ]; then
usage
fi

umask 0002

echo "[info] create dirs and clone calabash-frontend"

rm -rf $BUILD_DIR_NAME

mkdir -p $BUILD_DIR_NAME/tmp

echo "[info] download XML Calabash $CALABASH_VERSION and Saxon $SAXON_VERSION"

wget -O $CALABASH_DISTRO_ZIP ${CALABASH_RELEASE_URL}/${CALABASH_VERSION}/xmlcalabash-${CALABASH_VERSION}.zip

wget -O $SAXON_HE_ZIP ${SAXON_HE_RELEASE_URL}/SaxonHE$SAXON_VERSION/SaxonHE${SAXON_VERSION}J.zip

wget -O $SAXON_PE_ZIP ${SAXON_PE_RELEASE_URL}/SaxonPE${SAXON_VERSION}J.zip

git clone --recursive [email protected]:transpect/calabash-frontend.git $CALABASH_TARGET

cd $CALABASH_TARGET && git config core.fileMode false && git config core.autocrlf true

cd ../../

echo "[info] update calabash to $CALABASH_VERSION"

cd $CALABASH_TARGET/distro

git checkout master && git pull

git rm -r xmlcalabash-*.jar xpl schemas lib

git checkout -b $BRANCH_NAME

cd ../../../

echo "[info] unzip new files"

unzip -j $CALABASH_DISTRO_ZIP xmlcalabash-$CALABASH_VERSION/xmlcalabash-$CALABASH_VERSION.jar -d $CALABASH_TARGET/distro/
for dir in xpl schemas lib; do \
unzip -j $CALABASH_DISTRO_ZIP xmlcalabash-$CALABASH_VERSION/$dir/* -d $CALABASH_TARGET/distro/$dir
done
unzip -j $SAXON_HE_ZIP saxon-he-$2.jar -d $CALABASH_TARGET/saxon
unzip -j $SAXON_PE_ZIP saxon-pe-$2.jar -d $CALABASH_TARGET/saxon

# enter distro dir

cd $CALABASH_TARGET/distro && git add xmlcalabash-$CALABASH_VERSION.jar xpl schemas lib

echo "[info] commit new release $CALABASH_VERSION"
echo

git status

read -p "[PROMPT] Commit and push the new distribution (or proceed with nothing to commit)? [y/n]. If asked for password, please enter your GitHub personal access token (https://github.com/settings/tokens)" -n 1 -r
echo

if [[ $REPLY =~ ^[Yy]$ ]]
then
git commit -m "[info] update to version $CALABASH_VERSION"
git push -u origin $BRANCH_NAME
else
echo "[ERROR] commit aborted. Please check the working copy in $CALABASH_TARGET/distro"
exit 1
fi

# enter calabash-frontend

cd ../

git checkout -b $BRANCH_NAME

git add distro

git add saxon

git status

read -p "[PROMPT] Commit and push the new frontend (or proceed with nothing to commit)? [y/n]." -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
ls -l
git commit -m "update calabash to $CALABASH_VERSION / saxon to $SAXON_VERSION"
git push -u origin $BRANCH_NAME
else
echo "[ERROR] commit aborted. Please check the working copy in $CALABASH_TARGET"
exit 1
fi


2 changes: 1 addition & 1 deletion calabash.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
set svnext=%extensions%transpect/svn-extension
@set jaf=%scriptdir%/lib/javax.activation.jar
@set config="%scriptdir%extensions/transpect/transpect-config.xml"
@set distrolibs=%distro%lib/;%distro%lib/xmlresolver-5.2.1.jar;%distro%lib/xmlresolver-5.2.1-data.jar;%distro%lib/commons-fileupload-1.4.jar;%distro%lib/classindex-3.3.jar;%distro%lib/htmlparser-1.4.jar;%mailext%;%distro%xmlcalabash-1.5.7-100.jar;%distro%lib/slf4j-simple-1.7.36.jar;%distro%lib/slf4j-api-1.7.36.jar
@set distrolibs=%distro%lib/;%distro%lib/xmlresolver-5.2.2.jar;%distro%lib/xmlresolver-5.2.2-data.jar;%distro%lib/commons-fileupload-1.5.jar;%distro%lib/classindex-3.3.jar;%distro%lib/htmlparser-1.4.jar;%mailext%;%distro%xmlcalabash-1.4.1-100.jar;%distro%lib/slf4j-simple-1.7.36.jar;%distro%lib/slf4j-api-1.7.36.jar;%distro%lib/commons-io-2.14.0.jar

@set classpath=%adaptationsdir%common/saxon/;%projectdir%saxon/saxon10ee.jar;%projectdir%saxon/saxon10pe.jar;%projectdir%saxon/saxon10he.jar;%scriptdir%saxon/saxon10he.jar;%distrolibs%;%rngvalidext%;%extensions%transpect/;%javascriptext%;%epubckeckext%;%imagetransformext%;%imagepropsext%;%unzipext%;%mathtypeext%;%svnext%;%jaf%

Expand Down
Loading