From dbe8807224771b837bcc6e80a416e89388206ea7 Mon Sep 17 00:00:00 2001 From: Yannic Bonenberger Date: Wed, 6 May 2020 06:52:09 -0700 Subject: [PATCH] Add optional tool_path_origin to Tools in C++ crosstool This change adds an optional field to the C++ crosstool proto that allows configuring the origin tool_path is relative to. For now, the origin can be one of the following: - CROSSTOOL_PACKAGE: If tool_path is a relative path, it's assumed to be relative to the package of the crosstool top. - FILESYSTEM_ROOT: tool_path is an absolute path. This is checked by Bazel. - WORKSPACE_ROOT: tool_path must be a relative path and is assumed to be relative to the exec-root of the workspace (similar to other executables). Updates bazelbuild/bazel#8438 Closes #10967. PiperOrigin-RevId: 310142352 Change-Id: If6316ffa5d7d2713b197840b4aafb2f0cdbb0b96 --- .../src/main/protobuf/crosstool_config.proto | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto b/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto index d899c33..7f94306 100644 --- a/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto +++ b/third_party/com/github/bazelbuild/bazel/src/main/protobuf/crosstool_config.proto @@ -16,11 +16,11 @@ syntax = "proto2"; -// option java_api_version = 2; // copybara-comment-this-out-please -option java_package = "com.google.devtools.build.lib.view.config.crosstool"; - package com.google.devtools.build.lib.view.config.crosstool; +// option java_api_version = 2; // copybara-comment-this-out-please +option java_package = "com.google.devtools.build.lib.view.config.crosstool"; + // A description of a toolchain, which includes all the tools generally expected // to be available for building C/C++ targets, based on the GNU C compiler. // @@ -235,9 +235,28 @@ message CToolchain { // Describes a tool associated with a crosstool action config. message Tool { + // Describes the origin of a path. + enum PathOrigin { + // Indicates that `tool_path` is relative to the location of the + // crosstool. For legacy reasons, absolute paths are als0 allowed here. + CROSSTOOL_PACKAGE = 0; + + // Indicates that `tool_path` is an absolute path. + // This is enforced by Bazel. + FILESYSTEM_ROOT = 1; + + // Indicates that `tool_path` is relative to the current workspace's + // exec root. + WORKSPACE_ROOT = 2; + } + // Path to the tool, relative to the location of the crosstool. required string tool_path = 1; + // Origin of `tool_path`. + // Optional only for legacy reasons. New crosstools should set this value! + optional PathOrigin tool_path_origin = 4 [default = CROSSTOOL_PACKAGE]; + // A list of feature sets defining when this tool is applicable. The tool // will used when any one of the feature sets evaluate to true. (That is, // when when every 'feature' is enabled, and every 'not_feature' is not