aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar Mark Schaller <mschaller@google.com>2015-09-08 20:54:56 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-08 22:27:49 +0000
commit99a701b87f8c4243af2b71410c2e0bd2b60815fb (patch)
treef4fccf140bd895cfb619425a332d938b1c4aea1a /src/main/java/com/google/devtools/build/lib/rules
parentd4803010a6c07f262e3a326bde9c43f0f29aa5ff (diff)
*** Reason for rollback *** -- MOS_MIGRATED_REVID=102590114
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java1
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java27
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java9
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/LocalGccStrategy.java6
6 files changed, 19 insertions, 44 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
index 8028abda49..aff5dd7143 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java
@@ -63,7 +63,6 @@ public final class CcCommon {
CppFileTypes.CPP_SOURCE,
CppFileTypes.CPP_HEADER,
CppFileTypes.C_SOURCE,
- CppFileTypes.ASSEMBLER,
CppFileTypes.ASSEMBLER_WITH_C_PREPROCESSOR);
/**
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
index dc79e25a9c..d2f2b6a630 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
@@ -133,9 +133,8 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
public static final String CPP_MODULE_COMPILE = "c++-module-compile";
/**
- * A string constant for the assembler actions.
+ * A string constant for the preprocessing assembler action.
*/
- public static final String ASSEMBLE = "assemble";
public static final String PREPROCESS_ASSEMBLE = "preprocess-assemble";
@@ -228,8 +227,7 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
RuleContext ruleContext) {
super(owner,
createInputs(mandatoryInputs, context.getCompilationPrerequisites(), optionalSourceFile),
- CollectionUtils.asListWithoutNulls(outputFile,
- (dotdFile == null ? null : dotdFile.artifact()),
+ CollectionUtils.asListWithoutNulls(outputFile, dotdFile.artifact(),
gcnoFile, dwoFile));
this.configuration = configuration;
this.sourceLabel = sourceLabel;
@@ -831,14 +829,13 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
private DependencySet processDepset(Path execRoot, CppCompileActionContext.Reply reply)
throws IOException {
- DotdFile dotdFile = getDotdFile();
- Preconditions.checkNotNull(dotdFile);
DependencySet depSet = new DependencySet(execRoot);
- // artifact() is null if we are using in-memory .d files. We also want to prepare for the
+
+ // artifact() is null if we are not using in-memory .d files. We also want to prepare for the
// case where we expected an in-memory .d file, but we did not get an appropriate response.
// Perhaps we produced the file locally.
- if (dotdFile.artifact() != null || reply == null) {
- return depSet.read(dotdFile.getPath());
+ if (getDotdFile().artifact() != null || reply == null) {
+ return depSet.read(getDotdFile().getPath());
} else {
// This is an in-memory .d file.
return depSet.process(reply.getContents());
@@ -857,17 +854,14 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
*
* @param reply the reply from the compilation.
* @param inputs the ordered collection of inputs to append to
- * @throws ActionExecutionException iff the .d is missing (when required),
- * malformed, or has unresolvable included artifacts.
+ * @throws ActionExecutionException iff the .d is missing, malformed or has
+ * unresolvable included artifacts.
*/
@ThreadCompatible
private void populateActionInputs(Path execRoot,
ArtifactResolver artifactResolver, CppCompileActionContext.Reply reply,
NestedSetBuilder<Artifact> inputs)
throws ActionExecutionException {
- if (getDotdFile() == null) {
- return;
- }
try {
// Read .d file.
DependencySet depSet = processDepset(execRoot, reply);
@@ -1199,8 +1193,7 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
CcToolchainFeatures.Variables variables,
@Nullable String fdoBuildStamp) {
this.sourceFile = Preconditions.checkNotNull(sourceFile);
- this.dotdFile = CppFileTypes.mustProduceDotdFile(sourceFile.getPath().toString())
- ? Preconditions.checkNotNull(dotdFile) : null;
+ this.dotdFile = Preconditions.checkNotNull(dotdFile);
this.copts = Preconditions.checkNotNull(copts);
this.coptsFilter = coptsFilter;
this.pluginOpts = Preconditions.checkNotNull(pluginOpts);
@@ -1250,8 +1243,6 @@ public class CppCompileAction extends AbstractAction implements IncludeScannable
return C_COMPILE;
} else if (CppFileTypes.CPP_SOURCE.matches(sourcePath)) {
return CPP_COMPILE;
- } else if (CppFileTypes.ASSEMBLER.matches(sourcePath)) {
- return ASSEMBLE;
} else if (CppFileTypes.ASSEMBLER_WITH_C_PREPROCESSOR.matches(sourcePath)) {
return PREPROCESS_ASSEMBLE;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
index ab1196c1f7..a943057030 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
@@ -382,17 +382,13 @@ public class CppCompileActionBuilder {
}
public CppCompileActionBuilder setDotdFile(PathFragment outputName, String extension) {
- if (CppFileTypes.mustProduceDotdFile(outputName.toString())) {
- if (configuration.getFragment(CppConfiguration.class).getInmemoryDotdFiles()) {
- // Just set the path, no artifact is constructed
- PathFragment file = FileSystemUtils.replaceExtension(outputName, extension);
- Root root = configuration.getBinDirectory();
- dotdFile = new DotdFile(root.getExecPath().getRelative(file));
- } else {
- dotdFile = new DotdFile(ruleContext.getRelatedArtifact(outputName, extension));
- }
+ if (configuration.getFragment(CppConfiguration.class).getInmemoryDotdFiles()) {
+ // Just set the path, no artifact is constructed
+ PathFragment file = FileSystemUtils.replaceExtension(outputName, extension);
+ Root root = configuration.getBinDirectory();
+ dotdFile = new DotdFile(root.getExecPath().getRelative(file));
} else {
- dotdFile = null;
+ dotdFile = new DotdFile(ruleContext.getRelatedArtifact(outputName, extension));
}
return this;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java
index a7e3a1a1da..655dcd5f1a 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java
@@ -59,12 +59,11 @@ public final class CppFileTypes {
final String ext = ".s";
@Override
public boolean apply(String filename) {
- return (filename.endsWith(ext) && !PIC_ASSEMBLER.matches(filename))
- || filename.endsWith(".asm");
+ return filename.endsWith(ext) && !PIC_ASSEMBLER.matches(filename);
}
@Override
public List<String> getExtensions() {
- return ImmutableList.of(ext, ".asm");
+ return ImmutableList.of(ext);
}
};
@@ -140,8 +139,4 @@ public final class CppFileTypes {
// Output of the dwp tool
public static final FileType DEBUG_INFO_PACKAGE = FileType.of(".dwp");
-
- public static final boolean mustProduceDotdFile(String source) {
- return !(ASSEMBLER.matches(source) || PIC_ASSEMBLER.matches(source));
- }
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
index f651f629cc..de1c92ce96 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRuleClasses.java
@@ -18,7 +18,6 @@ import static com.google.devtools.build.lib.packages.ImplicitOutputsFunction.fro
import static com.google.devtools.build.lib.rules.cpp.CppFileTypes.ALWAYS_LINK_LIBRARY;
import static com.google.devtools.build.lib.rules.cpp.CppFileTypes.ALWAYS_LINK_PIC_LIBRARY;
import static com.google.devtools.build.lib.rules.cpp.CppFileTypes.ARCHIVE;
-import static com.google.devtools.build.lib.rules.cpp.CppFileTypes.ASSEMBLER;
import static com.google.devtools.build.lib.rules.cpp.CppFileTypes.ASSEMBLER_WITH_C_PREPROCESSOR;
import static com.google.devtools.build.lib.rules.cpp.CppFileTypes.CPP_HEADER;
import static com.google.devtools.build.lib.rules.cpp.CppFileTypes.CPP_SOURCE;
@@ -55,8 +54,7 @@ public class CppRuleClasses {
* those.
*/
static final InstrumentationSpec INSTRUMENTATION_SPEC = new InstrumentationSpec(
- FileTypeSet.of(CPP_SOURCE, C_SOURCE, CPP_HEADER, ASSEMBLER_WITH_C_PREPROCESSOR,
- ASSEMBLER),
+ FileTypeSet.of(CPP_SOURCE, C_SOURCE, CPP_HEADER, ASSEMBLER_WITH_C_PREPROCESSOR),
"srcs", "deps", "data", "hdrs");
public static final LibraryLanguage LANGUAGE = new LibraryLanguage("C++");
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LocalGccStrategy.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LocalGccStrategy.java
index d9be59b264..7b1cd6fef4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LocalGccStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LocalGccStrategy.java
@@ -46,11 +46,7 @@ public class LocalGccStrategy implements CppCompileActionContext {
public static void updateEnv(CppCompileAction action, Map<String, String> env) {
// We cannot locally execute an action that does not expect to output a .d file, since we would
// have no way to tell what files that it included were used during compilation.
- // The exception to this is that if no .d file can be produced (as indicated by
- // dotdfile == null), then the assumption is that there are truly no depencies,
- // and therefore we don't care whether the step executes locally or remotely.
- env.put("INTERCEPT_LOCALLY_EXECUTABLE",
- (action.getDotdFile() != null && action.getDotdFile().artifact() == null) ? "0" : "1");
+ env.put("INTERCEPT_LOCALLY_EXECUTABLE", action.getDotdFile().artifact() == null ? "0" : "1");
}
@Override