Skip to content

Commit d95da61

Browse files
committed
Support driver in cocoapods integration
1 parent afa0236 commit d95da61

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ def self.enable_xcremotecache(
123123
exclude_build_configurations,
124124
final_target,
125125
fake_src_root,
126-
exclude_sdks_configurations
126+
exclude_sdks_configurations,
127+
enable_swift_driver_integration
127128
)
128129
srcroot_relative_xc_location = parent_dir(xc_location, repo_distance)
129130
# location of the entrite CocoaPods project, relative to SRCROOT
@@ -137,14 +138,15 @@ def self.enable_xcremotecache(
137138
elsif mode == 'producer' || mode == 'producer-fast'
138139
config.build_settings.delete('CC') if config.build_settings.key?('CC')
139140
end
140-
reset_build_setting(config.build_settings, 'SWIFT_EXEC', "$SRCROOT/#{srcroot_relative_xc_location}/xcswiftc", exclude_sdks_configurations)
141+
swiftc_name = enable_swift_driver_integration ? 'swiftc' : 'xcswiftc'
142+
reset_build_setting(config.build_settings, 'SWIFT_EXEC', "$SRCROOT/#{srcroot_relative_xc_location}/#{swiftc_name}", exclude_sdks_configurations)
141143
reset_build_setting(config.build_settings, 'LIBTOOL', "$SRCROOT/#{srcroot_relative_xc_location}/xclibtool", exclude_sdks_configurations)
142144
# Setting LIBTOOL to '' breaks SwiftDriver intengration so resetting it to the original value 'libtool' for all excluded configurations
143145
add_build_setting_for_sdks(config.build_settings, 'LIBTOOL', 'libtool', exclude_sdks_configurations)
144146
reset_build_setting(config.build_settings, 'LD', "$SRCROOT/#{srcroot_relative_xc_location}/xcld", exclude_sdks_configurations)
145147
reset_build_setting(config.build_settings, 'LDPLUSPLUS', "$SRCROOT/#{srcroot_relative_xc_location}/xcldplusplus", exclude_sdks_configurations)
146148
reset_build_setting(config.build_settings, 'LIPO', "$SRCROOT/#{srcroot_relative_xc_location}/xclipo", exclude_sdks_configurations)
147-
reset_build_setting(config.build_settings, 'SWIFT_USE_INTEGRATED_DRIVER', 'NO', exclude_sdks_configurations)
149+
reset_build_setting(config.build_settings, 'SWIFT_USE_INTEGRATED_DRIVER', 'NO', exclude_sdks_configurations) unless enable_swift_driver_integration
148150

149151
reset_build_setting(config.build_settings, 'XCREMOTE_CACHE_FAKE_SRCROOT', fake_src_root, exclude_sdks_configurations)
150152
reset_build_setting(config.build_settings, 'XCRC_PLATFORM_PREFERRED_ARCH', "$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(PLATFORM_PREFERRED_ARCH):dir:standardizepath:file:default=arm64)", exclude_sdks_configurations)
@@ -498,6 +500,7 @@ def self.save_lldbinit_rewrite(user_proj_directory,fake_src_root)
498500
check_platform = @@configuration['check_platform']
499501
fake_src_root = @@configuration['fake_src_root']
500502
exclude_sdks_configurations = @@configuration['exclude_sdks_configurations'] || []
503+
enable_swift_driver_integration = @@configuration['enable_swift_driver_integration'] || false
501504

502505
xccc_location_absolute = "#{user_proj_directory}/#{xccc_location}"
503506
xcrc_location_absolute = "#{user_proj_directory}/#{xcrc_location}"
@@ -521,7 +524,7 @@ def self.save_lldbinit_rewrite(user_proj_directory,fake_src_root)
521524
next if target.name.start_with?("Pods-")
522525
next if target.name.end_with?("Tests")
523526
next if exclude_targets.include?(target.name)
524-
enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations)
527+
enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations, enable_swift_driver_integration)
525528
end
526529

527530
# Create .rcinfo into `Pods` directory as that .xcodeproj reads configuration from .xcodeproj location
@@ -534,7 +537,7 @@ def self.save_lldbinit_rewrite(user_proj_directory,fake_src_root)
534537
next if target.source_build_phase.files_references.empty?
535538
next if target.name.end_with?("Tests")
536539
next if exclude_targets.include?(target.name)
537-
enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations)
540+
enable_xcremotecache(target, 1, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations, enable_swift_driver_integration)
538541
end
539542
generated_project.save()
540543
end
@@ -575,7 +578,7 @@ def self.save_lldbinit_rewrite(user_proj_directory,fake_src_root)
575578
# Attach XCRC to the app targets
576579
user_project.targets.each do |target|
577580
next if exclude_targets.include?(target.name)
578-
enable_xcremotecache(target, 0, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations)
581+
enable_xcremotecache(target, 0, xcrc_location, xccc_location, mode, exclude_build_configurations, final_target,fake_src_root, exclude_sdks_configurations, enable_swift_driver_integration)
579582
end
580583

581584
# Set Target sourcemap

cocoapods-plugin/lib/cocoapods-xcremotecache/gem_version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414

1515
module CocoapodsXcremotecache
16-
VERSION = "0.0.16"
16+
VERSION = "0.0.17"
1717
end

tasks/e2e.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
'primary_branch' => GIT_BRANCH,
2626
'mode' => 'consumer',
2727
'final_target' => 'XCRemoteCacheSample',
28-
'artifact_maximum_age' => 0
28+
'artifact_maximum_age' => 0,
29+
'enable_swift_driver_integration' => true
2930
}.freeze
3031
DEFAULT_EXPECTATIONS = {
3132
'misses' => 0,

0 commit comments

Comments
 (0)