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.
1313# limitations under the License.
1414"""Functions to create the deploy info proto used by ASwB."""
1515
16+ load ("//rules:visibility.bzl" , "PROJECT_VISIBILITY" )
1617load (":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