blob: 42dd3eb60c99e0e0bcf81c1efba5445a0d4b0bc7 [file] [log] [blame]
def genlicenses(
name,
out,
opts = [],
java_deps = [],
non_java_deps = [],
visibility = []):
cmd = ['$(exe :gen_licenses)']
cmd.extend(opts)
cmd.append('>$OUT')
cmd.extend(java_deps)
cmd.extend(non_java_deps)
# Must use $(classpath) for Java deps, since transitive dependencies are not
# first-order dependencies of the output jar, so changes would not cause
# invalidation of the build cache key for the genrule.
cmd.extend('; true $(classpath %s)' % d for d in java_deps)
# Must use $(location) for non-Java deps, since $(classpath) will fail with an
# error. This is ok, because transitive dependencies are included in the
# output artifacts for everything _except_ Java libraries.
cmd.extend('; true $(location %s)' % d for d in non_java_deps)
genrule(
name = name,
out = out,
cmd = ' '.join(cmd),
visibility = visibility,
)