xcode 跨平台phonegap项目的目录结构
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7273097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Directory structure for cross-platform phonegap project
提问by Leopd
What's a good directory structure for a single source repository that holds both Android and iOS versions of a phonegap project? I'm okay using sym-links since I don't expect any development to happen on PCs. (But if there's a clean way to do it without, I'm all ears, since git and symlinks on PCs are a nightmare.) I've tried this:
对于同时包含 phonegap 项目的 Android 和 iOS 版本的单个源存储库,什么是好的目录结构?我可以使用符号链接,因为我不希望在 PC 上发生任何发展。(但如果没有一种干净的方法可以做到这一点,我全神贯注,因为 PC 上的 git 和符号链接是一场噩梦。)我试过这个:
www/
index.html
js/ *.js
xpjs-ios/ *.js
xpjs-android/ *.js
css/ *.css
html/ *.html (all other files)
android/
(lots of java and config files)
android/assets/www/index.html -> www/index.html
js -> www/js
xpjs -> www/xpjs-android
html -> www/html
css -> www/css
ios/
(xcode config and such)
ios/www/index.html -> www/index.html
js -> www/js
xpjs -> www/xpjs-ios
html -> www/html
css -> www/css
Then I point xcode at the ios/www directory, and eclipse at the android/www directory. For platform-specific javascript, the html files refer to xpjs/phonegap.jsand xpjs/my-quirks.jsand get either the android or ios versions of those files.
然后我将 xcode 指向 ios/www 目录,将 eclipse 指向 android/www 目录。对于平台特定的JavaScript中,HTML文件引用xpjs/phonegap.js,并xpjs/my-quirks.js和获得任何这些文件的Android或iOS版本。
This all seems like it should work, but xcode4 doesn't seem to deal with symlinks. If I open one of the source files in the xcode editor, it reads fine, but when I try to save it it says something like
这一切似乎都应该有效,但 xcode4 似乎不处理符号链接。如果我在 xcode 编辑器中打开源文件之一,它读起来很好,但是当我尝试保存它时,它会说类似
The document "index.html" could not be saved. It does not exist.
and the app when I try to run it fails with
当我尝试运行它时,应用程序失败了
ERROR: Start page 'www/index.html' was not found.
Surely somebody's figured this out.
肯定有人想到了这一点。
采纳答案by Truong-An Thai
Its actually quite easy with Git and Submodules. The phonegap wiki referenced above is indeed a bit slim so I actually went ahead and implemented a solution that configures xcode & eclipse project.
使用 Git 和子模块实际上很容易。上面引用的 phonegap wiki 确实有点小,所以我实际上继续实施了一个配置 xcode 和 eclipse 项目的解决方案。
See the link on my blog post: Phonegap project structure using git submodules
请参阅我的博客文章中的链接:使用 git 子模块的 Phonegap 项目结构
If you don't want to use Git submodules, there is a Symlink solution as well which doesn't care if you use Git or SVN.
如果你不想使用 Git 子模块,也有一个 Symlink 解决方案,它不在乎你是使用 Git 还是 SVN。
http://www.tricedesigns.com/2012/02/16/linked-source-files-across-phonegap-projects-on-osx/
http://www.tricedesigns.com/2012/02/16/linked-source-files-across-phonegap-projects-on-osx/
回答by pinkeerach
there's a writeup (looks like a first pass) on the phonegap wikithat explains how to use a git submodule. to supplement that entry, i also did a writeup on using the svn:externals property. my only thought on symlinks is that it's something people have to setup as opposed to getting them intrinsically from the source control repository. not really a problem, but it is a logistic to the setup when you switch computers or get additional devs on a project. i'll be taking the svn:externals route until i find something better.
在phonegap wiki上有一篇文章(看起来像第一遍)解释了如何使用 git 子模块。为了补充该条目,我还写了一篇关于使用 svn:externals 属性的文章。我对符号链接的唯一想法是人们必须设置它,而不是从源代码控制存储库本质上获取它们。不是真正的问题,但是当您切换计算机或在项目上获得额外的开发人员时,这是设置的一个逻辑问题。我将采用 svn:externals 路线,直到我找到更好的东西。

