Refactor to support dynamic repositories

This commit is contained in:
FriwiDev 2021-11-16 18:43:50 +01:00
parent 88fea496ce
commit d6e4e569a5
6 changed files with 37 additions and 15 deletions

View File

@ -3,7 +3,7 @@ FROM friwidev/jcefdocker:linux-latest AS stage
#Declare build type argument (Release or Debug)
ARG BUILD_TYPE
#Declare architecture argument (386 or amd64)
#Declare architecture argument (arm64, arm/v7, 386 or amd64)
ARG TARGETARCH
#Declare git args

View File

@ -4,7 +4,7 @@ if [ $# -lt 2 ] || [ $# -eq 3 ]
then
echo "Usage: ./compile_linux.sh <architecture> <buildType> [<gitrepo> <gitref>]"
echo ""
echo "architecture: the target architecture to build for. Architectures are either 386 or amd64."
echo "architecture: the target architecture to build for. Architectures are either arm64, arm/v7, 386 or amd64."
echo "buildType: either Release or Debug"
echo "gitrepo: git repository url to clone"
echo "gitref: the git commit id to pull"

View File

@ -1,17 +1,27 @@
#!/bin/bash
set -e
if [ ! $# -eq 2 ]
if [ $# -lt 2 ] || [ $# -eq 3 ]
then
echo "Usage: ./compile_macosx.sh <architecture> <buildType>"
echo "Usage: ./compile_macosx.sh <architecture> <buildType> [<gitrepo> <gitref>]"
echo ""
echo "architecture: the target architecture to build for. Architectures are either amd64 or arm64."
echo "buildType: either Release or Debug"
echo "gitrepo: git repository url to clone"
echo "gitref: the git commit id to pull"
exit 1
fi
TARGETARCH=$1
BUILD_TYPE=$2
if [ $# -lt 4 ]
then
REPO=https://bitbucket.org/chromiumembedded/java-cef.git
REF=master
else
REPO=$3
REF=$4
fi
# Determine architecture
echo "Building for architecture $TARGETARCH"
@ -19,13 +29,14 @@ echo "Building for architecture $TARGETARCH"
if [ ! -f "jcef/README.md" ]; then
echo "Did not find existing files to build - cloning..."
rm -rf jcef
git clone https://bitbucket.org/chromiumembedded/java-cef.git jcef
git clone ${REPO} jcef
cd jcef
git checkout ${REF}
#No CMakeLists patching required on macos, as we do not add any new platforms
else
echo "Found existing files to build"
fi
# Enter the JCEF source code directory.
cd jcef
fi
# Create and enter the `jcef_build` directory.
# The `jcef_build` directory name is required by other JCEF tooling

View File

@ -1,13 +1,21 @@
@echo off
if ("%2"=="") ( ^
echo "Usage: compile_windows.bat <architecture> <buildType>" && ^
echo "Usage: compile_windows.bat <architecture> <buildType> [<gitrepo> <gitref>]" && ^
echo "" && ^
echo "architecture: the target architecture to build for. Architectures are either 386 or amd64." && ^
echo "architecture: the target architecture to build for. Architectures are either arm64, 386 or amd64." && ^
echo "buildType: either Release or Debug" && ^
echo "gitrepo: git repository url to clone" && ^
echo "gitref: the git commit id to pull" && ^
exit 1 ^
)
::Determine repository and ref to pull from
if ("%3"=="") (set "REPO=https://bitbucket.org/chromiumembedded/java-cef.git") ^
else (set "REPO=%3")
if ("%4"=="") (set "REF=master") ^
else (set "REF=%4")
:: Execute build with windows Dockerfile
docker build -t jcefbuild --file DockerfileWindows .
@ -15,5 +23,5 @@ docker build -t jcefbuild --file DockerfileWindows .
if not exist "jcef" mkdir "jcef"
rmdir /S /Q out
mkdir "out"
docker run --name jcefbuild -v jcef:"C:\jcef" -e TARGETARCH=%1 -e BUILD_TYPE=%2 jcefbuild
docker run --name jcefbuild -v jcef:"C:\jcef" -e TARGETARCH=%1 -e BUILD_TYPE=%2 -e REPO=%REPO% -e REF=%REF% jcefbuild
docker cp jcefbuild:/out/binary_distrib.tar.gz out/binary_distrib.tar.gz

View File

@ -15,6 +15,7 @@ if [ ! -f "/jcef/README.md" ]; then
git clone ${REPO} /jcef
cd /jcef
git checkout ${REF}
#Temporary CMakeLists patching - beautify in the future
rm CMakeLists.txt
curl -o CMakeLists.txt https://raw.githubusercontent.com/jcefmaven/jcefbuild/master/CMakeLists.txt
else

View File

@ -8,12 +8,12 @@ certutil -generateSSTFromWU roots.sst && certutil -addstore -f root roots.sst &&
:: Check residency of workdir
cd ..
if exist "jcef\README.md" (echo "Found existing files to build") ^
if exist "jcef\README.md" (echo "Found existing files to build" && cd jcef) ^
else (echo "Did not find files to build - cloning..." && GOTO :CLONE)
:BUILD
cd jcef
rm CMakeLists.txt
:: Temporary CMakeLists patching - beautify in the future
del /f CMakeLists.txt
curl -o CMakeLists.txt https://raw.githubusercontent.com/jcefmaven/jcefbuild/master/CMakeLists.txt
:: Prepare build dir
@ -51,5 +51,7 @@ GOTO :EOF
:CLONE
if exist jcef rmdir /S /Q jcef
git clone https://bitbucket.org/chromiumembedded/java-cef jcef
git clone %REPO% jcef
cd jcef
git checkout %REF%
GOTO :BUILD