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
bb23a110
Unverified
Commit
bb23a110
authored
Jun 19, 2018
by
Florian Loitsch
Committed by
GitHub
Jun 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test (#18603)
Fix test. This makes the buildbot green again.
parent
08d1ec36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
61 deletions
+94
-61
gradle_plugin_test.dart
dev/devicelab/bin/tasks/gradle_plugin_test.dart
+94
-61
No files found.
dev/devicelab/bin/tasks/gradle_plugin_test.dart
View file @
bb23a110
...
...
@@ -12,6 +12,19 @@ import 'package:flutter_devicelab/framework/utils.dart';
String
javaHome
;
String
errorMessage
;
/// Runs the given [testFunction] in a clean temporary directory.
Future
<
void
>
runTest
(
Future
<
void
>
testFunction
(
FlutterProject
project
,
FlutterPluginProject
pluginProject
))
async
{
final
Directory
tmp
=
await
Directory
.
systemTemp
.
createTemp
(
'gradle'
);
final
FlutterProject
project
=
await
FlutterProject
.
create
(
tmp
,
'hello'
);
final
FlutterPluginProject
pluginProject
=
await
FlutterPluginProject
.
create
(
tmp
,
'aaa'
);
try
{
await
testFunction
(
project
,
pluginProject
);
}
finally
{
project
.
parent
.
deleteSync
(
recursive:
true
);
}
}
void
main
(
)
async
{
await
task
(()
async
{
section
(
'Running flutter doctor to get JAVA_HOME'
);
...
...
@@ -19,81 +32,101 @@ void main() async {
final
RegExp
javaHomeExtractor
=
new
RegExp
(
r'Android Studio at (.*)'
);
javaHome
=
javaHomeExtractor
.
firstMatch
(
flutterDoctor
).
group
(
1
)
+
'/jre'
;
section
(
'Setting up flutter projects'
);
final
Directory
tmp
=
await
Directory
.
systemTemp
.
createTemp
(
'gradle'
);
final
FlutterProject
project
=
await
FlutterProject
.
create
(
tmp
,
'hello'
);
final
FlutterPluginProject
pluginProject
=
await
FlutterPluginProject
.
create
(
tmp
,
'aaa'
);
try
{
section
(
'gradlew assembleDebug'
);
await
project
.
runGradleTask
(
'assembleDebug'
);
errorMessage
=
_validateSnapshotDependency
(
project
,
'build/app.dill'
);
if
(
errorMessage
!=
null
)
{
return
new
TaskResult
.
failure
(
errorMessage
);
}
section
(
'gradlew assembleDebug no-preview-dart-2'
);
await
project
.
runGradleTask
(
'assembleDebug'
,
options:
<
String
>[
'-Ppreview-dart-2=false'
]);
errorMessage
=
_validateSnapshotDependency
(
project
,
'
${project.rootPath}
/build/app/intermediates/flutter/debug/snapshot_blob.bin'
);
if
(
errorMessage
!=
null
)
{
return
new
TaskResult
.
failure
(
errorMessage
);
}
section
(
'gradlew assembleProfile'
);
await
project
.
runGradleTask
(
'assembleProfile'
);
section
(
'gradlew assembleRelease'
);
await
project
.
runGradleTask
(
'assembleRelease'
);
section
(
'gradlew assembleLocal (custom debug build)'
);
await
project
.
addCustomBuildType
(
'local'
,
initWith:
'debug'
);
await
project
.
runGradleTask
(
'assembleLocal'
);
section
(
'gradlew assembleBeta (custom release build)'
);
await
project
.
addCustomBuildType
(
'beta'
,
initWith:
'release'
);
await
project
.
runGradleTask
(
'assembleBeta'
);
section
(
'gradlew assembleFreeDebug (product flavor)'
);
await
project
.
addProductFlavor
(
'free'
);
await
project
.
runGradleTask
(
'assembleFreeDebug'
);
await
project
.
introduceError
();
section
(
'gradlew on build script with error'
);
{
final
ProcessResult
result
=
await
project
.
resultOfGradleTask
(
'assembleRelease'
);
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'gradlew assembleDebug'
);
await
project
.
runGradleTask
(
'assembleDebug'
);
errorMessage
=
_validateSnapshotDependency
(
project
,
'build/app.dill'
);
if
(
errorMessage
!=
null
)
{
throw
new
TaskResult
.
failure
(
errorMessage
);
}
});
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'gradlew assembleDebug no-preview-dart-2'
);
await
project
.
runGradleTask
(
'assembleDebug'
,
options:
<
String
>[
'-Ppreview-dart-2=false'
]);
});
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'gradlew assembleProfile'
);
await
project
.
runGradleTask
(
'assembleProfile'
);
});
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'gradlew assembleRelease'
);
await
project
.
runGradleTask
(
'assembleRelease'
);
});
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'gradlew assembleLocal (custom debug build)'
);
await
project
.
addCustomBuildType
(
'local'
,
initWith:
'debug'
);
await
project
.
runGradleTask
(
'assembleLocal'
);
});
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'gradlew assembleBeta (custom release build)'
);
await
project
.
addCustomBuildType
(
'beta'
,
initWith:
'release'
);
await
project
.
runGradleTask
(
'assembleBeta'
);
});
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'gradlew assembleFreeDebug (product flavor)'
);
await
project
.
addProductFlavor
(
'free'
);
await
project
.
runGradleTask
(
'assembleFreeDebug'
);
await
project
.
introduceError
();
});
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'gradlew on build script with error'
);
final
ProcessResult
result
=
await
project
.
resultOfGradleTask
(
'assembleRelease'
);
if
(
result
.
exitCode
==
0
)
return
_failure
(
'Gradle did not exit with error as expected'
,
result
);
return
_failure
(
'Gradle did not exit with error as expected'
,
result
);
final
String
output
=
result
.
stdout
+
'
\n
'
+
result
.
stderr
;
if
(
output
.
contains
(
'GradleException'
)
||
output
.
contains
(
'Failed to notify'
)
||
output
.
contains
(
'at org.gradle'
))
return
_failure
(
'Gradle output should not contain stacktrace'
,
result
);
if
(
output
.
contains
(
'GradleException'
)
||
output
.
contains
(
'Failed to notify'
)
||
output
.
contains
(
'at org.gradle'
))
return
_failure
(
'Gradle output should not contain stacktrace'
,
result
);
if
(!
output
.
contains
(
'Build failed'
)
||
!
output
.
contains
(
'builTypes'
))
return
_failure
(
'Gradle output should contain a readable error message'
,
result
);
}
return
_failure
(
'Gradle output should contain a readable error message'
,
result
);
});
section
(
'flutter build apk on build script with error'
);
{
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'flutter build apk on build script with error'
);
final
ProcessResult
result
=
await
project
.
resultOfFlutterCommand
(
'build'
,
<
String
>[
'apk'
]);
if
(
result
.
exitCode
==
0
)
return
_failure
(
'flutter build apk should fail when Gradle does'
,
result
);
return
_failure
(
'flutter build apk should fail when Gradle does'
,
result
);
final
String
output
=
result
.
stdout
+
'
\n
'
+
result
.
stderr
;
if
(!
output
.
contains
(
'Build failed'
)
||
!
output
.
contains
(
'builTypes'
))
return
_failure
(
'flutter build apk output should contain a readable Gradle error message'
,
result
);
return
_failure
(
'flutter build apk output should contain a readable Gradle error message'
,
result
);
if
(
_hasMultipleOccurrences
(
output
,
'builTypes'
))
return
_failure
(
'flutter build apk should not invoke Gradle repeatedly on error'
,
result
);
}
section
(
'gradlew assembleDebug on plugin example'
);
await
pluginProject
.
runGradleTask
(
'assembleDebug'
);
if
(!
pluginProject
.
hasDebugApk
)
return
new
TaskResult
.
failure
(
'Gradle did not produce an apk file at the expected place'
);
return
_failure
(
'flutter build apk should not invoke Gradle repeatedly on error'
,
result
);
});
await
runTest
((
FlutterProject
project
,
FlutterPluginProject
pluginProject
)
async
{
section
(
'gradlew assembleDebug on plugin example'
);
await
pluginProject
.
runGradleTask
(
'assembleDebug'
);
if
(!
pluginProject
.
hasDebugApk
)
throw
new
TaskResult
.
failure
(
'Gradle did not produce an apk file at the expected place'
);
});
return
new
TaskResult
.
success
(
null
);
}
on
TaskResult
catch
(
taskResult
)
{
return
taskResult
;
}
catch
(
e
)
{
return
new
TaskResult
.
failure
(
e
.
toString
());
}
finally
{
project
.
parent
.
deleteSync
(
recursive:
true
);
}
});
}
...
...
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