From 32b361c9291ba9e00eea69540c8cf0a6a6d07991 Mon Sep 17 00:00:00 2001 From: Ariel Demarco Date: Fri, 8 Nov 2024 19:19:55 -0300 Subject: [PATCH] Used revision with fix from OTel + modified build_dependencies script --- Package.resolved | 3 +-- Package.swift | 2 +- bin/build_dependencies.sh | 36 +++++++++++++++++++++++------------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Package.resolved b/Package.resolved index 84f1c943..d38cc2d7 100644 --- a/Package.resolved +++ b/Package.resolved @@ -32,8 +32,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/open-telemetry/opentelemetry-swift", "state" : { - "revision" : "0dd37c4a14a6aeeb131eea40a13cb3832c7c6a97", - "version" : "1.10.1" + "revision" : "0cd4a4c041baead7f845325b86b57f3d1355e86b" } }, { diff --git a/Package.swift b/Package.swift index e0f17f30..f35d4ba7 100644 --- a/Package.swift +++ b/Package.swift @@ -36,7 +36,7 @@ let package = Package( ), .package( url: "https://github.com/open-telemetry/opentelemetry-swift", - exact: "1.10.1" + revision: "0cd4a4c041baead7f845325b86b57f3d1355e86b" ), .package( url: "https://github.com/groue/GRDB.swift", diff --git a/bin/build_dependencies.sh b/bin/build_dependencies.sh index cec30474..18c598de 100755 --- a/bin/build_dependencies.sh +++ b/bin/build_dependencies.sh @@ -11,7 +11,14 @@ mkdir -p "$BUILD_DIR" get_dependency_info() { local DEPENDENCY_NAME=$(echo "$1" | tr '[:upper:]' '[:lower:]') - local INFO=$(jq -r --arg NAME "$DEPENDENCY_NAME" '.pins[] | select(.identity == $NAME) | { url: .location, version: (.state.version // .state.branch) }' Package.resolved) + local INFO=$(jq -r --arg NAME "$DEPENDENCY_NAME" ' + .pins[] | select(.identity == $NAME) | + if .state.version or .state.branch then + { url: .location, version: (.state.version // .state.branch) } + else + { url: .location, revision: .state.revision } + end + ' Package.resolved) echo "$INFO" } @@ -19,23 +26,26 @@ for NAME in "${DEPENDENCIES[@]}"; do echo "Processing dependency: $NAME" INFO=$(get_dependency_info "$NAME") - echo $INFO URL=$(echo "$INFO" | jq -r '.url') VERSION=$(echo "$INFO" | jq -r '.version') - - if [ -z "$URL" ] || [ -z "$VERSION" ]; then - echo "Could not find dependency $NAME in Package.resolved" - exit 1 - fi - - echo "URL: $URL" - echo "Version: $VERSION" + REVISION=$(echo "$INFO" | jq -r '.revision') REPO_DIR="$TEMP_DIR/$NAME" - if git ls-remote --tags "$URL" | grep -q "refs/tags/v${VERSION}$"; then - git clone --branch "v${VERSION}" "$URL" "$REPO_DIR" + if [ "$VERSION" != "null" ]; then + if git ls-remote --tags "$URL" | grep -q "refs/tags/v${VERSION}$"; then + git clone --branch "v${VERSION}" "$URL" "$REPO_DIR" + else + git clone --branch "$VERSION" "$URL" "$REPO_DIR" + fi + elif [ "$REVISION" != "null" ]; then + git clone "$URL" "$REPO_DIR" + cd "$REPO_DIR" + git fetch --depth 1 origin "$REVISION" + git checkout "$REVISION" + cd - else - git clone --branch "$VERSION" "$URL" "$REPO_DIR" + echo "Could not find dependency $NAME in Package.resolved" + exit 1 fi LOWERCASE_NAME=$(echo "$NAME" | tr '[:upper:]' '[:lower:]')