- Updated AAR releaser test to use ShorebirdProcess.defaultFlutterStorageBaseUrl. - Changed macOS releaser test to reference a new troubleshooting URL. - Enhanced shorebird_yaml_test with deserialization for AOT patch metadata. - Modified network_checker_test to check self-hosted URLs from ShorebirdEnv. - Added tests for artifact paths in shorebird_artifacts_test. - Updated shorebird_cli_command_runner_test to reflect new repository URL. - Improved shorebird_env_test with additional tests for shorebirdRoot and engine revision fallback. - Adjusted shorebird_flutter_test to use environment variables for Flutter Git URL. - Updated shorebird_process_test to utilize default Flutter storage URL. - Enhanced shorebird_validator_test to link to the default hosted URL. - Updated shorebird_web_console_test to use the configured hosted URL. - Refactored code_push_client to use default hosted URL for API requests. - Updated README and generation scripts for the code_push_protocol package to reflect new OpenAPI spec source. - Modified shared.sh to allow configurable Flutter repository and storage URLs. Signed-off-by: Tony <tonylu@tony-cloud.com>
3.1 KiB
Artifact Proxy
This is a tool for proxying Flutter artifacts from a derived Flutter engine revision back to the base Flutter engine revision. This is useful for when you need to modify some of the Flutter artifacts but not all of them.
This is a development tool which maps requests to configurable artifact origins.
By default, Flutter artifacts are redirected to the public Flutter storage
origin and Shorebird-specific artifacts are redirected to the local open mirror
root at http://localhost:8080/artifacts.
Usage
Uses config.dart to configure recognized artifact URL patterns. Runtime
origins are configured with environment variables:
SHOREBIRD_ARTIFACT_BASE_URL: root for open Shorebird manifests and artifacts, defaulting tohttp://localhost:8080/artifactsARTIFACT_PROXY_FLUTTER_BASE_URL: root for upstream Flutter artifacts, defaulting tohttps://storage.googleapis.com
# Run locally with hot-reload enabled.
PORT=8081 DEV=true dart --enable-vm-service run bin/server.dart
And then in a separate terminal:
FLUTTER_STORAGE_BASE_URL=http://localhost:8081 flutter precache -a
You should use a separate checkout of Flutter when running this, so you don't poison the cache of your main Flutter checkout.
Updating config.dart
If you run into 404s when fetching artifacts, ensure that the expected manifest exists at:
$SHOREBIRD_ARTIFACT_BASE_URL/shorebird/$engineRevision/artifacts_manifest.yaml
If it does, you may need to update the artifact list in config.dart and, if
the artifact is one we're providing, add it in
../../../scripts/write_artifact_manifest.py.
To do so, point Flutter at this proxy with FLUTTER_STORAGE_BASE_URL, run a
Shorebird/Flutter command that downloads the missing artifact, then add the
observed URL pattern to packages/artifact_proxy/lib/config.dart.
If you changed Flutter tool code while debugging, remove the flutter_tools snapshot:
cd bin/cache/flutter/bin/cache
rm flutter_tools.s*
- Run a Shorebird command (
shorebird runworks 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 artifacts_manifest.yaml
To generate a new artifacts_manifest.yaml for a specific Flutter engine
revision, use the workspace helper:
../../../scripts/write_artifact_manifest.py \
--flutter-engine-revision <flutter_engine_revision> \
--output artifacts_manifest.yaml
--flutter-engine-revision is the upstream Flutter engine revision used for
unchanged artifacts. Upload the generated file under the custom Shorebird engine
revision path shown below.
Then upload the artifacts_manifest.yaml to:
$SHOREBIRD_ARTIFACT_BASE_URL/shorebird/<shorebird_engine_revision>/artifacts_manifest.yaml
The GitHub CI engine artifacts include a mirror/ subtree for the override
files listed by this manifest. Copy the contents of that subtree to
$SHOREBIRD_ARTIFACT_BASE_URL alongside the manifest and patch-*.zip
artifacts.