From 98798670a148ae407999e1da7b55cf16381b024a Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Fri, 6 Jul 2018 04:26:25 -0700 Subject: Format .bzl files with buildifier PiperOrigin-RevId: 203459720 --- tensorflow/java/build_defs.bzl | 2 +- tensorflow/java/src/gen/gen_ops.bzl | 80 +++++++++++++++++++------------------ 2 files changed, 42 insertions(+), 40 deletions(-) (limited to 'tensorflow/java') diff --git a/tensorflow/java/build_defs.bzl b/tensorflow/java/build_defs.bzl index e1916ca4d9..f423cc4d82 100644 --- a/tensorflow/java/build_defs.bzl +++ b/tensorflow/java/build_defs.bzl @@ -18,7 +18,7 @@ XLINT_OPTS = [ "-Xlint:-processing", "-Xlint:-serial", "-Xlint:-try", - "-Xlint:-classfile", # see b/32750402, go/javac-warnings#classfile + "-Xlint:-classfile", # see b/32750402, go/javac-warnings#classfile ] # The bazel errorprone plugin currently only enables default errorChecks diff --git a/tensorflow/java/src/gen/gen_ops.bzl b/tensorflow/java/src/gen/gen_ops.bzl index f4ff34ea03..b46721a93d 100644 --- a/tensorflow/java/src/gen/gen_ops.bzl +++ b/tensorflow/java/src/gen/gen_ops.bzl @@ -17,46 +17,48 @@ load( # and then archive those source files into # ops/gen_sources.srcjar # -def tf_java_op_gen_srcjar(name, - gen_tool, - base_package, - api_def_srcs=[], - out_dir="ops/", - out_src_dir="src/main/java/", - visibility=["//tensorflow/java:__pkg__"]): +def tf_java_op_gen_srcjar( + name, + gen_tool, + base_package, + api_def_srcs = [], + out_dir = "ops/", + out_src_dir = "src/main/java/", + visibility = ["//tensorflow/java:__pkg__"]): + gen_cmds = ["rm -rf $(@D)"] # Always start from fresh when generating source files + srcs = api_def_srcs[:] - gen_cmds = ["rm -rf $(@D)"] # Always start from fresh when generating source files - srcs = api_def_srcs[:] + if not api_def_srcs: + api_def_args_str = "," + else: + api_def_args = [] + for api_def_src in api_def_srcs: + # Add directory of the first ApiDef source to args. + # We are assuming all ApiDefs in a single api_def_src are in the + # same directory. + api_def_args.append( + "$$(dirname $$(echo $(locations " + api_def_src + + ") | cut -d\" \" -f1))", + ) + api_def_args_str = ",".join(api_def_args) - if not api_def_srcs: - api_def_args_str = "," - else: - api_def_args = [] - for api_def_src in api_def_srcs: - # Add directory of the first ApiDef source to args. - # We are assuming all ApiDefs in a single api_def_src are in the - # same directory. - api_def_args.append( - "$$(dirname $$(echo $(locations " + api_def_src + - ") | cut -d\" \" -f1))") - api_def_args_str = ",".join(api_def_args) + gen_cmds += ["$(location " + gen_tool + ")" + + " --output_dir=$(@D)/" + out_src_dir + + " --base_package=" + base_package + + " --api_dirs=" + api_def_args_str] - gen_cmds += ["$(location " + gen_tool + ")" + - " --output_dir=$(@D)/" + out_src_dir + - " --base_package=" + base_package + - " --api_dirs=" + api_def_args_str] + # Generate a source archive containing generated code for these ops. + gen_srcjar = out_dir + name + ".srcjar" + gen_cmds += ["$(location @local_jdk//:jar) cMf $(location :" + gen_srcjar + ") -C $(@D) src"] - # Generate a source archive containing generated code for these ops. - gen_srcjar = out_dir + name + ".srcjar" - gen_cmds += ["$(location @local_jdk//:jar) cMf $(location :" + gen_srcjar + ") -C $(@D) src"] - - native.genrule( - name=name, - srcs=srcs, - outs=[gen_srcjar], - tools=[ - "@local_jdk//:jar", - "@local_jdk//:jdk", - gen_tool - ] + tf_binary_additional_srcs(), - cmd=" && ".join(gen_cmds)) + native.genrule( + name = name, + srcs = srcs, + outs = [gen_srcjar], + tools = [ + "@local_jdk//:jar", + "@local_jdk//:jdk", + gen_tool, + ] + tf_binary_additional_srcs(), + cmd = " && ".join(gen_cmds), + ) -- cgit v1.2.3