aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeConfigApi.java
diff options
context:
space:
mode:
authorGravatar juliexxia <juliexxia@google.com>2018-08-14 10:28:35 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-08-14 10:30:04 -0700
commit51215bd922d57f2ddd03deac6295f3e9267c7c3c (patch)
tree52416db9644977b11fbb4865a26a30c7f823481a /src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeConfigApi.java
parent265f09429d84ecc8ff0f5fdd6eb5eae9f3b5134b (diff)
Create new config module that is responsible for creating BuildSetting descriptor objects.
Build settings are units of configuration i.e. a key/value pair of a setting (e.g. cpu) and a value (e.g. ppc). A build setting descriptor is used to describe what kind of build setting a skylark rule is (if any at all). The BuildSettingDescriptor implementation of the API describes two facets of the build setting rule: the type of the value and whether or not the setting is settable on the command line. The methods exposed here will eventually be hooked up to a new parameter in the <code> rule() </code> function. Validation for these restrictions will also happen in a later CL attached to the same bug. PiperOrigin-RevId: 208669663
Diffstat (limited to 'src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeConfigApi.java')
-rw-r--r--src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeConfigApi.java57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeConfigApi.java b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeConfigApi.java
new file mode 100644
index 0000000000..2bd322b9f7
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeConfigApi.java
@@ -0,0 +1,57 @@
+// Copyright 2018 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.skydoc.fakebuildapi;
+
+import com.google.devtools.build.lib.skylarkbuildapi.SkylarkConfigApi;
+import com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter;
+
+/**
+ * Fake implementation of {@link SkylarkConfigApi}.
+ */
+public class FakeConfigApi implements SkylarkConfigApi {
+
+ @Override
+ public BuildSettingApi intSetting(Boolean flag) {
+ return new FakeBuildSettingDescriptor();
+ }
+
+ @Override
+ public BuildSettingApi boolSetting(Boolean flag) {
+ return new FakeBuildSettingDescriptor();
+ }
+
+ @Override
+ public BuildSettingApi stringSetting(Boolean flag) {
+ return new FakeBuildSettingDescriptor();
+ }
+
+ @Override
+ public BuildSettingApi stringListSetting(Boolean flag) {
+ return new FakeBuildSettingDescriptor();
+ }
+
+ @Override
+ public BuildSettingApi labelSetting(Boolean flag) {
+ return new FakeBuildSettingDescriptor();
+ }
+
+ @Override
+ public BuildSettingApi labelListSetting(Boolean flag) {
+ return new FakeBuildSettingDescriptor();
+ }
+
+ @Override
+ public void repr(SkylarkPrinter printer) {}
+}