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
d95adf99
Unverified
Commit
d95adf99
authored
Sep 18, 2019
by
Jenn Magder
Committed by
GitHub
Sep 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move build info checks from generating files to the xcode build (#40792)
parent
4e108b6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
61 deletions
+49
-61
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+20
-0
xcodeproj.dart
packages/flutter_tools/lib/src/ios/xcodeproj.dart
+29
-43
xcodeproj_test.dart
.../flutter_tools/test/general.shard/ios/xcodeproj_test.dart
+0
-18
No files found.
packages/flutter_tools/lib/src/ios/mac.dart
View file @
d95adf99
...
...
@@ -20,6 +20,7 @@ import '../base/process_manager.dart';
import
'../base/utils.dart'
;
import
'../build_info.dart'
;
import
'../convert.dart'
;
import
'../flutter_manifest.dart'
;
import
'../globals.dart'
;
import
'../macos/cocoapod_utils.dart'
;
import
'../macos/xcode.dart'
;
...
...
@@ -323,6 +324,25 @@ Future<XcodeBuildResult> buildXcodeProject({
return
XcodeBuildResult
(
success:
false
);
}
final
FlutterManifest
manifest
=
app
.
project
.
parent
.
manifest
;
final
String
buildName
=
parsedBuildName
(
manifest:
manifest
,
buildInfo:
buildInfo
);
final
bool
buildNameIsMissing
=
buildName
==
null
||
buildName
.
isEmpty
;
if
(
buildNameIsMissing
)
{
printStatus
(
'Warning: Missing build name (CFBundleShortVersionString).'
);
}
final
String
buildNumber
=
parsedBuildNumber
(
manifest:
manifest
,
buildInfo:
buildInfo
);
final
bool
buildNumberIsMissing
=
buildNumber
==
null
||
buildNumber
.
isEmpty
;
if
(
buildNumberIsMissing
)
{
printStatus
(
'Warning: Missing build number (CFBundleVersion).'
);
}
if
(
buildNameIsMissing
||
buildNumberIsMissing
)
{
printError
(
'Action Required: You must set a build name and number in the pubspec.yaml '
'file version field before submitting to the App Store.'
);
}
Map
<
String
,
String
>
autoSigningConfigs
;
if
(
codesign
&&
buildForDevice
)
{
autoSigningConfigs
=
await
getCodeSigningIdentityDevelopmentTeam
(
iosApp:
app
);
...
...
packages/flutter_tools/lib/src/ios/xcodeproj.dart
View file @
d95adf99
...
...
@@ -18,6 +18,7 @@ import '../base/process.dart';
import
'../base/utils.dart'
;
import
'../build_info.dart'
;
import
'../cache.dart'
;
import
'../flutter_manifest.dart'
;
import
'../globals.dart'
;
import
'../project.dart'
;
import
'../reporting/reporting.dart'
;
...
...
@@ -118,6 +119,31 @@ void _updateGeneratedEnvironmentVariablesScript({
os
.
chmod
(
generatedModuleBuildPhaseScript
,
'755'
);
}
/// Build name parsed and validated from build info and manifest. Used for CFBundleShortVersionString.
String
parsedBuildName
(
{
@required
FlutterManifest
manifest
,
@required
BuildInfo
buildInfo
,
})
{
final
String
buildNameToParse
=
buildInfo
?.
buildName
??
manifest
.
buildName
;
return
validatedBuildNameForPlatform
(
TargetPlatform
.
ios
,
buildNameToParse
);
}
/// Build number parsed and validated from build info and manifest. Used for CFBundleVersion.
String
parsedBuildNumber
(
{
@required
FlutterManifest
manifest
,
@required
BuildInfo
buildInfo
,
})
{
String
buildNumberToParse
=
buildInfo
?.
buildNumber
??
manifest
.
buildNumber
;
final
String
buildNumber
=
validatedBuildNumberForPlatform
(
TargetPlatform
.
ios
,
buildNumberToParse
);
if
(
buildNumber
!=
null
&&
buildNumber
.
isNotEmpty
)
{
return
buildNumber
;
}
// Drop back to parsing build name if build number is not present. Build number is optional in the manifest, but
// FLUTTER_BUILD_NUMBER is required as the backing value for the required CFBundleVersion.
buildNumberToParse
=
buildInfo
?.
buildName
??
manifest
.
buildName
;
return
validatedBuildNumberForPlatform
(
TargetPlatform
.
ios
,
buildNumberToParse
);
}
/// List of lines of build settings. Example: 'FLUTTER_BUILD_DIR=build'
List
<
String
>
_xcodeBuildSettingsLines
({
@required
FlutterProject
project
,
...
...
@@ -158,51 +184,11 @@ List<String> _xcodeBuildSettingsLines({
xcodeBuildSettings
.
add
(
'FLUTTER_FRAMEWORK_DIR=
$frameworkDir
'
);
}
final
String
buildNameToParse
=
buildInfo
?.
buildName
??
project
.
manifest
.
buildName
;
final
bool
buildNameIsMissing
=
buildNameToParse
==
null
||
buildNameToParse
.
isEmpty
;
String
buildName
;
const
String
defaultBuildName
=
'1.0.0'
;
if
(
buildNameIsMissing
)
{
buildName
=
defaultBuildName
;
}
else
{
buildName
=
validatedBuildNameForPlatform
(
TargetPlatform
.
ios
,
buildNameToParse
);
}
final
String
buildNumberToParse
=
buildInfo
?.
buildNumber
??
project
.
manifest
.
buildNumber
;
final
bool
buildNumberIsMissing
=
(
buildNumberToParse
==
null
||
buildNumberToParse
.
isEmpty
)
&&
buildNameIsMissing
;
String
buildNumber
;
const
String
defaultBuildNumber
=
'1'
;
if
(
buildNumberIsMissing
)
{
buildNumber
=
defaultBuildNumber
;
}
else
{
buildNumber
=
validatedBuildNumberForPlatform
(
TargetPlatform
.
ios
,
buildNumberToParse
);
// Drop back to parsing build name if build number is not present. Build number is optional in the manifest, but
// FLUTTER_BUILD_NUMBER is required as the backing value for the required CFBundleVersion.
buildNumber
??=
validatedBuildNumberForPlatform
(
TargetPlatform
.
ios
,
buildNameToParse
);
}
if
(
buildNameIsMissing
)
{
printError
(
'Warning: Missing build name (CFBundleShortVersionString), defaulting to
$defaultBuildName
.'
);
}
if
(
buildNumberIsMissing
)
{
printError
(
'Warning: Missing build number (CFBundleVersion), defaulting to
$defaultBuildNumber
.'
);
}
if
(
buildNameIsMissing
||
buildNumberIsMissing
)
{
printError
(
'Action Required: You must set a build name and number in the pubspec.yaml '
'file version field before submitting to the App Store.'
);
}
if
(
buildName
==
null
&&
buildNumber
==
null
)
{
throwToolExit
(
'Cannot parse build number
$buildNumberToParse
or build name
$buildNameToParse
, check pubspec.yaml version.'
);
}
else
if
(
buildName
==
null
)
{
throwToolExit
(
'Cannot parse build name
$buildNameToParse
, check pubspec.yaml version.'
);
}
else
if
(
buildNumber
==
null
)
{
throwToolExit
(
'Cannot parse build number
$buildNumberToParse
, check pubspec.yaml version.'
);
}
final
String
buildName
=
parsedBuildName
(
manifest:
project
.
manifest
,
buildInfo:
buildInfo
)
??
'1.0.0'
;
xcodeBuildSettings
.
add
(
'FLUTTER_BUILD_NAME=
$buildName
'
);
final
String
buildNumber
=
parsedBuildNumber
(
manifest:
project
.
manifest
,
buildInfo:
buildInfo
)
??
'1'
;
xcodeBuildSettings
.
add
(
'FLUTTER_BUILD_NUMBER=
$buildNumber
'
);
if
(
artifacts
is
LocalEngineArtifacts
)
{
...
...
packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart
View file @
d95adf99
...
...
@@ -646,24 +646,6 @@ flutter:
expectedBuildNumber:
'1'
,
);
});
testUsingOsxContext
(
'fail when build name cannot be parsed'
,
()
async
{
const
String
manifest
=
'''
name: test
dependencies:
flutter:
sdk: flutter
flutter:
'''
;
const
BuildInfo
buildInfo
=
BuildInfo
(
BuildMode
.
release
,
null
,
buildName:
'abc'
,
buildNumber:
'1'
);
const
String
stderr
=
'Cannot parse build name abc, check pubspec.yaml version.'
;
expect
(()
async
=>
await
checkBuildVersion
(
manifestString:
manifest
,
buildInfo:
buildInfo
),
throwsToolExit
(
message:
stderr
));
});
});
}
...
...
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