Skip to content

Commit e5fb704

Browse files
Ian Childsfacebook-github-bot
Ian Childs
authored andcommitted
Add zip_file_toolchain
Summary: Needed for Android builds in OSS Reviewed By: blackm00n Differential Revision: D74076436 fbshipit-source-id: c23abe3678b6dbb06565ead64e28d54cfa77a15a
1 parent 1f8cd87 commit e5fb704

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

prelude/toolchains/demo.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ load("@prelude//toolchains:ocaml.bzl", "system_ocaml_toolchain")
1818
load("@prelude//toolchains:python.bzl", "system_python_bootstrap_toolchain", "system_python_toolchain")
1919
load("@prelude//toolchains:remote_test_execution.bzl", "remote_test_execution_toolchain")
2020
load("@prelude//toolchains:rust.bzl", "system_rust_toolchain")
21+
load("@prelude//toolchains:zip_file.bzl", "zip_file_toolchain")
2122

2223
def system_demo_toolchains():
2324
"""
@@ -158,3 +159,8 @@ def system_demo_toolchains():
158159
name = "test",
159160
visibility = ["PUBLIC"],
160161
)
162+
163+
zip_file_toolchain(
164+
name = "zip_file",
165+
visibility = ["PUBLIC"],
166+
)

prelude/toolchains/zip_file.bzl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
#
3+
# This source code is licensed under both the MIT license found in the
4+
# LICENSE-MIT file in the root directory of this source tree and the Apache
5+
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
6+
# of this source tree.
7+
8+
load("@prelude//zip_file:zip_file_toolchain.bzl", "ZipFileToolchainInfo")
9+
10+
def zip_file_toolchain(name, **kwargs):
11+
kwargs["create_zip"] = "prelude//toolchains/android/src/com/facebook/buck/features/zip/rules/utils:zip_binary"
12+
13+
_zip_file_toolchain_rule(
14+
name = name,
15+
**kwargs
16+
)
17+
18+
def _zip_file_toolchain_rule_impl(ctx):
19+
return [
20+
DefaultInfo(),
21+
ZipFileToolchainInfo(
22+
create_zip = ctx.attrs.create_zip[RunInfo],
23+
),
24+
]
25+
26+
_zip_file_toolchain_rule = rule(
27+
attrs = {
28+
"create_zip": attrs.dep(providers = [RunInfo]),
29+
},
30+
impl = _zip_file_toolchain_rule_impl,
31+
is_toolchain_rule = True,
32+
)

0 commit comments

Comments
 (0)