From fd7a36a177ee5ad21c772993b6afb7dd10c65b49 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 5 Oct 2015 09:51:06 +0100 Subject: [PATCH] Introjucer: made the Xcode exporter treat swift files as source code --- .../jucer_ProjectExport_XCode.h | 28 ++++++++++--------- .../Source/Utility/jucer_RelativePath.h | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h index 8b7b579674..7f0cd2f92b 100644 --- a/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h +++ b/extras/Introjucer/Source/Project Saving/jucer_ProjectExport_XCode.h @@ -605,7 +605,7 @@ private: } addPlistDictionaryKey (dict, "CFBundleExecutable", "${EXECUTABLE_NAME}"); - addPlistDictionaryKey (dict, "CFBundleIconFile", iconFile.exists() ? iconFile.getFileName() : String::empty); + addPlistDictionaryKey (dict, "CFBundleIconFile", iconFile.exists() ? iconFile.getFileName() : String()); addPlistDictionaryKey (dict, "CFBundleIdentifier", project.getBundleIdentifier().toString()); addPlistDictionaryKey (dict, "CFBundleName", projectName); addPlistDictionaryKey (dict, "CFBundlePackageType", xcodePackageType); @@ -617,7 +617,7 @@ private: StringArray documentExtensions; documentExtensions.addTokens (replacePreprocessorDefs (getAllPreprocessorDefs(), settings ["documentExtensions"]), - ",", String::empty); + ",", StringRef()); documentExtensions.trim(); documentExtensions.removeEmptyStrings (true); @@ -1171,7 +1171,7 @@ private: projectItem.shouldInhibitWarnings()); } - return String::empty; + return String(); } void addFramework (const String& frameworkName) const @@ -1211,17 +1211,19 @@ private: void addMainBuildProduct() const { jassert (xcodeFileType.isNotEmpty()); - jassert (xcodeBundleExtension.isEmpty() || xcodeBundleExtension.startsWithChar('.')); - ProjectExporter::BuildConfiguration::Ptr config = getConfiguration(0); - jassert (config != nullptr); - String productName (replacePreprocessorTokens (*config, config->getTargetBinaryNameString())); + jassert (xcodeBundleExtension.isEmpty() || xcodeBundleExtension.startsWithChar ('.')); - if (xcodeFileType == "archive.ar") - productName = getLibbedFilename (productName); - else - productName += xcodeBundleExtension; + if (ProjectExporter::BuildConfiguration::Ptr config = getConfiguration(0)) + { + String productName (replacePreprocessorTokens (*config, config->getTargetBinaryNameString())); - addBuildProduct (xcodeFileType, productName); + if (xcodeFileType == "archive.ar") + productName = getLibbedFilename (productName); + else + productName += xcodeBundleExtension; + + addBuildProduct (xcodeFileType, productName); + } } void addBuildProduct (const String& fileType, const String& binaryName) const @@ -1495,7 +1497,7 @@ private: bool shouldFileBeCompiledByDefault (const RelativePath& file) const override { - return file.hasFileExtension (sourceFileExtensions); + return file.hasFileExtension (sourceFileExtensions) || file.hasFileExtension ("swift"); } static String getOSXVersionName (int version) diff --git a/extras/Introjucer/Source/Utility/jucer_RelativePath.h b/extras/Introjucer/Source/Utility/jucer_RelativePath.h index 301112868d..2d187ef6a9 100644 --- a/extras/Introjucer/Source/Utility/jucer_RelativePath.h +++ b/extras/Introjucer/Source/Utility/jucer_RelativePath.h @@ -65,7 +65,7 @@ public: String getFileNameWithoutExtension() const { return getFakeFile().getFileNameWithoutExtension(); } String getFileExtension() const { return getFakeFile().getFileExtension(); } - bool hasFileExtension (const String& extension) const { return getFakeFile().hasFileExtension (extension); } + bool hasFileExtension (StringRef extension) const { return getFakeFile().hasFileExtension (extension); } bool isAbsolute() const { return FileHelpers::isAbsolutePath (path); } RelativePath withFileExtension (const String& extension) const