From 2b4d8aa6ff77f07e00abefa456378ad25f406be5 Mon Sep 17 00:00:00 2001 From: Yonas Kolb Date: Tue, 19 Sep 2017 13:14:38 +0200 Subject: [PATCH] update generated LastUpgradeVersion to 0900 --- .../GeneratedProject.xcodeproj/project.pbxproj | 8 ++++---- .../xcshareddata/xcschemes/TestProject.xcscheme | 2 +- README.md | 2 +- Sources/XcodeGenKit/PBXProjGenerator.swift | 7 ++++--- Sources/XcodeGenKit/ProjectGenerator.swift | 4 ++-- docs/ProjectSpec.md | 4 ++-- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Fixtures/TestProject/GeneratedProject.xcodeproj/project.pbxproj b/Fixtures/TestProject/GeneratedProject.xcodeproj/project.pbxproj index d662f46f..109a29df 100644 --- a/Fixtures/TestProject/GeneratedProject.xcodeproj/project.pbxproj +++ b/Fixtures/TestProject/GeneratedProject.xcodeproj/project.pbxproj @@ -212,7 +212,7 @@ P81399456601 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0830; + LastUpgradeCheck = 0900; }; buildConfigurationList = XCCL81399401 /* Build configuration list for PBXProject */; compatibilityVersion = "Xcode 3.2"; @@ -269,7 +269,7 @@ outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; - shellPath = bin/sh; + shellPath = /bin/sh; shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; SSBP24648001 /* Strip Unused Architectures from Frameworks */ = { @@ -283,7 +283,7 @@ outputPaths = ( ); runOnlyForDeploymentPostprocessing = 1; - shellPath = bin/sh; + shellPath = /bin/sh; shellScript = "################################################################################\n#\n# Copyright 2015 Realm Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n################################################################################\n\n# This script strips all non-valid architectures from dynamic libraries in\n# the application's `Frameworks` directory.\n#\n# The following environment variables are required:\n#\n# BUILT_PRODUCTS_DIR\n# FRAMEWORKS_FOLDER_PATH\n# VALID_ARCHS\n# EXPANDED_CODE_SIGN_IDENTITY\n\n\n# Signs a framework with the provided identity\ncode_sign() {\n # Use the current code_sign_identitiy\n echo \"Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}\"\n echo \"/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements $1\"\n /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\"\n}\n\n# Set working directory to product’s embedded frameworks\ncd \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\nif [ \"$ACTION\" = \"install\" ]; then\n echo \"Copy .bcsymbolmap files to .xcarchive\"\n find . -name '*.bcsymbolmap' -type f -exec mv {} \"${CONFIGURATION_BUILD_DIR}\" \;\nelse\n # Delete *.bcsymbolmap files from framework bundle unless archiving\n find . -name '*.bcsymbolmap' -type f -exec rm -rf \"{}\" +\;\nfi\n\necho \"Stripping frameworks\"\n\nfor file in $(find . -type f -perm +111); do\n # Skip non-dynamic libraries\n if ! [[ \"$(file \"$file\")\" == *\"dynamically linked shared library\"* ]]; then\n continue\n fi\n # Get architectures for current file\n archs=\"$(lipo -info \"${file}\" | rev | cut -d ':' -f1 | rev)\"\n stripped=\"\"\n for arch in $archs; do\n if ! [[ \"${VALID_ARCHS}\" == *\"$arch\"* ]]; then\n # Strip non-valid architectures in-place\n lipo -remove \"$arch\" -output \"$file\" \"$file\" || exit 1\n stripped=\"$stripped $arch\"\n fi\n done\n if [[ \"$stripped\" != \"\" ]]; then\n echo \"Stripped $file of architectures:$stripped\"\n if [ \"${CODE_SIGNING_REQUIRED}\" == \"YES\" ]; then\n code_sign \"${file}\"\n fi\n fi\ndone\n"; }; SSBP35382101 /* Swiftlint */ = { @@ -297,7 +297,7 @@ outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; - shellPath = bin/sh; + shellPath = /bin/sh; shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/Fixtures/TestProject/GeneratedProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme b/Fixtures/TestProject/GeneratedProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme index 84ceedb0..7faa7c9a 100644 --- a/Fixtures/TestProject/GeneratedProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme +++ b/Fixtures/TestProject/GeneratedProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme @@ -1,5 +1,5 @@ - + diff --git a/README.md b/README.md index 22bf9686..f2f77476 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ targets: A project would be created with 2 connected targets, with all the required configurations and build settings. See the [Project Spec](docs/ProjectSpec.md) documentation for all the options you can specify. ## Installing -Make sure Xcode 8.3 is installed first. +Make sure Xcode 9 is installed first. ### Make diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index 1843d777..1dc51234 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -18,7 +18,7 @@ public class PBXProjGenerator { let spec: ProjectSpec let basePath: Path - let currentXcodeVersion = "0830" + let currentXcodeVersion: String var fileReferencesByPath: [Path: String] = [:] var groupsByPath: [Path: PBXGroup] = [:] @@ -37,7 +37,8 @@ public class PBXProjGenerator { return spec.options.carthageBuildPath ?? "Carthage/Build" } - public init(spec: ProjectSpec, path: Path) { + public init(spec: ProjectSpec, path: Path, currentXcodeVersion: String) { + self.currentXcodeVersion = currentXcodeVersion self.spec = spec basePath = path } @@ -114,7 +115,7 @@ public class PBXProjGenerator { addObject(mainGroup) let knownRegions: [String] = ["en", "Base"] - let projectAttributes: [String: Any] = spec.attributes.isEmpty ? ["LastUpgradeCheck": currentXcodeVersion] : spec.attributes + let projectAttributes: [String: Any] = ["LastUpgradeCheck": currentXcodeVersion].merged(spec.attributes) let root = PBXProject(reference: project.rootObject, buildConfigurationList: buildConfigList.reference, compatibilityVersion: "Xcode 3.2", diff --git a/Sources/XcodeGenKit/ProjectGenerator.swift b/Sources/XcodeGenKit/ProjectGenerator.swift index 8ac1d14b..d5a8c5a3 100644 --- a/Sources/XcodeGenKit/ProjectGenerator.swift +++ b/Sources/XcodeGenKit/ProjectGenerator.swift @@ -17,7 +17,7 @@ public class ProjectGenerator { var spec: ProjectSpec var path: Path - let currentXcodeVersion = "0830" + let currentXcodeVersion = "0900" public init(spec: ProjectSpec, path: Path) { self.spec = spec @@ -143,7 +143,7 @@ public class ProjectGenerator { public func generateProject() throws -> XcodeProj { try validate() - let pbxProjGenerator = PBXProjGenerator(spec: spec, path: path) + let pbxProjGenerator = PBXProjGenerator(spec: spec, path: path, currentXcodeVersion: currentXcodeVersion) let pbxProject = try pbxProjGenerator.generate() let workspace = try generateWorkspace() let sharedData = try generateSharedData(pbxProject: pbxProject) diff --git a/docs/ProjectSpec.md b/docs/ProjectSpec.md index 898b8ff0..9ba91169 100644 --- a/docs/ProjectSpec.md +++ b/docs/ProjectSpec.md @@ -27,11 +27,11 @@ Required properties are marked 🔵 and optional properties with ⚪️. - 🔵 **name**: `String` - Name of the generated project - ⚪️ **include**: `[String]` - The paths to other specs. They will be merged in order and then the current spec will be merged on top. Target names can be changed by adding a `name` property - ⚪️ **options**: [Options](#options) - Various options to override default behaviour -- ⚪️ **attributes**: `map` - The PBXProject attributes. This is for advanced use. Defaults to ``{"LastUpgradeCheck": "0830"}`` +- ⚪️ **attributes**: `map` - The PBXProject attributes. This is for advanced use. Defaults to ``{"LastUpgradeCheck": "0900"}`` - ⚪️ **configs**: [Configs](#configs) - Project build configurations. Defaults to `Debug` and `Release` configs - ⚪️ **settings**: [Settings](#settings) - Project specific settings. Default base and config type settings will be applied first before any settings defined here - ⚪️ **settingGroups**: [Setting Groups](#setting-groups) - Setting groups mapped by name -- ⚪️ **targets**: [String: [Target](#target)] - The list of targets in the project mapped by name +- ⚪️ **targets**: [Target](#target) - The list of targets in the project mapped by name ### Options - ⚪️ **carthageBuildPath**: `String` - The path to the carthage build directory. Defaults to `Carthage/Build`. This is used when specifying target carthage dependencies