diff options
author | pcloudy <pcloudy@google.com> | 2018-07-10 07:41:53 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-10 07:43:15 -0700 |
commit | 9f380c578d0cb9b846be5b906e99cd5e29e28446 (patch) | |
tree | 8a54c475f3fe638246bfc900a9b00125ac080b64 /src/main/java | |
parent | 5211f0e8044701c3168e520e29506e4872751f64 (diff) |
Remove old implementation for object file path
RELNOTES:
--experimental_shortened_obj_file_path is removed.
PiperOrigin-RevId: 203944948
Diffstat (limited to 'src/main/java')
3 files changed, 12 insertions, 48 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java index 384d98959f..f82782f6d4 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java @@ -1166,10 +1166,7 @@ public final class CcCompilationHelper { private Artifact getHeaderModule(Artifact moduleMapArtifact) { PathFragment objectDir = CppHelper.getObjDirectory(ruleContext.getLabel()); PathFragment outputName = - objectDir.getRelative( - cppConfiguration.shortenObjFilePath() - ? moduleMapArtifact.getRootRelativePath().getBaseName() - : moduleMapArtifact.getRootRelativePath().getPathString()); + objectDir.getRelative(moduleMapArtifact.getRootRelativePath().getBaseName()); return ruleContext.getRelatedArtifact(outputName, ".pcm"); } @@ -1177,10 +1174,7 @@ public final class CcCompilationHelper { private Artifact getPicHeaderModule(Artifact moduleMapArtifact) { PathFragment objectDir = CppHelper.getObjDirectory(ruleContext.getLabel()); PathFragment outputName = - objectDir.getRelative( - cppConfiguration.shortenObjFilePath() - ? moduleMapArtifact.getRootRelativePath().getBaseName() - : moduleMapArtifact.getRootRelativePath().getPathString()); + objectDir.getRelative(moduleMapArtifact.getRootRelativePath().getBaseName()); return ruleContext.getRelatedArtifact(outputName, ".pic.pcm"); } @@ -1294,15 +1288,14 @@ public final class CcCompilationHelper { } ImmutableMap<Artifact, String> outputNameMap = null; - if (cppConfiguration.shortenObjFilePath()) { - String outputNamePrefixDir = null; - // purpose is only used by objc rules, it ends with either "_non_objc_arc" or "_objc_arc". - // Here we use it to distinguish arc and non-arc compilation. - if (purpose != null) { - outputNamePrefixDir = purpose.endsWith("_non_objc_arc") ? "non_arc" : "arc"; - } - outputNameMap = calculateOutputNameMapByType(compilationUnitSources, outputNamePrefixDir); + + String outputNamePrefixDir = null; + // purpose is only used by objc rules, it ends with either "_non_objc_arc" or "_objc_arc". + // Here we use it to distinguish arc and non-arc compilation. + if (purpose != null) { + outputNamePrefixDir = purpose.endsWith("_non_objc_arc") ? "non_arc" : "arc"; } + outputNameMap = calculateOutputNameMapByType(compilationUnitSources, outputNamePrefixDir); for (CppSource source : compilationUnitSources.values()) { Artifact sourceArtifact = source.getSource(); @@ -1318,9 +1311,7 @@ public final class CcCompilationHelper { featureConfiguration.isEnabled(CppRuleClasses.THIN_LTO) && CppFileTypes.LTO_SOURCE.matches(sourceArtifact.getFilename()); - String outputName = cppConfiguration.shortenObjFilePath() - ? outputNameMap.get(sourceArtifact) - : FileSystemUtils.removeExtension(sourceArtifact.getRootRelativePath()).getPathString(); + String outputName = outputNameMap.get(sourceArtifact); if (!sourceArtifact.isTreeArtifact()) { switch (source.getType()) { @@ -1560,10 +1551,7 @@ public final class CcCompilationHelper { // If we find one, support needs to be added here. return; } - String outputName = - cppConfiguration.shortenObjFilePath() - ? module.getRootRelativePath().getBaseName() - : module.getRootRelativePath().getPathString(); + String outputName = module.getRootRelativePath().getBaseName(); // TODO(djasper): Make this less hacky after refactoring how the PIC/noPIC actions are created. boolean pic = module.getFilename().contains(".pic."); @@ -1674,13 +1662,7 @@ public final class CcCompilationHelper { // - it creates a header module (.pcm file). return createSourceAction( Label.parseAbsoluteUnchecked(cppModuleMap.getName()), - // The header module(.pcm) is generated at most one file per target, - // so it's safe to remove module map's package path from its output name. - cppConfiguration.shortenObjFilePath() - ? FileSystemUtils.removeExtension(moduleMapArtifact.getRootRelativePath()) - .getBaseName() - : FileSystemUtils.removeExtension(moduleMapArtifact.getRootRelativePath()) - .getPathString(), + FileSystemUtils.removeExtension(moduleMapArtifact.getRootRelativePath()).getBaseName(), result, env, moduleMapArtifact, diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java index 376a88f688..bfb6528ad2 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java @@ -913,10 +913,6 @@ public final class CppConfiguration extends BuildConfiguration.Fragment return cppOptions.forceIgnoreDashStatic; } - public boolean shortenObjFilePath() { - return cppOptions.shortenObjFilePath; - } - public boolean legacyWholeArchive() { return cppOptions.legacyWholeArchive; } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java index 8249996a06..0744f005d8 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java @@ -370,20 +370,6 @@ public class CppOptions extends FragmentOptions { public Label customMalloc; @Option( - name = "experimental_shortened_obj_file_path", - defaultValue = "true", - documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS, - effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS}, - help = - "When off, object files are generated at _objs/<target_name>/<source_package_path>/" - + "<source_base_name>.o, otherwise they are shortened to _objs/<target_name>/" - + "<source_base_name>.o. If there are multiple source files with the same base name, " - + "to avoid conflict, the object file path is _objs/<target_name>/<N>" - + "/<source_base_name>.o, where N = the source file's order among all source files " - + "with the same base name, N starts with 0.") - public boolean shortenObjFilePath; - - @Option( name = "legacy_whole_archive", defaultValue = "true", documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS, |