1
0
Fork 0

[mod] xar
Some checks failed
Run BaseX Tests / test (push) Failing after 24s

This commit is contained in:
Andy Bunce 2025-02-03 14:15:01 +00:00
parent 95b95b848d
commit 96ad5101d9
7 changed files with 62 additions and 11 deletions

View file

@ -40,9 +40,7 @@ jobs:
- name: Build package
run: |
basex scripts/install.bxs
cp dist/pdfbox-3.0.4.fat.jar /usr/local/basex/lib/custom/
echo "PWS" $PWD
ls -l /usr/local/basex/lib/custom
- name: run tests
run: |
basex -Wt src/test

View file

@ -1,2 +1,2 @@
30/1/2025.................
..lgnfjfggfgxhcsxwnndc
..lgnfjfggfgxhcsxwnndcc

View file

@ -26,7 +26,7 @@ return
@remark
:)
declare function build:fatjar-with-lib($input-dir as xs:string,$manifest-jar as xs:string)
{
as xs:base64Binary{
let $bin :=file:read-binary($input-dir || $manifest-jar)
let $lib:=file:list($input-dir || "lib/", false(), "*.jar")!concat("lib/",.)
@ -55,6 +55,32 @@ as xs:base64Binary{
archive:update($jar,$name,$file)
};
declare function build:xar-create($base as xs:string)
as xs:base64Binary{
let $entries:=
build:xar-add(map{},file:resolve-path("jars/",$base),"content/")
=>build:xar-add(file:resolve-path("src/Pdfbox3.xqm",$base),"content/")
=>build:xar-add(file:resolve-path("src/metadata/",$base),"")
return archive:create($entries?name, $entries?content,
map { "format" : "zip", "algorithm" : "deflate" })
};
(:~ zip data for $dir
:)
declare function build:xar-add($map as map(*),$src as xs:string,$xar-dir as xs:string)
as map(*){
let $_:=trace(count($map?name),"size ")
let $names:=if(file:is-dir($src))
then file:children($src)
else $src
return map:merge((
$map,
map{"name":$names!concat($xar-dir,file:name(.)),
"content":$names!file:read-binary( .)}
),
map{"duplicates":"combine"}
)
};
(:~ download $files from $urls to $destdir:)
declare variable $build:REPO as xs:string external :="https://repo1.maven.org/maven2/";
@ -68,7 +94,7 @@ as empty-sequence(){
=>trace("Download: ")))
};
(:~ write-binary but create dir if required :)
(:~ write-binary, creating dir if required :)
declare function build:write-binary($dest as xs:string,$contents)
as empty-sequence(){
file:create-dir(file:parent($dest)),

View file

@ -1,9 +1,8 @@
# run query
XQUERY "make fat jar.."
RUN make-fat-jar.xq
RUN make-xar.xq
XQUERY "Repo install.."
REPO INSTALL dist/pdfbox-3.0.4.fat.jar
REPO INSTALL dist/pdfbox.xar
REPO LIST
XQUERY "add-to-custom.."
RUN add-to-custom.xq
#TEST src/test

8
scripts/make-xar.xq Normal file
View file

@ -0,0 +1,8 @@
import module namespace build = 'urn:quodatum:build1' at 'build.xqm';
declare variable $base:= file:resolve-path("../",static-base-uri())=>trace("base ");
let $xar:=build:xar-create($base)
let $output-file := file:resolve-path("dist/pdfbox.xar",$base)
return (build:write-binary($output-file, $xar),
trace($output-file,"zar: "))

7
src/metadata/basex.xml Normal file
View file

@ -0,0 +1,7 @@
<package xmlns="http://www.basex.org/modules/pkg">
<jar>pdfbox-3.0.4.jar</jar>
<jar>pdfbox-io-3.0.4.jar</jar>
<jar>fontbox-3.0.4.jar</jar>
<jar>commons-logging-1.3.4.jar</jar>
<class>org.apache.pdfbox.pdmodel.PDDocument</class>
</package>

View file

@ -0,0 +1,13 @@
<package xmlns="http://expath.org/ns/pkg"
name="org.expkg_zone58.Pdfbox3"
abbrev="pdfbox"
version="0.1.0"
spec="1.0">
<title>BaseX interface to Pdfbox (https://pdfbox.apache.org/) version 3</title>
<dependency processor="basex" name="value"/>
<xquery>
<namespace>org.expkg_zone58.Pdfbox3</namespace>
<file>Pdfbox3.xqm</file>
</xquery>
</package>