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
754bc4a5
Unverified
Commit
754bc4a5
authored
Jan 26, 2021
by
Jenn Magder
Committed by
GitHub
Jan 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move android_plugin_example_app_build_test from devicelab to tool integration tests (#74685)
parent
47f8e956
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
136 additions
and
175 deletions
+136
-175
android_plugin_example_app_build_test.dart
...elab/bin/tasks/android_plugin_example_app_build_test.dart
+0
-157
prod_builders.json
dev/prod_builders.json
+0
-6
android_plugin_example_app_build_test.dart
...egration.shard/android_plugin_example_app_build_test.dart
+110
-0
daemon_mode_test.dart
...lutter_tools/test/integration.shard/daemon_mode_test.dart
+16
-9
debugger_stepping_test.dart
..._tools/test/integration.shard/debugger_stepping_test.dart
+10
-3
No files found.
dev/devicelab/bin/tasks/android_plugin_example_app_build_test.dart
deleted
100644 → 0
View file @
47f8e956
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/task_result.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
import
'package:path/path.dart'
as
path
;
final
String
gradlew
=
Platform
.
isWindows
?
'gradlew.bat'
:
'gradlew'
;
final
String
gradlewExecutable
=
Platform
.
isWindows
?
'.
\\
$gradlew
'
:
'./
$gradlew
'
;
/// Tests that a plugin example app can be built using the current Flutter Gradle plugin.
Future
<
void
>
main
()
async
{
await
task
(()
async
{
section
(
'Find Java'
);
final
String
javaHome
=
await
findJavaHome
();
if
(
javaHome
==
null
)
{
return
TaskResult
.
failure
(
'Could not find Java'
);
}
print
(
'
\n
Using JAVA_HOME=
$javaHome
'
);
section
(
'Create Flutter plugin project'
);
await
flutter
(
'precache'
,
options:
<
String
>[
'--android'
,
'--no-ios'
],
);
final
Directory
tempDir
=
Directory
.
systemTemp
.
createTempSync
(
'flutter_plugin_test.'
);
final
Directory
projectDir
=
Directory
(
path
.
join
(
tempDir
.
path
,
'plugin_test'
));
try
{
await
inDirectory
(
tempDir
,
()
async
{
await
flutter
(
'create'
,
options:
<
String
>[
'--template=plugin'
,
'--platforms=android'
,
'plugin_test'
,
],
);
});
final
Directory
exampleAppDir
=
Directory
(
path
.
join
(
projectDir
.
path
,
'example'
));
if
(!
exists
(
exampleAppDir
))
{
return
TaskResult
.
failure
(
'Example app directory doesn
\'
t exist'
);
}
final
File
buildGradleFile
=
File
(
path
.
join
(
exampleAppDir
.
path
,
'android'
,
'build.gradle'
));
if
(!
exists
(
buildGradleFile
))
{
return
TaskResult
.
failure
(
'
$buildGradleFile
doesn
\'
t exist'
);
}
final
String
buildGradle
=
buildGradleFile
.
readAsStringSync
();
final
RegExp
androidPluginRegExp
=
RegExp
(
r'com\.android\.tools\.build:gradle:(\d+\.\d+\.\d+)'
);
section
(
'Use AGP 4.1.0'
);
String
newBuildGradle
=
buildGradle
.
replaceAll
(
androidPluginRegExp
,
'com.android.tools.build:gradle:4.1.0'
);
print
(
newBuildGradle
);
buildGradleFile
.
writeAsString
(
newBuildGradle
);
section
(
'Run flutter build apk using AGP 4.1.0'
);
await
inDirectory
(
exampleAppDir
,
()
async
{
await
flutter
(
'build'
,
options:
<
String
>[
'apk'
,
'--target-platform=android-arm'
,
],
);
});
final
String
exampleApk
=
path
.
join
(
exampleAppDir
.
path
,
'build'
,
'app'
,
'outputs'
,
'flutter-apk'
,
'app-release.apk'
,
);
if
(!
exists
(
File
(
exampleApk
)))
{
return
TaskResult
.
failure
(
'Failed to build app-release.apk'
);
}
section
(
'Clean'
);
await
inDirectory
(
exampleAppDir
,
()
async
{
await
flutter
(
'clean'
);
});
section
(
'Remove Gradle wrapper'
);
Directory
(
path
.
join
(
exampleAppDir
.
path
,
'android'
,
'gradle'
,
'wrapper'
))
.
deleteSync
(
recursive:
true
);
section
(
'Use AGP 3.3.0'
);
newBuildGradle
=
buildGradle
.
replaceAll
(
androidPluginRegExp
,
'com.android.tools.build:gradle:3.3.0'
);
print
(
newBuildGradle
);
buildGradleFile
.
writeAsString
(
newBuildGradle
);
section
(
'Enable R8 in gradle.properties'
);
final
File
gradleProperties
=
File
(
path
.
join
(
exampleAppDir
.
path
,
'android'
,
'gradle.properties'
));
if
(!
exists
(
gradleProperties
))
{
return
TaskResult
.
failure
(
'
$gradleProperties
doesn
\'
t exist'
);
}
gradleProperties
.
writeAsString
(
'''
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true'''
);
section
(
'Run flutter build apk using AGP 3.3.0'
);
await
inDirectory
(
exampleAppDir
,
()
async
{
await
flutter
(
'build'
,
options:
<
String
>[
'apk'
,
'--target-platform=android-arm'
,
],
);
});
if
(!
exists
(
File
(
exampleApk
)))
{
return
TaskResult
.
failure
(
'Failed to build app-release.apk'
);
}
return
TaskResult
.
success
(
null
);
}
on
TaskResult
catch
(
taskResult
)
{
return
taskResult
;
}
catch
(
e
)
{
return
TaskResult
.
failure
(
e
.
toString
());
}
finally
{
rmTree
(
tempDir
);
}
});
}
dev/prod_builders.json
View file @
754bc4a5
...
...
@@ -444,12 +444,6 @@
"task_name"
:
"mac_build_aar_module_test"
,
"flaky"
:
false
},
{
"name"
:
"Mac_android android_plugin_example_app_build_test"
,
"repo"
:
"flutter"
,
"task_name"
:
"mac_android_android_plugin_example_app_build_test"
,
"flaky"
:
false
},
{
"name"
:
"Mac_android android_semantics_integration_test"
,
"repo"
:
"flutter"
,
...
...
packages/flutter_tools/test/integration.shard/android_plugin_example_app_build_test.dart
0 → 100644
View file @
754bc4a5
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:file_testing/file_testing.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'../src/common.dart'
;
import
'test_utils.dart'
;
void
main
(
)
{
Directory
tempDir
;
setUp
(()
async
{
tempDir
=
createResolvedTempDirectorySync
(
'flutter_plugin_test.'
);
});
tearDown
(()
async
{
tryToDelete
(
tempDir
);
});
test
(
'plugin example can be built using current Flutter Gradle plugin'
,
()
async
{
final
String
flutterBin
=
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
'flutter'
,
);
processManager
.
runSync
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'create'
,
'--template=plugin'
,
'--platforms=android'
,
'plugin_test'
,
],
workingDirectory:
tempDir
.
path
);
final
Directory
exampleAppDir
=
tempDir
.
childDirectory
(
'plugin_test'
).
childDirectory
(
'example'
);
final
File
buildGradleFile
=
exampleAppDir
.
childDirectory
(
'android'
).
childFile
(
'build.gradle'
);
expect
(
buildGradleFile
,
exists
);
final
String
buildGradle
=
buildGradleFile
.
readAsStringSync
();
final
RegExp
androidPluginRegExp
=
RegExp
(
r'com\.android\.tools\.build:gradle:(\d+\.\d+\.\d+)'
);
// Use AGP 4.1.0
String
newBuildGradle
=
buildGradle
.
replaceAll
(
androidPluginRegExp
,
'com.android.tools.build:gradle:4.1.0'
);
buildGradleFile
.
writeAsStringSync
(
newBuildGradle
);
// Run flutter build apk using AGP 4.1.0
processManager
.
runSync
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'build'
,
'apk'
,
'--target-platform=android-arm'
,
],
workingDirectory:
exampleAppDir
.
path
);
final
File
exampleApk
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
exampleAppDir
.
path
,
'build'
,
'app'
,
'outputs'
,
'flutter-apk'
,
'app-release.apk'
,
));
expect
(
exampleApk
,
exists
);
// Clean
processManager
.
runSync
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'clean'
,
],
workingDirectory:
exampleAppDir
.
path
);
// Remove Gradle wrapper
fileSystem
.
directory
(
fileSystem
.
path
.
join
(
exampleAppDir
.
path
,
'android'
,
'gradle'
,
'wrapper'
))
.
deleteSync
(
recursive:
true
);
// Use AGP 3.3.0
newBuildGradle
=
buildGradle
.
replaceAll
(
androidPluginRegExp
,
'com.android.tools.build:gradle:3.3.0'
);
buildGradleFile
.
writeAsStringSync
(
newBuildGradle
);
// Enable R8 in gradle.properties
final
File
gradleProperties
=
exampleAppDir
.
childDirectory
(
'android'
).
childFile
(
'gradle.properties'
);
expect
(
gradleProperties
,
exists
);
gradleProperties
.
writeAsStringSync
(
'''
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true'''
);
// Run flutter build apk using AGP 3.3.0
processManager
.
runSync
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'build'
,
'apk'
,
'--target-platform=android-arm'
,
],
workingDirectory:
exampleAppDir
.
path
);
expect
(
exampleApk
,
exists
);
});
}
packages/flutter_tools/test/integration.shard/daemon_mode_test.dart
View file @
754bc4a5
...
...
@@ -17,22 +17,32 @@ import 'test_driver.dart';
import
'test_utils.dart'
;
void
main
(
)
{
testWithoutContext
(
'device.getDevices'
,
()
async
{
final
Directory
tempDir
=
createResolvedTempDirectorySync
(
'daemon_mode_test.'
);
Directory
tempDir
;
Process
daemonProcess
;
setUp
(()
async
{
tempDir
=
createResolvedTempDirectorySync
(
'daemon_mode_test.'
);
});
tearDown
(()
async
{
tryToDelete
(
tempDir
);
daemonProcess
?.
kill
();
});
testWithoutContext
(
'device.getDevices'
,
()
async
{
final
BasicProject
_project
=
BasicProject
();
await
_project
.
setUpIn
(
tempDir
);
final
String
flutterBin
=
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
'flutter'
);
const
ProcessManager
processManager
=
LocalProcessManager
();
final
Process
p
rocess
=
await
processManager
.
start
(
daemonP
rocess
=
await
processManager
.
start
(
<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'--show-test-device'
,
'daemon'
],
workingDirectory:
tempDir
.
path
,
);
final
StreamController
<
String
>
stdout
=
StreamController
<
String
>.
broadcast
();
transformToLines
(
p
rocess
.
stdout
).
listen
((
String
line
)
=>
stdout
.
add
(
line
));
transformToLines
(
daemonP
rocess
.
stdout
).
listen
((
String
line
)
=>
stdout
.
add
(
line
));
final
Stream
<
Map
<
String
,
dynamic
>>
stream
=
stdout
.
stream
.
map
<
Map
<
String
,
dynamic
>>(
parseFlutterResponse
)
...
...
@@ -42,7 +52,7 @@ void main() {
expect
(
response
[
'event'
],
'daemon.connected'
);
// start listening for devices
p
rocess
.
stdin
.
writeln
(
'[
${jsonEncode(<String, dynamic>{
daemonP
rocess
.
stdin
.
writeln
(
'[
${jsonEncode(<String, dynamic>{
'id': 1,
'method': 'device.enable',
}
)}]'
);
...
...
@@ -56,7 +66,7 @@ void main() {
expect
(
response
[
'event'
],
'device.added'
);
// get the list of all devices
p
rocess
.
stdin
.
writeln
(
'[
${jsonEncode(<String, dynamic>{
daemonP
rocess
.
stdin
.
writeln
(
'[
${jsonEncode(<String, dynamic>{
'id': 2,
'method': 'device.getDevices',
}
)}]'
);
...
...
@@ -68,8 +78,5 @@ void main() {
final
dynamic
result
=
response
[
'result'
];
expect
(
result
,
isList
);
expect
(
result
,
isNotEmpty
);
tryToDelete
(
tempDir
);
process
.
kill
();
});
}
packages/flutter_tools/test/integration.shard/debugger_stepping_test.dart
View file @
754bc4a5
...
...
@@ -12,9 +12,17 @@ import 'test_driver.dart';
import
'test_utils.dart'
;
void
main
(
)
{
testWithoutContext
(
'can step over statements'
,
()
async
{
final
Directory
tempDir
=
createResolvedTempDirectorySync
(
'debugger_stepping_test.'
);
Directory
tempDir
;
setUp
(()
async
{
tempDir
=
createResolvedTempDirectorySync
(
'debugger_stepping_test.'
);
});
tearDown
(()
async
{
tryToDelete
(
tempDir
);
});
testWithoutContext
(
'can step over statements'
,
()
async
{
final
SteppingProject
_project
=
SteppingProject
();
await
_project
.
setUpIn
(
tempDir
);
...
...
@@ -43,6 +51,5 @@ void main() {
}
await
_flutter
.
stop
();
tryToDelete
(
tempDir
);
});
}
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