Skip to content

Commit 68fdb16

Browse files
matanlureymboetger
authored andcommitted
Use $dartSdkVersion when creating "dummy" pubspec for create_api_docs (flutter#172327)
Closes flutter#70239. /cc @ievdokdm
1 parent 8e31ddf commit 68fdb16

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

dev/tools/create_api_docs.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ class Configurator {
284284
'homepage: https://flutter.dev',
285285
'version: 0.0.0',
286286
'environment:',
287-
" sdk: '>=3.2.0-0 <4.0.0'",
287+
" sdk: '^${FlutterInformation.instance.getDartSdkVersion()}'",
288288
'dependencies:',
289289
for (final String package in findPackageNames(filesystem)) ' $package:\n sdk: flutter',
290290
' $kPlatformIntegrationPackageName: 0.0.1',
@@ -1194,6 +1194,9 @@ class FlutterInformation {
11941194
/// Gets the name of the current branch in the Flutter framework in the repo.
11951195
String getBranchName() => getFlutterInformation()['branchName']! as String;
11961196

1197+
/// Gets the current Dart SDK version.
1198+
Version getDartSdkVersion() => getFlutterInformation()['dartSdkVersion']! as Version;
1199+
11971200
Map<String, Object>? _cachedFlutterInformation;
11981201

11991202
/// Gets a Map of various kinds of information about the Flutter repo.

dev/tools/test/create_api_docs_test.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,15 +338,13 @@ void main() {
338338
test('.generateConfiguration generates pubspec.yaml', () async {
339339
configurator.generateConfiguration();
340340
expect(packageRoot.childFile('pubspec.yaml').existsSync(), isTrue);
341-
expect(packageRoot.childFile('pubspec.yaml').readAsStringSync(), contains('flutter_gpu:'));
342-
expect(
343-
packageRoot.childFile('pubspec.yaml').readAsStringSync(),
344-
contains('dependency_overrides:'),
345-
);
346-
expect(
347-
packageRoot.childFile('pubspec.yaml').readAsStringSync(),
348-
contains('platform_integration:'),
349-
);
341+
342+
final String pubspecContents = packageRoot.childFile('pubspec.yaml').readAsStringSync();
343+
344+
expect(pubspecContents, contains('flutter_gpu:'));
345+
expect(pubspecContents, contains("sdk: '^2.14.0-360.0.dev'"));
346+
expect(pubspecContents, contains('dependency_overrides:'));
347+
expect(pubspecContents, contains('platform_integration:'));
350348
});
351349

352350
test('.generateConfiguration generates fake lib', () async {

0 commit comments

Comments
 (0)