Closed Machipla closed 5 years ago
Hi there 😄
We're using CocoaPods version 1.5.3 and using this pod as a static library. The compiler complains when building, outputs:
1.5.3
"#import "Nimble_Snapshots/Nimble_Snapshots-Swift.h cannot be found in XCTestObservationCenter+CurrentTestCaseTracker.m"
#import "Nimble_Snapshots/Nimble_Snapshots-Swift.h
XCTestObservationCenter+CurrentTestCaseTracker.m
Looking around, I saw that Quick has some similar problems with that: https://github.com/Quick/Quick/issues/780 And that there's a proposed workaround (by the CocoaPods team): https://github.com/Quick/Quick/pull/781
I think that maybe in XCTestObservationCenter+CurrentTestCaseTracker.m the import could be changed from this:
#import "XCTestObservationCenter+CurrentTestCaseTracker.h" #import "Nimble_Snapshots/Nimble_Snapshots-Swift.h"
to this:
#import "XCTestObservationCenter+CurrentTestCaseTracker.h" #if __has_include("Nimble_Snapshot-Swift.h") #import "Nimble_Snapshot-Swift.h" #else #import <Nimble_Snapshot/Nimble_Snapshot-Swift.h> #endif
I've just tried changing the import and it compiles, but I want to confirm with you this, just in case I'm missing something.
PS: For now I'm working around it with this hacky script (maybe it's useful to someone):
post_install do |installer| target = installer.pods_project.targets.find{|t| t.to_s == "Nimble-Snapshots"} compatibility_phase = target.build_phases.find { |ph| ph.display_name == 'Copy generated compatibility header' } if compatibility_phase target.build_configurations.each do |config| config.build_settings['SWIFT_OBJC_INTERFACE_HEADER_NAME'] = "${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}-Swift.h" end compatibility_phase.shell_script = <<-SH.strip_heredoc COMPATIBILITY_HEADER_PATH="${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}-Swift.h" MODULE_MAP_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap" ditto "${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}-Swift.h" "${COMPATIBILITY_HEADER_PATH}" ditto "${PODS_ROOT}/Headers/Public/Nimble_Snapshots/Nimble-Snapshots.modulemap" "${MODULE_MAP_PATH}" ditto "${PODS_ROOT}/Headers/Public/Nimble_Snapshots/Nimble-Snapshots-umbrella.h" "${BUILT_PRODUCTS_DIR}" printf "module ${PRODUCT_MODULE_NAME}.Swift { header \\\"${COMPATIBILITY_HEADER_PATH}\\\" requires objc}" >> "${MODULE_MAP_PATH}" SH compatibility_phase.input_paths = ["${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}-Swift.h", "${PODS_ROOT}/Headers/Public/Nimble_Snapshots/Nimble-Snapshots.modulemap", "${PODS_ROOT}/Headers/Public/Nimble_Snapshots/Nimble-Snapshots-umbrella.h"] compatibility_phase.output_paths = ["${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap", "${BUILT_PRODUCTS_DIR}/Nimble-Snapshots-umbrella.h", "${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}/${PRODUCT_MODULE_NAME}-Swift.h"] end end
LGTM; could you make a PR with this change? Thanks @Machipla!
Done, here it is now the PR (https://github.com/ashfurrow/Nimble-Snapshots/pull/177)
Hi there 😄
We're using CocoaPods version
1.5.3
and using this pod as a static library. The compiler complains when building, outputs:Looking around, I saw that Quick has some similar problems with that: https://github.com/Quick/Quick/issues/780 And that there's a proposed workaround (by the CocoaPods team): https://github.com/Quick/Quick/pull/781
I think that maybe in
XCTestObservationCenter+CurrentTestCaseTracker.m
the import could be changed from this:to this:
I've just tried changing the import and it compiles, but I want to confirm with you this, just in case I'm missing something.
PS: For now I'm working around it with this hacky script (maybe it's useful to someone):