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
b947121f
Unverified
Commit
b947121f
authored
Jun 01, 2021
by
Jenn Magder
Committed by
GitHub
Jun 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up null assumptions for project.dart dependencies (#83445)
parent
a84bb4eb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
32 deletions
+63
-32
cmake.dart
packages/flutter_tools/lib/src/cmake.dart
+4
-4
flutter_plugins.dart
packages/flutter_tools/lib/src/flutter_plugins.dart
+5
-4
project.dart
packages/flutter_tools/lib/src/project.dart
+54
-24
No files found.
packages/flutter_tools/lib/src/cmake.dart
View file @
b947121f
...
@@ -63,10 +63,10 @@ list(APPEND FLUTTER_TOOL_ENVIRONMENT
...
@@ -63,10 +63,10 @@ list(APPEND FLUTTER_TOOL_ENVIRONMENT
"FLUTTER_ROOT=
$escapedFlutterRoot
"
"FLUTTER_ROOT=
$escapedFlutterRoot
"
"PROJECT_DIR=
$escapedProjectDir
"
"PROJECT_DIR=
$escapedProjectDir
"
'''
);
'''
);
for
(
final
String
key
in
environment
.
keys
)
{
environment
.
forEach
((
String
key
,
String
value
)
{
final
String
value
=
_escapeBackslashes
(
environment
[
key
]
);
final
String
configValue
=
_escapeBackslashes
(
value
);
buffer
.
writeln
(
' "
$key
=
$
v
alue
"'
);
buffer
.
writeln
(
' "
$key
=
$
configV
alue
"'
);
}
}
);
buffer
.
writeln
(
')'
);
buffer
.
writeln
(
')'
);
project
.
generatedCmakeConfigFile
project
.
generatedCmakeConfigFile
...
...
packages/flutter_tools/lib/src/flutter_plugins.dart
View file @
b947121f
...
@@ -1107,7 +1107,8 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
...
@@ -1107,7 +1107,8 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
continue
;
continue
;
}
}
// The plugin doesn't implement an interface, verify that it has a default implementation.
// The plugin doesn't implement an interface, verify that it has a default implementation.
if
(
plugin
.
implementsPackage
==
null
||
plugin
.
implementsPackage
.
isEmpty
)
{
final
String
implementsPackage
=
plugin
.
implementsPackage
;
if
(
implementsPackage
==
null
||
implementsPackage
.
isEmpty
)
{
final
String
defaultImplementation
=
plugin
.
defaultPackagePlatforms
[
platform
];
final
String
defaultImplementation
=
plugin
.
defaultPackagePlatforms
[
platform
];
if
(
defaultImplementation
==
null
)
{
if
(
defaultImplementation
==
null
)
{
if
(
throwOnPluginPubspecError
)
{
if
(
throwOnPluginPubspecError
)
{
...
@@ -1138,7 +1139,7 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
...
@@ -1138,7 +1139,7 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
plugin
.
pluginDartClassPlatforms
[
platform
]
==
'none'
)
{
plugin
.
pluginDartClassPlatforms
[
platform
]
==
'none'
)
{
continue
;
continue
;
}
}
final
String
resolutionKey
=
'
$platform
/
$
{plugin.implementsPackage}
'
;
final
String
resolutionKey
=
'
$platform
/
$
implementsPackage
'
;
if
(
directDependencyResolutions
.
containsKey
(
resolutionKey
))
{
if
(
directDependencyResolutions
.
containsKey
(
resolutionKey
))
{
final
PluginInterfaceResolution
currResolution
=
directDependencyResolutions
[
resolutionKey
];
final
PluginInterfaceResolution
currResolution
=
directDependencyResolutions
[
resolutionKey
];
if
(
currResolution
!=
null
&&
currResolution
.
plugin
.
isDirectDependency
)
{
if
(
currResolution
!=
null
&&
currResolution
.
plugin
.
isDirectDependency
)
{
...
@@ -1200,12 +1201,12 @@ Future<void> generateMainDartWithPluginRegistrant(
...
@@ -1200,12 +1201,12 @@ Future<void> generateMainDartWithPluginRegistrant(
String
currentMainUri
,
String
currentMainUri
,
File
newMainDart
,
File
newMainDart
,
File
mainFile
,
{
File
mainFile
,
{
bool
throwOnPluginPubspecError
,
bool
throwOnPluginPubspecError
=
false
,
})
async
{
})
async
{
final
List
<
Plugin
>
plugins
=
await
findPlugins
(
rootProject
);
final
List
<
Plugin
>
plugins
=
await
findPlugins
(
rootProject
);
final
List
<
PluginInterfaceResolution
>
resolutions
=
resolvePlatformImplementation
(
final
List
<
PluginInterfaceResolution
>
resolutions
=
resolvePlatformImplementation
(
plugins
,
plugins
,
throwOnPluginPubspecError:
throwOnPluginPubspecError
??
false
,
throwOnPluginPubspecError:
throwOnPluginPubspecError
,
);
);
final
LanguageVersion
entrypointVersion
=
determineLanguageVersion
(
final
LanguageVersion
entrypointVersion
=
determineLanguageVersion
(
mainFile
,
mainFile
,
...
...
packages/flutter_tools/lib/src/project.dart
View file @
b947121f
...
@@ -120,24 +120,40 @@ class FlutterProject {
...
@@ -120,24 +120,40 @@ class FlutterProject {
/// part of iOS product bundle identifier, Android application ID, or
/// part of iOS product bundle identifier, Android application ID, or
/// Gradle group ID.
/// Gradle group ID.
Future
<
Set
<
String
>>
get
organizationNames
async
{
Future
<
Set
<
String
>>
get
organizationNames
async
{
final
List
<
String
>
candidates
=
<
String
>[
final
List
<
String
>
candidates
=
<
String
>[];
if
(
ios
.
existsSync
())
{
// Don't require iOS build info, this method is only
// Don't require iOS build info, this method is only
// used during create as best-effort, use the
// used during create as best-effort, use the
// default target bundle identifier.
// default target bundle identifier.
if
(
ios
.
existsSync
())
final
String
bundleIdentifier
=
await
ios
.
productBundleIdentifier
(
null
);
await
ios
.
productBundleIdentifier
(
null
),
if
(
bundleIdentifier
!=
null
)
{
if
(
android
.
existsSync
())
...<
String
>[
candidates
.
add
(
bundleIdentifier
);
android
.
applicationId
,
}
android
.
group
,
}
],
if
(
android
.
existsSync
())
{
if
(
example
.
android
.
existsSync
())
final
String
applicationId
=
android
.
applicationId
;
example
.
android
.
applicationId
,
final
String
group
=
android
.
group
;
if
(
example
.
ios
.
existsSync
())
candidates
.
addAll
(<
String
>[
await
example
.
ios
.
productBundleIdentifier
(
null
),
if
(
applicationId
!=
null
)
];
applicationId
,
return
Set
<
String
>.
of
(
candidates
if
(
group
!=
null
)
.
map
<
String
>(
_organizationNameFromPackageName
)
group
,
.
where
((
String
name
)
=>
name
!=
null
));
]);
}
if
(
example
.
android
.
existsSync
())
{
final
String
applicationId
=
example
.
android
.
applicationId
;
if
(
applicationId
!=
null
)
{
candidates
.
add
(
applicationId
);
}
}
if
(
example
.
ios
.
existsSync
())
{
final
String
bundleIdentifier
=
await
example
.
ios
.
productBundleIdentifier
(
null
);
if
(
bundleIdentifier
!=
null
)
{
candidates
.
add
(
bundleIdentifier
);
}
}
return
Set
<
String
>.
of
(
candidates
.
map
<
String
>(
_organizationNameFromPackageName
).
whereType
<
String
>());
}
}
String
_organizationNameFromPackageName
(
String
packageName
)
{
String
_organizationNameFromPackageName
(
String
packageName
)
{
...
@@ -334,10 +350,14 @@ class FlutterProject {
...
@@ -334,10 +350,14 @@ class FlutterProject {
/// Returns a json encoded string containing the [appName], [version], and [buildNumber] that is used to generate version.json
/// Returns a json encoded string containing the [appName], [version], and [buildNumber] that is used to generate version.json
String
getVersionInfo
()
{
String
getVersionInfo
()
{
final
String
buildName
=
manifest
.
buildName
;
final
String
buildNumber
=
manifest
.
buildNumber
;
final
Map
<
String
,
String
>
versionFileJson
=
<
String
,
String
>{
final
Map
<
String
,
String
>
versionFileJson
=
<
String
,
String
>{
'app_name'
:
manifest
.
appName
,
'app_name'
:
manifest
.
appName
,
'version'
:
manifest
.
buildName
,
if
(
buildName
!=
null
)
'build_number'
:
manifest
.
buildNumber
'version'
:
buildName
,
if
(
buildNumber
!=
null
)
'build_number'
:
buildNumber
,
};
};
return
jsonEncode
(
versionFileJson
);
return
jsonEncode
(
versionFileJson
);
}
}
...
@@ -613,25 +633,33 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
...
@@ -613,25 +633,33 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
scheme
,
scheme
,
);
);
final
XcodeProjectBuildContext
buildContext
=
XcodeProjectBuildContext
(
environmentType:
environmentType
,
scheme:
scheme
,
configuration:
configuration
);
final
XcodeProjectBuildContext
buildContext
=
XcodeProjectBuildContext
(
environmentType:
environmentType
,
scheme:
scheme
,
configuration:
configuration
);
return
_buildSettingsByBuildContext
[
buildContext
]
??=
await
_xcodeProjectBuildSettings
(
buildContext
);
if
(
_buildSettingsByBuildContext
[
buildContext
]
==
null
)
{
final
Map
<
String
,
String
>
calculatedBuildSettings
=
await
_xcodeProjectBuildSettings
(
buildContext
);
if
(
calculatedBuildSettings
!=
null
)
{
_buildSettingsByBuildContext
[
buildContext
]
=
calculatedBuildSettings
;
}
}
return
_buildSettingsByBuildContext
[
buildContext
];
}
}
final
Map
<
XcodeProjectBuildContext
,
Map
<
String
,
String
>>
_buildSettingsByBuildContext
=
<
XcodeProjectBuildContext
,
Map
<
String
,
String
>>{};
final
Map
<
XcodeProjectBuildContext
,
Map
<
String
,
String
>>
_buildSettingsByBuildContext
=
<
XcodeProjectBuildContext
,
Map
<
String
,
String
>>{};
Future
<
XcodeProjectInfo
>
projectInfo
()
async
{
Future
<
XcodeProjectInfo
>
projectInfo
()
async
{
if
(!
xcodeProject
.
existsSync
()
||
!
globals
.
xcodeProjectInterpreter
.
isInstalled
)
{
final
XcodeProjectInterpreter
xcodeProjectInterpreter
=
globals
.
xcodeProjectInterpreter
;
if
(!
xcodeProject
.
existsSync
()
||
xcodeProjectInterpreter
==
null
||
!
xcodeProjectInterpreter
.
isInstalled
)
{
return
null
;
return
null
;
}
}
return
_projectInfo
??=
await
globals
.
xcodeProjectInterpreter
.
getInfo
(
hostAppRoot
.
path
);
return
_projectInfo
??=
await
xcodeProjectInterpreter
.
getInfo
(
hostAppRoot
.
path
);
}
}
XcodeProjectInfo
_projectInfo
;
XcodeProjectInfo
_projectInfo
;
Future
<
Map
<
String
,
String
>>
_xcodeProjectBuildSettings
(
XcodeProjectBuildContext
buildContext
)
async
{
Future
<
Map
<
String
,
String
>>
_xcodeProjectBuildSettings
(
XcodeProjectBuildContext
buildContext
)
async
{
if
(!
globals
.
xcodeProjectInterpreter
.
isInstalled
)
{
final
XcodeProjectInterpreter
xcodeProjectInterpreter
=
globals
.
xcodeProjectInterpreter
;
if
(
xcodeProjectInterpreter
==
null
||
!
xcodeProjectInterpreter
.
isInstalled
)
{
return
null
;
return
null
;
}
}
final
Map
<
String
,
String
>
buildSettings
=
await
globals
.
xcodeProjectInterpreter
.
getBuildSettings
(
final
Map
<
String
,
String
>
buildSettings
=
await
xcodeProjectInterpreter
.
getBuildSettings
(
xcodeProject
.
path
,
xcodeProject
.
path
,
buildContext:
buildContext
,
buildContext:
buildContext
,
);
);
...
@@ -791,12 +819,13 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
...
@@ -791,12 +819,13 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
logger:
globals
.
logger
,
logger:
globals
.
logger
,
templateRenderer:
globals
.
templateRenderer
,
templateRenderer:
globals
.
templateRenderer
,
);
);
final
String
iosBundleIdentifier
=
parent
.
manifest
.
iosBundleIdentifier
??
'com.example.
${parent.manifest.appName}
'
;
template
.
render
(
template
.
render
(
target
,
target
,
<
String
,
Object
>{
<
String
,
Object
>{
'ios'
:
true
,
'ios'
:
true
,
'projectName'
:
parent
.
manifest
.
appName
,
'projectName'
:
parent
.
manifest
.
appName
,
'iosIdentifier'
:
parent
.
manifest
.
iosBundleIdentifier
,
'iosIdentifier'
:
iosBundleIdentifier
,
},
},
printStatusWhenWriting:
false
,
printStatusWhenWriting:
false
,
overwriteExisting:
true
,
overwriteExisting:
true
,
...
@@ -975,12 +1004,13 @@ to migrate your project.
...
@@ -975,12 +1004,13 @@ to migrate your project.
logger:
globals
.
logger
,
logger:
globals
.
logger
,
templateRenderer:
globals
.
templateRenderer
,
templateRenderer:
globals
.
templateRenderer
,
);
);
final
String
androidIdentifier
=
parent
.
manifest
.
androidPackage
??
'com.example.
${parent.manifest.appName}
'
;
template
.
render
(
template
.
render
(
target
,
target
,
<
String
,
Object
>{
<
String
,
Object
>{
'android'
:
true
,
'android'
:
true
,
'projectName'
:
parent
.
manifest
.
appName
,
'projectName'
:
parent
.
manifest
.
appName
,
'androidIdentifier'
:
parent
.
manifest
.
androidPackage
,
'androidIdentifier'
:
androidIdentifier
,
'androidX'
:
usesAndroidX
,
'androidX'
:
usesAndroidX
,
},
},
printStatusWhenWriting:
false
,
printStatusWhenWriting:
false
,
...
...
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