Skip to content

Commit 2302a09

Browse files
ted-xiecopybara-github
authored andcommitted
Properly generate the deploy_info PB in mobile-install
Used for OSS mobile-install + Android Studio integration PiperOrigin-RevId: 743744386 Change-Id: I9aff608df0ed78f50d18e64891952e9028ada49f
1 parent 7f04410 commit 2302a09

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

mobile_install/dependency_map.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ versioned_deps = struct(
2424
head = "//src/tools/mi/deployment_oss:deploy_binary",
2525
),
2626
deploy_info = struct(
27-
head = "//tools/android:gen_fail",
27+
head = "//src/tools/deploy_info:deploy_info",
2828
),
2929
forwarder = struct(
3030
head = "//tools/android:gen_fail",

mobile_install/deploy_info.bzl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023 The Bazel Authors. All rights reserved.
1+
# Copyright 2018 The Bazel Authors. All rights reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -13,18 +13,20 @@
1313
# limitations under the License.
1414
"""Functions to create the deploy info proto used by ASwB."""
1515

16+
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
1617
load(":utils.bzl", "utils")
1718

18-
def make_deploy_info_pb(ctx, _unused_manifest, _unused_apks):
19+
visibility(PROJECT_VISIBILITY)
20+
21+
def make_deploy_info_pb(ctx, manifest, apks):
1922
"""Builds a android_deploy_info pb for ASwB.
2023
21-
proto def in bazel/src/main/protobuf/android_deploy_info.proto.
22-
For now, just writes an empty file to the pb.
24+
proto def in src/tools/deploy_info/proto/android_deploy_info.proto
2325
2426
Args:
2527
ctx: The context.
26-
_unused_manifest: the merged manifest of the application
27-
_unused_apks: the mobile_install apks
28+
manifest: the merged manifest of the application
29+
apks: the mobile_install apks
2830
2931
Returns:
3032
The android_deploy_info pb
@@ -34,9 +36,17 @@ def make_deploy_info_pb(ctx, _unused_manifest, _unused_apks):
3436
# Do not change this suffix without coordinating with an Android Studio change.
3537
deploy_info_pb = utils.isolated_declare_file(ctx, ctx.label.name + "_mi.deployinfo.pb")
3638

37-
ctx.actions.run_shell(
39+
args = ctx.actions.args()
40+
args.add("--manifest", manifest)
41+
args.add_joined("--apk", apks, join_with = ",")
42+
args.add("--deploy_info", deploy_info_pb)
43+
44+
ctx.actions.run(
45+
executable = ctx.executable._deploy_info,
46+
arguments = [args],
3847
outputs = [deploy_info_pb],
39-
command = "echo > " + deploy_info_pb.path,
48+
mnemonic = "DeployInfo",
49+
progress_message = "MI DeployInfo",
4050
)
4151

4252
return deploy_info_pb

0 commit comments

Comments
 (0)