mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
[macros] Fix basic macro compile with DDC, add e2e test.
The e2e test is for "how DDC is used in the language tests", more realistic setupts to follow. R=jakemac@google.com, nshahan@google.com Change-Id: Iece44740d2e4d91748a7deef59f4e18ad42ac853 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356241 Auto-Submit: Morgan :) <davidmorgan@google.com> Commit-Queue: Morgan :) <davidmorgan@google.com> Reviewed-by: Jake Macdonald <jakemac@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
8d47263f60
commit
6f7f571989
3 changed files with 33 additions and 2 deletions
|
@ -433,7 +433,7 @@ Map placeSourceMap(Map sourceMap, String sourceMapPath, String? multiRootScheme,
|
||||||
return sourcePath;
|
return sourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheme == 'org-dartlang-augmentation') {
|
if (scheme.startsWith('dart-macro+')) {
|
||||||
// TODO: https://github.com/dart-lang/sdk/issues/53913
|
// TODO: https://github.com/dart-lang/sdk/issues/53913
|
||||||
return sourcePath;
|
return sourcePath;
|
||||||
}
|
}
|
||||||
|
|
28
tests/macro_build/ddc_lt_test.dart
Normal file
28
tests/macro_build/ddc_lt_test.dart
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
|
||||||
|
// for details. All rights reserved. Use of this source code is governed by a
|
||||||
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'tester/tester.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
testMacroBuild([
|
||||||
|
r'$DART pub get',
|
||||||
|
r'$DART '
|
||||||
|
r'$DART_SDK_OUT/dart-sdk/bin/snapshots/dartdevc.dart.snapshot '
|
||||||
|
'-Dtest_runner.configuration=ddc-linux-chrome '
|
||||||
|
'--enable-experiment=macros '
|
||||||
|
'--sound-null-safety '
|
||||||
|
'-Dtest_runner.configuration=ddc-linux-chrome '
|
||||||
|
'--ignore-unrecognized-flags '
|
||||||
|
'--no-summarize '
|
||||||
|
'-o out.js '
|
||||||
|
'test/main.dart '
|
||||||
|
r'-s $DART_SDK_OUT/gen/utils/ddc/async_helper_outline.dill=async_helper '
|
||||||
|
r'-s $DART_SDK_OUT/gen/utils/ddc/expect_outline.dill=expect '
|
||||||
|
r'-s $DART_SDK_OUT/gen/utils/ddc/js_outline.dill=js '
|
||||||
|
r'-s $DART_SDK_OUT/gen/utils/ddc/meta_outline.dill=meta',
|
||||||
|
// Running out.js is nontrivial, just check if it contains the getter
|
||||||
|
// that the macro is supposed to add.
|
||||||
|
r'grep -q return$SPACE"OK" out.js',
|
||||||
|
]);
|
||||||
|
}
|
|
@ -73,7 +73,10 @@ runner to ensure they are built and not stale:
|
||||||
final commandParts = command
|
final commandParts = command
|
||||||
.replaceAll(r'$DART_SDK', dartSdkPath)
|
.replaceAll(r'$DART_SDK', dartSdkPath)
|
||||||
.replaceAll(r'$DART', dartPath)
|
.replaceAll(r'$DART', dartPath)
|
||||||
.split(' ');
|
.split(' ')
|
||||||
|
.map((c) => c.replaceAll(r'$SPACE', ' '))
|
||||||
|
.toList();
|
||||||
|
|
||||||
print('Running: ${commandParts.join(' ')}');
|
print('Running: ${commandParts.join(' ')}');
|
||||||
final process = await Process.start(
|
final process = await Process.start(
|
||||||
commandParts.first, commandParts.skip(1).toList(),
|
commandParts.first, commandParts.skip(1).toList(),
|
||||||
|
|
Loading…
Reference in a new issue