Skip to content

[friction] support for local dev-channel deploy#340

Merged
pq merged 1 commit into
flutter:mainfrom
pq:fricion_localDevDeploy
Apr 23, 2026
Merged

[friction] support for local dev-channel deploy#340
pq merged 1 commit into
flutter:mainfrom
pq:fricion_localDevDeploy

Conversation

@pq
Copy link
Copy Markdown
Collaborator

@pq pq commented Apr 23, 2026

Support local dev channel deployments. (Fixes a config cache issue too.)

Changes:

  • Local Deployment Support: Refactors third_party/tool/kokoro/deploy.sh to check for a JB_MARKETPLACE_TOKEN environment variable. If set, it uses this token for uploading to JetBrains Marketplace, falling back to the Kokoro keystore path if not set.
  • Git Commit Fallback: Adds fallback logic in third_party/build.gradle.kts to use git rev-parse --short HEAD when the KOKORO_GIT_COMMIT environment variable is unset, but only for dev builds.
  • Configuration Cache Fixes:
    • Uses providers.exec instead of ProcessBuilder in build.gradle.kts to run the git command in a configuration cache compatible way.
    • Refactors the printVersion task to use a custom task class (PrintVersionTask) to avoid capturing outer script references, which was breaking the configuration cache.
  • Documentation: Adds a one-liner usage comment at the top of deploy.sh for quick copy-pasting.

Verification:

  • Verified that deploy.sh fails correctly without a token and attempts upload with a dummy token.
  • Verified that ./gradlew printVersion -Pdev successfully appends the commit hash and stores the configuration cache without errors.
  • Verified an upload:
image

Fixes: #339


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread third_party/build.gradle.kts
@pq pq requested a review from helin24 April 23, 2026 18:13
tasks.register("printVersion") {
doLast {
println(intellijPlatform.pluginConfiguration.version.get())
abstract class PrintVersionTask : org.gradle.api.DefaultTask() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't follow how this task is used - is it only to check the version?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

}
version = if (commitHash.isNotEmpty()) "$baseVersion-${commitHash.take(7)}" else baseVersion
} else {
version = providers.gradleProperty("pluginVersion")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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..

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss. I'm happy to make any changes to get this more clear. Thanks!

@pq pq merged commit 879af76 into flutter:main Apr 23, 2026
8 checks passed
@pq pq deleted the fricion_localDevDeploy branch April 23, 2026 23:40
pq added a commit to flutter/flutter-intellij that referenced this pull request May 6, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[friction] Support for local dev channel uploads

2 participants