I'm trying to setup multiple variants for my React Native project (expo on bare workflow), I'm using the eas official documentation to do it (https://docs.expo.dev/build-reference/variants/)
As the documentation says I wrapped my original podfile target code inside an abstract_target
and it end up like this
require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")
platform :ios, '12.0'
require 'json'
podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {}
abstract_target 'common' do
use_expo_modules!
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => podfile_properties['expo.jsEngine'] == 'hermes'
)
target 'LoperDEVELOP' do
end
target 'LoperSTAGING' do
end
post_install do |installer|
react_native_post_install(installer)
installer.pods_project.targets.each do |target|
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end
end
post_integrate do |installer|
begin
expo_patch_react_imports!(installer)
rescue => e
Pod::UI.warn e
end
end
end
everything looks well, until the compiler fails with the following error:
Build input file cannot be found: '/Users/expo/workingdir/build/ios/Pods/Target Support Files/Pods-LoperDEVELOP/ExpoModulesProvider.swift
After checking the temporal generated folder it looks to be created with the wrong name after the addition of the abstract_target
now the output folder is
/Users/expo/workingdir/build/ios/Pods/Target Support Files/Pods-common-LoperDEVELOP/ExpoModulesProvider.swift
and the expected is
/Users/expo/workingdir/build/ios/Pods/Target Support Files/Pods-LoperDEVELOP/ExpoModulesProvider.swift
As you can see, in the LoperDevelop folder it is concatenating Pods-{abstract_target}-{target}
when the compiler expects just Pods-{target}
Am i doing something wrong? or it's any workaround to this situation?
Edit:
Add a little more info to the problem.
when I execute pod install
in ios folder the pods are installed without any problems.
but after that, when i ran expo run:ios
it produces a fail because it is looking for ExpoModulesProvider.swift
in Pods-LoperDEVELOP
folder instead of Pods-common-LoperDevelop
(which is created using abstract target 'common'
)
Thanks!
The problem is solved.
It was a miss configuration in XCode, if someone has in the same situation, you have to go to the following section
XCode -> Specific Target -> Build Phases -> Compile Sources
And inside it, make sure that all the files are correct, In my case, there were a file with a wrong path causing the entire issue