Merge "Skip Bazel dist dir migration if not in dist mode or if Bazel dist dir does not exist." am: e808dae1fd am: 861ea59475

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1532818

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I67c90bd431d3cc46bfc07726abd578a412bba6c7
This commit is contained in:
Rupert Shuttleworth
2020-12-17 04:01:05 +00:00
committed by Automerger Merge Worker

View File

@@ -174,7 +174,7 @@ func main() {
build.SetupOutDir(buildCtx, config)
if config.UseBazel() {
if config.UseBazel() && config.Dist() {
defer populateExternalDistDir(buildCtx, config)
}
@@ -547,6 +547,12 @@ func populateExternalDistDir(ctx build.Context, config build.Config) {
return
}
// Make sure the internal DIST_DIR actually exists before trying to read from it
if _, err = os.Stat(internalDistDirPath); os.IsNotExist(err) {
ctx.Println("Skipping Bazel dist dir migration - nothing to do!")
return
}
// Make sure the external DIST_DIR actually exists before trying to write to it
if err = os.MkdirAll(externalDistDirPath, 0755); err != nil {
ctx.Fatalf("Unable to make directory %s: %s", externalDistDirPath, err)