Skip to content

Commit 50677ba

Browse files
committed
Fix BCR integration
1 parent 35e8b0d commit 50677ba

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

Example/HelloWorld/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,5 +212,5 @@ setup_sourcekit_bsp(
212212
],
213213
build_test_suffix = "_(PLAT)_skbsp",
214214
build_test_platform_placeholder = "(PLAT)",
215-
index_build_batch_size = 10
215+
index_build_batch_size = 10,
216216
)

Sources/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ spm_release_binary(
1616
visibility = ["//visibility:public"],
1717
tags = [
1818
"no-sandbox",
19+
"requires-network",
1920
],
2021
)

rules/internal/spm.bzl

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
def _spm_release_binary_impl(ctx):
2-
"""Builds a Swift package with SPM."""
1+
BASE_SCRIPT = """#!/bin/bash
2+
set -e
3+
ORIG_PATH=$(pwd)
4+
PKG_PATH="{}"
5+
PKG_DIR=$(dirname $PKG_PATH)
6+
7+
cd $PKG_DIR
8+
swift build -c release
9+
BIN_PATH=$(realpath .build/release/{})
10+
cd $ORIG_PATH
11+
cp $BIN_PATH "{}"
12+
"""
313

4-
# Declare the output binary
14+
def _spm_release_binary_impl(ctx):
515
binary_name = ctx.attr.name
616
binary_output = ctx.actions.declare_file(binary_name)
717

818
build_script = ctx.actions.declare_file("build_spm.sh")
9-
base_script = """#!/bin/bash
10-
set -e
11-
ORIG_PATH=$(pwd)
12-
PKG_PATH="{}"
13-
PKG_DIR=$(dirname $PKG_PATH)
14-
cd $PKG_DIR
15-
swift build -c release
16-
BIN_PATH=$(realpath .build/release/{})
17-
cd $ORIG_PATH
18-
cp $BIN_PATH "{}"
19-
""".format(
19+
base_script = BASE_SCRIPT.format(
2020
ctx.file.package_swift.path,
2121
ctx.attr.name,
2222
binary_output.path,
@@ -34,6 +34,11 @@ def _spm_release_binary_impl(ctx):
3434
arguments = [],
3535
mnemonic = "SPMBuild",
3636
progress_message = "Building SPM binary: {}".format(ctx.attr.name),
37+
use_default_shell_env = True,
38+
execution_requirements = {
39+
"no-sandbox": "1",
40+
"requires-network": "1",
41+
},
3742
)
3843

3944
return DefaultInfo(

0 commit comments

Comments
 (0)