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:jenkinsworkspaceuild_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类
1 public static void buildAndroid() 2 { 3 string[] parameters = Environment.GetCommandLineArgs(); 4 JenkinsCommandParam param =new JenkinsCommandParam(); 5 string major = parameters[5]; 6 string minor = parameters[6]; 7 string build = parameters[7]; 8 //BuildAndroid(param); 9 }
ps:
可以增加log,在unity插件命令行后面增加
-logFile D:jenkinsworkspaceuild_efunCommandLineArgumentsLog.txt
-quit -batchmode -projectPath D:jenkinsworkspaceuild_efun -executeMethod JenkinsCommond.buildAndroid %major% %minor% %build% -logFile D:jenkinsworkspaceuild_efunCommandLineArgumentsLog.txt