Skip to content

DumpPlatformClassPath regression with --host_javabase=<jdk8> #6203

@cushon

Description

@cushon

With Bazel @ c608f65:

$ bazel build -s --host_javabase=@bazel_tools//tools/jdk:absolute_javabase --define=ABSOLUTE_JAVABASE=$JAVA9_HOME @bazel_tools//tools/jdk:platformclasspath
... OK
bazel build -s --host_javabase=@bazel_tools//tools/jdk:absolute_javabase --define=ABSOLUTE_JAVABASE=$JAVA8_HOME @bazel_tools//tools/jdk:platformclasspath
...
ERROR: external/bazel_tools/tools/jdk/BUILD:212:1: SkylarkAction external/bazel_tools/tools/jdk/platformclasspath_classes failed (Exit 2) javac failed: error executing command ./jdk1.8.0-latest/bin/javac -source 8 -target 8 -Xlint:-options -cp ./jdk1.8.0-latest/lib/tools.jar -d ... (remaining 2 argument(s) skipped)

javac: directory not found: bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath_classes
Usage: javac <options> <source files>

The failing action is invoking javac with the output directory set to a TreeArtifact.

args.add(class_dir)

The JDK 9 javac will create its output directory if it doesn't already exist, but the JDK 8 javac will not.

Apparently ctx.actions.declare_directory doesn't actually create the directory for the action, the action is expected to create it itself. Is that a bug?

Metadata

Metadata

Assignees

Labels

P1I'll work on this now. (Assignee required)team-Rules-JavaIssues for Java rules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions