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
"FLUTTER_ROOT=
$escapedFlutterRoot
"
"PROJECT_DIR=
$escapedProjectDir
"
'''
);
for
(
final
String
key
in
environment
.
keys
)
{
final
String
value
=
_escapeBackslashes
(
environment
[
key
]
);
buffer
.
writeln
(
' "
$key
=
$
v
alue
"'
);
}
environment
.
forEach
((
String
key
,
String
value
)
{
final
String
configValue
=
_escapeBackslashes
(
value
);
buffer
.
writeln
(
' "
$key
=
$
configV
alue
"'
);
}
);
buffer
.
writeln
(
')'
);
project
.
generatedCmakeConfigFile
...
...
packages/flutter_tools/lib/src/flutter_plugins.dart
View file @
b947121f
...
...
@@ -1107,7 +1107,8 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
continue
;
}
// 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
];
if
(
defaultImplementation
==
null
)
{
if
(
throwOnPluginPubspecError
)
{
...
...
@@ -1138,7 +1139,7 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
plugin
.
pluginDartClassPlatforms
[
platform
]
==
'none'
)
{
continue
;
}
final
String
resolutionKey
=
'
$platform
/
$
{plugin.implementsPackage}
'
;
final
String
resolutionKey
=
'
$platform
/
$
implementsPackage
'
;
if
(
directDependencyResolutions
.
containsKey
(
resolutionKey
))
{
final
PluginInterfaceResolution
currResolution
=
directDependencyResolutions
[
resolutionKey
];
if
(
currResolution
!=
null
&&
currResolution
.
plugin
.
isDirectDependency
)
{
...
...
@@ -1200,12 +1201,12 @@ Future<void> generateMainDartWithPluginRegistrant(
String
currentMainUri
,
File
newMainDart
,
File
mainFile
,
{
bool
throwOnPluginPubspecError
,
bool
throwOnPluginPubspecError
=
false
,
})
async
{
final
List
<
Plugin
>
plugins
=
await
findPlugins
(
rootProject
);
final
List
<
PluginInterfaceResolution
>
resolutions
=
resolvePlatformImplementation
(
plugins
,
throwOnPluginPubspecError:
throwOnPluginPubspecError
??
false
,
throwOnPluginPubspecError:
throwOnPluginPubspecError
,
);
final
LanguageVersion
entrypointVersion
=
determineLanguageVersion
(
mainFile
,
...
...
packages/flutter_tools/lib/src/project.dart
View file @
b947121f
...
...
@@ -120,24 +120,40 @@ class FlutterProject {
/// part of iOS product bundle identifier, Android application ID, or
/// Gradle group ID.
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
// used during create as best-effort, use the
// default target bundle identifier.
if
(
ios
.
existsSync
())
await
ios
.
productBundleIdentifier
(
null
),
if
(
android
.
existsSync
())
...<
String
>[
android
.
applicationId
,
android
.
group
,
],
if
(
example
.
android
.
existsSync
())
example
.
android
.
applicationId
,
if
(
example
.
ios
.
existsSync
())
await
example
.
ios
.
productBundleIdentifier
(
null
),
];
return
Set
<
String
>.
of
(
candidates
.
map
<
String
>(
_organizationNameFromPackageName
)
.
where
((
String
name
)
=>
name
!=
null
));
final
String
bundleIdentifier
=
await
ios
.
productBundleIdentifier
(
null
);
if
(
bundleIdentifier
!=
null
)
{
candidates
.
add
(
bundleIdentifier
);
}
}
if
(
android
.
existsSync
())
{
final
String
applicationId
=
android
.
applicationId
;
final
String
group
=
android
.
group
;
candidates
.
addAll
(<
String
>[
if
(
applicationId
!=
null
)
applicationId
,
if
(
group
!=
null
)
group
,
]);
}
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
)
{
...
...
@@ -334,10 +350,14 @@ class FlutterProject {
/// Returns a json encoded string containing the [appName], [version], and [buildNumber] that is used to generate version.json
String
getVersionInfo
()
{
final
String
buildName
=
manifest
.
buildName
;
final
String
buildNumber
=
manifest
.
buildNumber
;
final
Map
<
String
,
String
>
versionFileJson
=
<
String
,
String
>{
'app_name'
:
manifest
.
appName
,
'version'
:
manifest
.
buildName
,
'build_number'
:
manifest
.
buildNumber
if
(
buildName
!=
null
)
'version'
:
buildName
,
if
(
buildNumber
!=
null
)
'build_number'
:
buildNumber
,
};
return
jsonEncode
(
versionFileJson
);
}
...
...
@@ -613,25 +633,33 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
scheme
,
);
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
>>{};
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
_projectInfo
??=
await
globals
.
xcodeProjectInterpreter
.
getInfo
(
hostAppRoot
.
path
);
return
_projectInfo
??=
await
xcodeProjectInterpreter
.
getInfo
(
hostAppRoot
.
path
);
}
XcodeProjectInfo
_projectInfo
;
Future
<
Map
<
String
,
String
>>
_xcodeProjectBuildSettings
(
XcodeProjectBuildContext
buildContext
)
async
{
if
(!
globals
.
xcodeProjectInterpreter
.
isInstalled
)
{
final
XcodeProjectInterpreter
xcodeProjectInterpreter
=
globals
.
xcodeProjectInterpreter
;
if
(
xcodeProjectInterpreter
==
null
||
!
xcodeProjectInterpreter
.
isInstalled
)
{
return
null
;
}
final
Map
<
String
,
String
>
buildSettings
=
await
globals
.
xcodeProjectInterpreter
.
getBuildSettings
(
final
Map
<
String
,
String
>
buildSettings
=
await
xcodeProjectInterpreter
.
getBuildSettings
(
xcodeProject
.
path
,
buildContext:
buildContext
,
);
...
...
@@ -791,12 +819,13 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
logger:
globals
.
logger
,
templateRenderer:
globals
.
templateRenderer
,
);
final
String
iosBundleIdentifier
=
parent
.
manifest
.
iosBundleIdentifier
??
'com.example.
${parent.manifest.appName}
'
;
template
.
render
(
target
,
<
String
,
Object
>{
'ios'
:
true
,
'projectName'
:
parent
.
manifest
.
appName
,
'iosIdentifier'
:
parent
.
manifest
.
iosBundleIdentifier
,
'iosIdentifier'
:
iosBundleIdentifier
,
},
printStatusWhenWriting:
false
,
overwriteExisting:
true
,
...
...
@@ -975,12 +1004,13 @@ to migrate your project.
logger:
globals
.
logger
,
templateRenderer:
globals
.
templateRenderer
,
);
final
String
androidIdentifier
=
parent
.
manifest
.
androidPackage
??
'com.example.
${parent.manifest.appName}
'
;
template
.
render
(
target
,
<
String
,
Object
>{
'android'
:
true
,
'projectName'
:
parent
.
manifest
.
appName
,
'androidIdentifier'
:
parent
.
manifest
.
androidPackage
,
'androidIdentifier'
:
androidIdentifier
,
'androidX'
:
usesAndroidX
,
},
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