Score
0
Watch 10 Star 19 Fork 7

仁畅网络科技 / XUnityDeployRuby

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Unity 自动化编译IOS | Android项目 spread retract

Clone or download
Loading...
README.md

XUnityDeploy是针对Unity自动化编译Android/IOS的脚本。

环境

  • Xcode Version > 7.0

  • Ruby Version > 2.0

  • Unity Version > 5.0, 其中需要配置Android SDK,JDK, NDK等

  • Git or Svn

  • ios-deploy

步骤

  • XUnityDeploy放在Assets的同级目录

  • 拷贝plugins/EditorAssets/Editor

  • 配置参数XUnityDeploy_configs下的main.info.json, main.projmods.json, export.plist, unity_deploy.plist

  • ruby scripts/run_unity.rb -p ios[android]

XUnityDeploy的流程图

  1. run_unity启动脚本

  2. Ruby脚本生成Unity需要的配置unity_deploy

  3. XUnityDeploy读取unity_deploy配置,配置Unity项目,最后编译项目

  4. UnityDeployPostprocess在编译Unity之后需要配置Xcode项目(IOS)

    • 读取main.build,获取info
    • 获取projmods,配置Xcode项目
    • 获取info, 配置XcodeInfo.plist
  5. 对生成包进行重命名,并提交到down serve上

Rake使用

  • rake update 更新项目
  • rake compile:ios 编译ios项目
  • rake compile:android 编译android项目
  • rake install:ios 安装ios包
  • rake install:android 安装android包

目录结构说明

  • builds 最终生成包的目录(apk, xcode project, ipa)

  • ../XUnityDeploy_configs 配置文件目录

    • android.keystoreAndroid的签名文件,需要自己替换,并在unity_deploy中配置keystore
    • export.plist 是导出ipaxcode需要的配置文件。其中methodapp-store,enterprise, ad-hoc,development。参考export.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>compileBitcode</key>
	<false/>
        <key>method</key>
        <string>development</string>
        <key>teamID</key>
        <string>your team id</string>
        <key>provisioningProfiles</key>
        <dict>
            <key>your bundle id</key>
            <string>your provision name</string>
        </dict>
        <key>signingCertificate</key>
        <string>iPhone Developer</string>
        <key>signingStyle</key>
        <string>manual</string>
</dict>
</plist>
  • unity_deploy.jsonUnityXUnityDeploy中读取的配置,用于配置Unity的项目
{
    "ios" :
    {
        "Version" : "1.0",
        "BundleVersionCode": 1,
        "BundleIdentifier" : "com.501joy.over14",
        "ProductName" : "XUnityDeploy",
        "IsDevelopment" : false,
        "DefineSymbols" : "EXAMPLE",
        "StrippingLevel" : "UseMicroMSCorlib",
        "ScriptCallOptimizationLevel" : "FastButNoExceptions",
        "IOSTargetOSVersion" : "7.0",
        "AotOptions" : "nimt-trampolines=256",
        "ScriptBackent" : "IL2CPP",
        "Channel" : "500026"
    },
    "android" :
    {
        "Version" : "1.0",
        "BundleVersionCode" : 1,
        "BundleIdentifier" : "com.501joy.over14",
        "ProductName" : "XUnityDeploy",
        "IsDevelopment" : false,
        "DefineSymbols" : "EXAMPLE",
        "StrippingLevel" : "UseMicroMSCorlib",
        "OBB" : false,
        "ScriptBackent" : "IL2CPP",
        "KeystoreName" : "android.keystore",
        "KeystorePass" : "example",
        "KeyaliasName" : "example",
        "KeyaliasPass" : "example",        
        "Channel" : "600001"
    }
}
  • jenkins jenkins目录

  • logs 编译日志目录

  • scripts 运行脚本命令目录

  • tools 工具目录

  • unitys 编译脚本目录

  • utils 帮助脚本目录

说明

  • executeMethod class 'XUnityDeploy' could not be found 需要把plugins/Editor拷贝到Assets/Editor

  • 这里关于xcode项目的配置在UnityXUnityDeploy处理了,也就是配置main.projmods.json中的build_settings。这里还有一种方法在编译Unity之后,通过Xcodeproj配置xcode

  • Error Domain=IDEDistributionErrorDomain Code=1 "The operation couldn’t be completed 修改export.plist。还碰到过WWDR certificate expired, 需要重新更新一下,参考

  • 因为Unity切换平台(ios/android)比较慢,所以这里建议针对ios/android单独checkout一个目录

  • Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found."。这里需要把Ruby版本设置为system,即使用rvm use system 参考

TODO

  • 检查编译环境的脚本

  • 自动提交客户端的脚本

  • Xcodeproj替代Editor/XCodeEditor

Comments ( 0 )

Sign in for post a comment

Ruby
1
https://gitee.com/renchang/XUnityDeploy.git
git@gitee.com:renchang/XUnityDeploy.git
renchang
XUnityDeploy
XUnityDeploy
master

Search