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
219bcd32
Unverified
Commit
219bcd32
authored
Feb 02, 2022
by
Zachary Anderson
Committed by
GitHub
Feb 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include Dart SDK arch in package info (#97278)
parent
10fbbafe
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
259 additions
and
40 deletions
+259
-40
prepare_package.dart
dev/bots/prepare_package.dart
+96
-35
prepare_package_test.dart
dev/bots/test/prepare_package_test.dart
+163
-5
No files found.
dev/bots/prepare_package.dart
View file @
219bcd32
...
...
@@ -26,6 +26,7 @@ const String baseUrl = 'https://storage.googleapis.com/flutter_infra_release';
const
int
shortCacheSeconds
=
60
;
const
String
frameworkVersionTag
=
'frameworkVersionFromGit'
;
const
String
dartVersionTag
=
'dartSdkVersion'
;
const
String
dartTargetArchTag
=
'dartTargetArch'
;
/// Exception class for when a process fails to run, so we can catch
/// it and provide something more readable than a stack trace.
...
...
@@ -191,32 +192,72 @@ class ArchiveCreator {
///
/// If subprocessOutput is true, then output from processes invoked during
/// archive creation is echoed to stderr and stdout.
ArchiveCreator
(
this
.
tempDir
,
this
.
outputDir
,
this
.
revision
,
this
.
branch
,
{
this
.
strict
=
true
,
factory
ArchiveCreator
(
Directory
tempDir
,
Directory
outputDir
,
String
revision
,
Branch
branch
,
{
bool
strict
=
true
,
ProcessManager
?
processManager
,
bool
subprocessOutput
=
true
,
this
.
platform
=
const
LocalPlatform
(),
Platform
platform
=
const
LocalPlatform
(),
HttpReader
?
httpReader
,
})
:
assert
(
revision
.
length
==
40
),
flutterRoot
=
Directory
(
path
.
join
(
tempDir
.
path
,
'flutter'
)),
httpReader
=
httpReader
??
http
.
readBytes
,
_processRunner
=
ProcessRunner
(
processManager:
processManager
,
subprocessOutput:
subprocessOutput
,
platform:
platform
,
)
{
_flutter
=
path
.
join
(
})
{
final
Directory
flutterRoot
=
Directory
(
path
.
join
(
tempDir
.
path
,
'flutter'
));
final
ProcessRunner
processRunner
=
ProcessRunner
(
processManager:
processManager
,
subprocessOutput:
subprocessOutput
,
platform:
platform
,
)..
environment
[
'PUB_CACHE'
]
=
path
.
join
(
flutterRoot
.
absolute
.
path
,
'.pub-cache'
,
);
final
String
flutterExecutable
=
path
.
join
(
flutterRoot
.
absolute
.
path
,
'bin'
,
'flutter'
,
);
_processRunner
.
environment
[
'PUB_CACHE'
]
=
path
.
join
(
flutterRoot
.
absolute
.
path
,
'.pub-cache'
);
final
String
dartExecutable
=
path
.
join
(
flutterRoot
.
absolute
.
path
,
'bin'
,
'cache'
,
'dart-sdk'
,
'bin'
,
'dart'
,
);
return
ArchiveCreator
.
_
(
tempDir:
tempDir
,
platform:
platform
,
flutterRoot:
flutterRoot
,
outputDir:
outputDir
,
revision:
revision
,
branch:
branch
,
strict:
strict
,
processRunner:
processRunner
,
httpReader:
httpReader
??
http
.
readBytes
,
flutterExecutable:
flutterExecutable
,
dartExecutable:
dartExecutable
,
);
}
ArchiveCreator
.
_
({
required
this
.
tempDir
,
required
this
.
platform
,
required
this
.
flutterRoot
,
required
this
.
outputDir
,
required
this
.
revision
,
required
this
.
branch
,
required
this
.
strict
,
required
ProcessRunner
processRunner
,
required
this
.
httpReader
,
required
String
flutterExecutable
,
required
String
dartExecutable
,
})
:
assert
(
revision
.
length
==
40
),
_processRunner
=
processRunner
,
_flutter
=
flutterExecutable
,
_dart
=
dartExecutable
;
/// The platform to use for the environment and determining which
/// platform we're running on.
final
Platform
platform
;
...
...
@@ -252,17 +293,25 @@ class ArchiveCreator {
/// [http.readBytes].
final
HttpReader
httpReader
;
late
File
_outputFile
;
final
Map
<
String
,
String
>
_version
=
<
String
,
String
>{};
late
String
_flutter
;
late
String
_dart
;
late
final
Future
<
String
>
_dartArch
=
(()
async
{
// Parse 'arch' out of a string like '... "os_arch"\n'.
return
(
await
_runDart
(<
String
>[
'--version'
]))
.
trim
().
split
(
' '
).
last
.
replaceAll
(
'"'
,
''
).
split
(
'_'
)[
1
];
})();
/// Get the name of the channel as a string.
String
get
branchName
=>
getBranchName
(
branch
);
/// Returns a default archive name when given a Git revision.
/// Used when an output filename is not given.
String
get
_archiveName
{
Future
<
String
>
get
_archiveName
async
{
final
String
os
=
platform
.
operatingSystem
.
toLowerCase
();
// Include the intended host archetecture in the file name for non-x64.
final
String
arch
=
await
_dartArch
==
'x64'
?
''
:
'
${await _dartArch}
_'
;
// We don't use .tar.xz on Mac because although it can unpack them
// on the command line (with tar), the "Archive Utility" that runs
// when you double-click on them just does some crazy behavior (it
...
...
@@ -271,7 +320,7 @@ class ArchiveCreator {
// unpacking it!) So, we use .zip for Mac, and the files are about
// 220MB larger than they need to be. :-(
final
String
suffix
=
platform
.
isLinux
?
'tar.xz'
:
'zip'
;
return
'flutter_
${os}
_
${_version[frameworkVersionTag]}
-
$branchName
.
$suffix
'
;
return
'flutter_
${os}
_
$
arch$
{_version[frameworkVersionTag]}
-
$branchName
.
$suffix
'
;
}
/// Checks out the flutter repo and prepares it for other operations.
...
...
@@ -289,12 +338,15 @@ class ArchiveCreator {
/// Performs all of the steps needed to create an archive.
Future
<
File
>
createArchive
()
async
{
assert
(
_version
.
isNotEmpty
,
'Must run initializeRepo before createArchive'
);
_outputFile
=
File
(
path
.
join
(
outputDir
.
absolute
.
path
,
_archiveName
));
final
File
outputFile
=
File
(
path
.
join
(
outputDir
.
absolute
.
path
,
await
_archiveName
,
));
await
_installMinGitIfNeeded
();
await
_populateCaches
();
await
_validate
();
await
_archiveFiles
(
_
outputFile
);
return
_
outputFile
;
await
_archiveFiles
(
outputFile
);
return
outputFile
;
}
/// Validates the integrity of the release package.
...
...
@@ -307,14 +359,6 @@ class ArchiveCreator {
return
;
}
// Validate that the dart binary is codesigned
final
String
dartPath
=
path
.
join
(
flutterRoot
.
absolute
.
path
,
'bin'
,
'cache'
,
'dart-sdk'
,
'bin'
,
'dart'
,
);
try
{
// TODO(fujino): Use the conductor https://github.com/flutter/flutter/issues/81701
await
_processRunner
.
runProcess
(
...
...
@@ -322,13 +366,13 @@ class ArchiveCreator {
'codesign'
,
'-vvvv'
,
'--check-notarization'
,
dartPath
,
_dart
,
],
workingDirectory:
flutterRoot
,
);
}
on
PreparePackageException
catch
(
e
)
{
throw
PreparePackageException
(
'The binary
$
dartPath
was not codesigned!
\n
${e.message}
'
,
'The binary
$
_dart
was not codesigned!
\n
${e.message}
'
,
);
}
}
...
...
@@ -370,6 +414,7 @@ class ArchiveCreator {
final
Map
<
String
,
dynamic
>
result
=
json
.
decode
(
versionJson
)
as
Map
<
String
,
dynamic
>;
result
.
forEach
((
String
key
,
dynamic
value
)
=>
versionMap
[
key
]
=
value
.
toString
());
versionMap
[
frameworkVersionTag
]
=
gitVersion
;
versionMap
[
dartTargetArchTag
]
=
await
_dartArch
;
return
versionMap
;
}
...
...
@@ -464,6 +509,13 @@ class ArchiveCreator {
}
}
Future
<
String
>
_runDart
(
List
<
String
>
args
,
{
Directory
?
workingDirectory
})
{
return
_processRunner
.
runProcess
(
<
String
>[
_dart
,
...
args
],
workingDirectory:
workingDirectory
??
flutterRoot
,
);
}
Future
<
String
>
_runFlutter
(
List
<
String
>
args
,
{
Directory
?
workingDirectory
})
{
return
_processRunner
.
runProcess
(
<
String
>[
_flutter
,
...
args
],
...
...
@@ -623,6 +675,7 @@ class ArchivePublisher {
newEntry
[
'channel'
]
=
branchName
;
newEntry
[
'version'
]
=
version
[
frameworkVersionTag
];
newEntry
[
'dart_sdk_version'
]
=
version
[
dartVersionTag
];
newEntry
[
'dart_sdk_arch'
]
=
version
[
dartTargetArchTag
];
newEntry
[
'release_date'
]
=
DateTime
.
now
().
toUtc
().
toIso8601String
();
newEntry
[
'archive'
]
=
destinationArchivePath
;
newEntry
[
'sha256'
]
=
await
_getChecksum
(
outputFile
);
...
...
@@ -849,8 +902,16 @@ Future<void> main(List<String> rawArguments) async {
}
}
final
bool
publish
=
parsedArguments
[
'publish'
]
as
bool
;
final
bool
dryRun
=
parsedArguments
[
'dry_run'
]
as
bool
;
final
Branch
branch
=
fromBranchName
(
parsedArguments
[
'branch'
]
as
String
);
final
ArchiveCreator
creator
=
ArchiveCreator
(
tempDir
,
outputDir
,
revision
,
branch
,
strict:
parsedArguments
[
'publish'
]
as
bool
);
final
ArchiveCreator
creator
=
ArchiveCreator
(
tempDir
,
outputDir
,
revision
,
branch
,
strict:
publish
&&
!
dryRun
,
);
int
exitCode
=
0
;
late
String
message
;
try
{
...
...
@@ -863,7 +924,7 @@ Future<void> main(List<String> rawArguments) async {
branch
,
version
,
outputFile
,
parsedArguments
[
'dry_run'
]
as
bool
,
dryRun
,
);
await
publisher
.
publishArchive
(
parsedArguments
[
'force'
]
as
bool
);
}
...
...
dev/bots/test/prepare_package_test.dart
View file @
219bcd32
This diff is collapsed.
Click to expand it.
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