bazelbuild/bazel

--build_manual_tests applies to non-tests

Open

#11,103 创建于 2020年4月8日

在 GitHub 查看
 (7 评论) (0 反应) (0 负责人)Java (4,465 fork)batch import
P3help wantedteam-Coreteam-Documentationtype: documentation (cleanup)

仓库指标

Star
 (25,384 star)
PR 合并指标
 (平均合并 22天 20小时) (30 天内合并 77 个 PR)

描述

Description of the problem:

The --build_manual_tests flag builds targets tagged "manual" but which are not test targets. This behavior seems inconsistent with the documentation, which seems to imply that the flag applies specifically to test targets:

Forces test targets tagged 'manual' to be built. 'manual' tests are excluded from processing. This option forces them to be built (but not executed).

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Consider a workspace consisting of three files:

BUILD:

java_binary(
    name = "bin",
    srcs = glob(["Manual.java"]),
    main_class = "Manual",
    tags = ["manual"],
)

Manual.java:

public class Manual {
    public static void main(String[] args) {
        System.out.println("Hello");
    }
}

WORKSPACE: (empty)

Steps:

  1. Edit Manual.java
  2. Run bazel build --build_manual_tests ...

Expected outcome: no targets are built.

Actual outcome: The bin target is built:

$ bazel build --build_manual_tests --subcommands=pretty_print ...

INFO: Analyzed target //:bin (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
SUBCOMMAND: # //:bin [action 'Building bin.jar (1 source file)', configuration: dbadffe9d0533bf51e2ba2aac08b5435397cdb67cd0b74b86e24900343122bb0]
(cd /home/sebelino/.cache/bazel/_bazel_sebelino/c3c7a33107b6cbc76f7cc84608df699f/execroot/__main__ && \
  exec env - \
    LC_CTYPE=en_US.UTF-8 \
    PATH=/usr/local/bin:/usr/local/sbin:/opt/google-cloud-sdk/bin:/home/sebelino/scripts:/home/sebelino/bin:/usr/bin:/home/sebelino/code/go/bin:/opt/ida/bin:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/sonar-scanner/bin \
  external/remotejdk11_linux/bin/java \
    -XX:+UseParallelOldGC \
    -XX:-CompactStrings \
    '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' \
    '--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED' \
    '--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED' \
    '--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' \
    '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' \
    '--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED' \
    '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' \
    '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' \
    '--patch-module=java.compiler=external/remote_java_tools_linux/java_tools/java_compiler.jar' \
    '--patch-module=jdk.compiler=external/remote_java_tools_linux/java_tools/jdk_compiler.jar' \
    '--add-opens=java.base/java.nio=ALL-UNNAMED' \
    '--add-opens=java.base/java.lang=ALL-UNNAMED' \
    -jar \
    external/remote_java_tools_linux/java_tools/JavaBuilder_deploy.jar \
    @bazel-out/k8-fastbuild/bin/bin.jar-0.params \
    @bazel-out/k8-fastbuild/bin/bin.jar-1.params)
Target //:bin up-to-date:
  bazel-bin/bin.jar
  bazel-bin/bin
INFO: Elapsed time: 0.130s, Critical Path: 0.05s
INFO: 1 process: 1 worker.
INFO: Build completed successfully, 2 total actions

What operating system are you running Bazel on?

Linux 5.5.13-arch2-1

What's the output of bazel info release?

release 3.0.0

贡献者指南