1、svn check out/update u3d工程
2、调用u3d插件Invoke Unity3d Editor插件打包生成apk
步骤如下
创建任务
配置svn,配置参考:https://www.cnblogs.com/wangle/p/14787191.html
接下来u3d插件Invoke Unity3d Editor打包生成apk
命令行参数:
-quit -batchmode -projectPath D:\jenkins\workspace\build_efun -executeMethod JenkinsCommond.buildAndroid %major% %minor% %build%
-projectPatch是工程目录
-executeMethod:执行命令JenkinsCommond类下的buildAndroid方法,JenkinsCommond必须是UnityEditor,buildAndroid必须是静态static
%major% %minor% %build% 是参数
参考u3d官网命令行参数:https://docs.unity3d.com/cn/current/Manual/CommandLineArguments.html
%major% %minor% %build%参数配置,可以配置参数类型和默认值
JenkinsCommond类
public static void buildAndroid() { string[] parameters = Environment.GetCommandLineArgs(); JenkinsCommandParam param =new JenkinsCommandParam(); string major = parameters[5]; string minor = parameters[6]; string build = parameters[7]; //BuildAndroid(param); }
ps:
可以增加log,在unity插件命令行后面增加
-logFile D:\jenkins\workspace\build_efun\CommandLineArguments\Log.txt
-quit -batchmode -projectPath D:\jenkins\workspace\build_efun -executeMethod JenkinsCommond.buildAndroid %major% %minor% %build% -logFile D:\jenkins\workspace\build_efun\CommandLineArguments\Log.txt