From 51215bd922d57f2ddd03deac6295f3e9267c7c3c Mon Sep 17 00:00:00 2001 From: juliexxia Date: Tue, 14 Aug 2018 10:28:35 -0700 Subject: 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 rule() function. Validation for these restrictions will also happen in a later CL attached to the same bug. PiperOrigin-RevId: 208669663 --- .../build/skydoc/fakebuildapi/FakeConfigApi.java | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeConfigApi.java (limited to 'src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeConfigApi.java') 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) {} +} -- cgit v1.2.3