Commit 960b653d authored by Fabio Pelosin's avatar Fabio Pelosin

Add support for compile time introspection

parent 61ddc073
...@@ -5,7 +5,12 @@ ...@@ -5,7 +5,12 @@
* CocoaPods now defines the `COCOAPODS=1` macro in the Pod and the Client * CocoaPods now defines the `COCOAPODS=1` macro in the Pod and the Client
targets. This is useful for libraries which conditionally expose interfaces. targets. This is useful for libraries which conditionally expose interfaces.
[#903](https://github.com/CocoaPods/CocoaPods/issues/903) [#903](https://github.com/CocoaPods/CocoaPods/issues/903)
* CocoaPods now defines the deployment target of the project. * Compile time introspection. Macro definitions which allow to inspect the
installed Pods and their version have been introduced in the build
environment of the Pod libraries
([example](https://gist.github.com/irrationalfab/5348551)).
* CocoaPods now defines the deployment target of the Pods project computed as
the minimum deployment target of the Pods libraries.
[#556](https://github.com/CocoaPods/CocoaPods/issues/556) [#556](https://github.com/CocoaPods/CocoaPods/issues/556)
###### Bug fixes ###### Bug fixes
......
...@@ -6,19 +6,16 @@ module Pod ...@@ -6,19 +6,16 @@ module Pod
# #
# Example output: # Example output:
# #
# #define __COCOA_PODS # #define COCOAPODS_POD_AVAILABLE_ObjectiveSugar 1
# # #define COCOAPODS_VERSION_MAJOR_ObjectiveSugar 0
# #define __POD_AFIncrementaStore # #define COCOAPODS_VERSION_MINOR_ObjectiveSugar 6
# #define __POD_AFNetworking # #define COCOAPODS_VERSION_PATCH_ObjectiveSugar 2
# #define __POD_libextobjc_EXTConcreteProtocol
# #define __POD_libextobjc_EXTKeyPathCoding
# #define __POD_libextobjc_EXTScope
# #
# Example usage: # Example usage:
# #
# #ifdef __COCOA_PODS # #ifdef COCOAPODS
# #ifdef __POD__AFNetworking # #ifdef COCOAPODS_POD_AVAILABLE_ObjectiveSugar
# #import "MYLib+AFNetworking.h" # #import "ObjectiveSugar.h"
# #endif # #endif
# #else # #else
# // Non CocoaPods code # // Non CocoaPods code
...@@ -45,14 +42,35 @@ module Pod ...@@ -45,14 +42,35 @@ module Pod
# #
def save_as(pathname) def save_as(pathname)
pathname.open('w') do |source| pathname.open('w') do |source|
source.puts "// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future"
source.puts "#define __COCOA_PODS"
source.puts source.puts
specs.each do |specs| source.puts "// To check if a library is compiled with CocoaPods you"
source.puts "#define __POD_#{specs.name.gsub(/[^\w]/,'_')}" source.puts "// can use the `COCOAPODS` macro definition which is"
source.puts "// defined in the xcconfigs so it is available in"
source.puts "// headers also when they are imported in the client"
source.puts "// project."
source.puts
source.puts
specs.each do |spec|
spec_name = spec.name.gsub(/[^\w]/,'_')
source.puts "// #{spec.name}"
source.puts "#define COCOAPODS_POD_AVAILABLE_#{spec_name} TRUE"
if spec.version.semantic?
source.puts "#define COCOAPODS_VERSION_MAJOR_#{spec_name} #{spec.version.major}"
source.puts "#define COCOAPODS_VERSION_MINOR_#{spec_name} #{spec.version.minor}"
source.puts "#define COCOAPODS_VERSION_PATCH_#{spec_name} #{spec.version.patch}"
else
source.puts "// This library does not follow semantic-versioning,"
source.puts "// so we were not able to define version macros."
source.puts "// Please contact the author."
source.puts "// Version: #{spec.version}."
end
source.puts
end end
end end
end end
#-----------------------------------------------------------------------#
end end
end end
end end
...@@ -35,7 +35,7 @@ module Pod ...@@ -35,7 +35,7 @@ module Pod
create_suport_files_group create_suport_files_group
create_xcconfig_file create_xcconfig_file
create_target_header create_target_environement_header
create_prefix_header create_prefix_header
create_bridge_support_file create_bridge_support_file
create_copy_resources_script create_copy_resources_script
...@@ -158,9 +158,9 @@ module Pod ...@@ -158,9 +158,9 @@ module Pod
# Generates a header which allows to inspect at compile time the installed # Generates a header which allows to inspect at compile time the installed
# pods and the installed specifications of a pod. # pods and the installed specifications of a pod.
# #
def create_target_header def create_target_environement_header
path = library.target_header_path path = library.target_environment_header_path
UI.message "- Generating target header at #{UI.path(path)}" do UI.message "- Generating target environment header at #{UI.path(path)}" do
generator = Generator::TargetHeader.new(library.specs) generator = Generator::TargetHeader.new(library.specs)
generator.save_as(path) generator.save_as(path)
add_file_to_support_group(path) add_file_to_support_group(path)
...@@ -177,7 +177,7 @@ module Pod ...@@ -177,7 +177,7 @@ module Pod
path = library.prefix_header_path path = library.prefix_header_path
UI.message "- Generating prefix header at #{UI.path(path)}" do UI.message "- Generating prefix header at #{UI.path(path)}" do
generator = Generator::PrefixHeader.new(library.file_accessors, library.platform) generator = Generator::PrefixHeader.new(library.file_accessors, library.platform)
generator.imports << library.target_header_path.basename generator.imports << library.target_environment_header_path.basename
generator.save_as(path) generator.save_as(path)
add_file_to_support_group(path) add_file_to_support_group(path)
......
...@@ -127,8 +127,8 @@ module Pod ...@@ -127,8 +127,8 @@ module Pod
# @return [Pathname] the absolute path of the header file which contains # @return [Pathname] the absolute path of the header file which contains
# the information about the installed pods. # the information about the installed pods.
# #
def target_header_path def target_environment_header_path
support_files_root + "#{label}-header.h" support_files_root + "#{label}-environment.h"
end end
# @return [Pathname] the absolute path of the prefix header file. # @return [Pathname] the absolute path of the prefix header file.
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// JSONKit
#define COCOAPODS_POD_AVAILABLE_JSONKit TRUE
// This library does not follow semantic-versioning,
// so we were not able to define version macros.
// Please contact the author.
// Version: 1.5pre.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_JSONKit
#define __POD_Reachability
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
...@@ -15,7 +15,7 @@ File References: ...@@ -15,7 +15,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
......
...@@ -43,7 +43,7 @@ Generating Pods project ...@@ -43,7 +43,7 @@ Generating Pods project
- Installing target `Pods` iOS 6.0 - Installing target `Pods` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-SampleApp_1-header.h" #import "Pods-SampleApp_1-environment.h"
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-SampleApp_2-header.h" #import "Pods-SampleApp_2-environment.h"
...@@ -13,7 +13,7 @@ File References: ...@@ -13,7 +13,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods-SampleApp_1: - Pods-SampleApp_1:
- Pods-SampleApp_1.xcconfig - Pods-SampleApp_1.xcconfig
- Pods-SampleApp_1-header.h - Pods-SampleApp_1-environment.h
- Pods-SampleApp_1-prefix.pch - Pods-SampleApp_1-prefix.pch
- Pods-SampleApp_1-resources.sh - Pods-SampleApp_1-resources.sh
- Pods-SampleApp_1-acknowledgements.plist - Pods-SampleApp_1-acknowledgements.plist
...@@ -21,7 +21,7 @@ File References: ...@@ -21,7 +21,7 @@ File References:
- Pods-SampleApp_1-dummy.m - Pods-SampleApp_1-dummy.m
- Pods-SampleApp_2: - Pods-SampleApp_2:
- Pods-SampleApp_2.xcconfig - Pods-SampleApp_2.xcconfig
- Pods-SampleApp_2-header.h - Pods-SampleApp_2-environment.h
- Pods-SampleApp_2-prefix.pch - Pods-SampleApp_2-prefix.pch
- Pods-SampleApp_2-resources.sh - Pods-SampleApp_2-resources.sh
- Pods-SampleApp_2-acknowledgements.plist - Pods-SampleApp_2-acknowledgements.plist
......
...@@ -43,7 +43,7 @@ Generating Pods project ...@@ -43,7 +43,7 @@ Generating Pods project
- Installing target `Pods-SampleApp_1` iOS 6.0 - Installing target `Pods-SampleApp_1` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods-SampleApp_1.xcconfig` - Generating xcconfig file at `Pods/Pods-SampleApp_1.xcconfig`
- Generating target header at `Pods/Pods-SampleApp_1-header.h` - Generating target environment header at `Pods/Pods-SampleApp_1-environment.h`
- Generating prefix header at `Pods/Pods-SampleApp_1-prefix.pch` - Generating prefix header at `Pods/Pods-SampleApp_1-prefix.pch`
- Generating copy resources script at `Pods/Pods-SampleApp_1-resources.sh` - Generating copy resources script at `Pods/Pods-SampleApp_1-resources.sh`
- Generating acknowledgements at `Pods/Pods-SampleApp_1-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-SampleApp_1-acknowledgements.plist`
...@@ -52,7 +52,7 @@ Generating Pods project ...@@ -52,7 +52,7 @@ Generating Pods project
- Installing target `Pods-SampleApp_2` iOS 6.0 - Installing target `Pods-SampleApp_2` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods-SampleApp_2.xcconfig` - Generating xcconfig file at `Pods/Pods-SampleApp_2.xcconfig`
- Generating target header at `Pods/Pods-SampleApp_2-header.h` - Generating target environment header at `Pods/Pods-SampleApp_2-environment.h`
- Generating prefix header at `Pods/Pods-SampleApp_2-prefix.pch` - Generating prefix header at `Pods/Pods-SampleApp_2-prefix.pch`
- Generating copy resources script at `Pods/Pods-SampleApp_2-resources.sh` - Generating copy resources script at `Pods/Pods-SampleApp_2-resources.sh`
- Generating acknowledgements at `Pods/Pods-SampleApp_2-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-SampleApp_2-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// PodTest
#define COCOAPODS_POD_AVAILABLE_PodTest TRUE
#define COCOAPODS_VERSION_MAJOR_PodTest 1
#define COCOAPODS_VERSION_MINOR_PodTest 0
#define COCOAPODS_VERSION_PATCH_PodTest 0
// PodTest/subspec_1
#define COCOAPODS_POD_AVAILABLE_PodTest_subspec_1 TRUE
#define COCOAPODS_VERSION_MAJOR_PodTest_subspec_1 1
#define COCOAPODS_VERSION_MINOR_PodTest_subspec_1 0
#define COCOAPODS_VERSION_PATCH_PodTest_subspec_1 0
// PodTest/subspec_2
#define COCOAPODS_POD_AVAILABLE_PodTest_subspec_2 TRUE
#define COCOAPODS_VERSION_MAJOR_PodTest_subspec_2 1
#define COCOAPODS_VERSION_MINOR_PodTest_subspec_2 0
#define COCOAPODS_VERSION_PATCH_PodTest_subspec_2 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_PodTest
#define __POD_PodTest_subspec_1
#define __POD_PodTest_subspec_2
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
...@@ -15,7 +15,7 @@ File References: ...@@ -15,7 +15,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
......
...@@ -31,7 +31,7 @@ Generating Pods project ...@@ -31,7 +31,7 @@ Generating Pods project
- Installing target `Pods` iOS 4.3 - Installing target `Pods` iOS 4.3
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
...@@ -12,7 +12,7 @@ File References: ...@@ -12,7 +12,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
......
...@@ -25,7 +25,7 @@ Generating Pods project ...@@ -25,7 +25,7 @@ Generating Pods project
- Installing target `Pods` iOS 4.3 - Installing target `Pods` iOS 4.3
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// JSONKit
#define COCOAPODS_POD_AVAILABLE_JSONKit TRUE
// This library does not follow semantic-versioning,
// so we were not able to define version macros.
// Please contact the author.
// Version: 1.5pre.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_JSONKit
#define __POD_Reachability
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-SampleApp_2-header.h" #import "Pods-SampleApp_2-environment.h"
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// JSONKit
#define COCOAPODS_POD_AVAILABLE_JSONKit TRUE
// This library does not follow semantic-versioning,
// so we were not able to define version macros.
// Please contact the author.
// Version: 1.5pre.
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_JSONKit
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-test-header.h" #import "Pods-test-environment.h"
...@@ -17,7 +17,7 @@ File References: ...@@ -17,7 +17,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
...@@ -25,7 +25,7 @@ File References: ...@@ -25,7 +25,7 @@ File References:
- Pods-dummy.m - Pods-dummy.m
- Pods-SampleApp_2: - Pods-SampleApp_2:
- Pods-SampleApp_2.xcconfig - Pods-SampleApp_2.xcconfig
- Pods-SampleApp_2-header.h - Pods-SampleApp_2-environment.h
- Pods-SampleApp_2-prefix.pch - Pods-SampleApp_2-prefix.pch
- Pods-SampleApp_2-resources.sh - Pods-SampleApp_2-resources.sh
- Pods-SampleApp_2-acknowledgements.plist - Pods-SampleApp_2-acknowledgements.plist
...@@ -33,7 +33,7 @@ File References: ...@@ -33,7 +33,7 @@ File References:
- Pods-SampleApp_2-dummy.m - Pods-SampleApp_2-dummy.m
- Pods-test: - Pods-test:
- Pods-test.xcconfig - Pods-test.xcconfig
- Pods-test-header.h - Pods-test-environment.h
- Pods-test-prefix.pch - Pods-test-prefix.pch
- Pods-test-resources.sh - Pods-test-resources.sh
- Pods-test-acknowledgements.plist - Pods-test-acknowledgements.plist
......
...@@ -61,7 +61,7 @@ Generating Pods project ...@@ -61,7 +61,7 @@ Generating Pods project
- Installing target `Pods` iOS 6.0 - Installing target `Pods` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
...@@ -70,7 +70,7 @@ Generating Pods project ...@@ -70,7 +70,7 @@ Generating Pods project
- Installing target `Pods-SampleApp_2` iOS 6.0 - Installing target `Pods-SampleApp_2` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods-SampleApp_2.xcconfig` - Generating xcconfig file at `Pods/Pods-SampleApp_2.xcconfig`
- Generating target header at `Pods/Pods-SampleApp_2-header.h` - Generating target environment header at `Pods/Pods-SampleApp_2-environment.h`
- Generating prefix header at `Pods/Pods-SampleApp_2-prefix.pch` - Generating prefix header at `Pods/Pods-SampleApp_2-prefix.pch`
- Generating copy resources script at `Pods/Pods-SampleApp_2-resources.sh` - Generating copy resources script at `Pods/Pods-SampleApp_2-resources.sh`
- Generating acknowledgements at `Pods/Pods-SampleApp_2-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-SampleApp_2-acknowledgements.plist`
...@@ -79,7 +79,7 @@ Generating Pods project ...@@ -79,7 +79,7 @@ Generating Pods project
- Installing target `Pods-test` iOS 6.0 - Installing target `Pods-test` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods-test.xcconfig` - Generating xcconfig file at `Pods/Pods-test.xcconfig`
- Generating target header at `Pods/Pods-test-header.h` - Generating target environment header at `Pods/Pods-test-environment.h`
- Generating prefix header at `Pods/Pods-test-prefix.pch` - Generating prefix header at `Pods/Pods-test-prefix.pch`
- Generating copy resources script at `Pods/Pods-test-resources.sh` - Generating copy resources script at `Pods/Pods-test-resources.sh`
- Generating acknowledgements at `Pods/Pods-test-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-test-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
...@@ -12,7 +12,7 @@ File References: ...@@ -12,7 +12,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
......
...@@ -40,7 +40,7 @@ Generating Pods project ...@@ -40,7 +40,7 @@ Generating Pods project
- Installing target `Pods` iOS 6.0 - Installing target `Pods` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
...@@ -12,7 +12,7 @@ File References: ...@@ -12,7 +12,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
......
...@@ -41,7 +41,7 @@ Generating Pods project ...@@ -41,7 +41,7 @@ Generating Pods project
- Installing target `Pods` iOS 6.0 - Installing target `Pods` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
...@@ -12,7 +12,7 @@ File References: ...@@ -12,7 +12,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
......
...@@ -43,7 +43,7 @@ Generating Pods project ...@@ -43,7 +43,7 @@ Generating Pods project
- Installing target `Pods` iOS 6.0 - Installing target `Pods` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
...@@ -12,7 +12,7 @@ File References: ...@@ -12,7 +12,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
......
...@@ -29,7 +29,7 @@ Generating Pods project ...@@ -29,7 +29,7 @@ Generating Pods project
- Installing target `Pods` iOS 6.0 - Installing target `Pods` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
...@@ -14,7 +14,7 @@ File References: ...@@ -14,7 +14,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
......
...@@ -44,7 +44,7 @@ Generating Pods project ...@@ -44,7 +44,7 @@ Generating Pods project
- Installing target `Pods` iOS 6.0 - Installing target `Pods` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// PodTest/subspec_2
#define COCOAPODS_POD_AVAILABLE_PodTest_subspec_2 TRUE
#define COCOAPODS_VERSION_MAJOR_PodTest_subspec_2 1
#define COCOAPODS_VERSION_MINOR_PodTest_subspec_2 0
#define COCOAPODS_VERSION_PATCH_PodTest_subspec_2 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_PodTest_subspec_2
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#endif #endif
#import "Pods-OS X App-header.h" #import "Pods-OS X App-environment.h"
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// PodTest/subspec_1
#define COCOAPODS_POD_AVAILABLE_PodTest_subspec_1 TRUE
#define COCOAPODS_VERSION_MAJOR_PodTest_subspec_1 1
#define COCOAPODS_VERSION_MINOR_PodTest_subspec_1 0
#define COCOAPODS_VERSION_PATCH_PodTest_subspec_1 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_PodTest_subspec_1
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-iOS App-header.h" #import "Pods-iOS App-environment.h"
...@@ -17,7 +17,7 @@ File References: ...@@ -17,7 +17,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods-OS X App: - Pods-OS X App:
- Pods-OS X App.xcconfig - Pods-OS X App.xcconfig
- Pods-OS X App-header.h - Pods-OS X App-environment.h
- Pods-OS X App-prefix.pch - Pods-OS X App-prefix.pch
- Pods-OS X App-resources.sh - Pods-OS X App-resources.sh
- Pods-OS X App-acknowledgements.plist - Pods-OS X App-acknowledgements.plist
...@@ -25,7 +25,7 @@ File References: ...@@ -25,7 +25,7 @@ File References:
- Pods-OS X App-dummy.m - Pods-OS X App-dummy.m
- Pods-iOS App: - Pods-iOS App:
- Pods-iOS App.xcconfig - Pods-iOS App.xcconfig
- Pods-iOS App-header.h - Pods-iOS App-environment.h
- Pods-iOS App-prefix.pch - Pods-iOS App-prefix.pch
- Pods-iOS App-resources.sh - Pods-iOS App-resources.sh
- Pods-iOS App-acknowledgements.plist - Pods-iOS App-acknowledgements.plist
......
...@@ -37,7 +37,7 @@ Generating Pods project ...@@ -37,7 +37,7 @@ Generating Pods project
- Installing target `Pods-OS X App` OS X 10.6 - Installing target `Pods-OS X App` OS X 10.6
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods-OS X App.xcconfig` - Generating xcconfig file at `Pods/Pods-OS X App.xcconfig`
- Generating target header at `Pods/Pods-OS X App-header.h` - Generating target environment header at `Pods/Pods-OS X App-environment.h`
- Generating prefix header at `Pods/Pods-OS X App-prefix.pch` - Generating prefix header at `Pods/Pods-OS X App-prefix.pch`
- Generating copy resources script at `Pods/Pods-OS X App-resources.sh` - Generating copy resources script at `Pods/Pods-OS X App-resources.sh`
- Generating acknowledgements at `Pods/Pods-OS X App-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-OS X App-acknowledgements.plist`
...@@ -46,7 +46,7 @@ Generating Pods project ...@@ -46,7 +46,7 @@ Generating Pods project
- Installing target `Pods-iOS App` iOS 4.3 - Installing target `Pods-iOS App` iOS 4.3
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods-iOS App.xcconfig` - Generating xcconfig file at `Pods/Pods-iOS App.xcconfig`
- Generating target header at `Pods/Pods-iOS App-header.h` - Generating target environment header at `Pods/Pods-iOS App-environment.h`
- Generating prefix header at `Pods/Pods-iOS App-prefix.pch` - Generating prefix header at `Pods/Pods-iOS App-prefix.pch`
- Generating copy resources script at `Pods/Pods-iOS App-resources.sh` - Generating copy resources script at `Pods/Pods-iOS App-resources.sh`
- Generating acknowledgements at `Pods/Pods-iOS App-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-iOS App-acknowledgements.plist`
......
// To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// Reachability
#define COCOAPODS_POD_AVAILABLE_Reachability TRUE
#define COCOAPODS_VERSION_MAJOR_Reachability 3
#define COCOAPODS_VERSION_MINOR_Reachability 1
#define COCOAPODS_VERSION_PATCH_Reachability 0
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_Reachability
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
...@@ -12,7 +12,7 @@ File References: ...@@ -12,7 +12,7 @@ File References:
- Targets Support Files: - Targets Support Files:
- Pods: - Pods:
- Pods.xcconfig - Pods.xcconfig
- Pods-header.h - Pods-environment.h
- Pods-prefix.pch - Pods-prefix.pch
- Pods-resources.sh - Pods-resources.sh
- Pods-acknowledgements.plist - Pods-acknowledgements.plist
......
...@@ -43,7 +43,7 @@ Generating Pods project ...@@ -43,7 +43,7 @@ Generating Pods project
- Installing target `Pods` iOS 6.0 - Installing target `Pods` iOS 6.0
- Adding Build files - Adding Build files
- Generating xcconfig file at `Pods/Pods.xcconfig` - Generating xcconfig file at `Pods/Pods.xcconfig`
- Generating target header at `Pods/Pods-header.h` - Generating target environment header at `Pods/Pods-environment.h`
- Generating prefix header at `Pods/Pods-prefix.pch` - Generating prefix header at `Pods/Pods-prefix.pch`
- Generating copy resources script at `Pods/Pods-resources.sh` - Generating copy resources script at `Pods/Pods-resources.sh`
- Generating acknowledgements at `Pods/Pods-acknowledgements.plist` - Generating acknowledgements at `Pods/Pods-acknowledgements.plist`
......
...@@ -7,14 +7,24 @@ describe Pod::Generator::TargetHeader do ...@@ -7,14 +7,24 @@ describe Pod::Generator::TargetHeader do
@gen = Pod::Generator::TargetHeader.new([specification]) @gen = Pod::Generator::TargetHeader.new([specification])
end end
it "generates a header files wihc include the CocoaPods definition" do it "generates a header files which include macro definitions for installed Pods" do
file = temporary_directory + 'PodsDummy.m' file = temporary_directory + 'Pods-environment.h'
@gen.save_as(file) @gen.save_as(file)
file.read.should == <<-EOS.strip_heredoc file.read.should == <<-EOS.strip_heredoc
// WARNING: This feature of CocoaPods is present for discussion purposes and might be discontinued or changed in future
#define __COCOA_PODS
#define __POD_BananaLib // To check if a library is compiled with CocoaPods you
// can use the `COCOAPODS` macro definition which is
// defined in the xcconfigs so it is available in
// headers also when they are imported in the client
// project.
// BananaLib
#define COCOAPODS_POD_AVAILABLE_BananaLib TRUE
#define COCOAPODS_VERSION_MAJOR_BananaLib 1
#define COCOAPODS_VERSION_MINOR_BananaLib 0
#define COCOAPODS_VERSION_PATCH_BananaLib 0
EOS EOS
end end
end end
......
...@@ -40,7 +40,7 @@ module Pod ...@@ -40,7 +40,7 @@ module Pod
"Pods-acknowledgements.markdown", "Pods-acknowledgements.markdown",
"Pods-acknowledgements.plist", "Pods-acknowledgements.plist",
"Pods-dummy.m", "Pods-dummy.m",
"Pods-header.h", "Pods-environment.h",
"Pods-prefix.pch", "Pods-prefix.pch",
"Pods-resources.sh", "Pods-resources.sh",
"Pods.xcconfig" "Pods.xcconfig"
...@@ -149,10 +149,12 @@ module Pod ...@@ -149,10 +149,12 @@ module Pod
it "creates a header for the target which contains the information about the installed Pods" do it "creates a header for the target which contains the information about the installed Pods" do
@installer.install! @installer.install!
file = config.sandbox.root + 'Pods-header.h' file = config.sandbox.root + 'Pods-environment.h'
contents = file.read contents = file.read
contents.should.include?('#define __COCOA_PODS') contents.should.include?('#define COCOAPODS_POD_AVAILABLE_BananaLib TRUE')
contents.should.include?('#define __POD_BananaLib') contents.should.include?('#define COCOAPODS_VERSION_MAJOR_BananaLib 1')
contents.should.include?('#define COCOAPODS_VERSION_MINOR_BananaLib 0')
contents.should.include?('#define COCOAPODS_VERSION_PATCH_BananaLib 0')
end end
it "creates a prefix header, including the contents of the specification's prefix header" do it "creates a prefix header, including the contents of the specification's prefix header" do
...@@ -165,7 +167,7 @@ module Pod ...@@ -165,7 +167,7 @@ module Pod
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#endif #endif
#import "Pods-header.h" #import "Pods-environment.h"
#import "BlocksKit.h" #import "BlocksKit.h"
#import <BananaTree/BananaTree.h> #import <BananaTree/BananaTree.h>
EOS EOS
......
...@@ -45,7 +45,7 @@ module Pod ...@@ -45,7 +45,7 @@ module Pod
end end
it "returns the absolute path of the target header file" do it "returns the absolute path of the target header file" do
@lib.target_header_path.to_s.should.include?('Pods/Pods-header.h') @lib.target_environment_header_path.to_s.should.include?('Pods/Pods-environment.h')
end end
it "returns the absolute path of the prefix header file" do it "returns the absolute path of the prefix header file" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment