简体   繁体   English

Xcode 从文件夹或使用通配符添加资源文件

[英]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.我有一个跨越 2 个平台的项目:一个项目在 linux/ubuntu 上,另一个在 mac/iOS 上。

What I'm trying to achieve is to embed my linux installer package (.deb file) into my iOS app resources.我想要实现的是将我的 linux 安装程序 package (.deb 文件)嵌入到我的 iOS 应用程序资源中。 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). 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进行通信和更新步骤)。

I also will be setting my projects up using CI (Jenkins in my case) to auto build my projects.我还将使用 CI(在我的例子中是 Jenkins)设置我的项目来自动构建我的项目。 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. 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 建成项目。

The problem I'm having is that my.deb filename will change at every build version.我遇到的问题是 my.deb 文件名会在每个构建版本中更改。 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".例如,我的 deb package 在一次构建中可能被命名为“MyLinuxApp_x86_64_v1.0.1234.deb”,但在下一个构建中将被命名为“MyLinuxApp_x86_64_v1.0.1235.deb”。

So my question is, is there a way to setup my XCode project to:所以我的问题是,有没有办法将我的 XCode 项目设置为:

  1. bundle all files based on a wildcard string.基于通配符字符串捆绑所有文件。 Eg "MyLinuxApp_x86_64*.deb"例如“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例如“MyLinuxAppPackageFolder”,在该文件夹中,我会在构建我的 XCode 项目之前复制 my.deb 文件

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"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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