summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDavid Lönnhager <david.l@mullvad.net>2025-01-22 10:08:55 +0100
committerDavid Lönnhager <david.l@mullvad.net>2025-01-22 10:08:55 +0100
commite515f671c04ce54c310959eeffbc26300514771c (patch)
tree0ebe7e82e6caf63759fcd14ce0a2568968427a73
parent2f77310b6c3ee45241eff0ccc73e80c41ccd4c40 (diff)
parent3068d8f0e084810e52a9287f707294324025dd15 (diff)
downloadmullvadvpn-e515f671c04ce54c310959eeffbc26300514771c.tar.xz
mullvadvpn-e515f671c04ce54c310959eeffbc26300514771c.zip
Merge branch 'fix-win-modules-release-clean'
-rwxr-xr-xbuild-windows-modules.sh48
-rwxr-xr-xbuild.sh8
2 files changed, 37 insertions, 19 deletions
diff --git a/build-windows-modules.sh b/build-windows-modules.sh
index 6fcfc7ae85..32a1a98c05 100755
--- a/build-windows-modules.sh
+++ b/build-windows-modules.sh
@@ -6,6 +6,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
source scripts/utils/host
+source scripts/utils/log
case $HOST in
x86_64-pc-windows-msvc) HOST_TARGET=x64;;
@@ -16,6 +17,19 @@ case $HOST in
;;
esac
+ACTION=build
+
+while [[ "$#" -gt 0 ]]; do
+ case $1 in
+ clean) ACTION="clean";;
+ *)
+ log_error "Unknown parameter: $1"
+ exit 1
+ ;;
+ esac
+ shift
+done
+
# List of solution configurations to build.
# Default configurations generated by Visual Studio are "Release" and "Debug".
CPP_BUILD_MODES=${CPP_BUILD_MODES:-"Debug"}
@@ -23,17 +37,11 @@ CPP_BUILD_MODES=${CPP_BUILD_MODES:-"Debug"}
# Common platforms include "x86" and "x64".
CPP_BUILD_TARGETS=${CPP_BUILD_TARGETS:-"$HOST_TARGET"}
-IS_RELEASE=${IS_RELEASE:-"false"}
-
function clean_solution {
local path="$1"
-
- if [[ "$IS_RELEASE" == "true" ]]; then
- # Clean all intermediate and output files
- rm -r "${path:?}/bin/"* || true
- else
- echo "Will NOT clean intermediate files in $path/bin/ in dev builds"
- fi
+ # Clean all intermediate and output files
+ echo "Removing ${path:?}..."
+ rm -r "${path:?}/bin/"* 2>/dev/null || true
}
function build_solution_config {
@@ -51,8 +59,6 @@ function build_solution {
local path="$1"
local sln="$1/$2"
- clean_solution "$path"
-
for mode in $CPP_BUILD_MODES; do
for target in $CPP_BUILD_TARGETS; do
build_solution_config "$sln" "$mode" "$target"
@@ -92,20 +98,19 @@ function get_solution_output_path {
function build_nsis_plugins {
local nsis_root_path="./windows/nsis-plugins"
-
- clean_solution "$nsis_root_path"
build_solution_config "$nsis_root_path/nsis-plugins.sln" "Release" "x86"
}
-function clean_libraries {
+function clean_all {
+ local nsis_root_path="./windows/nsis-plugins"
+ clean_solution "$nsis_root_path"
+
clean_solution "./windows/libshared"
clean_solution "./windows/windows-libraries"
clean_solution "./windows/libwfp"
}
-function main {
- clean_libraries
-
+function build_all {
build_solution "./windows/winfw" "winfw.sln"
build_solution "./windows/driverlogic" "driverlogic.sln"
@@ -113,4 +118,11 @@ function main {
build_nsis_plugins
}
-main
+case $ACTION in
+ "build") build_all;;
+ "clean") clean_all;;
+ *)
+ echo "Unknown build action: $ACTION"
+ exit 1
+ ;;
+esac
diff --git a/build.sh b/build.sh
index fd73914c97..904ca3aabf 100755
--- a/build.sh
+++ b/build.sh
@@ -312,6 +312,12 @@ function build {
}
if [[ "$(uname -s)" == "MINGW"* ]]; then
+ if [[ "$IS_RELEASE" == "true" ]]; then
+ ./build-windows-modules.sh clean
+ else
+ echo "Will NOT clean intermediate files in ./windows/**/bin/ in dev builds"
+ fi
+
for t in "${TARGETS[@]:-"$HOST"}"; do
case "${t:-"$HOST"}" in
x86_64-pc-windows-msvc) CPP_BUILD_TARGET=x64;;
@@ -323,7 +329,7 @@ if [[ "$(uname -s)" == "MINGW"* ]]; then
esac
log_header "Building C++ code in $CPP_BUILD_MODE mode for $CPP_BUILD_TARGET"
- CPP_BUILD_MODES=$CPP_BUILD_MODE CPP_BUILD_TARGETS=$CPP_BUILD_TARGET IS_RELEASE=$IS_RELEASE ./build-windows-modules.sh
+ CPP_BUILD_MODES=$CPP_BUILD_MODE CPP_BUILD_TARGETS=$CPP_BUILD_TARGET ./build-windows-modules.sh
if [[ "$SIGN" == "true" ]]; then
CPP_BINARIES=(