28 Commits

Author SHA1 Message Date
Sven Gasterstädt
bdc2249933
Check that the windows architecture is 64-bit and not the process architecture (#174019)
Changes the platform detection for Windows - so that it can be invoked
from a 32-bit process when we are on a 64-bit system.
This is the case for example 'make' for windows which only comes with a
32-bit version.

_PROCESSOR_ARCHITEW6432_ is only set if the process architecture differs
from the platform architecture.

See
https://learn.microsoft.com/de-de/windows/win32/winprog64/wow64-implementation-details#environment-variables

Fixes https://github.com/flutter/flutter/issues/174017

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Matan Lurey <matanlurey@users.noreply.github.com>
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
2025-08-19 18:24:27 +00:00
Matan Lurey
d49370c230
Require 64-bit Windows (#171925)
Closes https://github.com/flutter/flutter/issues/62559.

We already do, but now we'll fail eagerly with a reasonable error
message.

Open to another way of doing this.
2025-07-11 15:27:12 +00:00
Matan Lurey
1d93621ed4
Ensure flutter_tools's pubspec.lock is newer than pubspec.yaml (#171300)
Closes https://github.com/flutter/flutter/issues/171024.
2025-06-27 22:26:32 +00:00
Jason Simmons
1af0c06704
Move the check for Git in the PATH into the top level Windows flutter.bat script (#169794)
The check for Git was originally in flutter.bat but was removed by
b84bfa3526
in order to improve performance.

It was later brought back in
bc4fc5ffb9.
However, that change added it to a subroutine in shared.bat. If Git is
not found then shared.bat would exit the shell process to stop retries
of the subroutine.

This PR moves the check back into flutter.bat and exits the script
without quitting the shell.

Fixes https://github.com/flutter/flutter/issues/169784
2025-06-05 00:36:07 +00:00
Matan Lurey
50d4d53c05
Update update_dart_sdk.sh|ps1 and related to use bin/cache/engine.stamp|realm. (#164498)
Towards https://github.com/flutter/flutter/issues/164315.
2025-03-03 20:58:16 +00:00
Mouad Debbar
006783101d
Limit number of retries when downloading the Dart SDK on Windows (#162411)
Disclaimer: I have no idea what I'm doing. I never wrote `.bat` code
before.

Fixes https://github.com/flutter/flutter/issues/162410
2025-01-30 20:40:19 +00:00
John McDole
021b2b3627
Ensure engine.version is up to date in the monorepo (#160668)
`update_dart_sdk.(ps1|sh)` is called too late and needs to be called
from `shared.(bat|sh)`.

Fixes #160640
2024-12-20 20:17:27 +00:00
Ben Konyi
bc4fc5ffb9
[ Tool ] Fix "Error: Unable to find git in your PATH" when Command Processor AutoRun registry key is defined (#159424)
cmd.exe will read from the AutoRun registry key at launch and execute
the commands listed in the key. Since `FOR /F IN (command) ...` causes a
new terminal instance to start, the AutoRun commands will be run again,
possibly changing the current working directory. In this case, the `git
rev-parse HEAD` check run in `shared.bat` could fail, which we were
assuming meant `git` was not on the user's PATH.

This change ensures that `git rev-parse HEAD` will always run in
%FLUTTER_ROOT% and explicitly adds a separate check for `git` using
`WHERE git` to more accurately determine if `git` is on the PATH.

Fixes https://github.com/flutter/flutter/issues/159018

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-12-02 18:45:14 +00:00
Christopher Fujino
b0bc023f24
[flutter_tools] do not try to build tool from dart.sh (#129186)
Fixes https://github.com/flutter/flutter/issues/121894
2023-11-03 00:42:25 +00:00
Christopher Fujino
3246808cd2
[flutter_tools] cache flutter sdk version to disk (#124558)
Fixes https://github.com/flutter/flutter/issues/112833

Most of the actual changes here are in [packages/flutter_tools/lib/src/version.dart](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605), while the rest is largely just addressing changes to the constructor of `FlutterVersion` which now has different dependencies.

This change makes `FlutterVersion` an interface with two concrete implementations:

1. `_FlutterVersionGit` which is mostly the previous implementation, and
2. `_FlutterVersionFromFile` which will read a new `.version.json` file from the root of the repo

The [`FlutterVersion` constructor](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605R70) is now a factory that first checks if `.version.json` exists, and if so returns an instance of `_FlutterVersionFromGit` else it returns the fallback `_FlutterVersionGit` which will end up writing `.version.json` so that we don't need to re-calculate the version on the next invocation.

`.version.json` will be deleted in the bash/batch entrypoints any time we need to rebuild he tool (this will usually be because the user did `flutter upgrade` or `flutter channel`, or manually changed the commit with git).
2023-06-15 00:20:30 +00:00
Christopher Fujino
7d767270b2
[flutter_tools] replace --no-analytics with --suppress-analytics (#123133)
[flutter_tools] replace --no-analytics with --suppress-analytics
2023-03-21 19:18:57 +00:00
Sigurd Meldgaard
1fd84f88e9
Always use user-level pub cache (#121802)
Use the pub cache resolved by pub itself.
To add packages to the flutter.zip download they are packaged as tar.gz and added to the pub-cache on first run by using  `pub cache preload`.
2023-03-13 08:38:17 +01:00
Sigurd Meldgaard
7a28078509
Use dart pub instead of dart __deprecated pub (#121605) 2023-03-06 11:23:12 +01:00
0x574859
1f85497efa
[flutter_tools] Add the NoProfile parameter to the PowerShell execution statement (#120786)
Use the NoProfile parameter of `pwsh.exe`/`PowerShell.exe` to start PowerShell without a profile to avoid executing the scripts in the user profile
2023-02-15 22:04:19 +00:00
jensjoha
9c588f32b8
Fix flutter tool crash on upgrade caused by app-jit (#111879)
Fix flutter tool crash on upgrade caused by app-jit
2022-09-20 08:05:18 +02:00
jensjoha
0abb98d8aa
Use app-jit snapshot for flutter tools (#111459) 2022-09-19 10:36:53 +02:00
jensjoha
b84bfa3526
Faster wrapper script on Windows (#111465) 2022-09-19 08:27:20 +02:00
moko256
45e212e74f
[Windows] Remove the usage of SETLOCAL ENABLEDELAYEDEXPANSION from bat scripts. (#106861) 2022-07-14 21:56:10 +00:00
Michael Thomsen
6e80ad0c9a
Switch from .packages to package_config (#106202) 2022-06-17 14:56:32 -04:00
Ian Hickson
2835c3f116
Consider the FLUTTER_TOOL_ARGS as part of the compilation stamp (#94951) 2022-01-10 15:20:05 -08:00
Sigurd Meldgaard
bce366203a
Stop calling top level pub (#89032)
* Use `dart __deprecated_pub` instead of `pub` to invoke pub from tools

The top level `pub` commmand has been deprecated and will print
a message. It is however implemented via the __deprecated_pub command
that prints no message.
2021-08-30 10:40:10 -07:00
Ben Konyi
357dcc96a3
Suppress 'Info: Compiling without sound null safety' message when building flutter_tools (#74740)
The CFE now logs to stdout by default when compiling a program which has
non-null-safe dependencies. Since flutter_tools has not yet migrated, we
need to suppress this message when compiling the tool.

Fixes https://github.com/flutter/flutter/issues/74366
2021-01-26 15:05:18 -08:00
Marcus Tomlinson
5f76bfb4af
Add the ability to inject a bootstrap script (#66897) 2020-09-29 19:24:21 +01:00
Jonah Williams
f1472e1fc4
[flutter_tools] only lock if an upgrade/download will be performed (linux/macos) and output building messages to stderr (#65422)
Currently an invocation of flutter/dart will always attempt to acquire a lock. This can pose problems for tools that attempt to run multiple dart/flutter instances.

Instead update the lock logic (on Linux/macOS) so that we only attempt to acquire it if an update/snapshot needs to be performed. To avoid repeatedly performing downloads/snapshots if multiple flutter/dart invocations are fired off concurrently when an update needs to be performed, do a second check of the download/snapshot condition after the lock is released.

Additionally, moves all of the building/debug output to stderr on both the bash and batch scripts. This allows machine mode consumption of the tool to ignore needing to parse/handle the rebuild messages.
2020-09-22 17:44:08 -07:00
Jonah Williams
1021a52f13
[flutter_tools] exit script if powershell version detection fails (#64773) 2020-08-31 11:23:06 -07:00
Jonah Williams
1b8e6b4236
[flutter_tools] fix exit label for batchfile (#62272)
move the final_exit label to the correct script location for the flutter/dart entrypoints.
2020-07-28 10:19:43 -07:00
Jonah Williams
8f59fdd20b
[flutter_tools] move mingit path addition back to flutter.bat (#59369)
fixes #57802

For users without git installed, flutter on windows bundles mingit. This needs to be added to the PATH in the main script, not the executed script, so that it is available to the tool
2020-06-15 09:43:10 -07:00
Christopher Fujino
06cd79d7df
[flutter_tools] Add additional bash entrypoint for running dart sdk directly (#57257) 2020-05-18 12:38:09 -07:00