<commit_before># -*- Python -*-

load("//tensorflow:tensorflow.bzl", "tf_copts")

# Given a list of "ops_libs" (a list of files in the core/ops directory
# without their .cc extensions), generate Java wrapper code for all operations
# found in the ops files.
# Then, combine all those source files into a single archive (.srcjar).
#
# For example:
#  tf_java_op_gen_srcjar("gen_sources", "gen_tool", [ "array_ops", "math_ops" ])
#
# will create a genrule named "gen_sources" that first generate source files:
#     ops/src/main/java/org/tensorflow/op/array/*.java
#     ops/src/main/java/org/tensorflow/op/math/*.java
#
# and then archive those source files in:
#     ops/gen_sources.srcjar
#
def tf_java_op_gen_srcjar(name,
                          gen_tool,
                          gen_base_package,
                          ops_libs=[],
                          ops_libs_pkg="//tensorflow/core",
                          out_dir="ops/",
                          out_src_dir="src/main/java/",
                          visibility=["//tensorflow/java:__pkg__"]):

  gen_tools = []
  gen_cmds = ["rm -rf $(@D)"] # Always start from fresh when generating source files

  # Construct an op generator binary for each ops library.
  for ops_lib in ops_libs:
    gen_lib = ops_lib[:ops_lib.rfind('_')]<commit_msg>Add mandatory "gen_base_package" argument in the usage example<commit_after># -*- Python -*-

load("//tensorflow:tensorflow.bzl", "tf_copts")

# Given a list of "ops_libs" (a list of files in the core/ops directory
# without their .cc extensions), generate Java wrapper code for all operations
# found in the ops files.
# Then, combine all those source files into a single archive (.srcjar).
#
# For example:
#  tf_java_op_gen_srcjar("gen_sources", "gen_tool", "my.package", [ "array_ops", "math_ops" ])
#
# will create a genrule named "gen_sources" that first generate source files:
#     ops/src/main/java/my/package/array/*.java
#     ops/src/main/java/my/package/math/*.java
#
# and then archive those source files in:
#     ops/gen_sources.srcjar
#
def tf_java_op_gen_srcjar(name,
                          gen_tool,
                          gen_base_package,
                          ops_libs=[],
                          ops_libs_pkg="//tensorflow/core",
                          out_dir="ops/",
                          out_src_dir="src/main/java/",
                          visibility=["//tensorflow/java:__pkg__"]):

  gen_tools = []
  gen_cmds = ["rm -rf $(@D)"] # Always start from fresh when generating source files

  # Construct an op generator binary for each ops library.
  for ops_lib in ops_libs:
    gen_lib = ops_lib[:ops_lib.rfind('_')]
{'fraction_non_alphanumeric': 0.11720791340052258, 'fraction_numerical': 0.0, 'mean_word_length': 2.4183673469387754, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5611286', 'n_tokens_mistral': 830, 'n_tokens_neox': 813, 'n_words': 223}