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
[Joshua Kalpin](https://github.com/Kapin)
[#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
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.26.2...0.27.1)
......
......@@ -39,9 +39,12 @@ module Pod
library.file_accessors.each do |file_accessor|
consumer = file_accessor.spec_consumer
flags = compiler_flags_for_consumer(consumer)
source_files = file_accessor.source_files
file_refs = source_files.map { |sf| project.reference_for_path(sf) }
target.add_file_references(file_refs, flags)
all_source_files = file_accessor.source_files
regular_source_files = all_source_files.reject { |sf| sf.extname == ".d" }
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
......
......@@ -42,7 +42,8 @@ module Pod
source_files.should == [
"Classes/Banana.h",
"Classes/Banana.m",
"Classes/BananaPrivate.h"
"Classes/BananaPrivate.h",
"Classes/BananaTrace.d"
]
end
......
......@@ -147,76 +147,91 @@ module Pod
dummy = config.sandbox.root + 'Pods-BananaLib-dummy.m'
dummy.read.should.include?('@interface PodsDummy_Pods')
end
#--------------------------------------------------------------------------------#
describe "concerning ARC before and after iOS 6.0 and OS X 10.8" do
before do
@spec = Pod::Spec.new
end
it "does not do anything if ARC is *not* required" do
@spec.requires_arc = false
@spec.ios.deployment_target = '5'
@spec.osx.deployment_target = '10.6'
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'
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
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
@spec.ios.deployment_target = '6'
@spec.osx.deployment_target = '10.8'
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'
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
end
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
@spec.requires_arc = true
@spec.ios.deployment_target = '5.1'
@spec.osx.deployment_target = '10.7.2'
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
it "adds -w per pod if target definition inhibits warnings for that pod" do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.include?('-w')
end
it "doesn't inhibit warnings by default" do
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.not.include?('-w')
end
it "adds -Xanalyzer -analyzer-disable-checker per pod" do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.include?('-Xanalyzer -analyzer-disable-checker')
end
it "doesn't inhibit analyzer warnings by default" do
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.not.include?('-Xanalyzer -analyzer-disable-checker')
end
end
describe "concerning compiler flags" do
before do
@spec = Pod::Spec.new
end
it "flags should not be added to dtrace files" do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
@installer.install!
dtrace_files = @installer.library.target.source_build_phase.files.reject {|sf|
!(File.extname(sf.file_ref.path) == '.d')
}
dtrace_files.each do |dt|
dt.settings.should.be.nil
end
end
it "adds -w per pod if target definition inhibits warnings for that pod" do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.include?('-w')
end
it "doesn't inhibit warnings by default" do
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.not.include?('-w')
end
it "adds -Xanalyzer -analyzer-disable-checker per pod" do
@installer.library.target_definition.stubs(:inhibits_warnings_for_pod?).returns(true)
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.include?('-Xanalyzer -analyzer-disable-checker')
end
it "doesn't inhibit analyzer warnings by default" do
flags = @installer.send(:compiler_flags_for_consumer, @spec.consumer(:ios))
flags.should.not.include?('-Xanalyzer -analyzer-disable-checker')
end
describe "concerning ARC before and after iOS 6.0 and OS X 10.8" do
it "does not do anything if ARC is *not* required" do
@spec.requires_arc = false
@spec.ios.deployment_target = '5'
@spec.osx.deployment_target = '10.6'
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'
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
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
@spec.ios.deployment_target = '6'
@spec.osx.deployment_target = '10.8'
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'
osx_flags.should.not.include '-DOS_OBJECT_USE_OBJC'
end
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
@spec.requires_arc = true
@spec.ios.deployment_target = '5.1'
@spec.osx.deployment_target = '10.7.2'
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
......@@ -48,7 +48,8 @@ module Pod
@accessor.source_files.sort.should == [
@root + "Classes/Banana.h",
@root + "Classes/Banana.m",
@root + "Classes/BananaPrivate.h"
@root + "Classes/BananaPrivate.h",
@root + "Classes/BananaTrace.d"
]
end
......@@ -148,6 +149,7 @@ module Pod
@accessor.source_files.sort.should == [
@root + "Classes/Banana.h",
@root + "Classes/Banana.m",
@root + "Classes/BananaTrace.d"
]
end
......@@ -160,7 +162,7 @@ module Pod
describe "#paths_for_attribute" 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 = {
:exclude_patterns => ["Classes/**/osx/**/*", "Resources/**/osx/**/*"],
:dir_pattern => "*.{h,hpp,hh,m,mm,c,cpp}",
......
......@@ -20,6 +20,7 @@ module Pod
Classes/Banana.m
Classes/BananaLib.pch
Classes/BananaPrivate.h
Classes/BananaTrace.d
README
Resources/logo-sidebar.png
Resources/sub_dir/logo-sidebar.png
......@@ -104,6 +105,7 @@ module Pod
paths.sort.should == %w[
Classes/Banana.h
Classes/BananaLib.pch
Classes/BananaTrace.d
]
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