Skip to content

Commit edde813

Browse files
dcharkesCommit Queue
authored andcommitted
[deps] Roll dart-lang/native
The dart-lang/native packages do no longer have path dependencies in them. So instead of rewriting those paths in the tests, write dependency overrides into the test projects. To simplify path handling, use absolute paths in the dependency overrides. Change-Id: I0db8529543a280fe937465e9a9c9aa4bb8fd0ee1 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/+/420900 Auto-Submit: Daco Harkes <[email protected]> Reviewed-by: Moritz Sümmermann <[email protected]> Commit-Queue: Moritz Sümmermann <[email protected]>
1 parent 72264d1 commit edde813

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ vars = {
137137
"i18n_rev": "de1943629469719bf34269bf90fcdbe9334a73f3",
138138
"leak_tracker_rev": "f5620600a5ce1c44f65ddaa02001e200b096e14c", # rolled manually
139139
"material_color_utilities_rev": "799b6ba2f3f1c28c67cc7e0b4f18e0c7d7f3c03e",
140-
"native_rev": "4928765d7681ad8a4211c5977afd2f93f50b3f65", # rolled manually while native assets are experimental
140+
"native_rev": "4e71c281e4e3c262b28b7ab5b3306e4029b78b1c", # rolled manually while native assets are experimental
141141
"protobuf_rev": "1aaa332af75c61ff32739821f7ec52186ff18d4c",
142142
"pub_rev": "b2c03b448a47fdd52800609b9222cd737be3a934", # rolled manually
143143
"shelf_rev": "082d3ac2d13a98700d8148e8fad8f3e12a6fd0e1",

pkg/dartdev/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ dev_dependencies:
4545
lints: any
4646
pub_semver: any
4747
test: any
48+
yaml_edit: any

pkg/dartdev/test/native_assets/helpers.dart

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'package:native_assets_builder/src/utils/run_process.dart'
1313
as run_process;
1414
import 'package:test/test.dart';
1515
import 'package:yaml/yaml.dart';
16+
import 'package:yaml_edit/yaml_edit.dart';
1617

1718
extension UriExtension on Uri {
1819
Uri get parent {
@@ -67,7 +68,7 @@ Future<run_process.RunProcessResult> runProcess({
6768
);
6869

6970
Future<void> copyTestProjects(
70-
Uri copyTargetUri, Logger logger, Uri packageLocation) async {
71+
Uri copyTargetUri, Logger logger, Uri packageLocation, Uri sdkRoot) async {
7172
// Reuse the test projects from `pkg:native`.
7273
final testProjectsUri = packageLocation.resolve('test_data/');
7374
final manifestUri = testProjectsUri.resolve('manifest.yaml');
@@ -101,10 +102,31 @@ Future<void> copyTestProjects(
101102
final sourceFile = File.fromUri(testProjectsUri.resolveUri(pathToModify));
102103
final targetUri = copyTargetUri.resolveUri(pathToModify);
103104
final sourceString = await sourceFile.readAsString();
104-
final modifiedString = sourceString.replaceAll(
105-
'path: ../../',
106-
'path: ${packageLocation.toFilePath().replaceAll('\\', '/')}',
107-
);
105+
final pubspec = YamlEditor(sourceString);
106+
if ((loadYamlNode(sourceString) as Map)['resolution'] != null) {
107+
pubspec.remove(['resolution']);
108+
}
109+
pubspec.update([
110+
'dependency_overrides'
111+
], {
112+
'native_assets_cli': {
113+
'path': sdkRoot
114+
.resolve('third_party/pkg/native/pkgs/native_assets_cli/')
115+
.toFilePath(),
116+
},
117+
'native_toolchain_c': {
118+
'path': sdkRoot
119+
.resolve('third_party/pkg/native/pkgs/native_toolchain_c/')
120+
.toFilePath(),
121+
},
122+
'meta': {
123+
'path': sdkRoot.resolve('pkg/meta/').toFilePath(),
124+
},
125+
'record_use': {
126+
'path': sdkRoot.resolve('pkg/record_use/').toFilePath(),
127+
},
128+
});
129+
final modifiedString = pubspec.toString();
108130
await File.fromUri(targetUri).writeAsString(modifiedString);
109131
}
110132

@@ -195,6 +217,7 @@ Future<void> nativeAssetsTest(
195217
],
196218
Platform.script.resolve(
197219
'../../../../third_party/pkg/native/pkgs/native_assets_builder/'),
220+
Platform.script.resolve('../../../../'),
198221
);
199222

200223
Future<void> recordUseTest(
@@ -208,18 +231,20 @@ Future<void> recordUseTest(
208231
fun,
209232
const ['drop_dylib_recording'],
210233
Platform.script.resolve('../../../record_use/'),
234+
Platform.script.resolve('../../../../'),
211235
);
212236

213237
Future<void> runPackageTest(
214238
String packageUnderTest,
215239
bool skipPubGet,
216240
Future<void> Function(Uri) fun,
217241
List<String> validPackages,
218-
Uri packageLocation,
242+
Uri packageLocation,
243+
Uri sdkRoot
219244
) async {
220245
assert(validPackages.contains(packageUnderTest));
221246
return await inTempDir((tempUri) async {
222-
await copyTestProjects(tempUri, logger, packageLocation);
247+
await copyTestProjects(tempUri, logger, packageLocation, sdkRoot);
223248
final packageUri = tempUri.resolve('$packageUnderTest/');
224249
if (!skipPubGet) {
225250
await runPubGet(workingDirectory: packageUri, logger: logger);

pkg/record_use/test_data/drop_dylib_recording/pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ dev_dependencies:
2121
lints: any
2222
test: any
2323

24-
2524
dependency_overrides:
2625
meta:
2726
path: ../../../meta/

0 commit comments

Comments
 (0)