Version 2.18.0-247.0.dev
Merge commit 'd2a3849f92ff99b29fcf3d8ab093f4a4f5df5446' into 'dev'
diff --git a/.gitignore b/.gitignore
index 9c674bd..9bd1379 100644
--- a/.gitignore
+++ b/.gitignore
@@ -75,9 +75,8 @@
packages
pubspec.lock
-# The top level package files (these are auto-generated per checkout)
+# The top level package file (this is auto-generated per checkout).
/.dart_tool/package_config.json
-/.packages
# Local pub storage
.pub
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 34479e4..4ac2208 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
## 2.19.0
+#### Dart command line
+
+- **Breaking change** [#46100](https://github.com/dart-lang/sdk/issues/46100):
+ The standalone `dartanalyzer` tool has been removed as previously
+ announced. `dartanalyzer` is replaced by the `dart analyze` command.
+
### Language
- **Breaking Change** [#48167](https://github.com/dart-lang/sdk/issues/48167):
diff --git a/DEPS b/DEPS
index 73593dd..6ba6564 100644
--- a/DEPS
+++ b/DEPS
@@ -108,7 +108,7 @@
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
"dart_style_rev": "d7b73536a8079331c888b7da539b80e6825270ea", # manually rev'd
- "dartdoc_rev": "d8195107d3e65e20094bb2ca0a8e8576e3a765bf",
+ "dartdoc_rev": "900432d8cb1e75c4f28c79d94c3036fd3b3ec21d",
"devtools_rev": "0aa619c42a68d6db4c94a7838121811aba8f5eb1",
"ffi_rev": "18b2b549d55009ff594600b04705ff6161681e07",
"file_rev": "0132eeedea2933513bf230513a766a8baeab0c4f",
@@ -135,7 +135,7 @@
"path_rev": "7a0ed40280345b1c11df4c700c71e590738f4257",
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
"pool_rev": "fa84ddd0e39f45bf3f09dcc5d6b9fbdda7820fef",
- "protobuf_rev": "7ac39080eb886e6eec55983dcba76e855c038701",
+ "protobuf_rev": "66593ca5a4d163b2f9a469a2b6368e12a710e550",
"pub_rev": "9bf4289d6fd5d6872a8929d6312bbd7098f3ea9c", # manually rev'd
"pub_semver_rev": "5c0b4bfd5ca57fe16f1319c581dc8c882e9b8cb2",
"root_certificates_rev": "692f6d6488af68e0121317a9c2c9eb393eb0ee50",
@@ -153,7 +153,7 @@
"test_descriptor_rev": "5ed5d7f6bf1191592995dcb8eedbbc17df69d386",
"test_process_rev": "3e695bcfeab551473ddc288970f345f30e5e1375",
"test_reflective_loader_rev": "8d0de01bbe852fea1f8e33aba907abcba50a8a1e",
- "test_rev": "6d656f60f2c486efce5f4f22ff00dbb037a825f1",
+ "test_rev": "ed73bb93b06280cd47108d202cd96bcf3494df65",
"typed_data_rev": "bb10b64f9a56b8fb49307d4465474bf1c1309f6d",
"usage_rev": "1d3c31e780af665fb796a27898a441fcb7d263db",
"vector_math_rev": "cdcee487bde4353a6ba7a29bfc7db3840426e50f",
@@ -161,7 +161,7 @@
"web_components_rev": "8f57dac273412a7172c8ade6f361b407e2e4ed02",
"web_socket_channel_rev": "99dbdc5769e19b9eeaf69449a59079153c6a8b1f",
"WebCore_rev": "bcb10901266c884e7b3740abc597ab95373ab55c",
- "webdev_rev": "b0a4059dcdfb3af2a011cbefc5eb21fb0cfd8032",
+ "webdev_rev": "9c4428472b04f50748ea4871829897cff43455a3",
"webdriver_rev": "e1a9ad671ee82e05eee463f922a34585ed2d2f15",
"webkit_inspection_protocol_rev": "57522d6b29d94903b765c757079d906555d5a171",
"yaml_edit_rev": "01589b3ce447b03aed991db49f1ec6445ad5476d",
diff --git a/README.dart-sdk b/README.dart-sdk
index 99dbb49..61ffe7e 100644
--- a/README.dart-sdk
+++ b/README.dart-sdk
@@ -9,7 +9,6 @@
dartaotruntime Minimal Dart runtime for running AOT modules
dart2js Dart to JavaScript production compiler
dartdevc Dart to Javascript development compiler
- dartanalyzer Dart static analyzer
dartdoc Dart documentation generator
include/ header files that define the Dart embedding API for use by
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index f49952a..c089234 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -478,7 +478,7 @@
* Deprecated `AstFactory.indexExpressionForTarget()`. Please use
`indexExpressionForTarget2` instead.
* Deprecated `ClassElement.isOrInheritsProxy` and `ClassElement.isProxy`. The
- `@proxy` annotation is deprecated in the langauge, and will be removed.
+ `@proxy` annotation is deprecated in the language, and will be removed.
* Added new error codes: BODY_MIGHT_COMPLETE_NORMALLY,
CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE,
DEFINITELY_UNASSIGNED_LATE_LOCAL_VARIABLE, LATE_FINAL_LOCAL_ALREADY_ASSIGNED,
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index 3bc7339..b249140 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -32,6 +32,7 @@
import '../js_ast/source_map_printer.dart'
show NodeEnd, NodeSpan, HoverComment, continueSourceMap;
import 'constants.dart';
+import 'future_or_normalizer.dart';
import 'js_interop.dart';
import 'js_typerep.dart';
import 'kernel_helpers.dart';
@@ -939,7 +940,7 @@
}
return _emitInterfaceType(t, emitNullability: emitNullability);
} else if (t is FutureOrType) {
- var normalizedType = _normalizeFutureOr(t);
+ var normalizedType = normalizeFutureOr(t, _coreTypes);
if (normalizedType is FutureOrType) {
_declareBeforeUse(_coreTypes.deprecatedFutureOrClass);
var typeRep = _emitFutureOrTypeWithArgument(
@@ -2911,64 +2912,6 @@
? visitNullType(const NullType())
: _emitNullabilityWrapper(runtimeCall('Never'), type.nullability);
- /// Normalizes `FutureOr` types.
- ///
- /// Any changes to the normalization logic here should be mirrored in the
- /// classes.dart runtime library method named `normalizeFutureOr`.
- DartType _normalizeFutureOr(FutureOrType futureOr) {
- var typeArgument = futureOr.typeArgument;
- if (typeArgument is DynamicType) {
- // FutureOr<dynamic> --> dynamic
- return typeArgument;
- }
- if (typeArgument is VoidType) {
- // FutureOr<void> --> void
- return typeArgument;
- }
-
- if (typeArgument is InterfaceType &&
- typeArgument.classNode == _coreTypes.objectClass) {
- // Normalize FutureOr of Object, Object?, Object*.
- var nullable = futureOr.nullability == Nullability.nullable ||
- typeArgument.nullability == Nullability.nullable;
- var legacy = futureOr.nullability == Nullability.legacy ||
- typeArgument.nullability == Nullability.legacy;
- var nullability = nullable
- ? Nullability.nullable
- : legacy
- ? Nullability.legacy
- : Nullability.nonNullable;
- return typeArgument.withDeclaredNullability(nullability);
- } else if (typeArgument is NeverType) {
- // FutureOr<Never> --> Future<Never>
- return InterfaceType(
- _coreTypes.futureClass, futureOr.nullability, [typeArgument]);
- } else if (typeArgument is NullType) {
- // FutureOr<Null> --> Future<Null>?
- return InterfaceType(
- _coreTypes.futureClass, Nullability.nullable, [typeArgument]);
- } else if (futureOr.declaredNullability == Nullability.nullable &&
- typeArgument.nullability == Nullability.nullable) {
- // FutureOr<T?>? --> FutureOr<T?>
- return futureOr.withDeclaredNullability(Nullability.nonNullable);
- }
- // The following is not part of the normalization spec but this is a
- // convenient place to perform this change of nullability consistently. This
- // only applies at compile-time and is not needed in the runtime version of
- // the FutureOr normalization.
- // FutureOr<T%>% --> FutureOr<T%>
- //
- // If the type argument has undetermined nullability the CFE propagates
- // it to the FutureOr type as well. In this case we can represent the
- // FutureOr type without any nullability wrappers and rely on the runtime to
- // handle the nullability of the instantiated type appropriately.
- if (futureOr.nullability == Nullability.undetermined &&
- typeArgument.nullability == Nullability.undetermined) {
- return futureOr.withDeclaredNullability(Nullability.nonNullable);
- }
- return futureOr;
- }
-
@override
js_ast.Expression visitInterfaceType(InterfaceType type) =>
_emitInterfaceType(type);
@@ -2979,7 +2922,7 @@
@override
js_ast.Expression visitFutureOrType(FutureOrType type) {
- var normalizedType = _normalizeFutureOr(type);
+ var normalizedType = normalizeFutureOr(type, _coreTypes);
return normalizedType is FutureOrType
? _emitFutureOrType(normalizedType)
: normalizedType.accept(this);
@@ -6534,7 +6477,7 @@
String? _annotationName(NamedNode node, bool Function(Expression) test) {
var annotation = findAnnotation(node, test);
return annotation != null
- ? _constants.getFieldValueFromAnnotation(annotation, 'name') as String
+ ? _constants.getFieldValueFromAnnotation(annotation, 'name') as String?
: null;
}
diff --git a/pkg/dev_compiler/lib/src/kernel/future_or_normalizer.dart b/pkg/dev_compiler/lib/src/kernel/future_or_normalizer.dart
new file mode 100644
index 0000000..492167b
--- /dev/null
+++ b/pkg/dev_compiler/lib/src/kernel/future_or_normalizer.dart
@@ -0,0 +1,91 @@
+// Copyright (c) 2022, 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 'package:kernel/ast.dart';
+import 'package:kernel/core_types.dart';
+import 'package:kernel/kernel.dart';
+import 'package:kernel/src/replacement_visitor.dart';
+
+/// Normalizes all `FutureOr` types found in [type].
+DartType normalizeFutureOr(DartType type, CoreTypes coreTypes) =>
+ type.accept1(_FutureOrNormalizer.instance(coreTypes), Variance.unrelated) ??
+ type;
+
+/// Visit methods returns a normalized version of `FutureOr` types or `null` if
+/// no normalization was applied.
+///
+/// The `variance` parameters in the visit methods are unused in this type
+/// replacement.
+///
+/// `FutureOr` types are normalized per the spec:
+/// https://github.com/dart-lang/language/blob/master/resources/type-system/normalization.md
+///
+/// Any changes to the normalization logic here should be mirrored in the
+/// classes.dart runtime library method named `normalizeFutureOr`.
+class _FutureOrNormalizer extends ReplacementVisitor {
+ final CoreTypes _coreTypes;
+
+ static _FutureOrNormalizer? _instance;
+
+ _FutureOrNormalizer._(this._coreTypes);
+
+ factory _FutureOrNormalizer.instance(CoreTypes coreTypes) =>
+ _instance ?? (_instance = _FutureOrNormalizer._(coreTypes));
+
+ @override
+ DartType? visitFutureOrType(FutureOrType futureOr, int variance) {
+ var normalizedTypeArg = futureOr.typeArgument.accept1(this, variance);
+ var typeArgument = normalizedTypeArg ?? futureOr.typeArgument;
+ if (typeArgument is DynamicType) {
+ // FutureOr<dynamic> --> dynamic
+ return typeArgument;
+ }
+ if (typeArgument is VoidType) {
+ // FutureOr<void> --> void
+ return typeArgument;
+ }
+
+ if (typeArgument is InterfaceType &&
+ typeArgument.classNode == _coreTypes.objectClass) {
+ // Normalize FutureOr of Object, Object?, Object*.
+ var nullable = futureOr.nullability == Nullability.nullable ||
+ typeArgument.nullability == Nullability.nullable;
+ var legacy = futureOr.nullability == Nullability.legacy ||
+ typeArgument.nullability == Nullability.legacy;
+ var nullability = nullable
+ ? Nullability.nullable
+ : legacy
+ ? Nullability.legacy
+ : Nullability.nonNullable;
+ return typeArgument.withDeclaredNullability(nullability);
+ } else if (typeArgument is NeverType) {
+ // FutureOr<Never> --> Future<Never>
+ return InterfaceType(
+ _coreTypes.futureClass, futureOr.nullability, [typeArgument]);
+ } else if (typeArgument is NullType) {
+ // FutureOr<Null> --> Future<Null>?
+ return InterfaceType(
+ _coreTypes.futureClass, Nullability.nullable, [typeArgument]);
+ } else if (futureOr.declaredNullability == Nullability.nullable &&
+ typeArgument.nullability == Nullability.nullable) {
+ // FutureOr<T?>? --> FutureOr<T?>
+ return futureOr.withDeclaredNullability(Nullability.nonNullable);
+ }
+ // The following is not part of the normalization spec but this is a
+ // convenient place to perform this change of nullability consistently. This
+ // only applies at compile-time and is not needed in the runtime version of
+ // the FutureOr normalization.
+ // FutureOr<T%>% --> FutureOr<T%>
+ //
+ // If the type argument has undetermined nullability the CFE propagates
+ // it to the FutureOr type as well. In this case we can represent the
+ // FutureOr type without any nullability wrappers and rely on the runtime to
+ // handle the nullability of the instantiated type appropriately.
+ if (futureOr.declaredNullability == Nullability.undetermined &&
+ typeArgument.declaredNullability == Nullability.undetermined) {
+ return futureOr.withDeclaredNullability(Nullability.nonNullable);
+ }
+ return null;
+ }
+}
diff --git a/pkg/language_versioning_2.7_test/pubspec.yaml b/pkg/language_versioning_2.7_test/pubspec.yaml
deleted file mode 100644
index 5ee0691..0000000
--- a/pkg/language_versioning_2.7_test/pubspec.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: language_versioning_2.7_test
-version: 1.0.0
-
-description: >
- Tests of language versioning.
- Stored as a package in order to have its own package configuration
- and default language version
-
-# This package is not intended for consumption on pub.dev. DO NOT publish.
-publish_to: none
-
-environment:
- sdk: '>=2.7.0 <3.0.0'
diff --git a/pkg/language_versioning_2.7_test/OWNERS b/pkg/language_versioning_2_7_test/OWNERS
similarity index 100%
rename from pkg/language_versioning_2.7_test/OWNERS
rename to pkg/language_versioning_2_7_test/OWNERS
diff --git a/pkg/language_versioning_2_7_test/analysis_options.yaml b/pkg/language_versioning_2_7_test/analysis_options.yaml
new file mode 100644
index 0000000..9cd4fca
--- /dev/null
+++ b/pkg/language_versioning_2_7_test/analysis_options.yaml
@@ -0,0 +1,8 @@
+include: package:lints/recommended.yaml
+
+analyzer:
+ exclude:
+ # These files have intentional errors.
+ - test/lib_ex2.7_test.dart
+ - test/lib_ex2.8_test.dart
+ - test/lib_im2.7_test.dart
diff --git a/pkg/language_versioning_2_7_test/pubspec.yaml b/pkg/language_versioning_2_7_test/pubspec.yaml
new file mode 100644
index 0000000..7e17122
--- /dev/null
+++ b/pkg/language_versioning_2_7_test/pubspec.yaml
@@ -0,0 +1,14 @@
+name: language_versioning_2_7_test
+version: 1.0.0
+description: >
+ Tests of language versioning. Stored as a package in order to have its own
+ package configuration and default language version
+
+# This package is not intended for consumption on pub.dev. DO NOT publish.
+publish_to: none
+
+environment:
+ sdk: '>=2.7.0 <3.0.0'
+
+dev_dependencies:
+ lints: any
diff --git a/pkg/language_versioning_2.7_test/test/lib_ex2.7_test.dart b/pkg/language_versioning_2_7_test/test/lib_ex2.7_test.dart
similarity index 95%
rename from pkg/language_versioning_2.7_test/test/lib_ex2.7_test.dart
rename to pkg/language_versioning_2_7_test/test/lib_ex2.7_test.dart
index e0756e3..10f7d4d 100644
--- a/pkg/language_versioning_2.7_test/test/lib_ex2.7_test.dart
+++ b/pkg/language_versioning_2_7_test/test/lib_ex2.7_test.dart
@@ -8,7 +8,7 @@
part "src/part_of_ex2.7_v_ex2.7.dart";
// Specification requires the part file to have
-// the same explicit langauge version marker
+// the same explicit language version marker
// as the including library,
// not just the same languge version.
part "src/part_of_ex2.7_v_im2.7.dart";
diff --git a/pkg/language_versioning_2.7_test/test/lib_ex2.8_test.dart b/pkg/language_versioning_2_7_test/test/lib_ex2.8_test.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/lib_ex2.8_test.dart
rename to pkg/language_versioning_2_7_test/test/lib_ex2.8_test.dart
diff --git a/pkg/language_versioning_2.7_test/test/lib_im2.7_test.dart b/pkg/language_versioning_2_7_test/test/lib_im2.7_test.dart
similarity index 95%
rename from pkg/language_versioning_2.7_test/test/lib_im2.7_test.dart
rename to pkg/language_versioning_2_7_test/test/lib_im2.7_test.dart
index 44d541e..646a282 100644
--- a/pkg/language_versioning_2.7_test/test/lib_im2.7_test.dart
+++ b/pkg/language_versioning_2_7_test/test/lib_im2.7_test.dart
@@ -7,7 +7,7 @@
part "src/part_of_im2.7_v_im2.7.dart";
// Specification requires the part fsrc/ile to have
-// the same explicit langauge version marker
+// the same explicit language version marker
// as the including library,
// not just the same languge version.
part "src/part_of_im2.7_v_ex2.7.dart";
diff --git a/pkg/language_versioning_2.7_test/test/src/part_of_ex2.7_v_ex2.7.dart b/pkg/language_versioning_2_7_test/test/src/part_of_ex2.7_v_ex2.7.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/src/part_of_ex2.7_v_ex2.7.dart
rename to pkg/language_versioning_2_7_test/test/src/part_of_ex2.7_v_ex2.7.dart
diff --git a/pkg/language_versioning_2.7_test/test/src/part_of_ex2.7_v_ex2.8.dart b/pkg/language_versioning_2_7_test/test/src/part_of_ex2.7_v_ex2.8.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/src/part_of_ex2.7_v_ex2.8.dart
rename to pkg/language_versioning_2_7_test/test/src/part_of_ex2.7_v_ex2.8.dart
diff --git a/pkg/language_versioning_2.7_test/test/src/part_of_ex2.7_v_im2.7.dart b/pkg/language_versioning_2_7_test/test/src/part_of_ex2.7_v_im2.7.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/src/part_of_ex2.7_v_im2.7.dart
rename to pkg/language_versioning_2_7_test/test/src/part_of_ex2.7_v_im2.7.dart
diff --git a/pkg/language_versioning_2.7_test/test/src/part_of_ex2.8_v_ex2.7.dart b/pkg/language_versioning_2_7_test/test/src/part_of_ex2.8_v_ex2.7.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/src/part_of_ex2.8_v_ex2.7.dart
rename to pkg/language_versioning_2_7_test/test/src/part_of_ex2.8_v_ex2.7.dart
diff --git a/pkg/language_versioning_2.7_test/test/src/part_of_ex2.8_v_ex2.8.dart b/pkg/language_versioning_2_7_test/test/src/part_of_ex2.8_v_ex2.8.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/src/part_of_ex2.8_v_ex2.8.dart
rename to pkg/language_versioning_2_7_test/test/src/part_of_ex2.8_v_ex2.8.dart
diff --git a/pkg/language_versioning_2.7_test/test/src/part_of_ex2.8_v_im2.7.dart b/pkg/language_versioning_2_7_test/test/src/part_of_ex2.8_v_im2.7.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/src/part_of_ex2.8_v_im2.7.dart
rename to pkg/language_versioning_2_7_test/test/src/part_of_ex2.8_v_im2.7.dart
diff --git a/pkg/language_versioning_2.7_test/test/src/part_of_im2.7_v_ex2.7.dart b/pkg/language_versioning_2_7_test/test/src/part_of_im2.7_v_ex2.7.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/src/part_of_im2.7_v_ex2.7.dart
rename to pkg/language_versioning_2_7_test/test/src/part_of_im2.7_v_ex2.7.dart
diff --git a/pkg/language_versioning_2.7_test/test/src/part_of_im2.7_v_ex2.8.dart b/pkg/language_versioning_2_7_test/test/src/part_of_im2.7_v_ex2.8.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/src/part_of_im2.7_v_ex2.8.dart
rename to pkg/language_versioning_2_7_test/test/src/part_of_im2.7_v_ex2.8.dart
diff --git a/pkg/language_versioning_2.7_test/test/src/part_of_im2.7_v_im2.7.dart b/pkg/language_versioning_2_7_test/test/src/part_of_im2.7_v_im2.7.dart
similarity index 100%
rename from pkg/language_versioning_2.7_test/test/src/part_of_im2.7_v_im2.7.dart
rename to pkg/language_versioning_2_7_test/test/src/part_of_im2.7_v_im2.7.dart
diff --git a/pkg/test_runner/lib/src/build_configurations.dart b/pkg/test_runner/lib/src/build_configurations.dart
index f684531..6ceccbc 100644
--- a/pkg/test_runner/lib/src/build_configurations.dart
+++ b/pkg/test_runner/lib/src/build_configurations.dart
@@ -85,7 +85,7 @@
Compiler.fasta: ['create_sdk', 'dartdevc_test', 'kernel_platform_files'],
Compiler.dartdevk: ['dartdevc_test'],
Compiler.dart2js: ['create_sdk'],
- Compiler.dart2analyzer: ['create_sdk'],
+ Compiler.dart2analyzer: ['create_sdk', 'utils/dartanalyzer'],
Compiler.specParser: <String>[],
};
final result = [...targetsForCompilers[compiler]!];
diff --git a/pkg/test_runner/lib/src/command.dart b/pkg/test_runner/lib/src/command.dart
index 07241ef..9f5933a 100644
--- a/pkg/test_runner/lib/src/command.dart
+++ b/pkg/test_runner/lib/src/command.dart
@@ -559,20 +559,37 @@
}
class AnalysisCommand extends ProcessCommand {
+ final List<String> commonAnalyzerCliArguments;
+
AnalysisCommand(String executable, List<String> arguments,
- Map<String, String> environmentOverrides, {int index = 0})
+ this.commonAnalyzerCliArguments, Map<String, String> environmentOverrides,
+ {int index = 0})
: super('dart2analyzer', executable, arguments, environmentOverrides,
null, index);
- AnalysisCommand indexedCopy(int index) =>
- AnalysisCommand(executable, arguments, environmentOverrides,
- index: index);
+ AnalysisCommand indexedCopy(int index) => AnalysisCommand(
+ executable, arguments, commonAnalyzerCliArguments, environmentOverrides,
+ index: index);
CommandOutput createOutput(int exitCode, bool timedOut, List<int> stdout,
List<int> stderr, Duration time, bool compilationSkipped,
[int? pid = 0]) =>
AnalysisCommandOutput(
this, exitCode, timedOut, stdout, stderr, time, compilationSkipped);
+
+ @override
+ List<String> get batchArguments => commonAnalyzerCliArguments;
+
+ @override
+ List<String> get nonBatchArguments => commonAnalyzerCliArguments;
+
+ @override
+ bool _equal(covariant ProcessCommand other) {
+ return other is AnalysisCommand &&
+ super._equal(other) &&
+ deepJsonCompare(
+ commonAnalyzerCliArguments, other.commonAnalyzerCliArguments);
+ }
}
class CompareAnalyzerCfeCommand extends ProcessCommand {
diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart
index 7af6b8e..85a8fc1 100644
--- a/pkg/test_runner/lib/src/compiler_configuration.dart
+++ b/pkg/test_runner/lib/src/compiler_configuration.dart
@@ -1188,6 +1188,7 @@
int get timeoutMultiplier => 4;
+ @override
String computeCompilerPath() {
var prefix = 'sdk/bin';
if (_isHostChecked) {
@@ -1196,31 +1197,55 @@
if (_useSdk) {
prefix = '${_configuration.buildDirectory}/dart-sdk/bin';
}
- return '$prefix/dartanalyzer$shellScriptExtension';
+ return '$prefix/dart$shellScriptExtension';
}
+ String computeAnalyzerCliPath() {
+ if (_useSdk) {
+ // This is a non-standard use of _useSdk, as dartanalyzer is not part
+ // of the SDK anymore, but there is no way to specify "use generated
+ // snapshot" directly.
+ return '${_configuration.buildDirectory}/gen/dartanalyzer.dart.snapshot';
+ }
+ return 'pkg/analyzer_cli/bin/analyzer.dart';
+ }
+
+ late final String compilerPath = computeCompilerPath();
+
+ // TODO(jcollins-g): move most of this into analyzer.dart defaults once it
+ // becomes an unpublished utility.
+ late final List<String> analyzerCliCommonArgs = [
+ ...computeDartOptions(),
+ computeAnalyzerCliPath(),
+ ...computeDartAnalyzerOptions(),
+ ];
+
+ /// [arguments].last must be the Dart source file.
CommandArtifact computeCompilationArtifact(String tempDir,
List<String> arguments, Map<String, String> environmentOverrides) {
- var args = [
- ...arguments,
+ // Since this is not a real compilation, no artifacts are produced.
+ return CommandArtifact([
+ AnalysisCommand(
+ compilerPath, arguments, analyzerCliCommonArgs, environmentOverrides)
+ ], arguments.last, 'application/vnd.dart');
+ }
+
+ /// Arguments passed to the Dart VM.
+ List<String> computeDartOptions() {
+ return _useSdk ? [] : ['--packages=.dart_tool/package_config.json'];
+ }
+
+ /// Arguments passed to the snapshot or CLI dart file.
+ List<String> computeDartAnalyzerOptions() {
+ return [
+ // analyzer.dart requires normalized path for dart-sdk.
+ if (!_useSdk) ...[
+ '--use-analysis-driver-memory-byte-store',
+ '--dart-sdk=${Repository.dir.absolute.join(Path('sdk'))}'
+ ],
if (_configuration.useAnalyzerCfe) '--use-cfe',
if (_configuration.useAnalyzerFastaParser) '--use-fasta-parser',
];
-
- // Since this is not a real compilation, no artifacts are produced.
- return CommandArtifact(
- [AnalysisCommand(computeCompilerPath(), args, environmentOverrides)],
- args.singleWhere((arg) => arg.endsWith('.dart')),
- 'application/vnd.dart');
- }
-
- List<String> computeRuntimeArguments(
- RuntimeConfiguration runtimeConfiguration,
- TestFile testFile,
- List<String> vmOptions,
- List<String> originalArguments,
- CommandArtifact? artifact) {
- return [];
}
}
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 1e4b8f1..087a32d 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -37,13 +37,11 @@
# ......dart.lib (import library for VM native extensions on Windows)
# ......dartaotruntime or dartaotruntime.exe (executable)
# ......dart2js
-# ......dartanalyzer
# ......dartdevc
# ......utils/gen_snapshot or utils/gen_snapshot.exe (if not on ia32)
# ......snapshots/
# ........analysis_server.dart.snapshot
# ........dart2js.dart.snapshot
-# ........dartanalyzer.dart.snapshot
# ........dartdev.dart.snapshot
# ........dartdev.dill
# ........dartdevc.dart.snapshot
@@ -88,9 +86,9 @@
# ......api_readme.md
# Scripts that go under bin/
-_platform_sdk_scripts = [ "dartanalyzer" ]
+_platform_sdk_scripts = []
-_full_sdk_scripts = [ "dartanalyzer" ]
+_full_sdk_scripts = []
# Snapshots that go under bin/snapshots
_platform_sdk_snapshots = [
@@ -99,10 +97,6 @@
"../utils/analysis_server",
],
[
- "dartanalyzer",
- "../utils/dartanalyzer:generate_dartanalyzer_snapshot",
- ],
- [
"dartdev",
"../utils/dartdev:dartdev",
],
diff --git a/sdk/bin/dartanalyzer b/sdk/bin/dartanalyzer
deleted file mode 100755
index 6525627..0000000
--- a/sdk/bin/dartanalyzer
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (c) 2013, 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.
-
-# Run dartanalyzer.dart on the Dart VM. This script assumes the Dart repo's
-# directory structure.
-
-echo "Warning: 'dartanalyzer' is deprecated. Please use 'dart analyze'." 1>&2
-
-function follow_links() {
- file="$1"
- while [ -h "$file" ]; do
- # On Mac OS, readlink -f doesn't work.
- file="$(readlink "$file")"
- done
- echo "$file"
-}
-
-# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
-PROG_NAME="$(follow_links "$BASH_SOURCE")"
-
-# Handle the case where dart-sdk/bin has been symlinked to.
-BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
-SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
-
-SDK_ARG="--dart-sdk=$SDK_DIR"
-
-DART="$BIN_DIR/dart"
-
-unset EXTRA_VM_OPTIONS
-declare -a EXTRA_VM_OPTIONS
-EXTRA_VM_OPTIONS+=("--enable_experiment=non-nullable")
-
-case $0 in
- *_developer)
- EXTRA_VM_OPTIONS+=('--enable-asserts')
- ;;
-esac
-
-# We allow extra vm options to be passed in through an environment variable.
-if [[ $DART_VM_OPTIONS ]]; then
- read -a OPTIONS <<< "$DART_VM_OPTIONS"
- EXTRA_VM_OPTIONS+=("${OPTIONS[@]}")
-fi
-
-DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)"
-
-ANALYZER="$DART_ROOT/pkg/analyzer_cli/bin/analyzer.dart"
-
-DEV_OPTIONS="--use-analysis-driver-memory-byte-store"
-
-exec "$DART" "--packages=$DART_ROOT/.packages" "${EXTRA_VM_OPTIONS[@]}" "$ANALYZER" "$DEV_OPTIONS" "$SDK_ARG" "$@"
diff --git a/sdk/bin/dartanalyzer.bat b/sdk/bin/dartanalyzer.bat
deleted file mode 100644
index 122e9b3..0000000
--- a/sdk/bin/dartanalyzer.bat
+++ /dev/null
@@ -1,72 +0,0 @@
-@echo off
-REM Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-REM for details. All rights reserved. Use of this source code is governed by a
-REM BSD-style license that can be found in the LICENSE file.
-
-echo Warning: 'dartanalyzer' is deprecated. Please use 'dart analyze'. 1>&2
-
-setlocal
-rem Handle the case where dart-sdk/bin has been symlinked to.
-set DIR_NAME_WITH_SLASH=%~dp0
-set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
-call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
-rem Get rid of surrounding quotes.
-for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
-
-set DART=%BIN_DIR%\dart
-
-rem Get absolute full name for SDK_DIR.
-for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi
-
-rem Remove trailing backslash if there is one
-if %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
-
-set SDK_ARG=--dart-sdk=%SDK_DIR%
-
-set EXTRA_VM_OPTIONS=
-
-if _%DARTANALYZER_DEVELOPER_MODE%_ == _1_ (
- set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% --enable_asserts
-)
-
-rem We allow extra vm options to be passed in through an environment variable.
-if not "_%DART_VM_OPTIONS%_" == "__" (
- set EXTRA_VM_OPTIONS=%EXTRA_VM_OPTIONS% %DART_VM_OPTIONS%
-)
-
-rem Get absolute full name for DART_ROOT.
-for %%i in ("%SDK_DIR%\..\") do set DART_ROOT=%%~fi
-
-rem Remove trailing backslash if there is one
-if %DART_ROOT:~-1%==\ set DART_ROOT=%DART_ROOT:~0,-1%
-
-set ANALYZER=%DART_ROOT%\pkg\analyzer_cli\bin\analyzer.dart
-
-"%DART%" "--packages=%DART_ROOT%\.packages" %EXTRA_VM_OPTIONS% "%ANALYZER%" "%SDK_ARG%" %*
-
-endlocal
-
-exit /b %errorlevel%
-
-rem Follow the symbolic links (junctions points) using `dir to determine the
-rem canonical path. Output with a link looks something like this
-rem
-rem 01/03/2013 10:11 PM <JUNCTION> abc def
-rem [c:\dart_bleeding\dart-repo.9\dart\out\ReleaseIA32\dart-sdk]
-rem
-rem So in the output of 'dir /a:l "targetdir"' we are looking for a filename
-rem surrounded by right angle bracket and left square bracket. Once we get
-rem the filename, which is name of the link, we recursively follow that.
-:follow_links
-setlocal
-for %%i in (%1) do set result=%%~fi
-set current=
-for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
- ^| %SystemRoot%\System32\find.exe "> %~n1 [" 2^>nul`) do (
- set current=%%i
-)
-if not "%current%"=="" call :follow_links "%current%", result
-endlocal & set %~2=%result%
-goto :eof
-
-:end
diff --git a/sdk/bin/dartanalyzer_sdk b/sdk/bin/dartanalyzer_sdk
deleted file mode 100755
index bb7b84a..0000000
--- a/sdk/bin/dartanalyzer_sdk
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env bash
-# Copyright (c) 2013, 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.
-
-# Run dartanalyzer.dart on the Dart VM. This script assumes the Dart SDK's
-# directory structure.
-
-echo "Warning: 'dartanalyzer' is deprecated. Please use 'dart analyze'." 1>&2
-
-function follow_links() {
- file="$1"
- while [ -h "$file" ]; do
- # On Mac OS, readlink -f doesn't work.
- file="$(readlink "$file")"
- done
- echo "$file"
-}
-
-# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
-PROG_NAME="$(follow_links "$BASH_SOURCE")"
-
-# Handle the case where dart-sdk/bin has been symlinked to.
-BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
-SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
-
-SDK_ARG="--dart-sdk=$SDK_DIR"
-
-SNAPSHOT="$BIN_DIR/snapshots/dartanalyzer.dart.snapshot"
-
-# We are running the snapshot in the built SDK.
-DART="$BIN_DIR/dart"
-exec "$DART" --enable_experiment=non-nullable "$SNAPSHOT" "$SDK_ARG" "$@"
diff --git a/sdk/bin/dartanalyzer_sdk.bat b/sdk/bin/dartanalyzer_sdk.bat
deleted file mode 100644
index 7b1e03b..0000000
--- a/sdk/bin/dartanalyzer_sdk.bat
+++ /dev/null
@@ -1,54 +0,0 @@
-@echo off
-REM Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-REM for details. All rights reserved. Use of this source code is governed by a
-REM BSD-style license that can be found in the LICENSE file.
-
-echo Warning: 'dartanalyzer' is deprecated. Please use 'dart analyze'. 1>&2
-
-setlocal
-rem Handle the case where dart-sdk/bin has been symlinked to.
-set DIR_NAME_WITH_SLASH=%~dp0
-set DIR_NAME=%DIR_NAME_WITH_SLASH:~0,-1%%
-call :follow_links "%DIR_NAME%", RETURNED_BIN_DIR
-rem Get rid of surrounding quotes.
-for %%i in ("%RETURNED_BIN_DIR%") do set BIN_DIR=%%~fi
-
-set DART=%BIN_DIR%\dart
-set SNAPSHOT=%BIN_DIR%\snapshots\dartanalyzer.dart.snapshot
-
-rem Get absolute full name for SDK_DIR.
-for %%i in ("%BIN_DIR%\..\") do set SDK_DIR=%%~fi
-
-rem Remove trailing backslash if there is one
-if %SDK_DIR:~-1%==\ set SDK_DIR=%SDK_DIR:~0,-1%
-
-set SDK_ARG=--dart-sdk=%SDK_DIR%
-
-"%DART%" "%SNAPSHOT%" "%SDK_ARG%" %*
-
-endlocal
-
-exit /b %errorlevel%
-
-rem Follow the symbolic links (junctions points) using `dir to determine the
-rem canonical path. Output with a link looks something like this
-rem
-rem 01/03/2013 10:11 PM <JUNCTION> abc def
-rem [c:\dart_bleeding\dart-repo.9\dart\out\ReleaseIA32\dart-sdk]
-rem
-rem So in the output of 'dir /a:l "targetdir"' we are looking for a filename
-rem surrounded by right angle bracket and left square bracket. Once we get
-rem the filename, which is name of the link, we recursively follow that.
-:follow_links
-setlocal
-for %%i in (%1) do set result=%%~fi
-set current=
-for /f "usebackq tokens=2 delims=[]" %%i in (`dir /a:l "%~dp1" 2^>nul ^
- ^| %SystemRoot%\System32\find.exe "> %~n1 [" 2^>nul`) do (
- set current=%%i
-)
-if not "%current%"=="" call :follow_links "%current%", result
-endlocal & set %~2=%result%
-goto :eof
-
-:end
diff --git a/tools/VERSION b/tools/VERSION
index 9bc408b..8bf1802 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 246
+PRERELEASE 247
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 15cb7565..efecd15 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -3262,7 +3262,8 @@
"name": "build dart",
"script": "tools/build.py",
"arguments": [
- "create_sdk"
+ "create_sdk",
+ "utils/dartanalyzer"
]
},
{
@@ -3352,7 +3353,8 @@
"name": "build dart",
"script": "tools/build.py",
"arguments": [
- "create_sdk"
+ "create_sdk",
+ "utils/dartanalyzer"
]
},
{
diff --git a/tools/dom/dom.py b/tools/dom/dom.py
index 9fcdf99..9db43b3 100755
--- a/tools/dom/dom.py
+++ b/tools/dom/dom.py
@@ -14,7 +14,7 @@
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import utils
-dart_out_dir = utils.GetBuildRoot(utils.GuessOS(), 'release', 'ia32')
+dart_out_dir = utils.GetBuildRoot(utils.GuessOS(), 'release', '64')
if utils.IsWindows():
dart_bin = os.path.join(dart_out_dir, 'dart.exe')
else:
@@ -43,10 +43,9 @@
def analyze():
''' Runs the dart analyzer. '''
return call([
- os.path.join(dart_out_dir, 'dart-sdk', 'bin', 'dartanalyzer'),
- os.path.join('tests', 'html', 'element_test.dart'),
- '--dart-sdk=sdk',
- '--show-package-warnings',
+ os.path.join(dart_out_dir, 'dart-sdk', 'bin', 'dart'),
+ 'analyze',
+ os.path.join('tests', 'lib', 'html', 'element_test.dart'),
])