Adds support for dev dependencies with build hooks in `dart test`.
TEST=pkg/dartdev/test/native_assets/test_test.dart
Change-Id: Ia05497ef5e1ec2bf11454fde8660b6626dcc524e
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432621
Reviewed-by: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Michael Goderbauer <goderbauer@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
- Adds `dart_mcp` and `dart_mcp_server` as DEPS
- Build an AOT snapshot for the dart_mcp_server executable
- Add top level `mcp-server` command to dartdev (hidden).
- I also did add an `--experimental-mcp-server` flag which is required for this command to actually work. We had initially discussed not doing this due to complexity but I was able to keep it completely scoped to just this command. I can remove it if there are strong opinions though.
Change-Id: I737a5625507f69a904ccd1012682764eb360a2c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430900
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
This PR enables native assets on the main and dev channel by default,
and make native assets available on the beta channel.
This PR removes the flag from invocations.
The helper packages (`package:hooks` and `package:code_assets`) will
stay 0.x for now, until the SDK constraint can be bumped to a beta
release and we're happy with the Dart API.
`dart build` is also made available as preview (without a flag on
the main, dev, and beta channels). We're still finalizing the spec for
this command. (https://github.com/dart-lang/sdk/issues/60730)
`dart test` will need https://github.com/dart-lang/test/pull/2501.
This means users will need to update their `package:test` dependency.
This PR refactors the way that invalid `package_config.json`s are
handled: they are now loaded in the dartdev commands and handled there.
Bug: https://github.com/dart-lang/sdk/issues/50565
Project: https://github.com/orgs/dart-lang/projects/99/
Change-Id: I7db9ff6d7196750cab9379a4605c6bbf89a974d7
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429920
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
`package:native_assets_cli` has been split up and
`package:native_assets_builder` has been renamed.
Change-Id: Ic9d5c21bb3c7ecf7924fdee6b4281153ad37fac5
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425504
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Roll for https://github.com/dart-lang/native/issues/2187.
The `NativeAssetsBuildRunner` now checks the pubspec for valid
user-defines, errors if they are not valid, and loads them.
So, delete all code in dartdev which did this.
Change-Id: I34f5bba3f4a7c4847c9cd33901c2f0a2f915ea22
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422720
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Bug: https://github.com/dart-lang/sdk/issues/60489
We can land a fix in `package:test` as well. However, projects
referring to an older version of test will not see such fixes.
So, land a workaround here that is picked up by older versions of test.
Change-Id: Ib26be2c0edc1bccf58b7231e05896cd55ac0cf19
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421741
Reviewed-by: Hossein Yousefi <yousefi@google.com>
- Add `target-arch` option to `dart compile exe|aot-snapshot`
- Add artifacts cache in `~/.dart`, and download gen_snapshot and
dartaotruntime from cloud storage if necessary
I've manually built an aot snapshot and exe on macOS ARM64 for Linux
X64, copied them over to a linux machine, and made sure they work.
Change-Id: I74dd581ecb573ff4069a2fe19f9d04aaa352538e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417801
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Don't split the `--extra-compiler-option` values by commas, to allow
passing `-D`/`--define` flags like `-DFOO=a, b` as one argument.
Fixes the dart2wasm failure in #60346.
Change-Id: I9c621f93d4bcd4e35926e495735c8d15a3bac212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416581
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
When parsing `--define` or `-D` arguments don't split the the value by
commas.
This is consistent with how dart2js handles `-D`, but inconsistent with
how VM handles it.
Example:
void main() {
print(const String.fromEnvironment("FOO"));
}
When compiled with `dart compile js -DFOO="a, b"` and run, dart2js
prints
a, b
VM prints (when compiled to exe)
a
Between these two, I think dart2js' behavior is more common, so we
follow dart2js.
Also update compile_benchmark to avoid splitting a single argument "a b"
into "a" and "b" when parsing the arguments and then splicing them back
before calling `dart2wasm`.
Also update the test runner and ddc batch mode argument parser to handle
splitting quoted arguments in `// dart2jsOption = ...` and the same
options for ddc and dart2wasm, by moving dart2js's `splitLine` to a new
library and reusing it in the test runner and ddc.
Fixes https://github.com/flutter/flutter/issues/164873.
See also https://github.com/dart-lang/sdk/issues/60341 for relevant
future work.
Change-Id: Idbdf69072fa212c8e4a390990577eb5a57b49e8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/415280
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
* In `_handleServerResponse`, use if-case with map patterns to avoid
casts and null checks and repeatedly fetching map values.
* Remove the castStringKeyedMap utility. After some other changes,
most call-sites passed in a Map, so then half of the utility is not
used. In the others, it seemed simplest to use `as Map` and `.cast()`
inline.
* Change some `dynamic` local variables to be `Object?` instead.
* Replace `DartdevCommand.project` getter and `_project` field with a
single final field.
* Remove unused properties from `Project` and unused `PackageConfig`
class.
* Remove associated tests.
Change-Id: I1f626ecc0e6e4d27ef24f65959fd4cb54fb5fc92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/412980
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Do not use the folder name as a proxy for the package name.
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Change-Id: I17664ea88a4e317d994d93ae84a5584078e5f94d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410360
Commit-Queue: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Moritz Sümmermann <mosum@google.com>
We want to avoid users passing `--enable-experiment=native-assets` on
stable and beta, as we'd like to move fast and break things on the
experiment. This aligns the experiment with how the experiment is
working in Flutter: main and dev branch only.
Before this CL, dartdev did not check experiment flags. Unknown
experiments would fail in the VM. After this CL, dartdev checks the
experiment flags and errors out early.
Change-Id: I875ea3272f4b67342da19ea2e4be329a4b380573
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406660
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This CL refactors the native assets implementation in Dartdev:
* It introduces a `DartNativeAssetsBuilder` that wraps all logic.
* The code now explicitly searches for a package config, and invokes
`pub get` if that file does not exist but a pubspec does.
(For most `dartdev` commands, `pub get` was already running later
implicitly.)
* The code now explicitly searches for a `runPackageName` and skips
building native assets if a package name cannot be found.
Change-Id: Ib5562fc64c3a756c99fee2e2daa763eb6fb1e855
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404583
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Hossein Yousefi <yousefi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This CL goes part of the way to support pub workspaces with native
assets.
This CL makes the `runPackageName` explicit in every invocation. This
ensures not too many native assets are built.
Moreover, this CL also makes `packageLayout` explicit, ensuring the
right packages config file is used.
A follow up PR should fix the checks w.r.t. the experiment not being
enabled.
For more info see:
https://github.com/dart-lang/native/pull/1911
TEST=pkg/dartdev/test/native
Change-Id: I3c3123526e320abb8bb094116e58bb4340c4c052
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405141
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Use VmInteropHandler for invoking sub commands instead of running them
in an isolate. Running sub commands in an isolate causes an increased footprint.
Changing this to use VmInteropHandler avoids the additional memory footprint.
Commands that need to use an AOT runtime for execution now exec the AOT
runtime and run the command.
TEST=ci
Change-Id: Ic96845b19951170effea3dd3619f798e2c72968a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402781
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>