Skip to content

Update the release script to take into account pubspec_overrides.yaml #2080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions tool/release.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void main(List<String> arguments) async {

int exitCode;
if (isReset == true) {
exitCode = runReset(
exitCode = await runReset(
package: package,
newVersion: newVersion,
);
Expand All @@ -68,7 +68,7 @@ void main(List<String> arguments) async {
}
}

int runReset({
Future<int> runReset({
required String package,
String? newVersion,
}) {
Expand All @@ -81,7 +81,13 @@ int runReset({
Current version is $currentVersion.
''',
);
return 1;
return Future.value(1);
}

// Add the dependency overrides of DWDS back for webdev:
if (package == 'webdev') {
_updateOverrides('webdev', includeOverrides: true);
_updateOverrides('test_common', includeOverrides: true);
}

// Update the version strings in CHANGELOG and pubspec.yaml.
Expand All @@ -92,7 +98,9 @@ int runReset({
isReset: true,
);

return 0;
// Build the package.
final exitCode = _buildPackage(package);
return exitCode;
}

Future<int> runRelease({
Expand All @@ -116,10 +124,15 @@ Future<int> runRelease({
}
}

// Update the pinned version of DWDS for webdev releases.
if (package == 'webdev') {
// Update the pinned version of DWDS for webdev releases.
_logInfo('Updating pinned version of DWDS.');
await _updateDwdsPin(package);
await _updateDwdsPin('webdev');
await _updateDwdsPin('test_common');
// Remove the dependency overrides of DWDS for webdev releases:
_logInfo('Removing dependency overrides of DWDS.');
_updateOverrides('webdev', includeOverrides: false);
_updateOverrides('test_common', includeOverrides: false);
}

// Run dart pub upgrade.
Expand Down Expand Up @@ -175,6 +188,19 @@ Future<int> _buildPackage(String package) async {
return buildProcess.exitCode;
}

void _updateOverrides(
String package, {
required bool includeOverrides,
}) {
final overridesFilePath = '../$package/pubspec_overrides.yaml';
final noOverridesFilePath = '../$package/ignore_pubspec_overrides.yaml';
if (includeOverrides) {
File(noOverridesFilePath).rename(overridesFilePath);
} else {
File(overridesFilePath).rename(noOverridesFilePath);
}
}

void _updateVersionStrings(
String package, {
required String nextVersion,
Expand Down