diff options
author | cparsons <cparsons@google.com> | 2018-06-11 11:01:51 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-11 11:03:23 -0700 |
commit | d2e0a947963f7f725d5bac69391ad9797f4a9beb (patch) | |
tree | ee5b186b877825d47ab2fbc62276ce748383ecb5 /src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository | |
parent | 4ee15b8182c9728855914ce174bd933698000d9b (diff) |
Create a bootstrap for repository-related skylark build API.
Also remove the old ConfiguredRuleClassProvider.addSkylarkModule() method, as it, after this change, has no callers.
RELNOTES: None.
PiperOrigin-RevId: 200078816
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/RepositoryBootstrap.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/RepositoryBootstrap.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/RepositoryBootstrap.java new file mode 100644 index 0000000000..0df43175a6 --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/RepositoryBootstrap.java @@ -0,0 +1,36 @@ +// 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.lib.skylarkbuildapi.repository; + +import com.google.common.collect.ImmutableMap.Builder; +import com.google.devtools.build.lib.skylarkbuildapi.Bootstrap; +import com.google.devtools.build.lib.syntax.Runtime; + +/** + * A {@link Bootstrap} for repository-related libraries of the build API. + */ +public class RepositoryBootstrap implements Bootstrap { + + private final Class<? extends RepositoryModuleApi> repositoryModuleApiClass; + + public RepositoryBootstrap(Class<? extends RepositoryModuleApi> repositoryModuleApiClass) { + this.repositoryModuleApiClass = repositoryModuleApiClass; + } + + @Override + public void addBindingsToBuilder(Builder<String, Object> builder) { + Runtime.setupModuleGlobals(builder, repositoryModuleApiClass); + } +} |