-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate CreateDeployInfoAction from Native to Starlark.
PiperOrigin-RevId: 611167708 Change-Id: I15d17a4850df5647921b8f2d61eadaf7136c1b16
- Loading branch information
Zhaoqing Xu
authored and
Copybara-Service
committed
Feb 28, 2024
1 parent
50e170b
commit aeb70ea
Showing
6 changed files
with
158 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") | ||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") | ||
|
||
package(default_applicable_licenses = ["//:license"]) | ||
|
||
licenses(["notice"]) | ||
|
||
go_binary( | ||
name = "deploy_info", | ||
srcs = ["deploy_info.go"], | ||
visibility = [ | ||
"//test/mobile_install:__subpackages__", | ||
"//toolchains/android:__subpackages__", | ||
], | ||
deps = [ | ||
"//src/common/golang:flagfile", | ||
"//src/common/golang:flags", | ||
"//src/tools/deploy_info/proto:android_deploy_info_go_proto", | ||
"@org_golang_google_protobuf//proto", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2018 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Tool to generate the deploy_info.pb that ASwB needs in order to deploy apps. | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"io/ioutil" | ||
"log" | ||
|
||
pb "src/tools/deploy_info/proto/android_deploy_info_go_proto" | ||
_ "src/common/golang/flagfile" | ||
"src/common/golang/flags" | ||
"google.golang.org/protobuf/proto" | ||
) | ||
|
||
var apk = flags.NewStringList("apk", "Path to the apk(s).") | ||
var manifest = flag.String("manifest", "", "Path to the Android manifest.") | ||
var deployInfo = flag.String("deploy_info", "", "Deploy info pb output path") | ||
|
||
func main() { | ||
flag.Parse() | ||
|
||
if *apk == nil { | ||
log.Fatalf("-apk needs to be specified.") | ||
} | ||
|
||
if *manifest == "" { | ||
log.Fatalf("-manifest needs to be specified.") | ||
} | ||
|
||
if *deployInfo == "" { | ||
log.Fatalf("-deploy_info needs to be specified.") | ||
} | ||
|
||
manifestArtifact := &pb.Artifact{ExecRootPath: *manifest} | ||
splitArtifacts := []*pb.Artifact{} | ||
for _, split := range *apk { | ||
splitArtifacts = append(splitArtifacts, &pb.Artifact{ExecRootPath: split}) | ||
} | ||
|
||
info := &pb.AndroidDeployInfo{ | ||
MergedManifest: manifestArtifact, | ||
ApksToDeploy: splitArtifacts} | ||
bits, err := proto.Marshal(info) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
if err := ioutil.WriteFile(*deployInfo, bits, 0644); err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") | ||
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") | ||
|
||
go_proto_library( | ||
name = "android_deploy_info_go_proto", | ||
importpath = "src/tools/deploy_info/proto/android_deploy_info_go_proto", | ||
protos = [ | ||
"@bazel_tools//src/main/protobuf:android_deploy_info_proto", | ||
], | ||
visibility = [ | ||
"//src/tools/deploy_info:__pkg__", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters