changes SWIFT_OPTIMIZATION_LEVEL and OTHER_LINKER_FLAGS, optimises the top compile time consuming methods decrease build time
authorbuff <andreas@pep-project.org>
Thu, 20 Jul 2017 09:57:30 +0200
branchdecrease build time
changeset 24554c3a8e331998
parent 2426 c8b74a3e6ec1
child 2456 7fb1cbd5e87f
child 2993 c95e3aef97d7
changes SWIFT_OPTIMIZATION_LEVEL and OTHER_LINKER_FLAGS, optimises the top compile time consuming methods
pEpForiOS.xcodeproj/project.pbxproj
pEpForiOS/UI/Compose/MessageBodyCell.swift
pEpForiOS/UI/EmailDisplay/EmailListViewController.swift
pEpForiOS/UI/EmailDisplay/MessageSenderCell.swift
pEpForiOS/UI/Handshake/HandshakePartnerTableViewCell.swift
pEpForiOS/UI/Util/CGRect+Util.swift
pEpForiOS/Util/Extensions/String+Extensions.swift
pEpForiOS/Util/Log.swift
pEpForiOS/Util/PEPUtil.swift
pEpForiOSTests/Models/CdMessage+PantomimeTest.swift
     1.1 --- a/pEpForiOS.xcodeproj/project.pbxproj	Mon Jul 17 14:01:08 2017 +0200
     1.2 +++ b/pEpForiOS.xcodeproj/project.pbxproj	Thu Jul 20 09:57:30 2017 +0200
     1.3 @@ -1247,12 +1247,14 @@
     1.4  			isa = PBXNativeTarget;
     1.5  			buildConfigurationList = 43980E4E1CBD0BCA00A7FC3C /* Build configuration list for PBXNativeTarget "pEp" */;
     1.6  			buildPhases = (
     1.7 -				4304FCF11EBB60340086DADA /* ShellScript */,
     1.8 +				151573B31F20913C0049BB0B /* Log Start Time script */,
     1.9 +				4304FCF11EBB60340086DADA /* Copy Trustwords Script */,
    1.10  				43980E1F1CBD0BC900A7FC3C /* Sources */,
    1.11  				43980E201CBD0BC900A7FC3C /* Frameworks */,
    1.12  				43980E211CBD0BC900A7FC3C /* Resources */,
    1.13  				4377D92F1DB7EB03003432BB /* CopyFiles */,
    1.14 -				4961BA0D1E7BEA4200920DF8 /* ShellScript */,
    1.15 +				4961BA0D1E7BEA4200920DF8 /* Warnings for TODO++ Script */,
    1.16 +				151573B41F2091910049BB0B /* Log Time Finished Script */,
    1.17  			);
    1.18  			buildRules = (
    1.19  			);
    1.20 @@ -1406,26 +1408,56 @@
    1.21  /* End PBXResourcesBuildPhase section */
    1.22  
    1.23  /* Begin PBXShellScriptBuildPhase section */
    1.24 -		4304FCF11EBB60340086DADA /* ShellScript */ = {
    1.25 +		151573B31F20913C0049BB0B /* Log Start Time script */ = {
    1.26  			isa = PBXShellScriptBuildPhase;
    1.27  			buildActionMask = 2147483647;
    1.28  			files = (
    1.29  			);
    1.30  			inputPaths = (
    1.31  			);
    1.32 +			name = "Log Start Time script";
    1.33 +			outputPaths = (
    1.34 +			);
    1.35 +			runOnlyForDeploymentPostprocessing = 0;
    1.36 +			shellPath = /bin/sh;
    1.37 +			shellScript = "echo \"BUILD_TIME START pEp_for_iOS: \"`date \"+%Y_%m_%d--%H:%M:%S\"`";
    1.38 +		};
    1.39 +		151573B41F2091910049BB0B /* Log Time Finished Script */ = {
    1.40 +			isa = PBXShellScriptBuildPhase;
    1.41 +			buildActionMask = 2147483647;
    1.42 +			files = (
    1.43 +			);
    1.44 +			inputPaths = (
    1.45 +			);
    1.46 +			name = "Log Time Finished Script";
    1.47 +			outputPaths = (
    1.48 +			);
    1.49 +			runOnlyForDeploymentPostprocessing = 0;
    1.50 +			shellPath = /bin/sh;
    1.51 +			shellScript = "echo \"BUILD_TIME STOP pEp_for_iOS: \"`date \"+%Y_%m_%d--%H:%M:%S\"`";
    1.52 +		};
    1.53 +		4304FCF11EBB60340086DADA /* Copy Trustwords Script */ = {
    1.54 +			isa = PBXShellScriptBuildPhase;
    1.55 +			buildActionMask = 2147483647;
    1.56 +			files = (
    1.57 +			);
    1.58 +			inputPaths = (
    1.59 +			);
    1.60 +			name = "Copy Trustwords Script";
    1.61  			outputPaths = (
    1.62  			);
    1.63  			runOnlyForDeploymentPostprocessing = 0;
    1.64  			shellPath = /bin/sh;
    1.65  			shellScript = "cp \"${SRCROOT}/../pEpEngine/db/system.db\" \"${SRCROOT}/pEpTrustWords.bundle\"\n";
    1.66  		};
    1.67 -		4961BA0D1E7BEA4200920DF8 /* ShellScript */ = {
    1.68 +		4961BA0D1E7BEA4200920DF8 /* Warnings for TODO++ Script */ = {
    1.69  			isa = PBXShellScriptBuildPhase;
    1.70  			buildActionMask = 2147483647;
    1.71  			files = (
    1.72  			);
    1.73  			inputPaths = (
    1.74  			);
    1.75 +			name = "Warnings for TODO++ Script";
    1.76  			outputPaths = (
    1.77  			);
    1.78  			runOnlyForDeploymentPostprocessing = 0;
    1.79 @@ -1776,8 +1808,9 @@
    1.80  				MTL_ENABLE_DEBUG_INFO = YES;
    1.81  				ONLY_ACTIVE_ARCH = YES;
    1.82  				OTHER_LDFLAGS = "-ObjC";
    1.83 +				OTHER_SWIFT_FLAGS = "-Onone";
    1.84  				SDKROOT = iphoneos;
    1.85 -				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
    1.86 +				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
    1.87  				TARGETED_DEVICE_FAMILY = "1,2";
    1.88  			};
    1.89  			name = Debug;
    1.90 @@ -1827,6 +1860,7 @@
    1.91  				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
    1.92  				MTL_ENABLE_DEBUG_INFO = NO;
    1.93  				OTHER_LDFLAGS = "-ObjC";
    1.94 +				OTHER_SWIFT_FLAGS = "";
    1.95  				SDKROOT = iphoneos;
    1.96  				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
    1.97  				TARGETED_DEVICE_FAMILY = "1,2";
    1.98 @@ -1845,14 +1879,15 @@
    1.99  				INFOPLIST_FILE = pEpForiOS/Info.plist;
   1.100  				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
   1.101  				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
   1.102 -				ONLY_ACTIVE_ARCH = YES;
   1.103 -				OTHER_SWIFT_FLAGS = "-DDEBUG_LOGGING -D DEBUG";
   1.104 +				ONLY_ACTIVE_ARCH = "$(inherited)";
   1.105 +				OTHER_SWIFT_FLAGS = "-DDEBUG_LOGGING -D DEBUG $(inherited)";
   1.106  				PRODUCT_BUNDLE_IDENTIFIER = "net.pep-security.apps.pEpAlpha";
   1.107  				PRODUCT_MODULE_NAME = pEpForiOS;
   1.108  				PRODUCT_NAME = "$(TARGET_NAME)";
   1.109  				PROVISIONING_PROFILE = "";
   1.110  				PROVISIONING_PROFILE_SPECIFIER = "";
   1.111  				SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)//pEpForiOS/pEpForiOS-Bridging-Header.h";
   1.112 +				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
   1.113  				SWIFT_VERSION = 3.0;
   1.114  			};
   1.115  			name = Debug;
   1.116 @@ -1868,7 +1903,7 @@
   1.117  				INFOPLIST_FILE = pEpForiOS/Info.plist;
   1.118  				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
   1.119  				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
   1.120 -				ONLY_ACTIVE_ARCH = NO;
   1.121 +				ONLY_ACTIVE_ARCH = "$(inherited)";
   1.122  				PRODUCT_BUNDLE_IDENTIFIER = "net.pep-security.apps.pEpAlpha";
   1.123  				PRODUCT_MODULE_NAME = pEpForiOS;
   1.124  				PRODUCT_NAME = "$(TARGET_NAME)";
   1.125 @@ -1886,6 +1921,7 @@
   1.126  				CLANG_ENABLE_MODULES = YES;
   1.127  				INFOPLIST_FILE = pEpForiOSTests/Info.plist;
   1.128  				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
   1.129 +				ONLY_ACTIVE_ARCH = "$(inherited)";
   1.130  				PRODUCT_BUNDLE_IDENTIFIER = "net.pep-security.apps.pEpForiOSTests";
   1.131  				PRODUCT_NAME = "$(TARGET_NAME)";
   1.132  				SWIFT_OBJC_BRIDGING_HEADER = "pEpForiOSTests/pEpForiOSTests-Bridging-Header.h";
   1.133 @@ -1902,6 +1938,7 @@
   1.134  				CLANG_ENABLE_MODULES = YES;
   1.135  				INFOPLIST_FILE = pEpForiOSTests/Info.plist;
   1.136  				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
   1.137 +				ONLY_ACTIVE_ARCH = "$(inherited)";
   1.138  				PRODUCT_BUNDLE_IDENTIFIER = "net.pep-security.apps.pEpForiOSTests";
   1.139  				PRODUCT_NAME = "$(TARGET_NAME)";
   1.140  				SWIFT_OBJC_BRIDGING_HEADER = "pEpForiOSTests/pEpForiOSTests-Bridging-Header.h";
   1.141 @@ -1917,6 +1954,7 @@
   1.142  				DEVELOPMENT_TEAM = "";
   1.143  				INFOPLIST_FILE = pEpForiOSUITests/Info.plist;
   1.144  				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
   1.145 +				ONLY_ACTIVE_ARCH = "$(inherited)";
   1.146  				PRODUCT_BUNDLE_IDENTIFIER = "net.pep-security.apps.pEpForiOSUITests";
   1.147  				PRODUCT_NAME = "$(TARGET_NAME)";
   1.148  				PROVISIONING_PROFILE = "";
   1.149 @@ -1933,6 +1971,7 @@
   1.150  				DEVELOPMENT_TEAM = "";
   1.151  				INFOPLIST_FILE = pEpForiOSUITests/Info.plist;
   1.152  				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
   1.153 +				ONLY_ACTIVE_ARCH = "$(inherited)";
   1.154  				PRODUCT_BUNDLE_IDENTIFIER = "net.pep-security.apps.pEpForiOSUITests";
   1.155  				PRODUCT_NAME = "$(TARGET_NAME)";
   1.156  				PROVISIONING_PROFILE = "";
     2.1 --- a/pEpForiOS/UI/Compose/MessageBodyCell.swift	Mon Jul 17 14:01:08 2017 +0200
     2.2 +++ b/pEpForiOS/UI/Compose/MessageBodyCell.swift	Thu Jul 20 09:57:30 2017 +0200
     2.3 @@ -71,7 +71,7 @@
     2.4              let nameurl = URL(fileURLWithPath: attachment.fileName)
     2.5              let fileext = nameurl.pathExtension
     2.6              let name = nameurl.deletingPathExtension().lastPathComponent
     2.7 -            validAttachment.fileName = name + "_" + String(amount) + "." + fileext
     2.8 +            validAttachment.fileName = "\(name)_\(String(amount)).\(fileext)"
     2.9          }
    2.10          add(validAttachment)
    2.11      }
     3.1 --- a/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Mon Jul 17 14:01:08 2017 +0200
     3.2 +++ b/pEpForiOS/UI/EmailDisplay/EmailListViewController.swift	Thu Jul 20 09:57:30 2017 +0200
     3.3 @@ -215,9 +215,9 @@
     3.4              self.tableView.reloadRows(at: [indexPath], with: .none)
     3.5          }
     3.6  
     3.7 -        var title = "\n\n" + NSLocalizedString("Flag", comment: "Message action (on swipe)")
     3.8 +        var title = "\n\n\(NSLocalizedString("Flag", comment: "Message action (on swipe)"))"
     3.9          if message.imapFlags?.flagged ?? true {
    3.10 -            title = "\n\n" + NSLocalizedString("Unflag", comment: "Message action (on swipe)")
    3.11 +            title = "\n\n\(NSLocalizedString("Unflag", comment: "Message action (on swipe)"))"
    3.12          }
    3.13  
    3.14          return createRowAction(
    3.15 @@ -237,7 +237,7 @@
    3.16  
    3.17          return createRowAction(
    3.18              cell: cell, image: UIImage(named: "swipe-trash"), action: action,
    3.19 -            title: "\n\n" + NSLocalizedString("Delete", comment: "Message action (on swipe)"))
    3.20 +            title: "\n\n\(NSLocalizedString("Delete", comment: "Message action (on swipe)"))")
    3.21      }
    3.22  
    3.23      func createMarkAsReadAction(message: Message, cell: EmailListViewCell) -> UITableViewRowAction {
    3.24 @@ -271,7 +271,7 @@
    3.25  
    3.26          return createRowAction(
    3.27              cell: cell, image: UIImage(named: "swipe-more"), action: action,
    3.28 -            title: "\n\n" + NSLocalizedString("More", comment: "Message action (on swipe)"))
    3.29 +            title: "\n\n\(NSLocalizedString("More", comment: "Message action (on swipe)"))")
    3.30      }
    3.31  
    3.32      // MARK: - Action Sheet
     4.1 --- a/pEpForiOS/UI/EmailDisplay/MessageSenderCell.swift	Mon Jul 17 14:01:08 2017 +0200
     4.2 +++ b/pEpForiOS/UI/EmailDisplay/MessageSenderCell.swift	Thu Jul 20 09:57:30 2017 +0200
     4.3 @@ -24,7 +24,7 @@
     4.4          ]
     4.5          
     4.6          message.allRecipients.forEach { (recepient) in
     4.7 -            let recepient = NSAttributedString(string: recepient.address + ", ", attributes: attributes)
     4.8 +            let recepient = NSAttributedString(string: "\(recepient.address), ", attributes: attributes)
     4.9              attributed.append(recepient)
    4.10          }
    4.11          valueLabel?.attributedText = attributed
     5.1 --- a/pEpForiOS/UI/Handshake/HandshakePartnerTableViewCell.swift	Mon Jul 17 14:01:08 2017 +0200
     5.2 +++ b/pEpForiOS/UI/Handshake/HandshakePartnerTableViewCell.swift	Thu Jul 20 09:57:30 2017 +0200
     5.3 @@ -238,7 +238,7 @@
     5.4          let showElipsis = !isPartnerPGPUser && !trustwordsFull
     5.5          if showElipsis,
     5.6              let trustwords = viewModel?.trustwords {
     5.7 -            trustWordsLabel.text = trustwords + " …"
     5.8 +            trustWordsLabel.text = "\(trustwords) …"
     5.9          } else {
    5.10              trustWordsLabel.text = viewModel?.trustwords
    5.11          }
     6.1 --- a/pEpForiOS/UI/Util/CGRect+Util.swift	Mon Jul 17 14:01:08 2017 +0200
     6.2 +++ b/pEpForiOS/UI/Util/CGRect+Util.swift	Thu Jul 20 09:57:30 2017 +0200
     6.3 @@ -22,9 +22,20 @@
     6.4          let r = standardized
     6.5          var theWidth = maxWidth
     6.6          theWidth = min(theWidth, min(r.width, r.height))
     6.7 -        let center = CGPoint(x: r.origin.x + round(r.width / 2),
     6.8 -                             y: r.origin.y + round(r.height / 2))
     6.9 -        let orig = CGPoint(x: center.x - round(theWidth / 2), y: center.y - round(theWidth / 2))
    6.10 +
    6.11 +        let widthR = round(r.width / 2)
    6.12 +        let centerX = r.origin.x + widthR
    6.13 +
    6.14 +        let heightR = round(r.height / 2)
    6.15 +        let centerY = r.origin.y + heightR
    6.16 +
    6.17 +        let center = CGPoint(x: centerX, y: centerY)
    6.18 +
    6.19 +        let width2 = round(theWidth / 2)
    6.20 +        let origX = center.x - width2
    6.21 +        let origY = center.y - width2
    6.22 +        let orig = CGPoint(x: origX, y: origY)
    6.23 +
    6.24          return CGRect(origin: orig, size: CGSize(width: theWidth, height: theWidth))
    6.25      }
    6.26  }
     7.1 --- a/pEpForiOS/Util/Extensions/String+Extensions.swift	Mon Jul 17 14:01:08 2017 +0200
     7.2 +++ b/pEpForiOS/Util/Extensions/String+Extensions.swift	Thu Jul 20 09:57:30 2017 +0200
     7.3 @@ -143,11 +143,12 @@
     7.4       - Returns: The part of a recipient list that connot be edited anymore.
     7.5       */
     7.6      public func finishedRecipientPart() -> String {
     7.7 -        let comps = self.components(separatedBy: String.internalRecipientDelimiter)
     7.8 +        var comps = self.components(separatedBy: String.internalRecipientDelimiter)
     7.9          if comps.count == 1 {
    7.10              return ""
    7.11          } else {
    7.12 -            let ar = comps[0..<comps.count-1].map({$0.trimmedWhiteSpace()})
    7.13 +            comps = Array(comps.dropLast())
    7.14 +            let ar = comps.map({$0.trimmedWhiteSpace()})
    7.15              return ar.joined(separator: String.externalRecipientDelimiter)
    7.16          }
    7.17      }
    7.18 @@ -445,7 +446,7 @@
    7.19          }
    7.20          let word1 = words[0]
    7.21          let word2 = words[words.count - 1]
    7.22 -        return word1.prefix(ofLength: 1).capitalized + word2.prefix(ofLength: 1).capitalized
    7.23 +        return "\(word1.prefix(ofLength: 1).capitalized)\(word2.prefix(ofLength: 1).capitalized)"
    7.24      }
    7.25  
    7.26      /**
     8.1 --- a/pEpForiOS/Util/Log.swift	Mon Jul 17 14:01:08 2017 +0200
     8.2 +++ b/pEpForiOS/Util/Log.swift	Thu Jul 20 09:57:30 2017 +0200
     8.3 @@ -85,7 +85,7 @@
     8.4  
     8.5      static open func error(component: String, errorString: String, error: Error) {
     8.6          Log.shared.saveLog(
     8.7 -            entity: component, description: errorString + " \(error)", comment: "error")
     8.8 +            entity: component, description: "\(errorString) \(error)", comment: "error")
     8.9      }
    8.10  
    8.11      static open func error(component: String, errorString: String) {
     9.1 --- a/pEpForiOS/Util/PEPUtil.swift	Mon Jul 17 14:01:08 2017 +0200
     9.2 +++ b/pEpForiOS/Util/PEPUtil.swift	Thu Jul 20 09:57:30 2017 +0200
     9.3 @@ -552,11 +552,8 @@
     9.4  }
     9.5  
     9.6  extension String {
     9.7 -
     9.8      public static var pepSignature: String {
     9.9 -        return "\n\n" +
    9.10 -            NSLocalizedString("Sent with p≡p",
    9.11 -                              comment: "pEp mail signature. Newlines will be added by app") + "\n"
    9.12 +        return "\n\n\(NSLocalizedString("Sent with p≡p", comment: "pEp mail signature. Newlines will be added by app"))\n"
    9.13      }
    9.14  }
    9.15  
    10.1 --- a/pEpForiOSTests/Models/CdMessage+PantomimeTest.swift	Mon Jul 17 14:01:08 2017 +0200
    10.2 +++ b/pEpForiOSTests/Models/CdMessage+PantomimeTest.swift	Thu Jul 20 09:57:30 2017 +0200
    10.3 @@ -63,7 +63,7 @@
    10.4  
    10.5          localFlags.flagDeleted = false
    10.6          XCTAssertEqual(m.storeCommandForUpdateFlags(to: .remove)!.0,
    10.7 -                       "UID STORE 1024 -FLAGS.SILENT " + "(\\Answered \\Draft \\Flagged \\Deleted)")
    10.8 +                       "UID STORE 1024 -FLAGS.SILENT (\\Answered \\Draft \\Flagged \\Deleted)")
    10.9      }
   10.10  
   10.11      func testStoreCommandForFlagsToAdd_noServerFlagsSet() {