expo / config-plugins

Out-of-tree Expo config plugins for packages that haven't adopted the config plugin system yet.
427 stars 91 forks source link

addResourceFileToGroup Is not being set for a target UUID that is different than the application native target #239

Open jottenlips opened 1 week ago

jottenlips commented 1 week ago

Summary

I am trying to use IOSConfig.XcodeUtils.addResourceFileToGroup to add a font to my widget. I expect the second checkbox to be selected after I run prebuild.

Screenshot 2024-06-20 at 10 49 51 AM

Code I am running:

    console.log(`Target UUID: ${targetUuid}`)

    for (const filePath of fontFiles) {
        console.log(`Adding resource file ${filePath}`)
        config.modResults = IOSConfig.XcodeUtils.addResourceFileToGroup({
            filepath: path.join('Fonts', filePath),
            groupName: 'Resources',
            project,
            isBuildFile: true,
            verbose: true,
            targetUuid, // I checked this UUID value and it is correct
        });
    }
    console.log('Resource files copied successfully.')

output of prebuild

✔ Updated package.json and added index.js entry point for iOS and Android
› Installing using npm
> npm install
Updating Info.plist files
plistFilePath: /Users/johnottenlips/vestaboard/expo-native-fonts/example/ios/exponativefontsexampleWidgetExtension/Info.plist
Copying files
SourceDir: /Users/johnottenlips/vestaboard/expo-native-fonts/example/fonts
TargetDir: /Users/johnottenlips/vestaboard/expo-native-fonts/example/ios/Fonts
Font files copied to ios/Fonts
Adding fonts to target exponativefontsexampleWidgetExtension
Font files:
[
  'Montserrat/Montserrat-Black.ttf',
  'Montserrat/Montserrat-BlackItalic.ttf',
  'Montserrat/Montserrat-Bold.ttf',
  'Montserrat/Montserrat-BoldItalic.ttf'
]
Searching for target exponativefontsexampleWidgetExtension
Target UUID: E8F07E52AAB34508AF54FEE8 "exponativefontsexampleWidgetExtension"
Adding resource file Montserrat/Montserrat-Black.ttf
Adding resource file Montserrat/Montserrat-BlackItalic.ttf
Adding resource file Montserrat/Montserrat-Bold.ttf
Adding resource file Montserrat/Montserrat-BoldItalic.ttf
Resource files copied successfully.

The script looks like it runs fine, however, the target exponativefontsexampleWidgetExtension is not selected when I open the workspace.

Thanks! I'm happy to provide more details if needed!###

Config Plugin

@config-plugins/apple-settings

What platform(s) does this occur on?

iOS

SDK Version

48, for this example, but I have also run into this on 50

Reproducible demo

https://github.com/Vestaboard/expo-native-fonts/pull/1

 "@expo/config-plugins": "~7.2.2",
// I also tried the latest 8.0.5
npm i
npm plugin:build
cd example
npm i
npm run prebuild
open ios/exponativefontsexample.xcworkspace
Screenshot 2024-06-20 at 10 49 51 AM

exponativefontsexampleWidgetExtension should be selected when I open the workspace.