Skip to content

Commit bd8f7ed

Browse files
authored
Use dartdoc 8.3.0 for packages that depend on macros. (#8334)
1 parent 9a5a4e3 commit bd8f7ed

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ Important changes to data models, configuration, and migrations between each
22
AppEngine version, listed here to ease deployment and troubleshooting.
33

44
## Next Release (replace with git tag when deployed)
5+
* Bump runtimeVersion to `2024.11.26`.
6+
* `dartdoc 8.3.0` is used for packages depending on `package:macros`.
57

68
## `20241121t150900-all`
79
* Bump runtimeVersion to `2024.11.21`.

app/lib/shared/versions.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ final RegExp runtimeVersionPattern = RegExp(r'^\d{4}\.\d{2}\.\d{2}$');
2424
/// when the version switch happens.
2525
const _acceptedRuntimeVersions = <String>[
2626
// The current [runtimeVersion].
27-
'2024.11.21',
27+
'2024.11.26',
2828
// Fallback runtime versions.
29+
'2024.11.21',
2930
'2024.11.18',
30-
'2024.11.11',
3131
];
3232

3333
/// Sets the current runtime versions.

pkg/pub_worker/lib/src/bin/pana_wrapper.dart

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ Future<void> main(List<String> args) async {
9999
final pkgDir = Directory(p.join(pkgDownloadDir.path, '$package-$version'));
100100
final detected = await _detectSdks(pkgDir.path);
101101

102+
final dartdocVersion =
103+
(await _overrideDartdocVersion(pkgDir.path)) ?? _dartdocVersion;
104+
102105
final toolEnv = await ToolEnvironment.create(
103106
dartSdkConfig: SdkConfig(
104107
rootPath: detected.dartSdkPath,
@@ -109,7 +112,7 @@ Future<void> main(List<String> args) async {
109112
configHomePath: _configHomePath('flutter', detected.configKind),
110113
),
111114
pubCacheDir: pubCache,
112-
dartdocVersion: _dartdocVersion,
115+
dartdocVersion: dartdocVersion,
113116
);
114117

115118
//final dartdocOutputDir =
@@ -191,6 +194,21 @@ String? _configHomePath(String sdk, String kind) {
191194
return path;
192195
}
193196

197+
/// Detects the package dependencies and overrides the dartdoc version to
198+
/// 8.3.0 if macros is being used.
199+
///
200+
/// TODO: remove this after the 3.6 SDK is released.
201+
Future<String?> _overrideDartdocVersion(String pkgDir) async {
202+
final pubspecFile = File(p.join(pkgDir, 'pubspec.yaml'));
203+
final pubspec = Pubspec.parseYaml(await pubspecFile.readAsString());
204+
final minMacrosVersion = pubspec.getDependencyContraintRangeMin('macros');
205+
if (minMacrosVersion != null &&
206+
minMacrosVersion.compareTo(Version.parse('0.1.3-main.0')) >= 0) {
207+
return '8.3.0';
208+
}
209+
return null;
210+
}
211+
194212
Future<({String configKind, String? dartSdkPath, String? flutterSdkPath})>
195213
_detectSdks(String pkgDir) async {
196214
// Load the pubspec so we detect which SDK to use for analysis

0 commit comments

Comments
 (0)