版本与PhoneGap的不同平台 [英] Versioning for different platforms with phonegap

查看:303
本文介绍了版本与PhoneGap的不同平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们遇到了不少问题,我们的版本,当它来到我们的新项目,我们与PhoneGap的3.2工作。我想问问你什么是有版本的数据的最佳方式,具有下列要求:

We have encountered quite a few problems with our versioning when it came to our new project, where we work with phonegap 3.2. I wanted to ask you what's the best way to have the data versioned, with the following requirements:


  • 所有开发商必须修改 WWW 文件夹的根目录中的项目

  • 一些开发商还需要改变Java文件中的平台/安卓/ src目录文件夹

  • 一些开发商也需要改变目标C code

  • All developers have to change the www folder in the root directory in the project
  • Some developers also need to change the Java Files in the platforms/android/src folder
  • Some developers also need to change the Objective C code

如果有3个不同的版本库位置,一个带有www,并为每个平台?还是说只有一个存储库位置,每一个开发者签出他需要的是什么?还是应该每个人都有与所有平台的文件,整个项目呢?

Should there be 3 different repository Locations, one with the www, and one for each platform? Or should there be only one repository location where each developer checks out what he needs? Or should everyone have the whole project with all platform files in it?

我们遇到的问题主要是,当平台code是通过科尔多瓦构建和COMMITED afterwoods改变。你已经签出这是另一台计算机上运行良好,整个项目也有时后,就不会再建。

The problems we encountered were mainly when platform code was changed through a cordova build and commited afterwoods. Also sometimes after you had checked out the whole project which was running fine on another computer, it wouldn't build anymore.

任何提示的AP preciated

Any hints are appreciated

推荐答案

目前科尔多瓦支持两种官方构建他们的应用程序的方式。
1.基于CLI的,在这里你完全跨平台工作,并有只存储 WWW 合并文件夹中。开发人员可以假设,你可以使用CLI科尔多瓦在新机器上设置你的环境

Currently Cordova support two official way of building their applications. 1. CLI based, where you work completely cross-platform and have to store only www and merges folder. Developers have assumption that you could use Cordova CLI on the new machine to setup your environment

cordova platform add android
cordova platform add ios
cordova plugin add org.apache.cordova.device

此工作流程使您受益具有 WWW 文件夹共同codeBase类的,你必须kepp特定于平台的覆盖你的CSS可在合并/ Android的,JS或HTML文件合并/ IOS 子文件夹,但你不能有修改特定于平台的code的方式。

This workflow gives you benefit of having common codebase in www folder and you have to kepp platform-specific overrides for you CSS,JS or HTML files in merges/android or merges/ios subfolders, but you cannot have modify platform-specific code that way.


  1. 平台SDK开发流程。你在哪里使用标准的SDK工具为平台创建应用程序,然后根据需要添加CordovaLib的依赖和嵌入的WebView。然后你使用Eclipse / X code的进一步发展。如果你有这样,你必须手动确保 WWW一个以上的项目设置在两个​​项目文件夹保持同步。

  1. Platform SDK development workflow. Where you create application using standard SDK tools for platform then add CordovaLib as dependency and embed WebView as needed. Then you use Eclipse/XCode for further development. If you have more then one project setup that way, you have to manually ensure that www folders in both projects remains in sync.

此工作流程使您受益不必使用的所有平台功能的能力,但是你必须手动同步的 WWW 文件夹的内容,并与平台相关的CSS / JS / HTML工作不知何故
注意:在支持我的意思是,这是两种工作流程赋予更多的关注开发商

This workflow gives you benefit of having ability to use all platform functionality, but you have to manually sync contents of www folders, and somehow work with platform specific CSS/JS/HTML Note: Under supported I mean, this is two workflow which gives more attention from developers.

现在你的问题 - 我建议你有以下工作流程是稍微修改基于CLI的工作流程的版本。你必须保存您的 WWW 合并文件夹和的只平台零部件插件文件夹不存储。由于平台按科尔多瓦CLI生成的子文件夹的许多部分内容你有你的的.gitignore 文件乱动。

Now to your question - I propose you to have following workflow which is slightly modified version of CLI-based workflow. You have to store you www, merges folders and only parts of the platforms. Plugins folder is not stored. Since many parts content of platforms sub-folders are generated by Cordova CLI you have to fiddle with your .gitignore file.

的.gitignore的内容

Content of .gitignore

## Eclipse specific stuff.
.metadata/

## Android specific stuff
local.properties
/platforms/android/gen
/platforms/android/bin
/platforms/android/assets/www
/platforms/android/.metadata
/platforms/android/.staging/www
/platforms/android/.settings
platforms/android/CordovaLib/.settings/
/platforms/android/CordovaLib/bin
/platforms/android/CordovaLib/bin/proguard.txt
*.d
*.class 

## iOS specific stuff
platforms/ios/.staging/
platforms/ios/platform_www/
platforms/ios/<--projectname-->.xcodeproj/project.xcworkspace
platforms/ios/<--projectname-->.xcodeproj/xcuserdata
platforms/ios/www

## Exclude Plugins
# For iOS you have to exclude only this single folder.
platforms/ios/<--projectname-->/Plugins/
# For Android you have to manually exclude folders for each plugin provider.
# .java files for plugins stored based on plugin id. For example
# to exclude all plugins provided by Cordova add following line.
# Make sure that when you create project you specify project ID 
# as com.yourcompany.yourapp that way your code will be in
# platforms/android/src/com/yourcompany/yourapp and separated from 
# plugins
platforms/android/src/org/apache/cordova/
# For example to exclude plugins provided by BlackBerry 
# add line 
# platforms/android/src/come/blackberry/

现在,当您安装新的项目,你应该签源$ C ​​$ c和运行下面的命令:

Now when you setup new project you should checkout source code and run following commands:

# Create local.properties file which is required for build
cordova platform update android 
# Or manually create local.properties with content below
# sdk.dir=C:\\adt\\sdk

# Add plugins
cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.vibration
# ... and other plugins

您之后安装项目这种方式,你能够做到最好采取从两个-世界。你可以使用科尔多瓦服务,你可以做,如果需要使用Android / iOS版SDK繁重做快速测试的浏览器。如果你让你切换到科尔多瓦codeBase的最小值和使用插件您需要whenether可能的,你甚至可以更新平台,科尔多瓦新版本时,他们将被释放到扩展的平台。

After you setup project that way you able to do take best from both-worlds. You could do quick testing in the browser using cordova serve, you could do heavy-lifting using Android/iOS SDK if needed. If you keep you changes to Cordova codebase to minimum and use plugins to extend platform for you need whenether possible you could even update platforms to newer version of Cordova when they will be released.

希望这你就可以选择方法,将工作最适合你。

Hopefully this you would be able to select method which will work best for you.

这篇关于版本与PhoneGap的不同平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆