Commit 740dfc73 authored by Swizzlr's avatar Swizzlr Committed by Fabio Pelosin

Fix dtrace and inhibit_all_warnings!

Squash of https://github.com/CocoaPods/CocoaPods/issues/1510
parent 525180c8
...@@ -50,6 +50,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -50,6 +50,10 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
[Joshua Kalpin](https://github.com/Kapin) [Joshua Kalpin](https://github.com/Kapin)
[#1567](https://github.com/CocoaPods/CocoaPods/pull/1567) [#1567](https://github.com/CocoaPods/CocoaPods/pull/1567)
* Dtrace files are now properly left unflagged when installing, regardless of configuration
[Swizzlr](https://github.com/swizzlr)
[#1560](https://github.com/CocoaPods/CocoaPods/pull/1560)
## 0.27.1 ## 0.27.1
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.26.2...0.27.1) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.26.2...0.27.1)
......
...@@ -39,9 +39,12 @@ module Pod ...@@ -39,9 +39,12 @@ module Pod
library.file_accessors.each do |file_accessor| library.file_accessors.each do |file_accessor|
consumer = file_accessor.spec_consumer consumer = file_accessor.spec_consumer
flags = compiler_flags_for_consumer(consumer) flags = compiler_flags_for_consumer(consumer)
source_files = file_accessor.source_files all_source_files = file_accessor.source_files
file_refs = source_files.map { |sf| project.reference_for_path(sf) } regular_source_files = all_source_files.reject { |sf| sf.extname == ".d" }
target.add_file_references(file_refs, flags) regular_file_refs = regular_source_files.map { |sf| project.reference_for_path(sf) }
target.add_file_references(regular_file_refs, flags)
other_file_refs = (all_source_files - regular_source_files).map { |sf| project.reference_for_path(sf) }
target.add_file_references(other_file_refs, nil)
end end
end end
end end
......
...@@ -42,7 +42,8 @@ module Pod ...@@ -42,7 +42,8 @@ module Pod
source_files.should == [ source_files.should == [
"Classes/Banana.h", "Classes/Banana.h",
"Classes/Banana.m", "Classes/Banana.m",
"Classes/BananaPrivate.h" "Classes/BananaPrivate.h",
"Classes/BananaTrace.d"
] ]
end end
......
...@@ -147,76 +147,91 @@ module Pod ...@@ -147,76 +147,91 @@ module Pod
dummy = config.sandbox.root + 'Pods-BananaLib-dummy.m' dummy = config.sandbox.root + 'Pods-BananaLib-dummy.m'
dummy.read.should.include?('@interface PodsDummy_Pods') dummy.read.should.include?('@interface PodsDummy_Pods')
end end
#--------------------------------------------------------------------------------# #--------------------------------------------------------------------------------#
describe "concerning compiler flags" do
describe "concerning ARC before and after iOS 6.0 and OS X 10.8" do before do
before do @spec = Pod::Spec.new
@spec = Pod::Spec.new end
end
it "flags should not be added to dtrace files" do
it "does not do anything if ARC is *not* required" do @installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@spec.requires_arc = false @installer.install!
@spec.ios.deployment_target = '5'
@spec.osx.deployment_target = '10.6' dtrace_files = @installer.library.target.source_build_phase.files.reject {|sf|
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) !(File.extname(sf.file_ref.path) == '.d')
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx)) }
ios_flags.should.not.include '-DOS_OBJECT_USE_OBJC' dtrace_files.each do |dt|
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC' dt.settings.should.be.nil
end end
end
it "does *not* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and has a deployment target of >= iOS 6.0 or OS X 10.8" do
@spec.requires_arc = false it "adds -w per pod if target definition inhibits warnings for that pod" do
@spec.ios.deployment_target = '6' @installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@spec.osx.deployment_target = '10.8' flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx)) flags.should.include?('-w')
ios_flags.should.not.include '-DOS_OBJECT_USE_OBJC' end
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
end it "doesn't inhibit warnings by default" do
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required but has a deployment target < iOS 6.0 or OS X 10.8" do flags.should.not.include?('-w')
@spec.requires_arc = true end
@spec.ios.deployment_target = '5.1'
@spec.osx.deployment_target = '10.7.2' it "adds -Xanalyzer -analyzer-disable-checker per pod" do
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) @installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx)) flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
ios_flags.should.include '-DOS_OBJECT_USE_OBJC'
osx_flags.should.include '-DOS_OBJECT_USE_OBJC' flags.should.include?('-Xanalyzer -analyzer-disable-checker')
end end
it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and *no* deployment target is specified" do it "doesn't inhibit analyzer warnings by default" do
@spec.requires_arc = true flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) flags.should.not.include?('-Xanalyzer -analyzer-disable-checker')
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx)) end
ios_flags.should.include '-DOS_OBJECT_USE_OBJC'
osx_flags.should.include '-DOS_OBJECT_USE_OBJC' describe "concerning ARC before and after iOS 6.0 and OS X 10.8" do
end
it "does not do anything if ARC is *not* required" do
it "adds -w per pod if target definition inhibits warnings for that pod" do @spec.requires_arc = false
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true) @spec.ios.deployment_target = '5'
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) @spec.osx.deployment_target = '10.6'
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.include?('-w') osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx))
end ios_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
it "doesn't inhibit warnings by default" do end
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.not.include?('-w') it "does *not* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and has a deployment target of >= iOS 6.0 or OS X 10.8" do
end @spec.requires_arc = false
@spec.ios.deployment_target = '6'
it "adds -Xanalyzer -analyzer-disable-checker per pod" do @spec.osx.deployment_target = '10.8'
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true) ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx))
ios_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
flags.should.include?('-Xanalyzer -analyzer-disable-checker') osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
end end
it "doesn't inhibit analyzer warnings by default" do it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required but has a deployment target < iOS 6.0 or OS X 10.8" do
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios)) @spec.requires_arc = true
flags.should.not.include?('-Xanalyzer -analyzer-disable-checker') @spec.ios.deployment_target = '5.1'
end @spec.osx.deployment_target = '10.7.2'
end ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx))
ios_flags.should.include '-DOS_OBJECT_USE_OBJC'
osx_flags.should.include '-DOS_OBJECT_USE_OBJC'
end
it "*does* disable the `OS_OBJECT_USE_OBJC` flag if ARC is required and *no* deployment target is specified" do
@spec.requires_arc = true
ios_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
osx_flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:osx))
ios_flags.should.include '-DOS_OBJECT_USE_OBJC'
osx_flags.should.include '-DOS_OBJECT_USE_OBJC'
end
end
end
end end
end end
end end
...@@ -48,7 +48,8 @@ module Pod ...@@ -48,7 +48,8 @@ module Pod
@accessor.source_files.sort.should == [ @accessor.source_files.sort.should == [
@root + "Classes/Banana.h", @root + "Classes/Banana.h",
@root + "Classes/Banana.m", @root + "Classes/Banana.m",
@root + "Classes/BananaPrivate.h" @root + "Classes/BananaPrivate.h",
@root + "Classes/BananaTrace.d"
] ]
end end
...@@ -148,6 +149,7 @@ module Pod ...@@ -148,6 +149,7 @@ module Pod
@accessor.source_files.sort.should == [ @accessor.source_files.sort.should == [
@root + "Classes/Banana.h", @root + "Classes/Banana.h",
@root + "Classes/Banana.m", @root + "Classes/Banana.m",
@root + "Classes/BananaTrace.d"
] ]
end end
...@@ -160,7 +162,7 @@ module Pod ...@@ -160,7 +162,7 @@ module Pod
describe "#paths_for_attribute" do describe "#paths_for_attribute" do
it "takes into account dir patterns and excluded files" do it "takes into account dir patterns and excluded files" do
file_patterns = ["Classes/*.{h,m}", "Vendor"] file_patterns = ["Classes/*.{h,m,d}", "Vendor"]
options = { options = {
:exclude_patterns => ["Classes/**/osx/**/*", "Resources/**/osx/**/*"], :exclude_patterns => ["Classes/**/osx/**/*", "Resources/**/osx/**/*"],
:dir_pattern => "*.{h,hpp,hh,m,mm,c,cpp}", :dir_pattern => "*.{h,hpp,hh,m,mm,c,cpp}",
......
...@@ -20,6 +20,7 @@ module Pod ...@@ -20,6 +20,7 @@ module Pod
Classes/Banana.m Classes/Banana.m
Classes/BananaLib.pch Classes/BananaLib.pch
Classes/BananaPrivate.h Classes/BananaPrivate.h
Classes/BananaTrace.d
README README
Resources/logo-sidebar.png Resources/logo-sidebar.png
Resources/sub_dir/logo-sidebar.png Resources/sub_dir/logo-sidebar.png
...@@ -104,6 +105,7 @@ module Pod ...@@ -104,6 +105,7 @@ module Pod
paths.sort.should == %w[ paths.sort.should == %w[
Classes/Banana.h Classes/Banana.h
Classes/BananaLib.pch Classes/BananaLib.pch
Classes/BananaTrace.d
] ]
end end
......
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