From dda01c0f3bf9afe360843f5a5e6861dc036a22df Mon Sep 17 00:00:00 2001 From: Bartosz Oleaczek Date: Fri, 25 Oct 2024 11:47:14 +0200 Subject: [PATCH] add moose script --- ci/add_moose.sh | 13 +++++++++++++ ci/compile.sh | 12 +----------- ci/set_bindings_version.sh | 6 ------ ci/test.sh | 6 +----- contrib/patches/add_moose.diff | 25 ------------------------- 5 files changed, 15 insertions(+), 47 deletions(-) create mode 100644 ci/add_moose.sh delete mode 100644 contrib/patches/add_moose.diff diff --git a/ci/add_moose.sh b/ci/add_moose.sh new file mode 100644 index 00000000..87be3f92 --- /dev/null +++ b/ci/add_moose.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +go mod edit -require=moose/events@v0.0.0 +go mod edit -require=moose/worker@v0.0.0 +go mod edit -replace=moose/events=./third-party/moose-events/nordvpnapp/moosenordvpnappgo +go mod edit -replace=moose/worker=./third-party/moose-worker/mooseworkergo +function revert_moose_patch { + go mod edit -droprequire=moose/events + go mod edit -droprequire=moose/worker + go mod edit -dropreplace=moose/events + go mod edit -dropreplace=moose/worker +} +trap revert_moose_patch EXIT \ No newline at end of file diff --git a/ci/compile.sh b/ci/compile.sh index 195f0c72..12843954 100755 --- a/ci/compile.sh +++ b/ci/compile.sh @@ -74,17 +74,7 @@ if [[ $tags == *"moose"* ]]; then -X 'main.EventsDomain=${events_domain:-""}' \ -X 'main.EventsSubdomain=${EVENTS_SUBDOMAIN:-""}'" - go mod edit -require=moose/events@v0.0.0 - go mod edit -require=moose/worker@v0.0.0 - go mod edit -replace=moose/events=./third-party/moose-events/nordvpnapp/moosenordvpnappgo - go mod edit -replace=moose/worker=./third-party/moose-worker/mooseworkergo - function revert_moose_patch { - go mod edit -droprequire=moose/events - go mod edit -droprequire=moose/worker - go mod edit -dropreplace=moose/events - go mod edit -dropreplace=moose/worker - } - trap revert_moose_patch EXIT + source "${WORKDIR}"/ci/add_moose.sh fi for program in ${!names_map[*]}; do # looping over keys diff --git a/ci/set_bindings_version.sh b/ci/set_bindings_version.sh index 744a38a0..5206f20a 100644 --- a/ci/set_bindings_version.sh +++ b/ci/set_bindings_version.sh @@ -1,12 +1,6 @@ #!/usr/bin/env bash set -euxo pipefail -function get_current_version { - partial_module_path=$1 - # - full_module_path=$(go list -m all | grep $partial_module_path) -} - declare -A LIB_NAME_TO_PACKAGE=( [libtelio]=github.com/NordSecurity/libtelio-go [libdrop]=github.com/NordSecurity/libdrop-go diff --git a/ci/test.sh b/ci/test.sh index e4aae4a4..cdbdc215 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -18,11 +18,7 @@ tags="internal" # everything if [ "${1:-""}" = "full" ]; then # Apply moose patch in case compiling with moose - git apply "${WORKDIR}"/contrib/patches/add_moose.diff - function revert_moose_patch { - git apply -R "${WORKDIR}"/contrib/patches/add_moose.diff - } - trap revert_moose_patch EXIT + source "${WORKDIR}"/ci/add_moose.sh excluded_packages="thisshouldneverexist" excluded_categories="root,link" diff --git a/contrib/patches/add_moose.diff b/contrib/patches/add_moose.diff deleted file mode 100644 index df16e121..00000000 --- a/contrib/patches/add_moose.diff +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/go.mod b/go.mod -index 129d05f..369a0f8 100644 ---- a/go.mod -+++ b/go.mod -@@ -12,6 +12,11 @@ require ( - github.com/NordSecurity/libtelio-go/v5 v5.0.0 - ) - -+replace ( -+ moose/events => ./third-party/moose-events/nordvpnapp/moosenordvpnappgo -+ moose/worker => ./third-party/moose-worker/mooseworkergo -+) -+ - require ( - github.com/NordSecurity/gopenvpn v0.0.0-20230117114932-2252c52984b4 - github.com/NordSecurity/systray v0.0.0-20240327004800-3e3b59c1b83d -@@ -50,6 +55,8 @@ require ( - google.golang.org/grpc v1.64.1 - google.golang.org/protobuf v1.34.2 - gopkg.in/natefinch/lumberjack.v2 v2.2.1 -+ moose/events v0.0.0 -+ moose/worker v0.0.0 - ) - - require (