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
d9e37156
Unverified
Commit
d9e37156
authored
Mar 20, 2018
by
Greg Spencer
Committed by
GitHub
Mar 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix package preparation on Windows (#15720)
parent
cc1cf9e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
23 deletions
+41
-23
prepare_package.dart
dev/bots/prepare_package.dart
+35
-18
prepare_package_test.dart
dev/bots/test/prepare_package_test.dart
+6
-5
No files found.
dev/bots/prepare_package.dart
View file @
d9e37156
...
...
@@ -165,10 +165,11 @@ class ProcessRunner {
final
int
exitCode
=
await
allComplete
();
if
(
exitCode
!=
0
&&
!
failOk
)
{
final
String
message
=
'Running "
${commandLine.join(' ')}
" in
${workingDirectory.path}
failed'
;
final
String
message
=
'Running "
${commandLine.join(' ')}
" in
${workingDirectory.path}
failed'
;
throw
new
ProcessRunnerException
(
message
,
new
ProcessResult
(
0
,
exitCode
,
null
,
'returned
$exitCode
'
));
message
,
new
ProcessResult
(
0
,
exitCode
,
null
,
'returned
$exitCode
'
),
);
}
return
utf8
.
decoder
.
convert
(
output
).
trim
();
}
...
...
@@ -350,13 +351,17 @@ class ArchiveCreator {
}
Future
<
String
>
_runFlutter
(
List
<
String
>
args
,
{
Directory
workingDirectory
})
{
return
_processRunner
.
runProcess
(<
String
>[
_flutter
]..
addAll
(
args
),
workingDirectory:
workingDirectory
??
flutterRoot
);
return
_processRunner
.
runProcess
(
<
String
>[
_flutter
]..
addAll
(
args
),
workingDirectory:
workingDirectory
??
flutterRoot
,
);
}
Future
<
String
>
_runGit
(
List
<
String
>
args
,
{
Directory
workingDirectory
})
{
return
_processRunner
.
runProcess
(<
String
>[
'git'
]..
addAll
(
args
),
workingDirectory:
workingDirectory
??
flutterRoot
);
return
_processRunner
.
runProcess
(
<
String
>[
'git'
]..
addAll
(
args
),
workingDirectory:
workingDirectory
??
flutterRoot
,
);
}
/// Unpacks the given zip file into the currentDirectory (if set), or the
...
...
@@ -400,8 +405,10 @@ class ArchiveCreator {
path
.
basename
(
source
.
path
),
];
}
return
_processRunner
.
runProcess
(
commandLine
,
workingDirectory:
new
Directory
(
path
.
dirname
(
source
.
absolute
.
path
)));
return
_processRunner
.
runProcess
(
commandLine
,
workingDirectory:
new
Directory
(
path
.
dirname
(
source
.
absolute
.
path
)),
);
}
/// Create a tar archive from the directory source.
...
...
@@ -427,7 +434,7 @@ class ArchivePublisher {
this
.
platform
:
const
LocalPlatform
(),
})
:
assert
(
revision
.
length
==
40
),
platformName
=
platform
.
operatingSystem
.
toLowerCase
(),
metadataGsPath
=
'
$gsReleaseFolder
/
releases_
${platform.operatingSystem.toLowerCase()}
.json
'
,
metadataGsPath
=
'
$gsReleaseFolder
/
${getMetadataFilename(platform)}
'
,
_processRunner
=
new
ProcessRunner
(
processManager:
processManager
,
subprocessOutput:
subprocessOutput
,
...
...
@@ -443,8 +450,8 @@ class ArchivePublisher {
final
File
outputFile
;
final
ProcessRunner
_processRunner
;
String
get
branchName
=>
getBranchName
(
branch
);
String
get
destinationArchivePath
=>
'
$branchName
/
$platformName
/
${path.basename(outputFile.path)}
'
;
String
get
destinationArchivePath
=>
'
$branchName
/
$platformName
/
${path.basename(outputFile.path)}
'
;
static
String
getMetadataFilename
(
Platform
platform
)
=>
'releases_
${platform.operatingSystem.toLowerCase()}
.json
'
;
/// Publish the archive to Google Storage.
Future
<
Null
>
publishArchive
()
async
{
...
...
@@ -455,7 +462,15 @@ class ArchivePublisher {
}
Future
<
Null
>
_updateMetadata
()
async
{
final
String
currentMetadata
=
await
_runGsUtil
(<
String
>[
'cat'
,
metadataGsPath
]);
// We can't just cat the metadata from the server with 'gsutil cat', because
// Windows wants to echo the commands that execute in gsutil.bat to the
// stdout when we do that. So, we copy the file locally and then read it
// back in.
final
File
metadataFile
=
new
File
(
path
.
join
(
tempDir
.
absolute
.
path
,
getMetadataFilename
(
platform
)),
);
await
_runGsUtil
(<
String
>[
'cp'
,
metadataGsPath
,
metadataFile
.
absolute
.
path
]);
final
String
currentMetadata
=
metadataFile
.
readAsStringSync
();
if
(
currentMetadata
.
isEmpty
)
{
throw
new
ProcessRunnerException
(
'Empty metadata received from server'
);
}
...
...
@@ -485,14 +500,16 @@ class ArchivePublisher {
metadata
[
'version'
]
=
version
;
jsonData
[
'releases'
][
revision
][
branchName
]
=
metadata
;
final
File
tempFile
=
new
File
(
path
.
join
(
tempDir
.
absolute
.
path
,
'releases_
$platformName
.json'
));
const
JsonEncoder
encoder
=
const
JsonEncoder
.
withIndent
(
' '
);
temp
File
.
writeAsStringSync
(
encoder
.
convert
(
jsonData
));
await
_cloudCopy
(
temp
File
.
absolute
.
path
,
metadataGsPath
);
metadata
File
.
writeAsStringSync
(
encoder
.
convert
(
jsonData
));
await
_cloudCopy
(
metadata
File
.
absolute
.
path
,
metadataGsPath
);
}
Future
<
String
>
_runGsUtil
(
List
<
String
>
args
,
{
Directory
workingDirectory
,
bool
failOk:
false
})
async
{
Future
<
String
>
_runGsUtil
(
List
<
String
>
args
,
{
Directory
workingDirectory
,
bool
failOk:
false
,
})
async
{
return
_processRunner
.
runProcess
(
<
String
>[
'gsutil'
]..
addAll
(
args
),
workingDirectory:
workingDirectory
,
...
...
dev/bots/test/prepare_package_test.dart
View file @
d9e37156
...
...
@@ -143,10 +143,10 @@ void main() {
await
creator
.
createArchive
();
expect
(
verify
(
processManager
.
start
(
captureAny
,
workingDirectory:
captureAny
,
environment:
captureAny
,
)).
captured
[
1
][
'PUB_CACHE'
],
typed
(
captureAny
)
,
workingDirectory:
typed
(
captureAny
,
named:
'workingDirectory'
)
,
environment:
typed
(
captureAny
,
named:
'environment'
)
,
)).
captured
[
2
][
'PUB_CACHE'
],
endsWith
(
path
.
join
(
'flutter'
,
'.pub-cache'
)),
);
});
...
...
@@ -257,10 +257,11 @@ void main() {
}
}
'''
;
new
File
(
jsonPath
).
writeAsStringSync
(
releasesJson
);
final
Map
<
String
,
List
<
ProcessResult
>>
calls
=
<
String
,
List
<
ProcessResult
>>{
'gsutil rm
$gsArchivePath
'
:
null
,
'gsutil -h Content-Type:
$archiveMime
cp
$archivePath
$gsArchivePath
'
:
null
,
'gsutil c
at
$gsJsonPath
'
:
<
ProcessResult
>[
new
ProcessResult
(
0
,
0
,
releasesJson
,
''
)]
,
'gsutil c
p
$gsJsonPath
$jsonPath
'
:
null
,
'gsutil rm
$gsJsonPath
'
:
null
,
'gsutil -h Content-Type:application/json cp
$jsonPath
$gsJsonPath
'
:
null
,
};
...
...
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