[friction] support for local dev-channel deploy#340
Conversation
There was a problem hiding this comment.
Code Review
This pull request improves the build and deployment process by enhancing commit hash retrieval, refactoring the printVersion Gradle task for better configuration, and adding support for local deployment via environment variables. A recommendation was made to use providers.environmentVariable instead of System.getenv in the build script to maintain compatibility with Gradle's configuration cache.
| tasks.register("printVersion") { | ||
| doLast { | ||
| println(intellijPlatform.pluginConfiguration.version.get()) | ||
| abstract class PrintVersionTask : org.gradle.api.DefaultTask() { |
There was a problem hiding this comment.
I don't follow how this task is used - is it only to check the version?
| } | ||
| version = if (commitHash.isNotEmpty()) "$baseVersion-${commitHash.take(7)}" else baseVersion | ||
| } else { | ||
| version = providers.gradleProperty("pluginVersion") |
There was a problem hiding this comment.
This would be for a follow up, but it's confusing that there's a pluginVersion in gradle.properties too (and there's a TODO there to get it from changelog similar to for the dev version. Maybe change that soon since you're working on versioning already..
There was a problem hiding this comment.
Let's discuss. I'm happy to make any changes to get this more clear. Thanks!
Adds support for local `dev` channel builds and deployments to the JetBrains Marketplace for `flutter-intellij`, comparable to what we did for the Dart plugin: flutter/dart-intellij-third-party#340. Along the way we found some gradle issues and curl failures and added safeguards for Gradle Configuration Cache invalidation and more verbose local diagnostics. Fixes: #8925 --- ### Key Changes #### 1. Gradle Build & Versioning (`build.gradle.kts`) - **Dynamic Git Hash Fallback**: Dynamically resolves the Git commit hash prefix (`git rev-parse --short HEAD`) as part of the `dev` channel version calculation if the `KOKORO_GIT_COMMIT` environment variable is absent. - **Configuration-Cache Safety**: Refactored the `dev`, `release`, and `singleIdeVersion` project property lookups to use the modern Gradle `providers.gradleProperty(...)` API. This registers properties as configuration inputs, ensuring correct cache invalidation when switching project parameters. - **Dynamic Version Inspection**: Registered a new, configuration-cache safe `printVersion` task to easily query the calculated plugin version from the command line. - **Robust Catching**: Handled potential compilation/CLI environment crashes gracefully (e.g., if git is not present or executing outside of a git clone) with comprehensive code comments. #### 2. Kokoro Deployment Pipeline (`tool/kokoro/deploy.sh`) - **Token Injection**: Added support for the `JB_MARKETPLACE_TOKEN` environment variable to allow local authorization token injection. - **Visible Debugging**: Removed the `--fail` option and replaced it with `curl -i` to ensure full JetBrains Marketplace error payloads are printed directly to standard output on error rather than hidden behind generic curl exit codes. - **Robust Zip Path Matching**: Fallback to `flutter-intellij.zip` automatically if not running inside the Kokoro pipeline directory structure. - **Local Setup Quality-of-Life**: Updated `setup.sh` to bypass cloning the Flutter SDK if `../flutter` is already present locally, making local pipeline test runs pain-free. --- ### Verification & Testing #### 1. Version calculation matches local Git state: ```bash $ ./gradlew printVersion -Pdev flutterPluginVersion: 93.0.0-dev.20260506-9a1a847 ... > Task :printVersion 93.0.0-dev.20260506-9a1a847 ``` **Verified deployment** 👍 : <img width="2314" height="772" alt="image" src="https://github.com/user-attachments/assets/0059bb70-31a7-4401-bcd1-20077f56431b" /> --- Review the contribution guidelines below: - [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR. - [x] I've included the required information in the description above. - [x] My up-to-date information is in the `AUTHORS` file. - [x] I've updated `CHANGELOG.md` if appropriate. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide](../CONTRIBUTING.md) and the [Flutter organization contributor guide]([https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](#8098)). </details>
Support local dev channel deployments. (Fixes a config cache issue too.)
Changes:
third_party/tool/kokoro/deploy.shto check for aJB_MARKETPLACE_TOKENenvironment variable. If set, it uses this token for uploading to JetBrains Marketplace, falling back to the Kokoro keystore path if not set.third_party/build.gradle.ktsto usegit rev-parse --short HEADwhen theKOKORO_GIT_COMMITenvironment variable is unset, but only fordevbuilds.providers.execinstead ofProcessBuilderinbuild.gradle.ktsto run the git command in a configuration cache compatible way.printVersiontask to use a custom task class (PrintVersionTask) to avoid capturing outer script references, which was breaking the configuration cache.deploy.shfor quick copy-pasting.Verification:
deploy.shfails correctly without a token and attempts upload with a dummy token../gradlew printVersion -Pdevsuccessfully appends the commit hash and stores the configuration cache without errors.Fixes: #339
Contribution guidelines:
dart format.