Skip to content

Commit 5d03858

Browse files
authored
[tool] Exempt test_apps/ from version and changelog checks (flutter#13255)
Follow-up to flutter/packages#12686. flutter/packages#12686 added `packages/material_ui/test_apps/a11y_assessments` and marked [`test_apps/` as ignored in `.pubignore`](https://github.com/flutter/packages/blob/ac2db9cfeaf69c5064739e0d477ef8cb9c19cd35/packages/material_ui/test_apps/.pubignore#L1-L2), so [`ValidateCommand.runForPackage`](https://github.com/flutter/packages/blob/ac2db9cfeaf69c5064739e0d477ef8cb9c19cd35/script/tool/lib/src/validate_command.dart#L176-L178) skips `test_apps/*` subpackages via `isPubIgnored`. However, when `validate --check-for-missing-changes` runs on the enclosing `material_ui` package, `checkPackageChangeState` only exempted `test_apps/a11y_assessments/test/...` via `pathComponents.contains('test')` and flagged `test_apps/a11y_assessments/lib/...` as requiring a version and `CHANGELOG.md` update: ``` The following packages had errors: packages/material_ui: Missing version change ``` Example CI failures: - https://ci.chromium.org/b/8668024481194498497 (on flutter/packages#13159) This PR adds `pathComponents.first == 'test_apps'` to `_isTestChange` in `package_state_utils.dart`.
1 parent 3675456 commit 5d03858

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

‎script/tool/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## NEXT
2+
3+
* Exempts `test_apps/` from requiring version and changelog changes.
4+
15
## 0.14.4+4
26

37
* Uses `flutter pub` instead of `dart pub` for non-Flutter packages that depend

‎script/tool/lib/src/common/package_state_utils.dart‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ bool _isTestChange(List<String> pathComponents) {
135135
pathComponents.contains('Tests') ||
136136
pathComponents.last == 'dart_test.yaml' ||
137137
// Pigeon's custom platform tests.
138-
pathComponents.first == 'platform_tests';
138+
pathComponents.first == 'platform_tests' ||
139+
// Standalone test apps within a package (e.g., material_ui/test_apps/).
140+
pathComponents.first == 'test_apps';
139141
}
140142

141143
// True if the given file is an example file other than the one that will be

‎script/tool/test/common/package_state_utils_test.dart‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,22 @@ void main() {
134134
expect(state.needsChangelogChange, false);
135135
});
136136

137+
test('does not require version or changelog change for test_apps changes', () async {
138+
final RepositoryPackage package = createFakePlugin('a_plugin', packagesDir);
139+
140+
const changedFiles = <String>['packages/a_plugin/test_apps/a_test_app/lib/main.dart'];
141+
142+
final PackageChangeState state = await checkPackageChangeState(
143+
package,
144+
changedPaths: changedFiles,
145+
relativePackagePath: 'packages/a_plugin/',
146+
);
147+
148+
expect(state.hasChanges, true);
149+
expect(state.needsVersionChange, false);
150+
expect(state.needsChangelogChange, false);
151+
});
152+
137153
test('does not require version or changelog change for AGENTS.md changes', () async {
138154
final RepositoryPackage package = createFakePlugin('a_plugin', packagesDir);
139155

‎script/tool/test/validate_command_version_test.dart‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,7 @@ packages/plugin/example/android/src/androidTest/foo/bar/FooTest.java
982982
packages/plugin/example/ios/RunnerTests/Foo.m
983983
packages/plugin/example/ios/RunnerUITests/info.plist
984984
packages/plugin/darwin/Tests/Foo.swift
985+
packages/plugin/test_apps/a_test_app/lib/main.dart
985986
packages/plugin/analysis_options.yaml
986987
packages/plugin/AGENTS.md
987988
packages/plugin/CHANGELOG.md

0 commit comments

Comments
 (0)