Skip to content

Commit

Permalink
Merge pull request #371 from CocoaPods/seg-xcode-7.3
Browse files Browse the repository at this point in the history
[Constants] Update for Xcode 7.3
  • Loading branch information
neonichu committed May 4, 2016
2 parents 8c2f46a + a3b8233 commit af55a8b
Show file tree
Hide file tree
Showing 134 changed files with 1,845 additions and 2,209 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

##### Enhancements

* None.
* Update constants for Xcode 7.3.
[Samuel Giddins](https://github.com/segiddins)
[#370](https://github.com/CocoaPods/Xcodeproj/issues/370)

##### Bug Fixes

* Fix issue with initializing an existing workspace but missing `contents.xcworkspacedir`, triggering pod
installs to fail with undefined method `root` for nil:NilClass errors.
* Support initializing a workspace that is missing a
`contents.xcworkspacedir`.
[Roger Hu](https://github.com/rogerhu)
[CocoaPods#4998](https://github.com/CocoaPods/CocoaPods/issues/4998)

Expand Down
112 changes: 63 additions & 49 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,69 +54,69 @@ begin
#-----------------------------------------------------------------------------#

namespace :common_build_settings do
PROJECT_PATH = 'Project/Project.xcodeproj'
PROJECT_PATH = 'Project/Project.xcodeproj'.freeze

task :prepare do
verbose false
cd 'spec/fixtures/CommonBuildSettings'
end

desc "Create a new empty project"
desc 'Create a new empty project'
task :new_project => [:prepare] do
verbose false
Bundler.setup
require 'xcodeproj'
title "Setup Boilerplate"
title 'Setup Boilerplate'

confirm "Delete existing fixture project and all data"
confirm 'Delete existing fixture project and all data'
rm_rf 'Project/*'

subtitle "Create a new fixture project"
subtitle 'Create a new fixture project'
Xcodeproj::Project.new(PROJECT_PATH).save

subtitle "Open the project …"
sh 'open "Project/Project.xcodeproj"'
end

desc "Interactive walkthrough for creating fixture targets"
desc 'Interactive walkthrough for creating fixture targets'
task :targets => [:prepare] do
verbose false
Bundler.setup
require 'xcodeproj'

title "Create Targets"
subtitle "You will be guided how to *manually* create the needed targets."
subtitle "Each target name will been copied to your clipboard."
confirm "Make sure you have nothing unsaved there"
title 'Create Targets'
subtitle 'You will be guided how to *manually* create the needed targets.'
subtitle 'Each target name will been copied to your clipboard.'
confirm 'Make sure you have nothing unsaved there'

targets = {
"Objc_iOS_Native" => { platform: :ios, type: :application, language: :objc, how: "iOS > Master-Detail Application > Language: Objective-C" },
"Swift_iOS_Native" => { platform: :ios, type: :application, language: :swift, how: "iOS > Master-Detail Application > Language: Swift" },
"Objc_iOS_Framework" => { platform: :ios, type: :framework, language: :objc, how: "iOS > Cocoa Touch Framework > Language: Objective-C" },
"Swift_iOS_Framework" => { platform: :ios, type: :framework, language: :swift, how: "iOS > Cocoa Touch Framework > Language: Swift" },
"Objc_iOS_StaticLibrary" => { platform: :ios, type: :static_library, language: :objc, how: "iOS > Cocoa Touch Static Library" },

"Objc_OSX_Native" => { platform: :osx, type: :application, language: :objc, how: "OSX > Cocoa Application > Language: Objective-C" },
"Swift_OSX_Native" => { platform: :osx, type: :application, language: :swift, how: "OSX > Cocoa Application > Language: Swift" },
"Objc_OSX_Framework" => { platform: :osx, type: :framework, language: :objc, how: "OSX > Cocoa Framework > Language: Objective-C" },
"Swift_OSX_Framework" => { platform: :osx, type: :framework, language: :swift, how: "OSX > Cocoa Framework > Language: Swift" },
"Objc_OSX_StaticLibrary" => { platform: :osx, type: :static_library, language: :objc, how: "OSX > Library > Type: Static" },
"Objc_OSX_DynamicLibrary" => { platform: :osx, type: :dynamic_library, language: :objc, how: "OSX > Library > Type: Dynamic" },
"OSX_Bundle" => { platform: :osx, type: :bundle, how: "OSX > Bundle" },

"Objc_watchOS_Native" => { platform: :watchos, type: :watch2_app, language: :objc, how: "watchOS > WatchKit App > Language: Objective-C" },
"Objc_watchOS_Native Extension" => { platform: :watchos, type: :watch2_extension, language: :objc, how: "Already done!" },
"Swift_watchOS_Native" => { platform: :watchos, type: :watch2_app, language: :swift, how: "watchOS > WatchKit App > Language: Swift" },
"Swift_watchOS_Native Extension" => { platform: :watchos, type: :watch2_extension, language: :swift, how: "Already done!" },
"Objc_watchOS_Framework" => { platform: :watchos, type: :framework, language: :objc, how: "watchOS > Watch Framework > Language: Objective-C" },
"Swift_watchOS_Framework" => { platform: :watchos, type: :framework, language: :swift, how: "watchOS > Watch Framework > Language: Swift" },
"Objc_watchOS_StaticLibrary" => { platform: :watchos, type: :static_library, language: :objc, how: "watchOS > Watch Static Library > Language: Objective-C" },

"Objc_tvOS_Native" => { platform: :tvos, type: :application, language: :objc, how: "tvOS > Single View Application > Language: Objective-C" },
"Swift_tvOS_Native" => { platform: :tvos, type: :application, language: :swift, how: "tvOS > Single View Application > Language: Swift" },
"Objc_tvOS_Framework" => { platform: :tvos, type: :framework, language: :objc, how: "tvOS > TV Framework > Language: Objective-C" },
"Swift_tvOS_Framework" => { platform: :tvos, type: :framework, language: :swift, how: "tvOS > TV Framework > Language: Swift" },
"Objc_tvOS_StaticLibrary" => { platform: :tvos, type: :static_library, language: :objc, how: "tvOS > TV Static Library > Language: Objective-C" },
'Objc_iOS_Native' => { :platform => :ios, :type => :application, :language => :objc, :how => 'iOS > Master-Detail Application > Language: Objective-C' },
'Swift_iOS_Native' => { :platform => :ios, :type => :application, :language => :swift, :how => 'iOS > Master-Detail Application > Language: Swift' },
'Objc_iOS_Framework' => { :platform => :ios, :type => :framework, :language => :objc, :how => 'iOS > Cocoa Touch Framework > Language: Objective-C' },
'Swift_iOS_Framework' => { :platform => :ios, :type => :framework, :language => :swift, :how => 'iOS > Cocoa Touch Framework > Language: Swift' },
'Objc_iOS_StaticLibrary' => { :platform => :ios, :type => :static_library, :language => :objc, :how => 'iOS > Cocoa Touch Static Library' },

'Objc_OSX_Native' => { :platform => :osx, :type => :application, :language => :objc, :how => 'OSX > Cocoa Application > Language: Objective-C' },
'Swift_OSX_Native' => { :platform => :osx, :type => :application, :language => :swift, :how => 'OSX > Cocoa Application > Language: Swift' },
'Objc_OSX_Framework' => { :platform => :osx, :type => :framework, :language => :objc, :how => 'OSX > Cocoa Framework > Language: Objective-C' },
'Swift_OSX_Framework' => { :platform => :osx, :type => :framework, :language => :swift, :how => 'OSX > Cocoa Framework > Language: Swift' },
'Objc_OSX_StaticLibrary' => { :platform => :osx, :type => :static_library, :language => :objc, :how => 'OSX > Library > Type: Static' },
'Objc_OSX_DynamicLibrary' => { :platform => :osx, :type => :dynamic_library, :language => :objc, :how => 'OSX > Library > Type: Dynamic' },
'OSX_Bundle' => { :platform => :osx, :type => :bundle, :how => 'OSX > Bundle' },

'Objc_watchOS_Native' => { :platform => :watchos, :type => :watch2_app, :language => :objc, :how => 'watchOS > WatchKit App > Language: Objective-C' },
'Objc_watchOS_Native Extension' => { :platform => :watchos, :type => :watch2_extension, :language => :objc, :how => 'Already done!' },
'Swift_watchOS_Native' => { :platform => :watchos, :type => :watch2_app, :language => :swift, :how => 'watchOS > WatchKit App > Language: Swift' },
'Swift_watchOS_Native Extension' => { :platform => :watchos, :type => :watch2_extension, :language => :swift, :how => 'Already done!' },
'Objc_watchOS_Framework' => { :platform => :watchos, :type => :framework, :language => :objc, :how => 'watchOS > Watch Framework > Language: Objective-C' },
'Swift_watchOS_Framework' => { :platform => :watchos, :type => :framework, :language => :swift, :how => 'watchOS > Watch Framework > Language: Swift' },
'Objc_watchOS_StaticLibrary' => { :platform => :watchos, :type => :static_library, :language => :objc, :how => 'watchOS > Watch Static Library > Language: Objective-C' },

'Objc_tvOS_Native' => { :platform => :tvos, :type => :application, :language => :objc, :how => 'tvOS > Single View Application > Language: Objective-C' },
'Swift_tvOS_Native' => { :platform => :tvos, :type => :application, :language => :swift, :how => 'tvOS > Single View Application > Language: Swift' },
'Objc_tvOS_Framework' => { :platform => :tvos, :type => :framework, :language => :objc, :how => 'tvOS > TV Framework > Language: Objective-C' },
'Swift_tvOS_Framework' => { :platform => :tvos, :type => :framework, :language => :swift, :how => 'tvOS > TV Framework > Language: Swift' },
'Objc_tvOS_StaticLibrary' => { :platform => :tvos, :type => :static_library, :language => :objc, :how => 'tvOS > TV Static Library > Language: Objective-C' },
}

targets.each do |name, attributes|
Expand All @@ -134,33 +134,47 @@ begin
raise "Type doesn't match." unless target.symbol_type == attributes[:type]

debug_config = target.build_configurations.find { |c| c.name == 'Debug' }
raise "Debug configuration is missing" if debug_config.nil?
raise 'Debug configuration is missing' if debug_config.nil?

release_config = target.build_configurations.find { |c| c.name == 'Release' }
raise "Release configuration is missing" if release_config.nil?
raise 'Release configuration is missing' if release_config.nil?

is_swift_present = debug_config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] != nil
is_swift_present = !debug_config.build_settings['SWIFT_OPTIMIZATION_LEVEL'].nil?
is_swift_expected = attributes[:language] == :swift
raise "Language doesn't match." unless is_swift_present == is_swift_expected

puts green("Target matches.")
puts green('Target matches.')
puts
rescue StandardError => e
puts "#{red(e.message)} Try again."
retry
end
end

puts green("All targets were been successfully created.")
Xcodeproj::Project.open(PROJECT_PATH).tap do |project|
project.sort
project.predictabilize_uuids
project.save
project.files.each do |file|
path = file.real_path
next unless path.file?
contents = path.read
contents.sub! %r{\A(//\s.+\n)+}, ''
contents.sub! /\A\s+/, ''
path.open('w') { |f| f.write(contents) }
end
end

puts green('All targets have been successfully created.')
end

desc "Dump the build settings of the fixture project to xcconfig files"
desc 'Dump the build settings of the fixture project to xcconfig files'
task :dump => [:prepare] do
verbose false
sh "../../../bin/xcodeproj config-dump Project/Project.xcodeproj configs"
sh '../../../bin/xcodeproj config-dump Project/Project.xcodeproj configs'
end

desc "Recreate the xcconfig files for the fixture project targets from scratch"
desc 'Recreate the xcconfig files for the fixture project targets from scratch'
task :rebuild => [
:new_project,
:targets,
Expand Down Expand Up @@ -200,7 +214,7 @@ begin

require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop) do |task|
task.patterns = ['lib', 'spec']
task.patterns = %w(lib spec)
end

rescue LoadError, NameError => e
Expand Down Expand Up @@ -254,13 +268,13 @@ def cyan(string)
"\n\033[0;36m#{string}\033[0m"
end

def confirm(message, decline_by_default=true)
options = ['y', 'n']
def confirm(message, decline_by_default = true)
options = %w(y n)
options[decline_by_default ? 1 : 0].upcase!
print yellow("#{message}: [#{options.join('/')}] ")
input = STDIN.gets.chomp
if input == options[1].downcase || (input == '' && decline_by_default)
puts red("Aborted by user.")
puts red('Aborted by user.')
exit 1
end
end
15 changes: 8 additions & 7 deletions lib/xcodeproj/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ module Xcodeproj
module Constants
# @return [String] The last known iOS SDK (stable).
#
LAST_KNOWN_IOS_SDK = '9.2'
LAST_KNOWN_IOS_SDK = '9.3'

# @return [String] The last known OS X SDK (stable).
#
LAST_KNOWN_OSX_SDK = '10.11'

# @return [String] The last known tvOS SDK (stable).
LAST_KNOWN_TVOS_SDK = '9.1'
LAST_KNOWN_TVOS_SDK = '9.2'

# @return [String] The last known watchOS SDK (stable).
LAST_KNOWN_WATCHOS_SDK = '2.1'
LAST_KNOWN_WATCHOS_SDK = '2.2'

# @return [String] The last known archive version to Xcodeproj.
#
Expand All @@ -33,7 +33,7 @@ module Constants

# @return [String] The last known object version to Xcodeproj.
#
LAST_SWIFT_UPGRADE_CHECK = '0720'
LAST_SWIFT_UPGRADE_CHECK = '0730'

# @return [String] The version of `.xcscheme` files supported by Xcodeproj
#
Expand Down Expand Up @@ -284,19 +284,20 @@ module Constants
PROJECT_DEFAULT_BUILD_SETTINGS = {
:all => {
'ALWAYS_SEARCH_USER_PATHS' => 'NO',
'CLANG_ANALYZER_NONNULL' => 'YES',
'CLANG_CXX_LANGUAGE_STANDARD' => 'gnu++0x',
'CLANG_CXX_LIBRARY' => 'libc++',
'CLANG_ENABLE_MODULES' => 'YES',
'CLANG_ENABLE_OBJC_ARC' => 'YES',
'CLANG_WARN__DUPLICATE_METHOD_MATCH' => 'YES',
'CLANG_WARN_BOOL_CONVERSION' => 'YES',
'CLANG_WARN_CONSTANT_CONVERSION' => 'YES',
'CLANG_WARN_DIRECT_OBJC_ISA_USAGE' => 'YES',
'CLANG_WARN__DUPLICATE_METHOD_MATCH' => 'YES',
'CLANG_WARN_EMPTY_BODY' => 'YES',
'CLANG_WARN_ENUM_CONVERSION' => 'YES',
'CLANG_WARN_INT_CONVERSION' => 'YES',
'CLANG_WARN_OBJC_ROOT_CLASS' => 'YES',
'CLANG_WARN_UNREACHABLE_CODE' => 'YES',
'CLANG_ENABLE_MODULES' => 'YES',
'GCC_C_LANGUAGE_STANDARD' => 'gnu99',
'GCC_WARN_64_TO_32_BIT_CONVERSION' => 'YES',
'GCC_WARN_ABOUT_RETURN_TYPE' => 'YES',
Expand All @@ -311,13 +312,13 @@ module Constants
'VALIDATE_PRODUCT' => 'YES',
}.freeze,
:debug => {
'ONLY_ACTIVE_ARCH' => 'YES',
'COPY_PHASE_STRIP' => 'NO',
'ENABLE_TESTABILITY' => 'YES',
'GCC_DYNAMIC_NO_PIC' => 'NO',
'GCC_OPTIMIZATION_LEVEL' => '0',
'GCC_PREPROCESSOR_DEFINITIONS' => ['DEBUG=1', '$(inherited)'],
'GCC_SYMBOLS_PRIVATE_EXTERN' => 'NO',
'ONLY_ACTIVE_ARCH' => 'YES',
}.freeze,
}.freeze

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// Objc_OSX_DynamicLibrary.h
// Objc_OSX_DynamicLibrary
//
// Created by Samuel Giddins on 12/26/15.
//
//

#import <Foundation/Foundation.h>

@interface Objc_OSX_DynamicLibrary : NSObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// Objc_OSX_DynamicLibrary.m
// Objc_OSX_DynamicLibrary
//
// Created by Samuel Giddins on 12/26/15.
//
//

#import "Objc_OSX_DynamicLibrary.h"

@implementation Objc_OSX_DynamicLibrary
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// Objc_OSX_Framework.h
// Objc_OSX_Framework
//
// Created by Samuel Giddins on 12/26/15.
//
//

#import <Cocoa/Cocoa.h>

//! Project version number for Objc_OSX_Framework.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// AppDelegate.h
// Objc_OSX_Native
//
// Created by Samuel Giddins on 12/26/15.
//
//

#import <Cocoa/Cocoa.h>

@interface AppDelegate : NSObject <NSApplicationDelegate>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// AppDelegate.m
// Objc_OSX_Native
//
// Created by Samuel Giddins on 12/26/15.
//
//

#import "AppDelegate.h"

@interface AppDelegate ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<view key="view" id="m2S-Jp-Qdl">
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
</view>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// ViewController.h
// Objc_OSX_Native
//
// Created by Samuel Giddins on 12/26/15.
//
//

#import <Cocoa/Cocoa.h>

@interface ViewController : NSViewController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// ViewController.m
// Objc_OSX_Native
//
// Created by Samuel Giddins on 12/26/15.
//
//

#import "ViewController.h"

@implementation ViewController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// main.m
// Objc_OSX_Native
//
// Created by Samuel Giddins on 12/26/15.
//
//

#import <Cocoa/Cocoa.h>

int main(int argc, const char * argv[]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// Objc_OSX_StaticLibrary.h
// Objc_OSX_StaticLibrary
//
// Created by Samuel Giddins on 12/26/15.
//
//

#import <Foundation/Foundation.h>

@interface Objc_OSX_StaticLibrary : NSObject
Expand Down
Loading

0 comments on commit af55a8b

Please sign in to comment.