From 1405695675e66e136ccb95dd9f61f7f718051070 Mon Sep 17 00:00:00 2001 From: Jake Macdonald Date: Thu, 2 Nov 2023 21:00:41 +0000 Subject: [PATCH] Add sample directories to the package config. This allows the package imports in the tests to resolve. Change-Id: Idadca8b55516a5b5d1511ebc38c298479aa8eda0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333662 Commit-Queue: Nate Bosch Auto-Submit: Jake Macdonald Reviewed-by: Nate Bosch --- samples/ffi/http/pubspec.yaml | 2 +- samples/ffi/http/test/http_test.dart | 2 +- tools/generate_package_config.dart | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/samples/ffi/http/pubspec.yaml b/samples/ffi/http/pubspec.yaml index d648b942fa1..1e4f6a3de14 100644 --- a/samples/ffi/http/pubspec.yaml +++ b/samples/ffi/http/pubspec.yaml @@ -1,4 +1,4 @@ -name: http +name: http_sample version: 0.0.1 publish_to: none diff --git a/samples/ffi/http/test/http_test.dart b/samples/ffi/http/test/http_test.dart index 33e949e33a6..56b092bc8d1 100644 --- a/samples/ffi/http/test/http_test.dart +++ b/samples/ffi/http/test/http_test.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'package:test/test.dart'; -import 'package:http/http.dart'; +import 'package:http_sample/http.dart'; Future main() async { test('httpGet', () async { diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart index 127a530c17d..3f9a24207b0 100644 --- a/tools/generate_package_config.dart +++ b/tools/generate_package_config.dart @@ -57,13 +57,16 @@ void main(List args) { platform('pkg/vm/testcases'), ]; + var sampleDirs = listSubdirectories(platform('samples')).toList(); + // Validate that all the given directories exist. var hasMissingDirectories = false; for (var path in [ ...packageDirs, ...cfePackageDirs, ...feAnalyzerSharedPackageDirs, - ...pkgVmPackageDirs + ...pkgVmPackageDirs, + ...sampleDirs, ]) { if (!Directory(join(repoRoot, path)).existsSync()) { stderr.writeln("Unable to locate directory: '$path'."); @@ -81,6 +84,7 @@ void main(List args) { ...makeFeAnalyzerSharedPackageConfigs(feAnalyzerSharedPackageDirs), ...makeFrontendServerPackageConfigs(frontendServerPackageDirs), ...makePkgVmPackageConfigs(pkgVmPackageDirs), + ...makePackageConfigs(sampleDirs), ]; packages.sort((a, b) => a.name.compareTo(b.name));