From b4181c08fb4b6bb511af4c4b2747263baa17da17 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Wed, 26 Apr 2023 13:39:26 -0500 Subject: [PATCH] feat(artifact_proxy): add script to generate `artifact_manifest.yaml` (#374) --- packages/artifact_proxy/README.md | 28 ++++++++++--- .../artifact_proxy/tool/generate_manifest.sh | 39 +++++++++++++++++++ 2 files changed, 61 insertions(+), 6 deletions(-) create mode 100755 packages/artifact_proxy/tool/generate_manifest.sh diff --git a/packages/artifact_proxy/README.md b/packages/artifact_proxy/README.md index b7dae45d..bbd1e8ca 100644 --- a/packages/artifact_proxy/README.md +++ b/packages/artifact_proxy/README.md @@ -32,7 +32,9 @@ If run into 404s when fetching artifacts, you may need to update the artifact li To do so, you will need to determine the artifact URLs. Follow these steps: - Adjust shorebird_cli to point to http://localhost:8080 instead of https://download.shorebird.dev: + - packages\shorebird_cli\lib\src\shorebird_process.dart + ```diff Map _environmentOverrides({ required String executable, @@ -47,7 +49,9 @@ To do so, you will need to determine the artifact URLs. Follow these steps: return {}; } ``` + - Adjust third_party Flutter to point to http://localhost:8080 instead of https://download.shorebird.dev: + - third_party\flutter\bin\internal\shared.sh ```diff @@ -63,10 +67,11 @@ To do so, you will need to determine the artifact URLs. Follow these steps: SHOREBIRD_ENGINE_VERSION=`cat "$FLUTTER_PATH/bin/internal/engine.version"` echo "Shorebird Engine • revision $SHOREBIRD_ENGINE_VERSION" # Install Shorebird Flutter Artifacts - - FLUTTER_STORAGE_BASE_URL=https://download.shorebird.dev $FLUTTER_PATH/bin/flutter --version - + FLUTTER_STORAGE_BASE_URL=http://localhost:8080 $FLUTTER_PATH/bin/flutter --version + - FLUTTER_STORAGE_BASE_URL=https://download.shorebird.dev $FLUTTER_PATH/bin/flutter --version + + FLUTTER_STORAGE_BASE_URL=http://localhost:8080 $FLUTTER_PATH/bin/flutter --version } ``` + - Modify flutter_tool used by Shorebird to allow downloads from insecure URLs: - shorebird\bin\cache\flutter\packages\flutter_tools\gradle\flutter.gradle ```diff @@ -81,9 +86,20 @@ To do so, you will need to determine the artifact URLs. Follow these steps: ``` - Remove the flutter_tools snapshot - ```bash - cd bin/cache/flutter/bin/cache - rm flutter_tools.s* - ``` + ```bash + cd bin/cache/flutter/bin/cache + rm flutter_tools.s* + ``` + - Run a shorebird command (`shorebird run` works well) - For each artifact that 404s, add a line to `packages\artifact_proxy\lib\config.dart`, following the conventions for capturing engine revisions and escaping relevant characters. + +## Generating an `artifact_manifest.yaml` + +To generate a new `artifact_manifest.yaml` for a specific flutter_revision use the following command: + +``` +./tools/generate_manifest.sh > artifact_manifest.yaml +``` + +Then upload the `artifact_manifest.yaml` to `download.shorebird.dev/shorebird//artifacts_manifest.yaml` diff --git a/packages/artifact_proxy/tool/generate_manifest.sh b/packages/artifact_proxy/tool/generate_manifest.sh new file mode 100755 index 00000000..dd9f3e17 --- /dev/null +++ b/packages/artifact_proxy/tool/generate_manifest.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# This script outputs an artifact_manifest.yaml mapping +# a shorebird engine revision to a flutter engine revision. +# Usage: +# ./generate_manifest.sh > artifact_manifest.yaml + +set -e + +if [ "$#" -ne 1 ]; then + echo "Usage: ./generate_manifest.sh " + exit 1 +fi + +FLUTTER_ENGINE_REVISION=$1 + +cat <