@@ -169,39 +169,6 @@ ${warningsConfigured ? warningConfig : ''}
169
169
''' );
170
170
}
171
171
172
- /// Writes a fake android/build.gradle file for an example [package] with the
173
- /// given options.
174
- void writeFakeExampleTopLevelSettingsGradle (
175
- RepositoryPackage package, {
176
- bool includeArtifactHub = true ,
177
- bool includeArtifactDocumentation = true ,
178
- }) {
179
- final File settingsGradle = package
180
- .platformDirectory (FlutterPlatform .android)
181
- .childFile ('settings.gradle' );
182
- settingsGradle.createSync (recursive: true );
183
-
184
- settingsGradle.writeAsStringSync ('''
185
- include ':app'
186
-
187
- def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
188
-
189
- def plugins = new Properties()
190
- def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
191
- if (pluginsFile.exists()) {
192
- pluginsFile.withInputStream { stream -> plugins.load(stream) }
193
- }
194
-
195
- plugins.each { name, path ->
196
- def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
197
- include ":\$ name"
198
- project(":\$ name").projectDir = pluginDirectory
199
- }
200
- ${includeArtifactDocumentation ? '// See ${GradleCheckCommand .artifactHubDocumentationString } for more info.' : '' }
201
- ${includeArtifactHub ? GradleCheckCommand .exampleRootSettingsArtifactHubString : '' }
202
- ''' );
203
- }
204
-
205
172
/// Writes a fake android/build.gradle file for an example [package] with the
206
173
/// given options.
207
174
void writeFakeExampleSettingsGradle (
@@ -216,8 +183,7 @@ ${includeArtifactHub ? GradleCheckCommand.exampleRootSettingsArtifactHubString :
216
183
217
184
/// String printed as a valid example of settings.gradle repository
218
185
/// configuration without the artifact hub env variable.
219
- /// GP stands for the gradle plugin method of flutter tooling inclusion.
220
- const String exampleSettingsWithoutArtifactHubStringGP = '''
186
+ const String exampleSettingsWithoutArtifactHubString = '''
221
187
plugins {
222
188
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
223
189
// ...other plugins
@@ -244,7 +210,7 @@ pluginManagement {
244
210
}
245
211
246
212
${includeArtifactDocumentation ? '// See ${GradleCheckCommand .artifactHubDocumentationString } for more info.' : '' }
247
- ${includeArtifactHub ? GradleCheckCommand .exampleSettingsArtifactHubStringGP : exampleSettingsWithoutArtifactHubStringGP }
213
+ ${includeArtifactHub ? GradleCheckCommand .exampleSettingsArtifactHubString : exampleSettingsWithoutArtifactHubString }
248
214
include ":app"
249
215
''' );
250
216
}
@@ -310,36 +276,6 @@ dependencies {
310
276
bool includeBuildArtifactHub = true ,
311
277
bool includeSettingsArtifactHub = true ,
312
278
bool includeSettingsDocumentationArtifactHub = true ,
313
- }) {
314
- writeFakeExampleTopLevelBuildGradle (
315
- package,
316
- pluginName: pluginName,
317
- warningsConfigured: warningsConfigured,
318
- kotlinVersion: kotlinVersion,
319
- includeArtifactHub: includeBuildArtifactHub,
320
- );
321
- writeFakeExampleAppBuildGradle (package,
322
- includeNamespace: includeNamespace,
323
- commentNamespace: commentNamespace,
324
- includeNameSpaceAsDeclaration: includeNameSpaceAsDeclaration);
325
- writeFakeExampleTopLevelSettingsGradle (
326
- package,
327
- includeArtifactHub: includeSettingsArtifactHub,
328
- includeArtifactDocumentation: includeSettingsDocumentationArtifactHub,
329
- );
330
- }
331
-
332
- void writeFakeExampleBuildGradleGP (
333
- RepositoryPackage package, {
334
- required String pluginName,
335
- bool includeNamespace = true ,
336
- bool commentNamespace = false ,
337
- bool includeNameSpaceAsDeclaration = false ,
338
- bool warningsConfigured = true ,
339
- String ? kotlinVersion,
340
- required bool includeBuildArtifactHub,
341
- required bool includeSettingsArtifactHub,
342
- required bool includeSettingsDocumentationArtifactHub,
343
279
}) {
344
280
writeFakeExampleTopLevelBuildGradle (
345
281
package,
@@ -827,7 +763,7 @@ dependencies {
827
763
output,
828
764
containsAllInOrder (< Matcher > [
829
765
contains (GradleCheckCommand .exampleRootGradleArtifactHubString),
830
- contains (GradleCheckCommand .exampleRootSettingsArtifactHubString ),
766
+ contains (GradleCheckCommand .exampleSettingsArtifactHubString ),
831
767
]),
832
768
);
833
769
});
@@ -859,11 +795,6 @@ dependencies {
859
795
contains (GradleCheckCommand .exampleRootGradleArtifactHubString),
860
796
]),
861
797
);
862
- expect (
863
- output,
864
- isNot (
865
- contains (GradleCheckCommand .exampleRootSettingsArtifactHubString)),
866
- );
867
798
});
868
799
869
800
test ('fails settings.gradle artifact hub check when missing' , () async {
@@ -890,7 +821,7 @@ dependencies {
890
821
expect (
891
822
output,
892
823
containsAllInOrder (< Matcher > [
893
- contains (GradleCheckCommand .exampleRootSettingsArtifactHubString ),
824
+ contains (GradleCheckCommand .exampleSettingsArtifactHubString ),
894
825
]),
895
826
);
896
827
expect (
@@ -907,10 +838,12 @@ dependencies {
907
838
writeFakePluginBuildGradle (package, includeLanguageVersion: true );
908
839
writeFakeManifest (package);
909
840
final RepositoryPackage example = package.getExamples ().first;
910
- writeFakeExampleBuildGradleGP (example,
841
+ writeFakeExampleBuildGradles (example,
911
842
pluginName: packageName,
843
+ // ignore: avoid_redundant_argument_values
912
844
includeBuildArtifactHub: true ,
913
845
includeSettingsArtifactHub: false ,
846
+ // ignore: avoid_redundant_argument_values
914
847
includeSettingsDocumentationArtifactHub: true );
915
848
writeFakeManifest (example, isApp: true );
916
849
@@ -924,14 +857,9 @@ dependencies {
924
857
expect (
925
858
output,
926
859
containsAllInOrder (< Matcher > [
927
- contains (GradleCheckCommand .exampleSettingsArtifactHubStringGP ),
860
+ contains (GradleCheckCommand .exampleSettingsArtifactHubString ),
928
861
]),
929
862
);
930
- expect (
931
- output,
932
- isNot (
933
- contains (GradleCheckCommand .exampleRootSettingsArtifactHubString)),
934
- );
935
863
});
936
864
937
865
test ('error message is printed when documentation link is missing' ,
@@ -942,9 +870,11 @@ dependencies {
942
870
writeFakePluginBuildGradle (package, includeLanguageVersion: true );
943
871
writeFakeManifest (package);
944
872
final RepositoryPackage example = package.getExamples ().first;
945
- writeFakeExampleBuildGradleGP (example,
873
+ writeFakeExampleBuildGradles (example,
946
874
pluginName: packageName,
875
+ // ignore: avoid_redundant_argument_values
947
876
includeBuildArtifactHub: true ,
877
+ // ignore: avoid_redundant_argument_values
948
878
includeSettingsArtifactHub: true ,
949
879
includeSettingsDocumentationArtifactHub: false );
950
880
writeFakeManifest (example, isApp: true );
0 commit comments