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
fb68d074
Unverified
Commit
fb68d074
authored
Apr 02, 2021
by
Jenn Magder
Committed by
GitHub
Apr 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate android_studio to null safety (#79504)
parent
d5671739
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
57 deletions
+97
-57
android_sdk.dart
packages/flutter_tools/lib/src/android/android_sdk.dart
+1
-1
android_studio.dart
packages/flutter_tools/lib/src/android/android_studio.dart
+59
-51
config.dart
packages/flutter_tools/lib/src/commands/config.dart
+2
-3
globals.dart
packages/flutter_tools/lib/src/globals.dart
+0
-2
globals_null_migrated.dart
packages/flutter_tools/lib/src/globals_null_migrated.dart
+2
-0
android_studio_test.dart
...tools/test/general.shard/android/android_studio_test.dart
+33
-0
No files found.
packages/flutter_tools/lib/src/android/android_sdk.dart
View file @
fb68d074
...
...
@@ -13,7 +13,7 @@ import '../base/platform.dart';
import
'../base/process.dart'
;
import
'../base/version.dart'
;
import
'../convert.dart'
;
import
'../globals.dart'
as
globals
;
import
'../globals
_null_migrated
.dart'
as
globals
;
import
'android_studio.dart'
;
// ANDROID_HOME is deprecated.
...
...
packages/flutter_tools/lib/src/android/android_studio.dart
View file @
fb68d074
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/config.dart
View file @
fb68d074
...
...
@@ -4,7 +4,6 @@
// @dart = 2.8
import
'../android/android_studio.dart'
;
import
'../base/common.dart'
;
import
'../convert.dart'
;
import
'../features.dart'
;
...
...
@@ -176,8 +175,8 @@ class ConfigCommand extends FlutterCommand {
}
// Ensure we send any calculated ones, if overrides don't exist.
if
(
results
[
'android-studio-dir'
]
==
null
&&
androidStudio
!=
null
)
{
results
[
'android-studio-dir'
]
=
androidStudio
.
directory
;
if
(
results
[
'android-studio-dir'
]
==
null
&&
globals
.
androidStudio
!=
null
)
{
results
[
'android-studio-dir'
]
=
globals
.
androidStudio
.
directory
;
}
if
(
results
[
'android-sdk'
]
==
null
&&
globals
.
androidSdk
!=
null
)
{
results
[
'android-sdk'
]
=
globals
.
androidSdk
.
directory
.
path
;
...
...
packages/flutter_tools/lib/src/globals.dart
View file @
fb68d074
...
...
@@ -5,7 +5,6 @@
// @dart = 2.8
import
'android/android_sdk.dart'
;
import
'android/android_studio.dart'
;
import
'android/gradle_utils.dart'
;
import
'artifacts.dart'
;
import
'base/bot_detector.dart'
;
...
...
@@ -52,7 +51,6 @@ CocoaPodsValidator get cocoapodsValidator => context.get<CocoaPodsValidator>();
LocalEngineLocator
get
localEngineLocator
=>
context
.
get
<
LocalEngineLocator
>();
AndroidStudio
get
androidStudio
=>
context
.
get
<
AndroidStudio
>();
AndroidSdk
get
androidSdk
=>
context
.
get
<
AndroidSdk
>();
CocoaPods
get
cocoaPods
=>
context
.
get
<
CocoaPods
>();
FlutterVersion
get
flutterVersion
=>
context
.
get
<
FlutterVersion
>();
...
...
packages/flutter_tools/lib/src/globals_null_migrated.dart
View file @
fb68d074
...
...
@@ -4,6 +4,7 @@
import
'package:process/process.dart'
;
import
'android/android_studio.dart'
;
import
'base/config.dart'
;
import
'base/context.dart'
;
import
'base/error_handling_io.dart'
;
...
...
@@ -26,6 +27,7 @@ HttpClientFactory get httpClientFactory => context.get<HttpClientFactory>()!;
Logger
get
logger
=>
context
.
get
<
Logger
>()!;
OperatingSystemUtils
get
os
=>
context
.
get
<
OperatingSystemUtils
>()!;
Signals
get
signals
=>
context
.
get
<
Signals
>()
??
LocalSignals
.
instance
;
AndroidStudio
?
get
androidStudio
=>
context
.
get
<
AndroidStudio
>();
/// Currently active implementation of the file system.
///
...
...
packages/flutter_tools/test/general.shard/android/android_studio_test.dart
View file @
fb68d074
...
...
@@ -174,6 +174,39 @@ void main() {
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'finds latest valid install'
,
()
{
final
String
applicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Applications'
,
'Android Studio.app'
,
'Contents'
,
);
globals
.
fs
.
directory
(
applicationPlistFolder
).
createSync
(
recursive:
true
);
final
String
applicationsPlistFilePath
=
globals
.
fs
.
path
.
join
(
applicationPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
applicationsPlistFilePath
]
=
macStudioInfoPlist
;
final
String
homeDirectoryPlistFolder
=
globals
.
fs
.
path
.
join
(
globals
.
fsUtils
.
homeDirPath
,
'Applications'
,
'Android Studio.app'
,
'Contents'
,
);
globals
.
fs
.
directory
(
homeDirectoryPlistFolder
).
createSync
(
recursive:
true
);
final
String
homeDirectoryPlistFilePath
=
globals
.
fs
.
path
.
join
(
homeDirectoryPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
homeDirectoryPlistFilePath
]
=
macStudioInfoPlist4_1
;
expect
(
AndroidStudio
.
allInstalled
().
length
,
2
);
expect
(
AndroidStudio
.
latestValid
().
version
,
Version
(
4
,
1
,
0
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
Platform:
()
=>
platform
,
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'extracts custom paths for directly downloaded Android Studio on Mac'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
...
...
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