简体   繁体   中英

Xcode add resource files from folder or with wildcard

I have a project that spans 2 platforms: one project is on linux/ubuntu and the other is on mac/iOS.

What I'm trying to achieve is to embed my linux installer package (.deb file) into my iOS app resources. It's a long story why I want to do this, but basically my iOS app will be communicating with my linux app on some external hardware and so I want my iOS app to be able to update the app on my linux hardware (I already know how to do the communication and updating steps).

I also will be setting my projects up using CI (Jenkins in my case) to auto build my projects. So I want to be able to automate the process of 1) creating the linux.deb package installer, 2) move the.deb package installer over to the iOS project, 3) build the iOS project and have the.deb package stored in my iOS built project.

The problem I'm having is that my.deb filename will change at every build version. For example my deb package might be named "MyLinuxApp_x86_64_v1.0.1234.deb" for one build, but then at the next build will be named "MyLinuxApp_x86_64_v1.0.1235.deb".

So my question is, is there a way to setup my XCode project to:

  1. bundle all files based on a wildcard string. Eg "MyLinuxApp_x86_64*.deb"
  2. or bundle all files in a folder. Eg "MyLinuxAppPackageFolder" and in that folder I'd copy my.deb file just before building my XCode project

To be clear, I know how to add this file "manually" each time the file name changes, but I need a way to automate it.

Thanks for any help you can provide.

Yes, you can use wildcards, but you should make sure that you only have one file matching in your source directory.

Add this as a build step:

RESOURCE_PATH="$SRCROOT/where/ever/.../MyLinuxApp_x86_64_*.deb"

BUILD_APP_DIR=${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}
cp $RESOURCE_PATH "$BUILD_APP_DIR/BundledLinuxApp_x86_64.deb"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM