From d688c4c19d0ec6d639ba7047e786bdacb7a4b45b Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Tue, 7 May 2019 21:10:58 -0700 Subject: Swift: remove unnecessary unreleased Ninja infrastructure This cleans up the new options that were added to support Swift. This was not released, and the proper support approach that we settled upon does not require as much specialised support. --- Source/cmNinjaNormalTargetGenerator.cxx | 33 ------------------------ Source/cmNinjaTargetGenerator.cxx | 45 --------------------------------- Source/cmRulePlaceholderExpander.cxx | 40 ----------------------------- Source/cmRulePlaceholderExpander.h | 8 ------ 4 files changed, 126 deletions(-) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 680f881..770d80c 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -281,11 +281,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()); vars.Language = this->TargetLinkLanguage.c_str(); - if (this->TargetLinkLanguage == "Swift") { - vars.SwiftPartialModules = "$SWIFT_PARTIAL_MODULES"; - vars.TargetSwiftModule = "$TARGET_SWIFT_MODULE"; - vars.TargetSwiftDoc = "$TARGET_SWIFT_DOC"; - } std::string responseFlag; if (!useResponseFile) { @@ -804,34 +799,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmNinjaDeps outputs; outputs.push_back(targetOutputReal); - if (this->TargetLinkLanguage == "Swift") { - if (const char* name = gt.GetProperty("SWIFT_MODULE_NAME")) { - vars["TARGET_SWIFT_DOC"] = std::string(name) + ".swiftdoc"; - vars["TARGET_SWIFT_MODULE"] = std::string(name) + ".swiftmodule"; - } else { - vars["TARGET_SWIFT_DOC"] = gt.GetName() + ".swiftdoc"; - vars["TARGET_SWIFT_MODULE"] = gt.GetName() + ".swiftmodule"; - } - outputs.push_back(vars["TARGET_SWIFT_DOC"]); - outputs.push_back(vars["TARGET_SWIFT_MODULE"]); - - cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator(); - - std::string partials; - std::vector sources; - gt.GetObjectSources(sources, this->GetConfigName()); - for (cmSourceFile const* source : sources) { - partials += " "; - if (const char* partial = source->GetProperty("SWIFT_PARTIAL_MODULE")) { - partials += partial; - } else { - partials += localGen.GetTargetDirectory(>) + "/" + - gt.GetObjectName(source) + ".swiftmodule"; - } - } - vars["SWIFT_PARTIAL_MODULES"] = partials; - } - // Compute specific libraries to link with. cmNinjaDeps explicitDeps = this->GetObjects(); cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 8afac70..b818107 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -19,7 +19,6 @@ #include "cmGeneratorExpression.h" #include "cmGeneratorTarget.h" #include "cmGlobalNinjaGenerator.h" -#include "cmListFileCache.h" // for BT #include "cmLocalGenerator.h" #include "cmLocalNinjaGenerator.h" #include "cmMakefile.h" @@ -455,13 +454,6 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) vars.TargetCompilePDB = "$TARGET_COMPILE_PDB"; vars.ObjectDir = "$OBJECT_DIR"; vars.ObjectFileDir = "$OBJECT_FILE_DIR"; - if (lang == "Swift") { - vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES"; - vars.SwiftModuleName = "$SWIFT_MODULE_NAME"; - vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME"; - vars.SwiftPartialModule = "$SWIFT_PARTIAL_MODULE"; - vars.SwiftPartialDoc = "$SWIFT_PARTIAL_DOC"; - } // For some cases we do an explicit preprocessor invocation. bool const explicitPP = this->NeedExplicitPreprocessing(lang); @@ -947,43 +939,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["FLAGS"] = this->ComputeFlagsForObject(source, language); vars["DEFINES"] = this->ComputeDefines(source, language); vars["INCLUDES"] = this->ComputeIncludes(source, language); - if (language == "Swift") { - // The swift compiler needs all the sources besides the one being compiled - // in order to do the type checking. List all these "auxiliary" sources. - std::string aux_sources; - cmGeneratorTarget::KindedSources const& sources = - this->GeneratorTarget->GetKindedSources(this->GetConfigName()); - for (cmGeneratorTarget::SourceAndKind const& src : sources.Sources) { - if (src.Source.Value == source) { - continue; - } - aux_sources += " " + this->GetSourceFilePath(src.Source.Value); - } - vars["SWIFT_AUXILIARY_SOURCES"] = aux_sources; - - if (const char* name = - this->GeneratorTarget->GetProperty("SWIFT_MODULE_NAME")) { - vars["SWIFT_MODULE_NAME"] = name; - } else { - vars["SWIFT_MODULE_NAME"] = this->GeneratorTarget->GetName(); - } - - cmGeneratorTarget::Names targetNames = - this->GeneratorTarget->GetLibraryNames(this->GetConfigName()); - vars["SWIFT_LIBRARY_NAME"] = targetNames.Base; - - if (const char* partial = source->GetProperty("SWIFT_PARTIAL_MODULE")) { - vars["SWIFT_PARTIAL_MODULE"] = partial; - } else { - vars["SWIFT_PARTIAL_MODULE"] = objectFileName + ".swiftmodule"; - } - - if (const char* partial = source->GetProperty("SWIFT_PARTIAL_DOC")) { - vars["SWIFT_PARTIAL_DOC"] = partial; - } else { - vars["SWIFT_PARTIAL_DOC"] = objectFileName + ".swiftdoc"; - } - } if (!this->NeedDepTypeMSVC(language)) { bool replaceExt(false); diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index 309ee30..8751a11 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -162,46 +162,6 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable( } } } - if (replaceValues.SwiftAuxiliarySources) { - if (variable == "SWIFT_AUXILIARY_SOURCES") { - return replaceValues.SwiftAuxiliarySources; - } - } - if (replaceValues.SwiftModuleName) { - if (variable == "SWIFT_MODULE_NAME") { - return replaceValues.SwiftModuleName; - } - } - if (replaceValues.SwiftLibraryName) { - if (variable == "SWIFT_LIBRARY_NAME") { - return replaceValues.SwiftLibraryName; - } - } - if (replaceValues.SwiftPartialDoc) { - if (variable == "SWIFT_PARTIAL_DOC") { - return replaceValues.SwiftPartialDoc; - } - } - if (replaceValues.SwiftPartialModule) { - if (variable == "SWIFT_PARTIAL_MODULE") { - return replaceValues.SwiftPartialModule; - } - } - if (replaceValues.SwiftPartialModules) { - if (variable == "SWIFT_PARTIAL_MODULES") { - return replaceValues.SwiftPartialModules; - } - } - if (replaceValues.TargetSwiftDoc) { - if (variable == "TARGET_SWIFT_DOC") { - return replaceValues.TargetSwiftDoc; - } - } - if (replaceValues.TargetSwiftModule) { - if (variable == "TARGET_SWIFT_MODULE") { - return replaceValues.TargetSwiftModule; - } - } if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" || variable == "TARGET_INSTALLNAME_DIR") { // All these variables depend on TargetSOName diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h index ebd4d41..4a03dc8 100644 --- a/Source/cmRulePlaceholderExpander.h +++ b/Source/cmRulePlaceholderExpander.h @@ -58,14 +58,6 @@ public: const char* Includes; const char* DependencyFile; const char* FilterPrefix; - const char* SwiftAuxiliarySources; - const char* SwiftModuleName; - const char* SwiftLibraryName; - const char* SwiftPartialModule; - const char* SwiftPartialDoc; - const char* TargetSwiftModule; - const char* TargetSwiftDoc; - const char* SwiftPartialModules; }; // Expand rule variables in CMake of the type found in language rules -- cgit v0.12