Files
artloglaby/fetch_dependencies.sh
philippe lhardy 7bef98a33a update zstd-jnilib to latest
and provide in fetch_dependencies information of latest

Signed-off-by: philippe lhardy <philippe.lhardy@astrolabe.coop>
2025-11-02 20:21:31 +01:00

119 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# SPDX-FileCopyrightText: 2025 artlog@l0g.eu
# SPDX-License-Identifier: AGPL-3.0-or-later
# header generated by lib/metascript.sh header
# metascript_version=v1.0.0
toolsdir=lib
pushd $toolsdir >/dev/null
toolsdir=$(pwd)
source metascript.sh
popd >/dev/null
usage() {
cat <<EOF
$0 use_jackson|use_zstd|use_artgraphic
EOF
}
fetch_jackson_databind()
{
lib_jackson_databind=jackson-databind-${libversion_jackson_databind}.jar
if [[ ! -e libs/$lib_jackson_databind ]]
then
jacksonmaven=https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/${libversion_jackson_databind}/$lib_jackson_databind
$defer pushd libs
$metarun wget $jacksonmaven
$defer popd
fi
}
fetch_zstd-jni()
{
# echo "compiled from https://github.com/luben/zstd-jni commit 54d3d50c16d96bd8a30e2d4c0a9648001a52d6f9"
# had to hack through jar generation ...
# cp ~/artisanlogiciel/ext_projects/java/zstd-jni/target/zstd-jni-1.5.2-2.jar .
maven_repo=https://repo1.maven.org/maven2/
package_path=com/github/luben/zstd-jni/
# https://repo1.maven.org/maven2/maven-metadata.xml
latest=$(curl -s ${maven_repo}${package_path}maven-metadata.xml | xmllint --xpath 'string(metadata/versioning/latest)' -)
log_info "latest version : $latest"
zstdjni=$(xmllint --xpath 'string(/project/property[@name="zstd-jnilib"]/@value)' build.xml)
if [[ -n $zstdjni ]]
then
$defer pushd libs
libversion_zstdjni=${zstdjni/zstd-jni-}
$metarun curl ${maven_repo}${package_path}${libversion_zstdjni}/${zstdjni}.jar -o ${zstdjni}.jar
$defer popd
else
log_error 'no /project/property[@name="zstd-jnilib"]/@value) found in build.xml'
fi
}
# HARDCODED START
libversion_jackson_databind=2.12.0
sharedrawweb_git_url="https://framagit.org/artlog/sharedrawweb.git"
libversion_artgaphic=0.2.0
# HARDCODED END
lib_artgaphic=artgaphics-${libversion_artgaphic}.jar
metarun=metarun
# change default to sudo if needed
# metasudo=sudo
while [[ $# > 0 ]]
do
case "$1" in
use_jackson)
use_jackson=$1
;;
use_zstd)
use_zstd=$1
;;
use_artgraphic)
use_artgraphic=$1
;;
*)
parsemetaarg "$1"
;;
esac
shift
done
if [[ ! -d libs ]]
then
$metarun mkdir libs
fi
if [[ -n $user_artgraphic ]]
then
if [[ ! -d sharedrawweb ]]
then
log_error "expected a sharedrawweb project parent ( for exports ). Please clone related project."
log_info "git clone $sharedrawweb_git_url sharedrawweb"
fi
if [[ ! -e libs/$lib_artgaphic ]]
then
lib_artgaphic_source_file=sharedrawweb/dist/lib/$lib_artgaphic
if [[ -f $lib_artgaphic_source_file ]]
then
# ../ since libs is one level below current project
$metarun ln -s ../$lib_artgaphic_source_file libs/
else
log_error "Missing $lib_artgaphic_source_file"
log_info "It is required to build sharedrawweb project first"
fi
fi
fi
if [[ -n $use_jackson ]]
then
fetch_jackson_databind
fi
if [[ -n $use_zstd ]]
then
fetch_zstd-jni
fi