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
b65f4211
Unverified
Commit
b65f4211
authored
Feb 07, 2020
by
Christopher Fujino
Committed by
GitHub
Feb 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make `codesign.dart` integration test easier to run locally (#50289)
parent
5dfa8e9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
7 deletions
+45
-7
codesign.dart
dev/bots/codesign.dart
+45
-7
No files found.
dev/bots/codesign.dart
View file @
b65f4211
...
...
@@ -5,11 +5,10 @@
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
String
get
cacheDirectory
{
final
String
flutterRepoRoot
=
path
.
normalize
(
path
.
join
(
path
.
dirname
(
Platform
.
script
.
path
),
'..'
,
'..'
));
return
path
.
normalize
(
path
.
join
(
flutterRepoRoot
,
'bin'
,
'cache'
));
}
String
get
repoRoot
=>
path
.
normalize
(
path
.
join
(
path
.
dirname
(
Platform
.
script
.
toFilePath
()),
'..'
,
'..'
));
String
get
cacheDirectory
=>
path
.
normalize
(
path
.
join
(
repoRoot
,
'bin'
,
'cache'
));
/// Check mime-type of file at [filePath] to determine if it is binary
bool
isBinary
(
String
filePath
)
{
final
ProcessResult
result
=
Process
.
runSync
(
'file'
,
...
...
@@ -22,11 +21,13 @@ bool isBinary(String filePath) {
return
(
result
.
stdout
as
String
).
contains
(
'application/x-mach-binary'
);
}
List
<
String
>
findBinaryPaths
()
{
/// Find every binary file in the given [rootDirectory]
List
<
String
>
findBinaryPaths
([
String
rootDirectory
])
{
rootDirectory
??=
cacheDirectory
;
final
ProcessResult
result
=
Process
.
runSync
(
'find'
,
<
String
>[
cache
Directory
,
root
Directory
,
'-type'
,
'f'
,
'-perm'
,
...
...
@@ -37,10 +38,47 @@ List<String> findBinaryPaths() {
return
allFiles
.
where
(
isBinary
).
toList
();
}
/// Given the path to a stamp file, read the contents.
///
/// Will throw if the file doesn't exist.
String
readStamp
(
String
filePath
)
{
final
File
file
=
File
(
filePath
);
if
(!
file
.
existsSync
())
{
throw
'Error! Stamp file
$filePath
does not exist!'
;
}
return
file
.
readAsStringSync
().
trim
();
}
/// Return whether or not the flutter cache is up to date.
bool
checkCacheIsCurrent
(
)
{
try
{
final
String
dartSdkStamp
=
readStamp
(
path
.
join
(
cacheDirectory
,
'engine-dart-sdk.stamp'
));
final
String
engineVersion
=
readStamp
(
path
.
join
(
repoRoot
,
'bin'
,
'internal'
,
'engine.version'
));
return
dartSdkStamp
==
engineVersion
;
}
catch
(
e
)
{
print
(
e
);
return
false
;
}
}
void
main
(
)
{
final
List
<
String
>
failures
=
<
String
>[];
for
(
final
String
binaryPath
in
findBinaryPaths
())
{
if
(!
Platform
.
isMacOS
)
{
print
(
'Error! Expected operating system "macos", actual operating system '
'is: "
${Platform.operatingSystem}
"'
);
exit
(
1
);
}
if
(!
checkCacheIsCurrent
())
{
print
(
'Warning! Your cache is either not present or not matching your flutter
\n
'
'version. Run a `flutter` command to update your cache, and re-try this
\n
'
'test.'
);
exit
(
1
);
}
for
(
final
String
binaryPath
in
findBinaryPaths
(
cacheDirectory
))
{
print
(
'Verifying the code signature of
$binaryPath
'
);
final
ProcessResult
result
=
Process
.
runSync
(
'codesign'
,
...
...
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