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
5f5d4802
Unverified
Commit
5f5d4802
authored
Aug 30, 2022
by
Jenn Magder
Committed by
GitHub
Aug 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support single arch local engines for 'build macos-framework' and 'ios-framework' (#110564)
parent
c49531f0
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
85 additions
and
10 deletions
+85
-10
artifacts.dart
packages/flutter_tools/lib/src/artifacts.dart
+9
-0
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+29
-2
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+1
-1
build_macos_framework.dart
...flutter_tools/lib/src/commands/build_macos_framework.dart
+3
-4
xcode_build_settings.dart
packages/flutter_tools/lib/src/ios/xcode_build_settings.dart
+1
-1
build_linux.dart
packages/flutter_tools/lib/src/linux/build_linux.dart
+1
-1
build_windows.dart
packages/flutter_tools/lib/src/windows/build_windows.dart
+1
-1
build_info_test.dart
...ges/flutter_tools/test/general.shard/build_info_test.dart
+40
-0
No files found.
packages/flutter_tools/lib/src/artifacts.dart
View file @
5f5d4802
...
@@ -732,6 +732,8 @@ abstract class LocalEngineArtifacts implements Artifacts {
...
@@ -732,6 +732,8 @@ abstract class LocalEngineArtifacts implements Artifacts {
})
=
CachedLocalEngineArtifacts
;
})
=
CachedLocalEngineArtifacts
;
String
get
engineOutPath
;
String
get
engineOutPath
;
String
get
localEngineName
;
}
}
/// Manages the artifacts of a locally built engine.
/// Manages the artifacts of a locally built engine.
...
@@ -745,6 +747,7 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
...
@@ -745,6 +747,7 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
required
Platform
platform
,
required
Platform
platform
,
required
OperatingSystemUtils
operatingSystemUtils
,
required
OperatingSystemUtils
operatingSystemUtils
,
})
:
_fileSystem
=
fileSystem
,
})
:
_fileSystem
=
fileSystem
,
localEngineName
=
fileSystem
.
path
.
basename
(
engineOutPath
),
_cache
=
cache
,
_cache
=
cache
,
_processManager
=
processManager
,
_processManager
=
processManager
,
_platform
=
platform
,
_platform
=
platform
,
...
@@ -753,6 +756,9 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
...
@@ -753,6 +756,9 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
@override
@override
final
String
engineOutPath
;
final
String
engineOutPath
;
@override
final
String
localEngineName
;
final
String
_hostEngineOutPath
;
final
String
_hostEngineOutPath
;
final
FileSystem
_fileSystem
;
final
FileSystem
_fileSystem
;
final
Cache
_cache
;
final
Cache
_cache
;
...
@@ -1063,4 +1069,7 @@ class _TestLocalEngine extends _TestArtifacts implements LocalEngineArtifacts {
...
@@ -1063,4 +1069,7 @@ class _TestLocalEngine extends _TestArtifacts implements LocalEngineArtifacts {
@override
@override
final
String
engineOutPath
;
final
String
engineOutPath
;
@override
String
get
localEngineName
=>
fileSystem
.
path
.
basename
(
engineOutPath
);
}
}
packages/flutter_tools/lib/src/build_info.dart
View file @
5f5d4802
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
'package:package_config/package_config_types.dart'
;
import
'package:package_config/package_config_types.dart'
;
import
'artifacts.dart'
;
import
'base/config.dart'
;
import
'base/config.dart'
;
import
'base/context.dart'
;
import
'base/context.dart'
;
import
'base/file_system.dart'
;
import
'base/file_system.dart'
;
...
@@ -562,8 +563,19 @@ enum AndroidArch {
...
@@ -562,8 +563,19 @@ enum AndroidArch {
/// The default set of iOS device architectures to build for.
/// The default set of iOS device architectures to build for.
List
<
DarwinArch
>
defaultIOSArchsForEnvironment
(
List
<
DarwinArch
>
defaultIOSArchsForEnvironment
(
EnvironmentType
environmentType
)
{
EnvironmentType
environmentType
,
if
(
environmentType
==
EnvironmentType
.
simulator
)
{
Artifacts
artifacts
,
)
{
// Handle single-arch local engines.
if
(
artifacts
is
LocalEngineArtifacts
)
{
final
String
localEngineName
=
artifacts
.
localEngineName
;
if
(
localEngineName
.
contains
(
'_arm64'
))
{
return
<
DarwinArch
>[
DarwinArch
.
arm64
];
}
if
(
localEngineName
.
contains
(
'_sim'
))
{
return
<
DarwinArch
>[
DarwinArch
.
x86_64
];
}
}
else
if
(
environmentType
==
EnvironmentType
.
simulator
)
{
return
<
DarwinArch
>[
return
<
DarwinArch
>[
DarwinArch
.
x86_64
,
DarwinArch
.
x86_64
,
DarwinArch
.
arm64
,
DarwinArch
.
arm64
,
...
@@ -574,6 +586,21 @@ List<DarwinArch> defaultIOSArchsForEnvironment(
...
@@ -574,6 +586,21 @@ List<DarwinArch> defaultIOSArchsForEnvironment(
];
];
}
}
/// The default set of macOS device architectures to build for.
List
<
DarwinArch
>
defaultMacOSArchsForEnvironment
(
Artifacts
artifacts
)
{
// Handle single-arch local engines.
if
(
artifacts
is
LocalEngineArtifacts
)
{
if
(
artifacts
.
localEngineName
.
contains
(
'_arm64'
))
{
return
<
DarwinArch
>[
DarwinArch
.
arm64
];
}
return
<
DarwinArch
>[
DarwinArch
.
x86_64
];
}
return
<
DarwinArch
>[
DarwinArch
.
x86_64
,
DarwinArch
.
arm64
,
];
}
// Returns the Dart SDK's name for the specified target architecture.
// Returns the Dart SDK's name for the specified target architecture.
//
//
// When building for Darwin platforms, the tool invokes architecture-specific
// When building for Darwin platforms, the tool invokes architecture-specific
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
5f5d4802
...
@@ -422,7 +422,7 @@ end
...
@@ -422,7 +422,7 @@ end
kTargetFile: targetFile,
kTargetFile: targetFile,
kTargetPlatform: getNameForTargetPlatform(TargetPlatform.ios),
kTargetPlatform: getNameForTargetPlatform(TargetPlatform.ios),
kBitcodeFlag: '
true
',
kBitcodeFlag: '
true
',
kIosArchs: defaultIOSArchsForEnvironment(sdkType)
kIosArchs: defaultIOSArchsForEnvironment(sdkType
, globals.artifacts!
)
.map(getNameForDarwinArch)
.map(getNameForDarwinArch)
.join('
'),
.join('
'),
kSdkRoot: await globals.xcode!.sdkLocation(sdkType),
kSdkRoot: await globals.xcode!.sdkLocation(sdkType),
...
...
packages/flutter_tools/lib/src/commands/build_macos_framework.dart
View file @
5f5d4802
...
@@ -193,10 +193,9 @@ end
...
@@ -193,10 +193,9 @@ end
defines: <String, String>{
defines: <String, String>{
kTargetFile: targetFile,
kTargetFile: targetFile,
kTargetPlatform: getNameForTargetPlatform(TargetPlatform.darwin),
kTargetPlatform: getNameForTargetPlatform(TargetPlatform.darwin),
kDarwinArchs: <DarwinArch>[
kDarwinArchs: defaultMacOSArchsForEnvironment(globals.artifacts!)
DarwinArch.x86_64,
.map(getNameForDarwinArch)
DarwinArch.arm64,
.join('
'),
].map(getNameForDarwinArch).join('
'),
...buildInfo.toBuildSystemEnvironment(),
...buildInfo.toBuildSystemEnvironment(),
},
},
artifacts: globals.artifacts!,
artifacts: globals.artifacts!,
...
...
packages/flutter_tools/lib/src/ios/xcode_build_settings.dart
View file @
5f5d4802
...
@@ -176,7 +176,7 @@ Future<List<String>> _xcodeBuildSettingsLines({
...
@@ -176,7 +176,7 @@ Future<List<String>> _xcodeBuildSettingsLines({
final
String
engineOutPath
=
localEngineArtifacts
.
engineOutPath
;
final
String
engineOutPath
=
localEngineArtifacts
.
engineOutPath
;
xcodeBuildSettings
.
add
(
'FLUTTER_ENGINE=
${globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath))}
'
);
xcodeBuildSettings
.
add
(
'FLUTTER_ENGINE=
${globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath))}
'
);
final
String
localEngineName
=
globals
.
fs
.
path
.
basename
(
engineOutPath
)
;
final
String
localEngineName
=
localEngineArtifacts
.
localEngineName
;
xcodeBuildSettings
.
add
(
'LOCAL_ENGINE=
$localEngineName
'
);
xcodeBuildSettings
.
add
(
'LOCAL_ENGINE=
$localEngineName
'
);
// Tell Xcode not to build universal binaries for local engines, which are
// Tell Xcode not to build universal binaries for local engines, which are
...
...
packages/flutter_tools/lib/src/linux/build_linux.dart
View file @
5f5d4802
...
@@ -60,7 +60,7 @@ Future<void> buildLinux(
...
@@ -60,7 +60,7 @@ Future<void> buildLinux(
final
LocalEngineArtifacts
localEngineArtifacts
=
artifacts
;
final
LocalEngineArtifacts
localEngineArtifacts
=
artifacts
;
final
String
engineOutPath
=
localEngineArtifacts
.
engineOutPath
;
final
String
engineOutPath
=
localEngineArtifacts
.
engineOutPath
;
environmentConfig
[
'FLUTTER_ENGINE'
]
=
globals
.
fs
.
path
.
dirname
(
globals
.
fs
.
path
.
dirname
(
engineOutPath
));
environmentConfig
[
'FLUTTER_ENGINE'
]
=
globals
.
fs
.
path
.
dirname
(
globals
.
fs
.
path
.
dirname
(
engineOutPath
));
environmentConfig
[
'LOCAL_ENGINE'
]
=
globals
.
fs
.
path
.
basename
(
engineOutPath
)
;
environmentConfig
[
'LOCAL_ENGINE'
]
=
localEngineArtifacts
.
localEngineName
;
}
}
writeGeneratedCmakeConfig
(
Cache
.
flutterRoot
!,
linuxProject
,
buildInfo
,
environmentConfig
);
writeGeneratedCmakeConfig
(
Cache
.
flutterRoot
!,
linuxProject
,
buildInfo
,
environmentConfig
);
...
...
packages/flutter_tools/lib/src/windows/build_windows.dart
View file @
5f5d4802
...
@@ -221,7 +221,7 @@ void _writeGeneratedFlutterConfig(
...
@@ -221,7 +221,7 @@ void _writeGeneratedFlutterConfig(
if
(
artifacts
is
LocalEngineArtifacts
)
{
if
(
artifacts
is
LocalEngineArtifacts
)
{
final
String
engineOutPath
=
artifacts
.
engineOutPath
;
final
String
engineOutPath
=
artifacts
.
engineOutPath
;
environment
[
'FLUTTER_ENGINE'
]
=
globals
.
fs
.
path
.
dirname
(
globals
.
fs
.
path
.
dirname
(
engineOutPath
));
environment
[
'FLUTTER_ENGINE'
]
=
globals
.
fs
.
path
.
dirname
(
globals
.
fs
.
path
.
dirname
(
engineOutPath
));
environment
[
'LOCAL_ENGINE'
]
=
globals
.
fs
.
path
.
basename
(
engineOutPath
)
;
environment
[
'LOCAL_ENGINE'
]
=
artifacts
.
localEngineName
;
}
}
writeGeneratedCmakeConfig
(
Cache
.
flutterRoot
!,
windowsProject
,
buildInfo
,
environment
);
writeGeneratedCmakeConfig
(
Cache
.
flutterRoot
!,
windowsProject
,
buildInfo
,
environment
);
}
}
...
...
packages/flutter_tools/test/general.shard/build_info_test.dart
View file @
5f5d4802
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter_tools/src/artifacts.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
...
@@ -99,6 +100,45 @@ void main() {
...
@@ -99,6 +100,45 @@ void main() {
expect
(
getNameForTargetPlatform
(
TargetPlatform
.
android
),
isNot
(
contains
(
'ios'
)));
expect
(
getNameForTargetPlatform
(
TargetPlatform
.
android
),
isNot
(
contains
(
'ios'
)));
});
});
testWithoutContext
(
'defaultIOSArchsForEnvironment'
,
()
{
expect
(
defaultIOSArchsForEnvironment
(
EnvironmentType
.
physical
,
Artifacts
.
test
(
localEngine:
'ios_debug_unopt'
),
).
single
,
DarwinArch
.
arm64
);
expect
(
defaultIOSArchsForEnvironment
(
EnvironmentType
.
simulator
,
Artifacts
.
test
(
localEngine:
'ios_debug_sim_unopt'
),
).
single
,
DarwinArch
.
x86_64
);
expect
(
defaultIOSArchsForEnvironment
(
EnvironmentType
.
simulator
,
Artifacts
.
test
(
localEngine:
'ios_debug_sim_unopt_arm64'
),
).
single
,
DarwinArch
.
arm64
);
expect
(
defaultIOSArchsForEnvironment
(
EnvironmentType
.
physical
,
Artifacts
.
test
(),
).
single
,
DarwinArch
.
arm64
);
expect
(
defaultIOSArchsForEnvironment
(
EnvironmentType
.
simulator
,
Artifacts
.
test
(),
),
<
DarwinArch
>[
DarwinArch
.
x86_64
,
DarwinArch
.
arm64
]);
});
testWithoutContext
(
'defaultMacOSArchsForEnvironment'
,
()
{
expect
(
defaultMacOSArchsForEnvironment
(
Artifacts
.
test
(
localEngine:
'host_debug_unopt'
),
).
single
,
DarwinArch
.
x86_64
);
expect
(
defaultMacOSArchsForEnvironment
(
Artifacts
.
test
(
localEngine:
'host_debug_unopt_arm64'
),
).
single
,
DarwinArch
.
arm64
);
expect
(
defaultMacOSArchsForEnvironment
(
Artifacts
.
test
(),
),
<
DarwinArch
>[
DarwinArch
.
x86_64
,
DarwinArch
.
arm64
]);
});
testWithoutContext
(
'getIOSArchForName on Darwin arches'
,
()
{
testWithoutContext
(
'getIOSArchForName on Darwin arches'
,
()
{
expect
(
getIOSArchForName
(
'armv7'
),
DarwinArch
.
armv7
);
expect
(
getIOSArchForName
(
'armv7'
),
DarwinArch
.
armv7
);
expect
(
getIOSArchForName
(
'arm64'
),
DarwinArch
.
arm64
);
expect
(
getIOSArchForName
(
'arm64'
),
DarwinArch
.
arm64
);
...
...
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