Skip to content

Commit c985ec9

Browse files
committed
check: pin flutter version
* Introduce a git submodule to pin the version of flutter SDK under `vendor/flutter`. * Use direnv to add `vendor/flutter/bin` to the current PATH so that subsequent calls to `flutter` on the shell uses the our pinned version of flutter. * Update instructions to use pinned version of flutter. * Pin to 18340ea16c of flutter which matches the current lowerbound version in pubsec.yaml (3.21.0-12.0.pre.26). NOTE: Users can still choose to opt-out and use their own version of flutter. This just provides a recommended and tested version on our CI.
1 parent 9044a9a commit c985ec9

File tree

7 files changed

+42
-21
lines changed

7 files changed

+42
-21
lines changed

.envrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is used by direnv to setup the environment when entering to
2+
# use vendored flutter SDK.
3+
4+
# Comment out the next line if you want to use your system flutter.
5+
PATH_add vendor/flutter/bin

.github/workflows/ci.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,26 @@ jobs:
66
check:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- name: Checkout repository
10+
uses: actions/checkout@v3
1011

11-
- name: Clone Flutter SDK
12+
- name: Checkout flutter submodule
1213
# We can't do a depth-1 clone, because we need the most recent tag
1314
# so that Flutter knows its version and sees the constraint in our
1415
# pubspec is satisfied. It's uncommon for flutter/flutter to go
15-
# more than 100 commits between tags. Fetch 1000 for good measure.
16+
# more than 100 commits between tags. Fetch 1000 for good measure.
17+
# This is also why we don't use the `with submodules` in the
18+
# `checkout` action.
1619
run: |
17-
git clone --depth=1000 https://github.com/flutter/flutter ~/flutter
18-
TZ=UTC git --git-dir ~/flutter/.git log -1 --format='%h | %ci | %s' --date=iso8601-local
19-
echo ~/flutter/bin >> "$GITHUB_PATH"
20+
git submodule update --init --depth 1000
21+
22+
- name: Add vendored flutter to PATH
23+
run: |
24+
echo vendor/flutter/bin >> "$GITHUB_PATH"
25+
26+
- name: Display version (Temporary)
27+
run: |
28+
flutter --version
2029
2130
- name: Download Flutter SDK artifacts (flutter precache)
2231
run: flutter precache --universal

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "vendor/flutter"]
2+
path = vendor/flutter
3+
url = https://github.com/flutter/flutter.git
4+
branch = main

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717

1818
// This much more focused automatic fix is helpful, though.
1919
"files.trimTrailingWhitespace": true,
20+
"dart.flutterSdkPaths": ["vendor/flutter"],
2021
}

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,21 @@ Two specific points to expand on:
9292

9393
### Setting up
9494

95-
1. Follow the [Flutter installation guide](https://docs.flutter.dev/get-started/install)
96-
for your platform of choice.
97-
2. Switch to the latest version of Flutter by running `flutter channel main`
98-
and `flutter upgrade` (see [Flutter version](#flutter-version) below).
95+
1. Install direnv (TBA), and set up its hook.
96+
2. Make sure you have initialized submodules by doing (do
97+
not do `--depth=1` as flutter relies on tags to know its version):
98+
99+
```sh
100+
git submodule update --init
101+
```
99102
3. Ensure Flutter is correctly configured by running `flutter doctor`.
100103
4. Start the app with `flutter run`, or from your IDE.
101104

102105

103106
### Flutter version
104107

105-
While in the beta phase, we use the latest Flutter from Flutter's
106-
main branch. Use `flutter channel main` and `flutter upgrade`.
107-
108-
We don't pin a specific version, because Flutter itself doesn't offer
109-
a way to do so. So far that hasn't been a problem. When it becomes one,
110-
we'll figure it out; there are several tools for this in the Flutter
111-
community. See [issue #15][].
112-
113-
[issue #15]: https://github.com/zulip/zulip-flutter/issues/15
114-
108+
We pin to a particular version of flutter SDK via git submodules in [vendor/flutter/](vendor/flutter/).
109+
If your local checkout of this repository does not have this submodule checked out at the same commit, the build may fail.
115110

116111
### Tests
117112

@@ -242,13 +237,16 @@ that's a good prompt to do this. We also do this when there's a
242237
new PR merged that we particularly want to take.
243238

244239
To update the version bounds:
240+
* First, make sure you're on the `main` channel, run:
241+
`flutter channel main`.
245242
* Use `flutter upgrade` to upgrade your local Flutter and Dart.
246243
* Update the lower bounds at `environment` in `pubspec.yaml`
247244
to the new versions, as seen in `flutter --version`.
248245
* Run `flutter pub get`, which will update `pubspec.lock`.
249246
* Make a quick check that things work: `tools/check`,
250247
and do a quick smoke-test of the app.
251-
* Commit and push the changes in `pubspec.yaml` and `pubspec.lock`.
248+
* Commit and push the changes in the submodule `vendor/flutter`,
249+
`pubspec.yaml` and `pubspec.lock`.
252250

253251

254252
### Upgrading dependencies

analysis_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
# packages, and plugins designed to encourage good coding practices.
1010
include: package:flutter_lints/flutter.yaml
1111

12+
analyzer:
13+
exclude: [vendor/**]
14+
1215
linter:
1316
# The lint rules applied to this project can be customized in the
1417
# section below to disable rules from the `package:flutter_lints/flutter.yaml`

vendor/flutter

Submodule flutter added at 18340ea

0 commit comments

Comments
 (0)