Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve local artifact proxy use #2106

Open
felangel opened this issue May 15, 2024 · 0 comments
Open

feat: improve local artifact proxy use #2106

felangel opened this issue May 15, 2024 · 0 comments
Labels
tech debt Tasks that make the code cleaner, more maintainable, etc.

Comments

@felangel
Copy link
Contributor

Description

Currently, in order to use a local instance of the artifact proxy, we need to manually change two places:

  1. shorebird/third_party/flutter/bin/internal/shared.sh
# Either clones or pulls the Shorebird Flutter repository, depending on whether FLUTTER_PATH exists.
function update_flutter {
  if [[ -d "$FLUTTER_PATH" ]]; then
    git -C "$FLUTTER_PATH" fetch
  else
    git clone --filter=tree:0 https://github.com/shorebirdtech/flutter.git --no-checkout "$FLUTTER_PATH"
  fi
  # -c to avoid printing a warning about being in a detached head state.
  git -C "$FLUTTER_PATH" -c advice.detachedHead=false checkout "$FLUTTER_VERSION"
  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  
}
  1. shorebird/packages/shorebird_cli/lib/src/shorebird_process.dart
Map<String, String> _environmentOverrides({
    required String executable,
  }) {
    if (executable == 'flutter') {
      // If this ever changes we also need to update the `shorebird` shell
      // wrapper which downloads runs Flutter to fetch artifacts the first time.
-     return {'FLUTTER_STORAGE_BASE_URL': 'https://download.shorebird.dev'};
+     return {'FLUTTER_STORAGE_BASE_URL': 'http://localhost:8080'};
    }

    return {};
  }
}

In addition, the local build.gradle needs to be modified to allow http:

allprojects {
    repositories {
        google()
        mavenCentral()

+       all {
+           allowInsecureProtocol = true
+       }
    }
}

It would be nice to expose an environment variable that can be specified to override this without modifying the source e.g. SHOREBIRD_ARTIFACT_PROXY_URL.

Not sure about how to improve the build.gradle experience but open to suggestions.

@felangel felangel added the tech debt Tasks that make the code cleaner, more maintainable, etc. label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech debt Tasks that make the code cleaner, more maintainable, etc.
Projects
None yet
Development

No branches or pull requests

1 participant