Skip to content

Commit

Permalink
Add new ToolchainTypeRequirement class to track toolchain type status.
Browse files Browse the repository at this point in the history
Part of Optional Toolchains (bazelbuild#14726).
  • Loading branch information
katre committed Feb 9, 2022
1 parent 91c8085 commit 86c27ac
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/com/google/devtools/build/lib/analysis/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,15 @@ java_library(
],
)

java_library(
name = "config/toolchain_type_requirement",
srcs = ["config/ToolchainTypeRequirement.java"],
deps = [
"//src/main/java/com/google/devtools/build/lib/cmdline",
"//third_party:auto_value",
],
)

java_library(
name = "config/transition_factories",
srcs = ["config/TransitionFactories.java"],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2022 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.analysis.config;

import com.google.auto.value.AutoValue;
import com.google.devtools.build.lib.cmdline.Label;

/**
* Describes a requirement on a specific toolchain type.
*/
@AutoValue
public abstract class ToolchainTypeRequirement {
/** Returns a builder for a new {@Link ToolchainTypeRequirement}. */
public static Builder builder() {
return new AutoValue_ToolchainTypeRequirement.Builder()
.mandatory(true);
}

/** The toolchain type this requirement is for. */
public abstract Label toolchainType();

/** Whether the toolchain type is mandatory or optional. */
public abstract boolean mandatory();

/** A builder for a new {@link ToolchainTypeRequirement}. */
@AutoValue.Builder
public interface Builder {
/** Sets the toolchain type. */
Builder toolchainType(Label toolchainType);
/** Sets whether the toolchain type is mandatory. */
Builder mandatory(boolean mandatory);

/** Returns the newly built {@link ToolchainTypeRequirement}. */
ToolchainTypeRequirement build();
}
}

0 comments on commit 86c27ac

Please sign in to comment.