CQ. Remove deprecated methods from ResourceProviderMixin.

Change-Id: Ib6b4a942bb7f599c4a7e9b576c710d155baf6ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373761
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2024-06-28 18:47:34 +00:00 committed by Commit Queue
parent 0083eadca5
commit 5b00f3651c
8 changed files with 36 additions and 47 deletions

View file

@ -101,11 +101,6 @@ mixin ResourceProviderMixin {
return newFile(path, content);
}
@Deprecated('Use newAnalysisOptionsYamlFile() instead')
File newAnalysisOptionsYamlFile2(String directoryPath, String content) {
return newAnalysisOptionsYamlFile(directoryPath, content);
}
File newBlazeBuildFile(String directoryPath, String content) {
String path = join(directoryPath, file_paths.blazeBuild);
return newFile(path, content);
@ -121,12 +116,6 @@ mixin ResourceProviderMixin {
return resourceProvider.getFile(convertedPath)..writeAsStringSync(content);
}
@Deprecated('Use newFile() instead')
File newFile2(String path, String content) {
String convertedPath = convertPath(path);
return resourceProvider.getFile(content)..writeAsStringSync(convertedPath);
}
Folder newFolder(String path) {
String convertedPath = convertPath(path);
return resourceProvider.getFolder(convertedPath)..create();

View file

@ -395,7 +395,7 @@ class PubPackageResolutionTest extends _ContextResolutionTest {
}
void writePackageConfig(String path, PackageConfigFileBuilder config) {
newFile2(
newFile(
path,
config.toContent(
toUriStr: toUriStr,
@ -567,11 +567,11 @@ abstract class _ContextResolutionTest
String get testFilePath => '/test/lib/test.dart';
void addTestFile(String content) {
newFile2(testFilePath, content);
newFile(testFilePath, content);
}
@override
File newFile2(String path, String content) {
File newFile(String path, String content) {
if (_analysisContextCollection != null && !path.endsWith('.dart')) {
throw StateError('Only dart files can be changed after analysis.');
}

View file

@ -37,7 +37,7 @@ import ''
}
test_missingFiles() async {
newFile2('$testPackageRootPath/lib/exists.dart', '');
newFile('$testPackageRootPath/lib/exists.dart', '');
await assertDiagnostics(
r'''

View file

@ -27,7 +27,7 @@ class DirectivesOrderingTest extends LintRuleTest {
String get lintRule => 'directives_ordering';
test_dartDirectivesGoFirst_exports() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/a.dart', '');
await assertDiagnostics(r'''
export 'dart:math';
export 'a.dart';
@ -41,7 +41,7 @@ export 'dart:isolate';
}
test_dartDirectivesGoFirst_imports() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/a.dart', '');
await assertDiagnostics(r'''
import 'dart:math';
import 'a.dart';
@ -55,9 +55,9 @@ import 'dart:isolate';
}
test_importsGoBeforeExports() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile2('$testPackageLibPath/b.dart', '');
newFile2('$testPackageLibPath/c.dart', '');
newFile('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/b.dart', '');
newFile('$testPackageLibPath/c.dart', '');
await assertDiagnostics(r'''
import 'a.dart';
@ -78,7 +78,7 @@ export 'c.dart';
}
test_multipleSchemaImportsSortedByPath() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/a.dart', '');
await assertNoDiagnostics(r'''
// From analysis_server/test/services/correction/organize_directives_test.dart
// test named `sort`.
@ -118,8 +118,8 @@ main() {}
}
test_packageDirectivesGoBeforeRelative_exports() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile2('$testPackageLibPath/b.dart', '');
newFile('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/b.dart', '');
await assertDiagnostics(r'''
export 'dart:math';
export 'a.dart';
@ -134,8 +134,8 @@ export 'b.dart';
}
test_packageDirectivesGoBeforeRelative_imports() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile2('$testPackageLibPath/b.dart', '');
newFile('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/b.dart', '');
await assertDiagnostics(r'''
import 'dart:math';
import 'package:js/js.dart';
@ -149,7 +149,7 @@ import 'b.dart';
}
test_packageImportsSortedByPath() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/a.dart', '');
await assertNoDiagnostics(r'''
// From analysis_server/test/services/correction/organize_directives_test.dart
// test named `sort_imports_packageAndPath`.
@ -168,7 +168,7 @@ import 'package:product2.client/entity.dart';
}
test_reportOneNodeOnlyOnce() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/a.dart', '');
await assertDiagnostics(r'''
import 'package:meta/meta.dart';
import 'a.dart';
@ -223,9 +223,9 @@ import 'foo1.dart';
}
test_sortDirectiveSectionsAlphabetically_packageSchema_export() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile2('$testPackageLibPath/b.dart', '');
newFile2('$testPackageLibPath/c.dart', '');
newFile('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/b.dart', '');
newFile('$testPackageLibPath/c.dart', '');
await assertDiagnostics(r'''
export 'package:js/js.dart';
export 'package:meta/meta.dart';
@ -241,9 +241,9 @@ export 'package:test/b.dart';
}
test_sortDirectiveSectionsAlphabetically_packageSchema_import() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile2('$testPackageLibPath/b.dart', '');
newFile2('$testPackageLibPath/c.dart', '');
newFile('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/b.dart', '');
newFile('$testPackageLibPath/c.dart', '');
await assertDiagnostics(r'''
import 'package:js/js.dart';
import 'package:meta/meta.dart';
@ -260,10 +260,10 @@ import 'package:test/b.dart';
}
test_sortDirectiveSectionsAlphabetically_relativePath_export() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile2('$testPackageLibPath/b.dart', '');
newFile2('$testPackageLibPath/c.dart', '');
newFile2('$testPackageLibPath/d.dart', '');
newFile('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/b.dart', '');
newFile('$testPackageLibPath/c.dart', '');
newFile('$testPackageLibPath/d.dart', '');
await assertDiagnostics(r'''
export 'd.dart';
export 'a.dart';
@ -275,10 +275,10 @@ export 'c.dart';
}
test_sortDirectiveSectionsAlphabetically_relativePath_import() async {
newFile2('$testPackageLibPath/a.dart', '');
newFile2('$testPackageLibPath/b.dart', '');
newFile2('$testPackageLibPath/c.dart', '');
newFile2('$testPackageLibPath/d.dart', '');
newFile('$testPackageLibPath/a.dart', '');
newFile('$testPackageLibPath/b.dart', '');
newFile('$testPackageLibPath/c.dart', '');
newFile('$testPackageLibPath/d.dart', '');
await assertDiagnostics(r'''
import 'd.dart';
import 'd.dart';

View file

@ -276,7 +276,7 @@ class A {
}
test_deferred_arg() async {
newFile2('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
const A();
}
@ -298,7 +298,7 @@ main() {
}
test_deferredConstructorCall() async {
newFile2('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
class A {
const A();
}

View file

@ -36,7 +36,7 @@ library with_comment;
}
test_hasPart() async {
newFile2('$testPackageLibPath/part.dart', '''
newFile('$testPackageLibPath/part.dart', '''
part of 'test.dart';
''');
// Parts may still use library names to reference what they are a 'part of'.

View file

@ -358,7 +358,7 @@ _E e = _E.withValue(0);
}
test_simple_hasPart() async {
newFile2('$testPackageLibPath/a.dart', '''
newFile('$testPackageLibPath/a.dart', '''
part of 'test.dart';
''');
await assertDiagnostics(r'''

View file

@ -21,7 +21,7 @@ class UseStringInPartOfDirectivesTest extends LintRuleTest {
String get lintRule => 'use_string_in_part_of_directives';
test_part_of_with_library_name() async {
newFile2('$testPackageRootPath/lib/lib.dart', '''
newFile('$testPackageRootPath/lib/lib.dart', '''
library lib;
part '$testFileName';
''');
@ -36,7 +36,7 @@ part of lib;
}
test_part_of_with_string() async {
newFile2('$testPackageRootPath/lib/lib.dart', '''
newFile('$testPackageRootPath/lib/lib.dart', '''
part '$testFileName';
''');
await assertNoDiagnostics(r'''