Skip to content

Commit 472bc84

Browse files
committed
Improved build rules
1 parent ca1ebf8 commit 472bc84

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

third_party/java/arcs/build_defs/build_defs.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ arcs_kt_native_library = _arcs_kt_native_library
4444

4545
arcs_kt_particles = _arcs_kt_particles
4646

47-
arcs_kt_schema = _arcs_kt_schema
48-
4947
arcs_kt_plan = _arcs_kt_plan
5048

49+
arcs_kt_schema = _arcs_kt_schema
50+
5151
arcs_manifest = _arcs_manifest
5252

5353
arcs_manifest_bundle = _arcs_manifest_bundle

third_party/java/arcs/build_defs/internal/kotlin.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ load(
2727
"//third_party/java/arcs/build_defs/internal:kotlin_wasm_annotations.bzl",
2828
"kotlin_wasm_annotations",
2929
)
30-
load("//third_party/java/arcs/build_defs/internal:util.bzl", "output_name")
30+
load("//third_party/java/arcs/build_defs/internal:util.bzl", "replace_arcs_suffix")
3131
load("//tools/build_defs/android:rules.bzl", "android_local_test")
3232
load(
3333
"//tools/build_defs/kotlin:rules.bzl",
@@ -278,7 +278,7 @@ def arcs_kt_plan(name, src, deps = [], out = None, visibility = None):
278278
out: the name of the output artifact (a Kotlin file).
279279
visibility: list of visibilities
280280
"""
281-
outs = [out] if out != None else [output_name(name, ".kt")]
281+
outs = [out] if out != None else [replace_arcs_suffix(src, ".kt")]
282282

283283
sigh_command(
284284
name = name,

third_party/java/arcs/build_defs/internal/manifest.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Arcs manifest bundling rules."""
22

33
load("//third_party/java/arcs/build_defs:sigh.bzl", "sigh_command")
4-
load("//third_party/java/arcs/build_defs/internal:util.bzl", "output_name")
4+
load("//third_party/java/arcs/build_defs/internal:util.bzl", "replace_arcs_suffix")
55

66
def arcs_manifest(name, srcs, deps = [], visibility = None):
77
"""Bundles .arcs manifest files with their particle implementations.
@@ -50,7 +50,7 @@ def arcs_manifest_json(name, srcs = [], deps = [], out = None, visibility = None
5050
out: the name of the output artifact (a JSON file).
5151
visibility: list of visibilities
5252
"""
53-
outs = [out] if out != None else [output_name(name, ".json")]
53+
outs = [out] if out != None else [replace_arcs_suffix(name, ".json")]
5454

5555
sigh_command(
5656
name = name,
@@ -73,7 +73,7 @@ def arcs_manifest_proto(name, src, deps = [], out = None, visibility = None):
7373
out: the name of the output artifact (a proto file).
7474
visibility: list of visibilities
7575
"""
76-
outs = [out] if out != None else [output_name(name, ".pb.bin")]
76+
outs = [out] if out != None else [replace_arcs_suffix(name, ".pb.bin")]
7777

7878
sigh_command(
7979
name = name,

third_party/java/arcs/build_defs/internal/schemas.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Rules are re-exported in build_defs.bzl -- use those instead.
44
"""
55

66
load("//third_party/java/arcs/build_defs:sigh.bzl", "sigh_command")
7-
load("//third_party/java/arcs/build_defs/internal:util.bzl", "output_name")
7+
load("//third_party/java/arcs/build_defs/internal:util.bzl", "replace_arcs_suffix")
88
load(":kotlin.bzl", "ARCS_SDK_DEPS", "arcs_kt_library")
99

1010
def _run_schema2wasm(
@@ -52,7 +52,7 @@ def arcs_cc_schema(name, src, deps = [], out = None, package = "arcs"):
5252
name = name + "_genrule",
5353
src = src,
5454
deps = deps,
55-
out = out or output_name(src, ".h"),
55+
out = out or replace_arcs_suffix(src, ".h"),
5656
language_flag = "--cpp",
5757
language_name = "C++",
5858
wasm = False,
@@ -72,8 +72,8 @@ def arcs_kt_schema(name, srcs, deps = [], package = "arcs.sdk"):
7272
for src in srcs:
7373
for wasm in [True, False]:
7474
ext = "wasm" if wasm else "jvm"
75-
genrule_name = output_name(src, "_genrule_" + ext)
76-
out = output_name(src, "_GeneratedSchemas.%s.kt" % ext)
75+
genrule_name = replace_arcs_suffix(src, "_genrule_" + ext)
76+
out = replace_arcs_suffix(src, "_GeneratedSchemas.%s.kt" % ext)
7777
outs.append(out)
7878
_run_schema2wasm(
7979
name = genrule_name,

third_party/java/arcs/build_defs/internal/util.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Shared utilities for Arcs internal rules"""
22

3-
def output_name(src, suffix = ""):
4-
"""Cleans up the given file name, and replaces the .arcs extension."""
3+
def replace_arcs_suffix(src, suffix = ""):
4+
"""Cleans up the given file name, and replaces the .arcs extension with the provided suffix."""
55

66
# For references to files in other build targets, extract the filename:
77
# //src/wasm/tests:manifest.arcs -> manifest.arcs

0 commit comments

Comments
 (0)