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
3a479e7e
Unverified
Commit
3a479e7e
authored
Nov 23, 2020
by
Jenn Magder
Committed by
GitHub
Nov 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename SdkType -> EnvironmentType (#71095)
parent
2b4a2358
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
59 deletions
+49
-59
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+17
-16
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+10
-8
xcode.dart
packages/flutter_tools/lib/src/macos/xcode.dart
+18
-20
xcode_test.dart
...es/flutter_tools/test/general.shard/macos/xcode_test.dart
+4
-15
No files found.
packages/flutter_tools/lib/src/build_info.dart
View file @
3a479e7e
...
...
@@ -12,7 +12,6 @@ import 'base/logger.dart';
import
'base/utils.dart'
;
import
'build_system/targets/icon_tree_shaker.dart'
;
import
'globals.dart'
as
globals
;
import
'macos/xcode.dart'
;
/// Information about a build to be performed or used.
class
BuildInfo
{
...
...
@@ -320,6 +319,12 @@ BuildMode getBuildModeForName(String name) {
return
BuildMode
.
fromName
(
name
);
}
/// Environment type of the target device.
enum
EnvironmentType
{
physical
,
simulator
,
}
String
validatedBuildNumberForPlatform
(
TargetPlatform
targetPlatform
,
String
buildNumber
,
Logger
logger
)
{
if
(
buildNumber
==
null
)
{
return
null
;
...
...
@@ -481,22 +486,18 @@ enum AndroidArch {
}
/// The default set of iOS device architectures to build for.
List
<
DarwinArch
>
defaultIOSArchsForSdk
(
SdkType
sdkType
)
{
switch
(
sdkType
)
{
case
SdkType
.
iPhone
:
return
<
DarwinArch
>[
DarwinArch
.
armv7
,
DarwinArch
.
arm64
,
];
case
SdkType
.
iPhoneSimulator
:
List
<
DarwinArch
>
defaultIOSArchsForEnvironment
(
EnvironmentType
environmentType
)
{
if
(
environmentType
==
EnvironmentType
.
simulator
)
{
return
<
DarwinArch
>[
// Apple Silicon ARM simulators not yet supported.
DarwinArch
.
x86_64
,
];
default
:
assert
(
false
,
'Unknown SDK type
$sdkType
'
);
return
null
;
}
return
<
DarwinArch
>[
DarwinArch
.
armv7
,
DarwinArch
.
arm64
,
];
}
String
getNameForDarwinArch
(
DarwinArch
arch
)
{
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
3a479e7e
...
...
@@ -21,7 +21,6 @@ import '../cache.dart';
import
'../convert.dart'
;
import
'../globals.dart'
as
globals
;
import
'../macos/cocoapod_utils.dart'
;
import
'../macos/xcode.dart'
;
import
'../plugins.dart'
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
show
DevelopmentArtifact
,
FlutterCommandResult
;
...
...
@@ -375,11 +374,13 @@ end
final Status status = globals.logger.startProgress(
'
├─
Building
App
.
framework
...
',
);
final List<SdkType> sdkTypes = <SdkType>[SdkType.iPhone];
final List<EnvironmentType> environmentTypes = <EnvironmentType>[
EnvironmentType.physical,
];
final List<Directory> frameworks = <Directory>[];
Target target;
if (buildInfo.isDebug) {
sdkTypes.add(SdkType.iPhoneS
imulator);
environmentTypes.add(EnvironmentType.s
imulator);
target = const DebugIosApplicationBundle();
} else if (buildInfo.isProfile) {
target = const ProfileIosApplicationBundle();
...
...
@@ -388,8 +389,9 @@ end
}
try {
for (final SdkType sdkType in sdkTypes) {
final Directory outputBuildDirectory = sdkType == SdkType.iPhone
for (final EnvironmentType sdkType in environmentTypes) {
final Directory outputBuildDirectory =
sdkType == EnvironmentType.physical
? iPhoneBuildOutput
: simulatorBuildOutput;
frameworks.add(outputBuildDirectory.childDirectory(appFrameworkName));
...
...
@@ -411,7 +413,7 @@ end
buildInfo.extraGenSnapshotOptions.join('
,
'),
if (buildInfo?.extraFrontEndOptions?.isNotEmpty ?? false)
kExtraFrontEndOptions: buildInfo.extraFrontEndOptions.join('
,
'),
kIosArchs: defaultIOSArchsFor
Sdk
(sdkType)
kIosArchs: defaultIOSArchsFor
Environment
(sdkType)
.map(getNameForDarwinArch)
.join('
'),
kSdkRoot: await globals.xcode.sdkLocation(sdkType),
...
...
packages/flutter_tools/lib/src/macos/xcode.dart
View file @
3a479e7e
...
...
@@ -29,29 +29,16 @@ const int kXcodeRequiredVersionMajor = 11;
const
int
kXcodeRequiredVersionMinor
=
0
;
const
int
kXcodeRequiredVersionPatch
=
0
;
enum
SdkType
{
iPhone
,
iPhoneSimulator
,
macOS
,
}
/// SDK name passed to `xcrun --sdk`. Corresponds to undocumented Xcode
/// SUPPORTED_PLATFORMS values.
///
/// Usage: xcrun [options] <tool name> ... arguments ...
/// ...
/// --sdk <sdk name> find the tool for the given SDK name.
String
getNameForSdk
(
SdkType
sdk
)
{
switch
(
sdk
)
{
case
SdkType
.
iPhone
:
return
'iphoneos'
;
case
SdkType
.
iPhoneSimulator
:
return
'iphonesimulator'
;
case
SdkType
.
macOS
:
return
'macosx'
;
}
assert
(
false
);
return
null
;
String
getSDKNameForIOSEnvironmentType
(
EnvironmentType
environmentType
)
{
return
(
environmentType
==
EnvironmentType
.
simulator
)
?
'iphonesimulator'
:
'iphoneos'
;
}
/// A utility class for interacting with Xcode command line tools.
...
...
@@ -178,10 +165,10 @@ class Xcode {
);
}
Future
<
String
>
sdkLocation
(
SdkType
sdk
)
async
{
assert
(
sdk
!=
null
);
Future
<
String
>
sdkLocation
(
EnvironmentType
environmentType
)
async
{
assert
(
environmentType
!=
null
);
final
RunResult
runResult
=
await
_processUtils
.
run
(
<
String
>[...
xcrunCommand
(),
'--sdk'
,
get
NameForSdk
(
sdk
),
'--show-sdk-path'
],
<
String
>[...
xcrunCommand
(),
'--sdk'
,
get
SDKNameForIOSEnvironmentType
(
environmentType
),
'--show-sdk-path'
],
);
if
(
runResult
.
exitCode
!=
0
)
{
throwToolExit
(
'Could not find SDK location:
${runResult.stderr}
'
);
...
...
@@ -203,6 +190,17 @@ class Xcode {
}
}
EnvironmentType
environmentTypeFromSdkroot
(
Directory
sdkroot
)
{
assert
(
sdkroot
!=
null
);
// iPhoneSimulator.sdk or iPhoneOS.sdk
final
String
sdkName
=
sdkroot
.
basename
.
toLowerCase
();
if
(
sdkName
.
contains
(
'iphone'
))
{
return
sdkName
.
contains
(
'simulator'
)
?
EnvironmentType
.
simulator
:
EnvironmentType
.
physical
;
}
assert
(
false
);
return
null
;
}
enum
XCDeviceEvent
{
attach
,
detach
,
...
...
packages/flutter_tools/test/general.shard/macos/xcode_test.dart
View file @
3a479e7e
...
...
@@ -300,9 +300,8 @@ void main() {
});
testWithoutContext
(
'SDK name'
,
()
{
expect
(
getNameForSdk
(
SdkType
.
iPhone
),
'iphoneos'
);
expect
(
getNameForSdk
(
SdkType
.
iPhoneSimulator
),
'iphonesimulator'
);
expect
(
getNameForSdk
(
SdkType
.
macOS
),
'macosx'
);
expect
(
getSDKNameForIOSEnvironmentType
(
EnvironmentType
.
physical
),
'iphoneos'
);
expect
(
getSDKNameForIOSEnvironmentType
(
EnvironmentType
.
simulator
),
'iphonesimulator'
);
});
group
(
'SDK location'
,
()
{
...
...
@@ -314,17 +313,7 @@ void main() {
stdout:
sdkroot
,
));
expect
(
await
xcode
.
sdkLocation
(
SdkType
.
iPhone
),
sdkroot
);
expect
(
fakeProcessManager
.
hasRemainingExpectations
,
isFalse
);
});
testWithoutContext
(
'--show-sdk-path macosx'
,
()
async
{
fakeProcessManager
.
addCommand
(
const
FakeCommand
(
command:
<
String
>[
'xcrun'
,
'--sdk'
,
'macosx'
,
'--show-sdk-path'
],
stdout:
sdkroot
,
));
expect
(
await
xcode
.
sdkLocation
(
SdkType
.
macOS
),
sdkroot
);
expect
(
await
xcode
.
sdkLocation
(
EnvironmentType
.
physical
),
sdkroot
);
expect
(
fakeProcessManager
.
hasRemainingExpectations
,
isFalse
);
});
...
...
@@ -335,7 +324,7 @@ void main() {
stderr:
'xcrun: error:'
,
));
expect
(()
async
=>
await
xcode
.
sdkLocation
(
SdkType
.
iPhone
),
expect
(()
async
=>
await
xcode
.
sdkLocation
(
EnvironmentType
.
physical
),
throwsToolExit
(
message:
'Could not find SDK location'
));
expect
(
fakeProcessManager
.
hasRemainingExpectations
,
isFalse
);
});
...
...
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