Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
bcba43f5
Unverified
Commit
bcba43f5
authored
Jul 14, 2022
by
Christopher Fujino
Committed by
GitHub
Jul 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Make android gradle builder test hermetic (#107606)
parent
69e0a43c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
android_gradle_builder_test.dart
...st/general.shard/android/android_gradle_builder_test.dart
+46
-0
No files found.
packages/flutter_tools/test/general.shard/android/android_gradle_builder_test.dart
View file @
bcba43f5
...
...
@@ -5,6 +5,7 @@
import
'package:archive/archive.dart'
;
import
'package:file/memory.dart'
;
import
'package:file_testing/file_testing.dart'
;
import
'package:flutter_tools/src/android/android_studio.dart'
;
import
'package:flutter_tools/src/android/gradle.dart'
;
import
'package:flutter_tools/src/android/gradle_errors.dart'
;
import
'package:flutter_tools/src/android/gradle_utils.dart'
;
...
...
@@ -124,6 +125,8 @@ void main() {
parameters:
CustomDimensions
(),
),
));
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'Verbose mode for APKs includes Gradle stacktrace and sets debug log level'
,
()
async
{
...
...
@@ -187,6 +190,8 @@ void main() {
localGradleErrors:
<
GradleHandledError
>[],
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'Can retry build on recognized exit code/stderr'
,
()
async
{
...
...
@@ -288,6 +293,8 @@ void main() {
parameters:
CustomDimensions
(),
),
));
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'Converts recognized ProcessExceptions into tools exits'
,
()
async
{
...
...
@@ -376,6 +383,8 @@ void main() {
parameters:
CustomDimensions
(),
),
));
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'rethrows unrecognized ProcessException'
,
()
async
{
...
...
@@ -436,6 +445,8 @@ void main() {
);
},
throwsProcessException
());
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'logs success event after a successful retry'
,
()
async
{
...
...
@@ -535,6 +546,8 @@ void main() {
),
));
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'performs code size analysis and sends analytics'
,
()
async
{
...
...
@@ -632,6 +645,8 @@ void main() {
'apk'
,
),
));
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'indicates that an APK has been built successfully'
,
()
async
{
...
...
@@ -697,6 +712,8 @@ void main() {
contains
(
'Built build/app/outputs/flutter-apk/app-release.apk (0.0MB)'
),
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
"doesn't indicate how to consume an AAR when printHowToConsumeAar is false"
,
()
async
{
...
...
@@ -759,6 +776,8 @@ void main() {
isFalse
,
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'Verbose mode for AARs includes Gradle stacktrace and sets debug log level'
,
()
async
{
...
...
@@ -814,6 +833,8 @@ void main() {
buildNumber:
'1.0'
,
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'gradle exit code and stderr is forwarded to tool exit'
,
()
async
{
...
...
@@ -870,6 +891,8 @@ void main() {
buildNumber:
'1.0'
,
),
throwsToolExit
(
exitCode:
108
,
message:
'Gradle task assembleAarRelease failed with exit code 108.'
));
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'build apk uses selected local engine with arm32 ABI'
,
()
async
{
...
...
@@ -944,6 +967,8 @@ void main() {
);
},
throwsToolExit
());
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'build apk uses selected local engine with arm64 ABI'
,
()
async
{
...
...
@@ -1018,6 +1043,8 @@ void main() {
);
},
throwsToolExit
());
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'build apk uses selected local engine with x86 ABI'
,
()
async
{
...
...
@@ -1092,6 +1119,8 @@ void main() {
);
},
throwsToolExit
());
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'build apk uses selected local engine with x64 ABI'
,
()
async
{
...
...
@@ -1167,6 +1196,8 @@ void main() {
);
},
throwsToolExit
());
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'honors --no-android-gradle-daemon setting'
,
()
async
{
...
...
@@ -1223,6 +1254,8 @@ void main() {
);
},
throwsToolExit
());
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'build aar uses selected local engine with arm32 ABI'
,
()
async
{
...
...
@@ -1307,6 +1340,8 @@ void main() {
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
),
exists
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'build aar uses selected local engine with x64 ABI'
,
()
async
{
...
...
@@ -1391,6 +1426,8 @@ void main() {
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
),
exists
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'build aar uses selected local engine with x86 ABI'
,
()
async
{
...
...
@@ -1475,6 +1512,8 @@ void main() {
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
),
exists
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
testUsingContext
(
'build aar uses selected local engine on x64 ABI'
,
()
async
{
...
...
@@ -1559,6 +1598,8 @@ void main() {
'flutter_embedding_release-1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b.pom'
),
exists
);
expect
(
processManager
,
hasNoRemainingExpectations
);
},
overrides:
<
Type
,
Generator
>{
AndroidStudio:
()
=>
FakeAndroidStudio
(),
});
});
}
...
...
@@ -1569,3 +1610,8 @@ class FakeGradleUtils extends Fake implements GradleUtils {
return
'gradlew'
;
}
}
class
FakeAndroidStudio
extends
Fake
implements
AndroidStudio
{
@override
String
get
javaPath
=>
'java'
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment