Skip to content

Commit

Permalink
Implemented a "--experimental_repository_cache" option as the first s…
Browse files Browse the repository at this point in the history
…tep to

caching external repositories.

The option is categorized as hidden because it is a no-op.

Re-submit with fix from rollback in commit 9883e22 due to JDK7 build failure.

GitHub issue: #1752

--
MOS_MIGRATED_REVID=135231668
  • Loading branch information
jin authored and damienmg committed Oct 5, 2016
1 parent e025939 commit 239d995
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/google/devtools/build/lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib:vfs",
"//src/main/java/com/google/devtools/build/lib/bazel/repository/downloader",
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/common/options",
"//third_party:aether",
"//third_party:apache_commons_compress",
"//third_party:guava",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package com.google.devtools.build.lib.bazel;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider;
Expand All @@ -28,6 +29,7 @@
import com.google.devtools.build.lib.bazel.repository.MavenServerRepositoryFunction;
import com.google.devtools.build.lib.bazel.repository.NewGitRepositoryFunction;
import com.google.devtools.build.lib.bazel.repository.NewHttpArchiveFunction;
import com.google.devtools.build.lib.bazel.repository.RepositoryOptions;
import com.google.devtools.build.lib.bazel.repository.skylark.SkylarkRepositoryFunction;
import com.google.devtools.build.lib.bazel.repository.skylark.SkylarkRepositoryModule;
import com.google.devtools.build.lib.bazel.rules.android.AndroidNdkRepositoryFunction;
Expand Down Expand Up @@ -62,6 +64,7 @@
import com.google.devtools.build.lib.util.io.TimestampGranularityMonitor;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsProvider;

import java.util.Map.Entry;
Expand Down Expand Up @@ -170,4 +173,11 @@ public void beforeCommand(Command command, CommandEnvironment env) throws Abrupt
delegator.setClientEnvironment(env.getClientEnv());
skylarkRepositoryFunction.setCommandEnvironment(env);
}

@Override
public Iterable<Class<? extends OptionsBase>> getCommandOptions(Command command) {
return "fetch".equals(command.name()) || "build".equals(command.name())
? ImmutableList.<Class<? extends OptionsBase>>of(RepositoryOptions.class)
: ImmutableList.<Class<? extends OptionsBase>>of();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//Copyright 2016 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.bazel.repository;

import com.google.devtools.build.lib.util.OptionsUtils;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionsBase;

/**
* Command-line options for repositories.
*/
public class RepositoryOptions extends OptionsBase {

@Option(name = "experimental_repository_cache",
defaultValue = "null",
category = "hidden",
converter = OptionsUtils.PathFragmentConverter.class,
help = "Specifies the cache location of the downloaded values obtained "
+ "during the fetching of external repositories.")
public PathFragment experimentalRepositoryCache;

}

0 comments on commit 239d995

Please sign in to comment.