Files
ortools-clone/tools/release/build_delivery_macos.sh

486 lines
16 KiB
Bash
Raw Permalink Normal View History

2018-09-10 12:48:14 +02:00
#!/usr/bin/env bash
2025-01-10 11:35:44 +01:00
# Copyright 2010-2025 Google LLC
2022-06-17 14:23:05 +02:00
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2021-03-18 10:51:16 +01:00
set -eo pipefail
function help() {
local -r NAME=$(basename "$0")
local -r BOLD="\e[1m"
local -r RESET="\e[0m"
local -r help=$(cat << EOF
${BOLD}NAME${RESET}
\t$NAME - Build delivery using the ${BOLD}local host system${RESET}.
${BOLD}SYNOPSIS${RESET}
\t$NAME [-h|--help|help] [examples|dotnet|java|python|all|reset]
2021-03-18 10:51:16 +01:00
${BOLD}DESCRIPTION${RESET}
\tBuild Google OR-Tools deliveries.
\tYou ${BOLD}MUST${RESET} define the following variables before running this script:
\t* ORTOOLS_TOKEN: secret use to decrypt keys to sign .Net and Java packages.
2021-03-18 10:51:16 +01:00
${BOLD}OPTIONS${RESET}
2021-03-18 15:56:07 +01:00
\t-h --help: display this help text
2025-06-12 10:02:27 +02:00
\tarchive: build all (C++, .Net, Java) archives
2021-03-18 15:56:07 +01:00
\tdotnet: build all .Net packages
\tjava: build all Java packages
\tpython: build all Pyhon packages
\texamples: build examples archives
2021-03-18 10:51:16 +01:00
\tall: build everything (default)
${BOLD}EXAMPLES${RESET}
Using export to define the ${BOLD}ORTOOLS_TOKEN${RESET} env and only building the Java packages:
export ORTOOLS_TOKEN=SECRET
$0 java
2021-03-18 15:56:07 +01:00
note: the 'export ...' should be placed in your bashrc to avoid any leak
of the secret in your bash history
2021-03-18 10:51:16 +01:00
EOF
)
2021-03-18 15:56:07 +01:00
echo -e "$help"
2021-03-18 10:51:16 +01:00
}
function assert_defined(){
if [[ -z "${!1}" ]]; then
>&2 echo "Variable '${1}' must be defined"
exit 1
fi
}
2021-04-19 16:46:21 +02:00
# .Net build
2021-03-18 10:51:16 +01:00
function build_dotnet() {
if echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" | cmp --silent "${ROOT_DIR}/export/dotnet_build" -; then
2021-09-08 17:09:23 +02:00
echo "build .Net up to date!" | tee -a build.log
2021-03-18 10:51:16 +01:00
return 0
fi
2022-08-05 14:54:04 +02:00
cd "${ROOT_DIR}" || exit 2
2025-06-19 15:07:38 +02:00
echo -n "check swig..."
2021-03-18 10:51:16 +01:00
command -v swig
command -v swig | xargs echo "swig: " | tee -a build.log
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
echo -n "check dotnet..."
2021-03-18 10:51:16 +01:00
command -v dotnet
command -v dotnet | xargs echo "dotnet: " | tee -a build.log
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
# Install .Net SNK
2021-03-18 15:56:07 +01:00
echo -n "Install .Net SNK..." | tee -a build.log
2022-08-18 11:54:42 +02:00
local OPENSSL_PRG=openssl
if [[ -x $(command -v openssl11) ]]; then
OPENSSL_PRG=openssl11
fi
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
echo -n "check ${OPENSSL_PRG}..."
2022-11-21 16:47:25 +01:00
command -v ${OPENSSL_PRG} | xargs echo "openssl: " | tee -a build.log
2022-08-18 11:54:42 +02:00
$OPENSSL_PRG aes-256-cbc -iter 42 -pass pass:"$ORTOOLS_TOKEN" \
2021-03-18 15:56:07 +01:00
-in "${RELEASE_DIR}/or-tools.snk.enc" \
-out "${ROOT_DIR}/export/or-tools.snk" -d
2023-02-08 12:12:01 +01:00
export DOTNET_SNK=export/or-tools.snk
2021-03-18 10:51:16 +01:00
echo "DONE" | tee -a build.log
# Clean dotnet
echo -n "Clean .Net..." | tee -a build.log
2021-03-18 10:51:16 +01:00
cd "${ROOT_DIR}" || exit 2
rm -rf "${ROOT_DIR}/temp_dotnet"
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
2025-06-19 15:07:38 +02:00
echo "Build .Net..." | tee -a build.log
2022-03-03 17:53:54 +00:00
cmake -S. -Btemp_dotnet -DBUILD_SAMPLES=OFF -DBUILD_EXAMPLES=OFF -DBUILD_DOTNET=ON
cmake --build temp_dotnet -j8 -v
2025-06-19 15:07:38 +02:00
echo -n " Check libortools.dylib..." | tee -a build.log
otool -L temp_dotnet/lib/libortools.dylib | grep -vqz "/Users"
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
echo "DONE" | tee -a build.log
#cmake --build temp_dotnet --target test
#echo "cmake test: DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
# copy nupkg to export
cp temp_dotnet/dotnet/packages/*nupkg export/
2021-03-18 10:51:16 +01:00
echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" > "${ROOT_DIR}/export/dotnet_build"
}
# Java build
function build_java() {
if echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" | cmp --silent "${ROOT_DIR}/export/java_build" -; then
2021-09-08 17:09:23 +02:00
echo "build Java up to date!" | tee -a build.log
2021-03-18 10:51:16 +01:00
return 0
fi
2022-08-05 14:54:04 +02:00
cd "${ROOT_DIR}" || exit 2
2025-06-19 15:07:38 +02:00
echo -n "check swig..."
2021-03-18 10:51:16 +01:00
command -v swig
command -v swig | xargs echo "swig: " | tee -a build.log
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
# maven require JAVA_HOME
if [[ -z "${JAVA_HOME}" ]]; then
2021-09-08 17:09:23 +02:00
echo "JAVA_HOME: not found !" | tee -a build.log
2021-03-18 10:51:16 +01:00
exit 1
else
echo "JAVA_HOME: ${JAVA_HOME}" | tee -a build.log
2022-11-21 16:47:25 +01:00
echo "check java..."
2021-03-18 10:51:16 +01:00
command -v java | xargs echo "java: " | tee -a build.log
2022-11-21 16:47:25 +01:00
echo "check javac..."
2021-03-18 10:51:16 +01:00
command -v javac | xargs echo "javac: " | tee -a build.log
2022-11-21 16:47:25 +01:00
echo "check jar..."
2021-03-18 10:51:16 +01:00
command -v jar | xargs echo "jar: " | tee -a build.log
2022-11-21 16:47:25 +01:00
echo "check mvn..."
2021-03-18 10:51:16 +01:00
command -v mvn | xargs echo "mvn: " | tee -a build.log
2022-08-04 17:36:52 +02:00
echo "Check java version..."
2022-08-18 11:54:42 +02:00
java -version 2>&1 | head -n 1 | xargs echo "java version: " | tee -a build.log
2022-09-19 18:31:14 +02:00
if [[ ${PLATFORM} == "arm64" ]]; then
2022-08-04 17:36:52 +02:00
java -version 2>&1 | head -n 1 | grep "11\.0"
else
java -version 2>&1 | head -n 1 | grep "1\.8"
fi
2021-03-18 10:51:16 +01:00
fi
# Maven central need gpg sign and we store the release key encoded using openssl
2022-08-18 11:54:42 +02:00
local OPENSSL_PRG=openssl
if [[ -x $(command -v openssl11) ]]; then
OPENSSL_PRG=openssl11
fi
2022-11-21 16:47:25 +01:00
echo "check ${OPENSSL_PRG}..."
command -v ${OPENSSL_PRG} | xargs echo "openssl: " | tee -a build.log
echo "check gpg..."
2021-03-18 10:51:16 +01:00
command -v gpg
command -v gpg | xargs echo "gpg: " | tee -a build.log
# Install Java GPG
2021-03-18 15:56:07 +01:00
echo -n "Install Java GPG..." | tee -a build.log
2022-08-18 11:54:42 +02:00
$OPENSSL_PRG aes-256-cbc -iter 42 -pass pass:"$ORTOOLS_TOKEN" \
2021-03-18 15:56:07 +01:00
-in tools/release/private-key.gpg.enc \
-out private-key.gpg -d
2021-03-18 10:51:16 +01:00
gpg --batch --import private-key.gpg
# Don't need to trust the key
#expect -c "spawn gpg --edit-key "corentinl@google.com" trust quit; send \"5\ry\r\"; expect eof"
# Install the maven settings.xml having the GPG passphrase
mkdir -p ~/.m2
2022-08-18 11:54:42 +02:00
$OPENSSL_PRG aes-256-cbc -iter 42 -pass pass:"$ORTOOLS_TOKEN" \
2021-03-18 15:56:07 +01:00
-in tools/release/settings.xml.enc \
-out ~/.m2/settings.xml -d
2021-03-18 10:51:16 +01:00
echo "DONE" | tee -a build.log
# Clean java
echo -n "Clean Java..." | tee -a build.log
2021-03-18 10:51:16 +01:00
cd "${ROOT_DIR}" || exit 2
rm -rf "${ROOT_DIR}/temp_java"
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
2025-06-19 15:07:38 +02:00
echo "Build Java..." | tee -a build.log
2022-08-18 11:54:42 +02:00
if [[ ! -v GPG_ARGS ]]; then
GPG_EXTRA=""
else
GPG_EXTRA="-DGPG_ARGS=${GPG_ARGS}"
fi
2023-02-08 12:12:01 +01:00
# shellcheck disable=SC2086 # cmake fail to parse empty string ""
cmake -S. -Btemp_java -DBUILD_SAMPLES=OFF -DBUILD_EXAMPLES=OFF \
2022-08-18 11:54:42 +02:00
-DBUILD_JAVA=ON -DSKIP_GPG=OFF ${GPG_EXTRA}
cmake --build temp_java -j8 -v
2025-06-19 15:07:38 +02:00
echo -n " Check libortools.dylib..." | tee -a build.log
otool -L temp_java/lib/libortools.dylib | grep -vqz "/Users"
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
echo "DONE" | tee -a build.log
#cmake --build temp_java --target test
#echo "cmake test: DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
# copy jar to export
2022-09-19 18:31:14 +02:00
if [[ ${PLATFORM} == "arm64" ]]; then
2022-08-04 17:36:52 +02:00
cp temp_java/java/ortools-darwin-aarch64/target/*.jar* export/
2022-08-04 16:24:31 +02:00
else
2022-08-04 17:36:52 +02:00
cp temp_java/java/ortools-darwin-x86-64/target/*.jar* export/
2022-08-04 16:24:31 +02:00
fi
cp temp_java/java/ortools-java/target/*.jar* export/
2021-03-18 10:51:16 +01:00
echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" > "${ROOT_DIR}/export/java_build"
}
2022-03-09 15:27:43 +01:00
# Python 3
2022-06-22 17:51:14 +02:00
# TODO(user) Use `make --directory tools/docker python` instead
# shellcheck disable=2317
2022-03-09 15:27:43 +01:00
function build_python() {
if echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" | cmp --silent "${ROOT_DIR}/export/python_build" -; then
echo "build python up to date!" | tee -a build.log
2021-03-18 10:51:16 +01:00
return 0
fi
2022-08-18 11:54:42 +02:00
# Save PATH
PATH_BCKP=${PATH}
2022-08-05 14:54:04 +02:00
cd "${ROOT_DIR}" || exit 2
2025-06-19 15:07:38 +02:00
echo -n "check swig..."
2022-03-09 15:27:43 +01:00
command -v swig
command -v swig | xargs echo "swig: " | tee -a build.log
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2022-08-04 16:24:31 +02:00
2022-09-19 18:31:14 +02:00
if [[ ${PLATFORM} == "arm64" ]]; then
2025-11-21 16:27:05 +01:00
local -r PY=(3.9 3.10 3.11 3.12 3.13 3.14)
2022-08-05 10:57:11 +02:00
else
2025-11-21 16:27:05 +01:00
local -r PY=(3.9 3.10 3.11 3.12 3.13 3.14)
2022-08-04 16:24:31 +02:00
fi
2022-08-05 10:57:11 +02:00
# Check Python env
2023-02-08 12:12:01 +01:00
for PY_VERSION in "${PY[@]}"; do
# Check python interpreter
# Need the one form python.org not from homebrew to be compatible with older macOS
2023-02-08 12:12:01 +01:00
PY_PATH="/Library/Frameworks/Python.framework/Versions/${PY_VERSION}"
2022-08-05 10:57:11 +02:00
if [[ ! -d "$PY_PATH" ]]; then
2023-02-08 12:12:01 +01:00
echo "Error: Python ${PY_VERSION} is not found (${PY_PATH})." | tee -a build.log
2022-08-05 10:57:11 +02:00
exit 1
fi
2023-02-08 12:12:01 +01:00
export PATH="${HOME}/Library/Python/${PY_VERSION}/bin:${PY_PATH}/bin:${PATH_BCKP}"
2022-08-05 10:57:11 +02:00
# Check Python packages mandatory are available and up to date
echo "check python${PY_VERSION}..."
command -v python3 | xargs echo "python${PY_VERSION}: " | tee -a build.log
2023-02-08 12:12:01 +01:00
command -v "python${PY_VERSION}" | xargs echo "python${PY_VERSION}: " | tee -a build.log
"python${PY_VERSION}" -c "import platform as p; print(p.platform())" | tee -a build.log
2023-02-08 12:12:01 +01:00
"python${PY_VERSION}" -m pip install --upgrade --user pip
2025-06-19 15:07:38 +02:00
"python${PY_VERSION}" -m pip install --upgrade --user wheel absl-py mypy mypy-protobuf protobuf virtualenv
2022-11-21 16:47:25 +01:00
echo "check protoc-gen-mypy..."
2022-08-05 10:57:11 +02:00
command -v protoc-gen-mypy | xargs echo "protoc-gen-mypy: " | tee -a build.log
protoc-gen-mypy --version | xargs echo "protoc-gen-mypy version: " | tee -a build.log
protoc-gen-mypy --version | grep "4\.0\.0"
2022-03-09 15:27:43 +01:00
done
2021-03-18 10:51:16 +01:00
declare -a MYPY_FILES=(
"ortools/algorithms/python/knapsack_solver.pyi"
"ortools/constraint_solver/pywrapcp.pyi"
"ortools/graph/python/linear_sum_assignment.pyi"
"ortools/graph/python/max_flow.pyi"
"ortools/graph/python/min_cost_flow.pyi"
"ortools/init/python/init.pyi"
"ortools/linear_solver/python/model_builder_helper.pyi"
"ortools/linear_solver/pywraplp.pyi"
"ortools/pdlp/python/pdlp.pyi"
"ortools/sat/python/cp_model_helper.pyi"
"ortools/scheduling/python/rcpsp.pyi"
"ortools/util/python/sorted_interval_list.pyi"
)
2023-02-08 12:12:01 +01:00
for PY_VERSION in "${PY[@]}"; do
PY_PATH="/Library/Frameworks/Python.framework/Versions/${PY_VERSION}"
2022-03-09 15:27:43 +01:00
if [[ ! -d "$PY_PATH" ]]; then
2023-02-08 12:12:01 +01:00
echo "Error: Python ${PY_VERSION} is not found (${PY_PATH})." | tee -a build.log
2022-03-09 15:27:43 +01:00
exit 1
fi
2023-02-08 12:12:01 +01:00
export PATH="${HOME}/Library/Python/${PY_VERSION}/bin:${PY_PATH}/bin:${PATH_BCKP}"
2022-03-09 15:27:43 +01:00
# Clean and build
2023-02-08 12:12:01 +01:00
echo -n "Cleaning Python ${PY_VERSION}..." | tee -a build.log
rm -rf "temp_python${PY_VERSION}"
2022-08-18 11:54:42 +02:00
echo "DONE" | tee -a build.log
2025-06-19 15:07:38 +02:00
2025-06-16 11:40:09 +02:00
echo "Build Python ${PY_VERSION}..." | tee -a build.log
echo -n " CMake configure..." | tee -a build.log
2023-02-08 12:12:01 +01:00
cmake -S. -B"temp_python${PY_VERSION}" -DBUILD_SAMPLES=OFF -DBUILD_EXAMPLES=OFF -DBUILD_PYTHON=ON -DPython3_ROOT_DIR="$PY_PATH"
2025-06-16 11:40:09 +02:00
echo "DONE" | tee -a build.log
echo -n " Build libortools..." | tee -a build.log
cmake --build "temp_python${PY_VERSION}" --target ortools -j8 -v
2025-06-16 11:40:09 +02:00
echo "DONE" | tee -a build.log
echo -n " Build all few times..." | tee -a build.log
# on macos stubgen will timeout -> need to build few times
cmake --build "temp_python${PY_VERSION}" -j4 -v || true
sleep 10
cmake --build "temp_python${PY_VERSION}" -v || true
echo "DONE" | tee -a build.log
echo -n " ReBuild all..." | tee -a build.log
cmake --build "temp_python${PY_VERSION}" -j4 -v
echo "DONE" | tee -a build.log
2025-06-16 11:40:09 +02:00
echo -n " Check libortools.dylib..." | tee -a build.log
otool -L "temp_python${PY_VERSION}/lib/libortools.dylib" | grep -vqz "/Users"
2022-03-09 15:27:43 +01:00
echo "DONE" | tee -a build.log
2025-06-16 11:40:09 +02:00
echo "Build Python ${PY_VERSION}...DONE" | tee -a build.log
2023-02-08 12:12:01 +01:00
#cmake --build temp_python${PY_VERSION} --target test
#echo "cmake test_python${PY_VERSION}: DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
# Check mypy files
for FILE in "${MYPY_FILES[@]}"; do
2024-02-27 23:29:38 +01:00
if [[ ! -f "temp_python${PY_VERSION}/python/${FILE}" ]]; then
echo "error: ${FILE} missing in the python project" | tee -a build.log
exit 2
fi
done
2023-02-08 12:12:01 +01:00
cp "temp_python${PY_VERSION}"/python/dist/*.whl export/
pushd export
2023-02-08 12:12:01 +01:00
for WHEEL_FILE in *_universal2.whl; do
if [[ ${PLATFORM} == "arm64" ]]; then
2023-02-08 12:12:01 +01:00
mv "${WHEEL_FILE}" "${WHEEL_FILE%_universal2.whl}_arm64.whl"
else
mv "${WHEEL_FILE}" "${WHEEL_FILE%_universal2.whl}_x86_64.whl" || true
fi
done
popd
2022-03-09 15:27:43 +01:00
done
2022-08-05 10:57:11 +02:00
# Reset PATH
export PATH=${PATH_BCKP}
2022-08-18 11:54:42 +02:00
2022-03-09 15:27:43 +01:00
echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" > "${ROOT_DIR}/export/python_build"
2021-03-18 10:51:16 +01:00
}
# Create Archive
2021-03-18 10:51:16 +01:00
function build_archive() {
if echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" | cmp --silent "${ROOT_DIR}/export/archive_build" -; then
2021-09-08 17:09:23 +02:00
echo "build archive up to date!" | tee -a build.log
2021-03-18 10:51:16 +01:00
return 0
fi
# Clean archive
cd "${ROOT_DIR}" || exit 2
echo "Check Make version..."
make --version 2>&1 | head -n 1 | grep "\b4\.4"
echo "Check Sed version..."
sed --version 2>&1 | head -n 1 | grep "GNU sed.*\b4"
echo -n "Clean previous archive..." | tee -a build.log
2021-03-18 10:51:16 +01:00
make clean_archive
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
2025-06-19 15:07:38 +02:00
echo "Make cpp archive..." | tee -a build.log
make archive_cpp
2025-06-19 15:07:38 +02:00
echo -n " Check libortools.dylib..." | tee -a build.log
otool -L "build_make/lib/libortools.dylib" | grep -vqz "/Users"
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2020-04-14 17:23:15 +02:00
echo "DONE" | tee -a build.log
2025-06-19 15:07:38 +02:00
echo "Make dotnet archive..." | tee -a build.log
make archive_dotnet
2025-06-19 15:07:38 +02:00
echo -n " Check libortools.dylib..." | tee -a build.log
otool -L "build_make/lib/libortools.dylib" | grep -vqz "/Users"
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2020-04-14 17:23:15 +02:00
echo "DONE" | tee -a build.log
2025-06-19 15:07:38 +02:00
echo "Make java archive..." | tee -a build.log
make archive_java
2025-06-19 15:07:38 +02:00
echo -n " Check libortools.dylib..." | tee -a build.log
otool -L "build_make/lib/libortools.dylib" | grep -vqz "/Users"
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2020-04-14 17:23:15 +02:00
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
# move archive to export
2021-04-29 01:07:54 +02:00
mv or-tools_*.tar.gz export/
2021-03-18 10:51:16 +01:00
echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" > "${ROOT_DIR}/export/archive_build"
}
# Build Examples
# shellcheck disable=2317
2021-03-18 10:51:16 +01:00
function build_examples() {
if echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" | cmp --silent "${ROOT_DIR}/export/examples_build" -; then
2021-09-08 17:09:23 +02:00
echo "build examples up to date!" | tee -a build.log
2021-03-18 10:51:16 +01:00
return 0
fi
cd "${ROOT_DIR}" || exit 2
echo "Check Make version..."
make --version 2>&1 | head -n 1 | grep "\b4\.3"
echo "Check Sed version..."
sed --version 2>&1 | head -n 1 | grep "GNU sed.*\b4"
2021-03-18 10:51:16 +01:00
2025-06-19 15:07:38 +02:00
echo -n "Clean previous example archives..." | tee -a build.log
2021-03-18 10:51:16 +01:00
rm -rf temp ./*.tar.gz
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
echo "Build examples archives..." | tee -a build.log
2021-03-18 10:51:16 +01:00
echo -n " Python examples archive..." | tee -a build.log
make python_examples_archive UNIX_PYTHON_VER=3
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
echo -n " Java examples archive..." | tee -a build.log
make java_examples_archive UNIX_PYTHON_VER=3
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
2021-03-18 10:51:16 +01:00
echo -n " .Net examples archive..." | tee -a build.log
make dotnet_examples_archive UNIX_PYTHON_VER=3
2020-04-14 17:23:15 +02:00
echo "DONE" | tee -a build.log
2025-06-19 15:07:38 +02:00
echo "DONE" | tee -a build.log
# move example to export/
2021-04-29 01:07:54 +02:00
mv or-tools_*_examples_*.tar.gz export/
2021-03-18 10:51:16 +01:00
echo "${ORTOOLS_BRANCH} ${ORTOOLS_SHA1}" > "${ROOT_DIR}/export/examples_build"
}
2022-07-04 14:29:50 +02:00
# Cleaning everything
function reset() {
echo "Cleaning everything..."
2022-08-04 16:24:31 +02:00
cd "${ROOT_DIR}" || exit 2
2022-07-04 14:29:50 +02:00
make clean
rm -rf temp_cpp
2022-08-18 11:54:42 +02:00
rm -rf temp_dotnet
rm -rf temp_java
rm -rf temp_python*
rm -rf export
rm -f ./*.gpg
rm -f ./*.log
rm -f ./*.whl
2022-07-04 14:29:50 +02:00
rm -f ./*.tar.gz
2022-08-05 14:54:04 +02:00
rm -f ortools.snk
2022-07-04 14:29:50 +02:00
echo "DONE"
}
2021-03-18 10:51:16 +01:00
# Main
function main() {
case ${1} in
-h | --help | help)
2021-03-18 10:51:16 +01:00
help; exit ;;
esac
assert_defined ORTOOLS_TOKEN
echo "ORTOOLS_TOKEN: FOUND" | tee -a build.log
2021-03-18 10:51:16 +01:00
2021-04-20 16:24:07 +02:00
local -r ROOT_DIR="$(cd -P -- "$(dirname -- "$0")/../.." && pwd -P)"
2021-09-08 17:09:23 +02:00
echo "ROOT_DIR: '${ROOT_DIR}'" | tee -a build.log
2021-03-18 15:56:07 +01:00
2021-04-20 16:24:07 +02:00
local -r RELEASE_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
2021-09-08 17:09:23 +02:00
echo "RELEASE_DIR: '${RELEASE_DIR}'" | tee -a build.log
2021-03-18 10:51:16 +01:00
(cd "${ROOT_DIR}" && make print-OR_TOOLS_VERSION | tee -a build.log)
2021-03-18 10:51:16 +01:00
local -r ORTOOLS_BRANCH=$(git rev-parse --abbrev-ref HEAD)
local -r ORTOOLS_SHA1=$(git rev-parse --verify HEAD)
2022-08-05 14:54:04 +02:00
local -r PLATFORM=$(uname -m)
2021-03-18 10:51:16 +01:00
2022-08-04 16:24:31 +02:00
mkdir -p "${ROOT_DIR}/export"
2021-03-18 10:51:16 +01:00
case ${1} in
2022-03-09 15:27:43 +01:00
dotnet|java|python|archive|examples)
2021-03-18 10:51:16 +01:00
"build_$1"
exit ;;
2022-07-04 14:29:50 +02:00
reset)
reset
exit ;;
2021-03-18 10:51:16 +01:00
all)
build_dotnet
build_java
#build_python
build_archive
#build_examples
2021-03-18 10:51:16 +01:00
exit ;;
*)
>&2 echo "Target '${1}' unknown"
2021-03-18 10:51:16 +01:00
exit 1
esac
}
main "${1:-all}"