Skip to content

Commit

Permalink
Use dartdoc 8.3.0 for packages that depend on macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos committed Nov 25, 2024
1 parent 031c368 commit d9a61fa
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Important changes to data models, configuration, and migrations between each
AppEngine version, listed here to ease deployment and troubleshooting.

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

## `20241121t150900-all`
* Bump runtimeVersion to `2024.11.21`.
Expand Down
4 changes: 2 additions & 2 deletions app/lib/shared/versions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ final RegExp runtimeVersionPattern = RegExp(r'^\d{4}\.\d{2}\.\d{2}$');
/// when the version switch happens.
const _acceptedRuntimeVersions = <String>[
// The current [runtimeVersion].
'2024.11.21',
'2024.11.25',
// Fallback runtime versions.
'2024.11.21',
'2024.11.18',
'2024.11.11',
];

/// Sets the current runtime versions.
Expand Down
20 changes: 19 additions & 1 deletion pkg/pub_worker/lib/src/bin/pana_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ Future<void> main(List<String> args) async {
final pkgDir = Directory(p.join(pkgDownloadDir.path, '$package-$version'));
final detected = await _detectSdks(pkgDir.path);

final dartdocVersion =
(await _overrideDartdocVersion(pkgDir.path)) ?? _dartdocVersion;

final toolEnv = await ToolEnvironment.create(
dartSdkConfig: SdkConfig(
rootPath: detected.dartSdkPath,
Expand All @@ -109,7 +112,7 @@ Future<void> main(List<String> args) async {
configHomePath: _configHomePath('flutter', detected.configKind),
),
pubCacheDir: pubCache,
dartdocVersion: _dartdocVersion,
dartdocVersion: dartdocVersion,
);

//final dartdocOutputDir =
Expand Down Expand Up @@ -191,6 +194,21 @@ String? _configHomePath(String sdk, String kind) {
return path;
}

/// Detects the package dependencies and overrides the dartdoc version to
/// 8.3.0 if macros is being used.
///
/// TODO: remove this after the 3.6 SDK is released.
Future<String?> _overrideDartdocVersion(String pkgDir) async {
final pubspecFile = File(p.join(pkgDir, 'pubspec.yaml'));
final pubspec = Pubspec.parseYaml(await pubspecFile.readAsString());
final minMacrosVersion = pubspec.getDependencyContraintRangeMin('macros');
if (minMacrosVersion != null &&
minMacrosVersion.compareTo(Version.parse('0.1.3-main.0')) >= 0) {
return '8.3.0';
}
return null;
}

Future<({String configKind, String? dartSdkPath, String? flutterSdkPath})>
_detectSdks(String pkgDir) async {
// Load the pubspec so we detect which SDK to use for analysis
Expand Down

0 comments on commit d9a61fa

Please sign in to comment.