New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make APPLICATION_EXTENSION_API_ONLY not break when performing a cached incremental install #9142
Merged
dnkoutso
merged 9 commits into
CocoaPods:1-8-stable
from
igor-makarov:api-extension-with-cache
Sep 9, 2019
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c319a90
make APPLICATION_EXTENSION_API_ONLY not break when performing a cache…
igor-makarov 6b98e85
properly copy :application_extension_api_only when merging pod targets
igor-makarov 89c2798
add specs for :application_extension_api_only in Analyzer
igor-makarov 4cd2dd6
remove specs that were testing code that was removed
igor-makarov 91d3ca7
add specs for :application_extension_api_only in BuildSettings
igor-makarov a791284
fix typo
igor-makarov 814cd03
make `Target#application_extension_api_only` a readonly prop
igor-makarov 484e803
Changelog entry
igor-makarov 759e92d
fix tests
igor-makarov File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require File.expand_path('../../../spec_helper', __FILE__) | ||
|
||
module Pod | ||
describe Installer::Analyzer do | ||
describe Installer::Analyzer do # rubocop:disable Metrics/BlockLength | ||
describe 'Analysis' do | ||
before do | ||
repos = [Source.new(fixture('spec-repos/test_repo')), TrunkSource.new(fixture('spec-repos/trunk'))] | ||
|
@@ -2029,6 +2029,149 @@ module Pod | |
analyzer.analyze | ||
end.message.should.match /Sample Extensions Project \(false\) and Today Extension \(true\) do not both set use_frameworks!\./ | ||
end | ||
|
||
describe 'APPLICATION_EXTENSION_API_ONLY' do | ||
it 'configures APPLICATION_EXTENSION_API_ONLY for app extension targets' do | ||
@podfile.use_frameworks! | ||
analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile) | ||
result = analyzer.analyze | ||
|
||
result.targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['Pods-Sample Extensions Project', false], ['Pods-Today Extension', true]] | ||
result.pod_targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['matryoshka-Bar', true], ['matryoshka-Bar-Foo', false], ['JSONKit', false], ['monkey', true]] | ||
end | ||
|
||
it 'configures APPLICATION_EXTENSION_API_ONLY for watch app extension targets' do | ||
@user_project = Xcodeproj::Project.open(SpecHelper.create_sample_app_copy_from_fixture('Sample Extensions Project')) | ||
targets = @user_project.targets | ||
targets.delete(targets.find('Sample Extensions Project').first) | ||
extension_target = targets.find('Today Extension').first | ||
extension_target.product_type = 'com.apple.product-type.watchkit2-extension' | ||
extension_target.name = 'watchOS Extension Target' | ||
extension_target.symbol_type.should == :watch2_extension | ||
@user_project.save | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this actually leave the file system dirty after this test runs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't - this is a temp copy ( |
||
project_path = @user_project.path | ||
@podfile = Pod::Podfile.new do | ||
source SpecHelper.test_repo_url | ||
platform :watchos, '2.0' | ||
project project_path | ||
|
||
target 'watchOS Extension Target' do | ||
use_frameworks! | ||
pod 'monkey' | ||
end | ||
end | ||
|
||
@podfile.use_frameworks! | ||
analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile) | ||
result = analyzer.analyze | ||
|
||
result.targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['Pods-watchOS Extension Target', true]] | ||
result.pod_targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['monkey', true]] | ||
end | ||
|
||
it 'configures APPLICATION_EXTENSION_API_ONLY for TV app extension targets' do | ||
@user_project = Xcodeproj::Project.open(SpecHelper.create_sample_app_copy_from_fixture('Sample Extensions Project')) | ||
targets = @user_project.targets | ||
targets.delete(targets.find('Sample Extensions Project').first) | ||
extension_target = targets.find('Today Extension').first | ||
extension_target.product_type = 'com.apple.product-type.tv-app-extension' | ||
extension_target.name = 'tvOS Extension Target' | ||
extension_target.symbol_type.should == :tv_extension | ||
@user_project.save | ||
project_path = @user_project.path | ||
@podfile = Pod::Podfile.new do | ||
source SpecHelper.test_repo_url | ||
platform :tvos, '9.0' | ||
project project_path | ||
|
||
target 'tvOS Extension Target' do | ||
use_frameworks! | ||
pod 'monkey' | ||
end | ||
end | ||
|
||
@podfile.use_frameworks! | ||
analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile) | ||
result = analyzer.analyze | ||
|
||
result.targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['Pods-tvOS Extension Target', true]] | ||
result.pod_targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['monkey', true]] | ||
end | ||
|
||
it 'configures APPLICATION_EXTENSION_API_ONLY for messages extension targets' do | ||
@user_project = Xcodeproj::Project.open(SpecHelper.create_sample_app_copy_from_fixture('Sample Extensions Project')) | ||
targets = @user_project.targets | ||
app_target = targets.find { |t| t.name == 'Sample Extensions Project' } | ||
app_target.product_type = 'com.apple.product-type.application.messages' | ||
extension_target = targets.find { |t| t.name == 'Today Extension' } | ||
extension_target.product_type = 'com.apple.product-type.app-extension.messages' | ||
extension_target.name = 'Messages Extension Target' | ||
extension_target.symbol_type.should == :messages_extension | ||
@user_project.save | ||
project_path = @user_project.path | ||
@podfile = Pod::Podfile.new do | ||
source SpecHelper.test_repo_url | ||
platform :ios, '8.0' | ||
project project_path | ||
|
||
target 'Sample Extensions Project' do | ||
pod 'JSONKit', '1.4' | ||
end | ||
|
||
target 'Messages Extension Target' do | ||
use_frameworks! | ||
pod 'monkey' | ||
end | ||
end | ||
|
||
@podfile.use_frameworks! | ||
analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile) | ||
result = analyzer.analyze | ||
|
||
result.targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['Pods-Sample Extensions Project', false], ['Pods-Messages Extension Target', true]] | ||
result.pod_targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['JSONKit', false], ['monkey', true]] | ||
end | ||
|
||
it 'configures APPLICATION_EXTENSION_API_ONLY when build setting is set in user target' do | ||
@user_project = Xcodeproj::Project.open(SpecHelper.create_sample_app_copy_from_fixture('Sample Extensions Project')) | ||
targets = @user_project.targets | ||
app_target = targets.find { |t| t.name == 'Sample Extensions Project' } | ||
app_target.build_configurations.each { |c| c.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES' } | ||
@user_project.save | ||
project_path = @user_project.path | ||
@podfile = Pod::Podfile.new do | ||
source SpecHelper.test_repo_url | ||
platform :ios, '8.0' | ||
project project_path | ||
|
||
target 'Sample Extensions Project' do | ||
pod 'JSONKit', '1.4' | ||
end | ||
|
||
target 'Today Extension' do | ||
use_frameworks! | ||
pod 'monkey' | ||
end | ||
end | ||
|
||
@podfile.use_frameworks! | ||
analyzer = Pod::Installer::Analyzer.new(config.sandbox, @podfile) | ||
result = analyzer.analyze | ||
|
||
result.targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['Pods-Sample Extensions Project', true], ['Pods-Today Extension', true]] | ||
result.pod_targets.map { |t| [t.name, t.application_extension_api_only] }. | ||
should == [['JSONKit', true], ['monkey', true]] | ||
end | ||
end | ||
end | ||
|
||
#-------------------------------------------------------------------------# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the logic for determining
is_app_extension
live insideAggregateTarget
. It looks like you're only using properties offaggregate_target
. This allows you to removemark_application_extension_api_only
which is kinda ugly and get rid of the defaultfalse
value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the logic for
is_app_extension
can be put in AggregateTarget,mark_application_extension_api_only
cannot be done away with - PodTarget also needs to be marked and it has no idea who its parent is.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah bummer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a chat with @segiddins about it and it makes sense for the Analyzer to be the single one responsible for this weird flag.