From a063b2f757effe30b38afe59057f276d1cecbf42 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Sun, 24 Sep 2017 15:44:47 -0700 Subject: [PATCH 1/4] Update commments/docs to indicate :skip will skip pch generation --- CHANGELOG.md | 4 +++- lib/cocoapods-core/specification/dsl.rb | 8 ++++++-- spec/specification/dsl_spec.rb | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91f60b53c..c22434ce2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ ##### Enhancements -* None. +* Update commments/docs to indicate :skip will skip pch generation + [Paul Beusterien](https://github.com/paulb777) + [#412](https://github.com/CocoaPods/Core/pull/412) ##### Bug Fixes diff --git a/lib/cocoapods-core/specification/dsl.rb b/lib/cocoapods-core/specification/dsl.rb index fafb0988c..a0a2b65e9 100644 --- a/lib/cocoapods-core/specification/dsl.rb +++ b/lib/cocoapods-core/specification/dsl.rb @@ -855,15 +855,19 @@ def dependency(*args) # # A path to a prefix header file to inject in the prefix header of the # pod project. + # ':skip' indicates that the default CocoaPods prefix header should not + # be generated. # # --- # - # This attribute is __not recommended__ as Pods should not pollute the - # prefix header of other libraries or of the user project. + # The file path options is __not recommended__ as Pods should not + # pollute the prefix header of other libraries or of the user project. + # # # @example # # spec.prefix_header_file = 'iphone/include/prefix.pch' + # spec.prefix_header_file = ':skip' # # @param [String] path # The path to the prefix header file. diff --git a/spec/specification/dsl_spec.rb b/spec/specification/dsl_spec.rb index eb70fa30d..1e65198bf 100644 --- a/spec/specification/dsl_spec.rb +++ b/spec/specification/dsl_spec.rb @@ -269,6 +269,11 @@ module Pod @spec.attributes_hash['prefix_header_file'].should == 'iphone/include/prefix.pch' end + it 'allows to skip prefix header file generation' do + @spec.prefix_header_file = ':skip' + @spec.attributes_hash['prefix_header_file'].should == ':skip' + end + it 'allows to specify a directory to use for the headers' do @spec.header_dir = 'Three20Core' @spec.attributes_hash['header_dir'].should == 'Three20Core' From 5f1dcc50603d3e977a72d86ae307e29dd7d59250 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Sun, 24 Sep 2017 18:06:52 -0700 Subject: [PATCH 2/4] Use boolean for disable prefix_header_file flag --- CHANGELOG.md | 2 +- lib/cocoapods-core/specification/dsl.rb | 13 +++++++++---- .../specification/root_attribute_accessors.rb | 6 ++++++ spec/specification/dsl_spec.rb | 4 ++-- spec/specification/root_attribute_accessors_spec.rb | 5 +++++ 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c22434ce2..55c3b453a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ##### Enhancements -* Update commments/docs to indicate :skip will skip pch generation +* Update commments/docs to indicate prefix_header=false will skip pch generation [Paul Beusterien](https://github.com/paulb777) [#412](https://github.com/CocoaPods/Core/pull/412) diff --git a/lib/cocoapods-core/specification/dsl.rb b/lib/cocoapods-core/specification/dsl.rb index a0a2b65e9..a1e6db4fb 100644 --- a/lib/cocoapods-core/specification/dsl.rb +++ b/lib/cocoapods-core/specification/dsl.rb @@ -855,7 +855,7 @@ def dependency(*args) # # A path to a prefix header file to inject in the prefix header of the # pod project. - # ':skip' indicates that the default CocoaPods prefix header should not + # false indicates that the default CocoaPods prefix header should not # be generated. # # --- @@ -867,12 +867,17 @@ def dependency(*args) # @example # # spec.prefix_header_file = 'iphone/include/prefix.pch' - # spec.prefix_header_file = ':skip' # - # @param [String] path - # The path to the prefix header file. + # @example + # + # spec.prefix_header_file = false + # + # @param [Bool, String] path + # The path to the prefix header file or whether to disable + # prefix_header generation. # attribute :prefix_header_file, + :types => [TrueClass, FalseClass, String], :inherited => true #------------------# diff --git a/lib/cocoapods-core/specification/root_attribute_accessors.rb b/lib/cocoapods-core/specification/root_attribute_accessors.rb index 8bbf28735..2e16d18c3 100644 --- a/lib/cocoapods-core/specification/root_attribute_accessors.rb +++ b/lib/cocoapods-core/specification/root_attribute_accessors.rb @@ -25,6 +25,12 @@ def requires_arc attributes_hash['requires_arc'] end + # @return [Bool, String] The prefix_header_file value. + # + def prefix_header_file + attributes_hash['prefix_header_file'] + end + # @return [Version] The version of the Pod. # # @todo The version is memoized because the Resolvers sets the head diff --git a/spec/specification/dsl_spec.rb b/spec/specification/dsl_spec.rb index 1e65198bf..5060ab22a 100644 --- a/spec/specification/dsl_spec.rb +++ b/spec/specification/dsl_spec.rb @@ -270,8 +270,8 @@ module Pod end it 'allows to skip prefix header file generation' do - @spec.prefix_header_file = ':skip' - @spec.attributes_hash['prefix_header_file'].should == ':skip' + @spec.prefix_header_file = false + @spec.attributes_hash['prefix_header_file'].should == false end it 'allows to specify a directory to use for the headers' do diff --git a/spec/specification/root_attribute_accessors_spec.rb b/spec/specification/root_attribute_accessors_spec.rb index f5fa2555b..5afc7a1cd 100644 --- a/spec/specification/root_attribute_accessors_spec.rb +++ b/spec/specification/root_attribute_accessors_spec.rb @@ -7,6 +7,7 @@ module Pod s.name = 'Pod' s.version = '1.0' s.requires_arc = true + s.prefix_header_file = false s.subspec 'Subspec' do end end @@ -178,5 +179,9 @@ module Pod it 'returns the correct requires_arc value, if specified' do @spec.requires_arc.should == true end + + it 'returns the correct prefix_headers value, if specified' do + @spec.prefix_header_file.should == false + end end end From 6b7312a3650b247453a26c80a4226ac6af861528 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Mon, 25 Sep 2017 08:09:16 -0700 Subject: [PATCH 3/4] move getter to specification.rb per review --- lib/cocoapods-core/specification.rb | 6 ++++++ .../specification/root_attribute_accessors.rb | 6 ------ spec/specification/root_attribute_accessors_spec.rb | 5 ----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/cocoapods-core/specification.rb b/lib/cocoapods-core/specification.rb index bc4173779..0b264d294 100644 --- a/lib/cocoapods-core/specification.rb +++ b/lib/cocoapods-core/specification.rb @@ -346,6 +346,12 @@ def consumer(platform) @consumers[platform] ||= Consumer.new(self, platform) end + # @return [Bool, String] The prefix_header_file value. + # + def prefix_header_file + attributes_hash['prefix_header_file'] + end + #-------------------------------------------------------------------------# public diff --git a/lib/cocoapods-core/specification/root_attribute_accessors.rb b/lib/cocoapods-core/specification/root_attribute_accessors.rb index 2e16d18c3..8bbf28735 100644 --- a/lib/cocoapods-core/specification/root_attribute_accessors.rb +++ b/lib/cocoapods-core/specification/root_attribute_accessors.rb @@ -25,12 +25,6 @@ def requires_arc attributes_hash['requires_arc'] end - # @return [Bool, String] The prefix_header_file value. - # - def prefix_header_file - attributes_hash['prefix_header_file'] - end - # @return [Version] The version of the Pod. # # @todo The version is memoized because the Resolvers sets the head diff --git a/spec/specification/root_attribute_accessors_spec.rb b/spec/specification/root_attribute_accessors_spec.rb index 5afc7a1cd..f5fa2555b 100644 --- a/spec/specification/root_attribute_accessors_spec.rb +++ b/spec/specification/root_attribute_accessors_spec.rb @@ -7,7 +7,6 @@ module Pod s.name = 'Pod' s.version = '1.0' s.requires_arc = true - s.prefix_header_file = false s.subspec 'Subspec' do end end @@ -179,9 +178,5 @@ module Pod it 'returns the correct requires_arc value, if specified' do @spec.requires_arc.should == true end - - it 'returns the correct prefix_headers value, if specified' do - @spec.prefix_header_file.should == false - end end end From 37b3a48e8b125c318f4c49ca2430cd51f9b632ea Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Mon, 25 Sep 2017 11:26:15 -0700 Subject: [PATCH 4/4] Add true to docs --- lib/cocoapods-core/specification/dsl.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/cocoapods-core/specification/dsl.rb b/lib/cocoapods-core/specification/dsl.rb index a1e6db4fb..8af5bdb6b 100644 --- a/lib/cocoapods-core/specification/dsl.rb +++ b/lib/cocoapods-core/specification/dsl.rb @@ -855,8 +855,10 @@ def dependency(*args) # # A path to a prefix header file to inject in the prefix header of the # pod project. - # false indicates that the default CocoaPods prefix header should not + # `false` indicates that the default CocoaPods prefix header should not # be generated. + # `true` is the default and indicates that the default CocoaPods prefix + # header should be generated. # # --- #