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
aab9a76e
Unverified
Commit
aab9a76e
authored
Nov 18, 2020
by
Dan Field
Committed by
GitHub
Nov 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Allow any iOS app to be added to an existing host app (#70647)" (#70739)
This reverts commit
abdd65fc
.
parent
abdd65fc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
377 additions
and
440 deletions
+377
-440
build_ios_framework_module_test.dart
dev/devicelab/bin/tasks/build_ios_framework_module_test.dart
+343
-390
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+6
-21
plugins.dart
packages/flutter_tools/lib/src/plugins.dart
+23
-11
project.dart
packages/flutter_tools/lib/src/project.dart
+5
-18
No files found.
dev/devicelab/bin/tasks/build_ios_framework_module_test.dart
View file @
aab9a76e
...
...
@@ -17,49 +17,15 @@ Future<void> main() async {
section
(
'Create module project'
);
final
Directory
tempDir
=
Directory
.
systemTemp
.
createTempSync
(
'flutter_module_test.'
);
final
Directory
projectDir
=
Directory
(
path
.
join
(
tempDir
.
path
,
'hello'
));
try
{
await
inDirectory
(
tempDir
,
()
async
{
section
(
'Test module template'
);
final
Directory
moduleProjectDir
=
Directory
(
path
.
join
(
tempDir
.
path
,
'hello_module'
));
await
flutter
(
'create'
,
options:
<
String
>[
'--org'
,
'io.flutter.devicelab'
,
'--template'
,
'module'
,
'hello_module'
],
);
await
_testBuildIosFramework
(
moduleProjectDir
,
isModule:
true
);
section
(
'Test app template'
);
final
Directory
projectDir
=
Directory
(
path
.
join
(
tempDir
.
path
,
'hello_project'
));
await
flutter
(
'create'
,
options:
<
String
>[
'--org'
,
'io.flutter.devicelab'
,
'
hello_project
'
],
options:
<
String
>[
'--org'
,
'io.flutter.devicelab'
,
'
--template'
,
'module'
,
'hello
'
],
);
await
_testBuildIosFramework
(
projectDir
);
});
return
TaskResult
.
success
(
null
);
}
on
TaskResult
catch
(
taskResult
)
{
return
taskResult
;
}
catch
(
e
)
{
return
TaskResult
.
failure
(
e
.
toString
());
}
finally
{
// rmTree(tempDir);
}
});
}
Future
<
void
>
_testBuildIosFramework
(
Directory
projectDir
,
{
bool
isModule
=
false
})
async
{
section
(
'Add plugins'
);
final
File
pubspec
=
File
(
path
.
join
(
projectDir
.
path
,
'pubspec.yaml'
));
...
...
@@ -333,9 +299,6 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
section
(
'Check all modes have generated plugin registrant'
);
for
(
final
String
mode
in
<
String
>[
'Debug'
,
'Profile'
,
'Release'
])
{
if
(!
isModule
)
{
continue
;
}
final
String
registrantFrameworkPath
=
path
.
join
(
outputPath
,
mode
,
...
...
@@ -410,15 +373,11 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
'App.framework'
,
));
if
(
Directory
(
path
.
join
(
checkDirectoryExists
(
path
.
join
(
cocoapodsOutputPath
,
mode
,
'FlutterPluginRegistrant.framework'
,
)).
existsSync
()
!=
isModule
)
{
throw
TaskResult
.
failure
(
'Unexpected FlutterPluginRegistrant.framework.'
);
}
));
checkDirectoryExists
(
path
.
join
(
cocoapodsOutputPath
,
...
...
@@ -433,21 +392,15 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
));
}
if
(
File
(
path
.
join
(
outputPath
,
'GeneratedPluginRegistrant.h'
,
)).
existsSync
()
==
isModule
)
{
throw
TaskResult
.
failure
(
'Unexpected GeneratedPluginRegistrant.h.'
);
}
if
(
File
(
path
.
join
(
outputPath
,
'GeneratedPluginRegistrant.m'
,
)).
existsSync
()
==
isModule
)
{
throw
TaskResult
.
failure
(
'Unexpected GeneratedPluginRegistrant.m.'
);
return
TaskResult
.
success
(
null
);
}
on
TaskResult
catch
(
taskResult
)
{
return
taskResult
;
}
catch
(
e
)
{
return
TaskResult
.
failure
(
e
.
toString
());
}
finally
{
rmTree
(
tempDir
);
}
});
}
Future
<
void
>
_checkFrameworkArchs
(
String
frameworkPath
,
String
mode
)
async
{
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
aab9a76e
...
...
@@ -113,7 +113,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
final
String
name
=
'ios-framework'
;
@override
final
String
description
=
'Produces
.frameworks for a Flutter project
'
final
String
description
=
'Produces
a .framework directory for a Flutter module
'
'and its plugins for integration into existing, plain Xcode projects.
\n
'
'This can only be run on macOS hosts.'
;
...
...
@@ -144,6 +144,10 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
Future
<
void
>
validateCommand
()
async
{
await
super
.
validateCommand
();
_project
=
FlutterProject
.
current
();
if
(!
_project
.
isModule
)
{
throwToolExit
(
'Building frameworks for iOS is only supported from a module.'
);
}
if
(!
_platform
.
isMacOS
)
{
throwToolExit
(
'Building frameworks for iOS is only supported on the Mac.'
);
}
...
...
@@ -174,7 +178,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
}
if
(!
_project
.
ios
.
existsSync
())
{
throwToolExit
(
'
Project
does not support iOS'
);
throwToolExit
(
'
Module
does not support iOS'
);
}
final
Directory
outputDirectory
=
globals
.
fs
.
directory
(
globals
.
fs
.
path
.
absolute
(
globals
.
fs
.
path
.
normalize
(
outputArgument
)));
...
...
@@ -229,23 +233,6 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
}
globals
.
printStatus
(
'Frameworks written to
${outputDirectory.path}
.'
);
if
(!
_project
.
isModule
&&
hasPlugins
(
_project
))
{
// Apps do not generate a FlutterPluginRegistrant.framework. Users will need
// to copy the GeneratedPluginRegistrant class to their project manually.
final
File
pluginRegistrantHeader
=
_project
.
ios
.
pluginRegistrantHeader
;
final
File
pluginRegistrantImplementation
=
_project
.
ios
.
pluginRegistrantImplementation
;
pluginRegistrantHeader
.
copySync
(
outputDirectory
.
childFile
(
pluginRegistrantHeader
.
basename
).
path
);
pluginRegistrantImplementation
.
copySync
(
outputDirectory
.
childFile
(
pluginRegistrantImplementation
.
basename
)
.
path
);
globals
.
printStatus
(
'
\n
Copy the
${globals.fs.path.basenameWithoutExtension(pluginRegistrantHeader.path)}
class into your project.
\n
'
'See https://flutter.dev/docs/development/add-to-app/ios/add-flutter-screen#create-a-flutterengine for more information.'
);
}
return
FlutterCommandResult
.
success
();
}
...
...
@@ -472,7 +459,6 @@ end
xcodeBuildConfiguration,
'
SYMROOT
=
$
{
iPhoneBuildOutput
.
path
}
',
'
BITCODE_GENERATION_MODE
=
$bitcodeGenerationMode
',
'
ENABLE_BITCODE
=
YES
', // Support host apps with bitcode enabled.
'
ONLY_ACTIVE_ARCH
=
NO
', // No device targeted, so build all valid architectures.
'
BUILD_LIBRARY_FOR_DISTRIBUTION
=
YES
',
];
...
...
@@ -497,7 +483,6 @@ end
'
-
configuration
',
xcodeBuildConfiguration,
'
SYMROOT
=
$
{
simulatorBuildOutput
.
path
}
',
'
ENABLE_BITCODE
=
YES
', // Support host apps with bitcode enabled.
'
ARCHS
=
x86_64
',
'
ONLY_ACTIVE_ARCH
=
NO
', // No device targeted, so build all valid architectures.
'
BUILD_LIBRARY_FOR_DISTRIBUTION
=
YES
',
...
...
packages/flutter_tools/lib/src/plugins.dart
View file @
aab9a76e
...
...
@@ -897,24 +897,36 @@ Future<void> _writeIOSPluginRegistrant(FlutterProject project, List<Plugin> plug
'
framework
': '
Flutter
',
'
plugins
': iosPlugins,
};
if (project.isModule) {
final String registryDirectory = project.ios.pluginRegistrantHost.path;
if (project.isModule) {
final String registryClassesDirectory = globals.fs.path.join(registryDirectory, '
Classes
');
_renderTemplateToFile(
_pluginRegistrantPodspecTemplate,
context,
globals.fs.path.join(registryDirectory, '
FlutterPluginRegistrant
.
podspec
'),
);
}
_renderTemplateToFile(
_objcPluginRegistryHeaderTemplate,
context,
project.ios.pluginRegistrantHeader.path
,
globals.fs.path.join(registryClassesDirectory, '
GeneratedPluginRegistrant
.
h
')
,
);
_renderTemplateToFile(
_objcPluginRegistryImplementationTemplate,
context,
project.ios.pluginRegistrantImplementation.path
,
globals.fs.path.join(registryClassesDirectory, '
GeneratedPluginRegistrant
.
m
')
,
);
} else {
_renderTemplateToFile(
_objcPluginRegistryHeaderTemplate,
context,
globals.fs.path.join(registryDirectory, '
GeneratedPluginRegistrant
.
h
'),
);
_renderTemplateToFile(
_objcPluginRegistryImplementationTemplate,
context,
globals.fs.path.join(registryDirectory, '
GeneratedPluginRegistrant
.
m
'),
);
}
}
/// The relative path from a project'
s
main
CMake
file
to
the
plugin
symlink
...
...
packages/flutter_tools/lib/src/project.dart
View file @
aab9a76e
...
...
@@ -665,12 +665,15 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
)
);
if
(
framework
.
existsSync
())
{
final
Directory
engineDest
=
ephemeralDirectory
.
childDirectory
(
'Flutter'
)
.
childDirectory
(
'engine'
);
final
File
podspec
=
framework
.
parent
.
childFile
(
'Flutter.podspec'
);
globals
.
fsUtils
.
copyDirectorySync
(
framework
,
engine
CopyDirectory
.
childDirectory
(
'Flutter.framework'
),
engine
Dest
.
childDirectory
(
'Flutter.framework'
),
);
podspec
.
copySync
(
engine
CopyDirectory
.
childFile
(
'Flutter.podspec'
).
path
);
podspec
.
copySync
(
engine
Dest
.
childFile
(
'Flutter.podspec'
).
path
);
}
}
...
...
@@ -701,22 +704,6 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
:
hostAppRoot
.
childDirectory
(
_hostAppProjectName
);
}
File
get
pluginRegistrantHeader
{
final
Directory
registryDirectory
=
isModule
?
pluginRegistrantHost
.
childDirectory
(
'Classes'
)
:
pluginRegistrantHost
;
return
registryDirectory
.
childFile
(
'GeneratedPluginRegistrant.h'
);
}
File
get
pluginRegistrantImplementation
{
final
Directory
registryDirectory
=
isModule
?
pluginRegistrantHost
.
childDirectory
(
'Classes'
)
:
pluginRegistrantHost
;
return
registryDirectory
.
childFile
(
'GeneratedPluginRegistrant.m'
);
}
Directory
get
engineCopyDirectory
{
return
isModule
?
ephemeralDirectory
.
childDirectory
(
'Flutter'
).
childDirectory
(
'engine'
)
:
hostAppRoot
.
childDirectory
(
'Flutter'
);
}
Future
<
void
>
_overwriteFromTemplate
(
String
path
,
Directory
target
)
async
{
final
Template
template
=
await
Template
.
fromName
(
path
,
...
...
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