标签:磁盘 start pip ret 路径 账号 getc private pre
NOTE:安装失败的话,后面进入管理plugins的高级选项中,将更新站点设置为:http://mirror.xmission.com/jenkins/updates/current/update-center.json。
2.1.安装Unity3d plugin。
3.1.在Configure中新增build step,选择Unity,设置命令行参数-quit -batchmode -projectPath "E:/Project Files/Unity Project/2018.3/jenkins" -executeMethod Jenkins.AutoBuild -logFile build.log Version-$Version。
3.2.build environment中勾选Add timestamps to the console output,为每个命令输出添加时间戳,方便后期查找。
3.3.设置SVN版本控制
3.4.新增命令行参数,其中参数以$Version的形式存在
3.5.丢弃旧的构建,保证磁盘不会出现占满的情况。
public class Jenkins : Editor { private static string[] SCENES = FindEnabledEditorScenes(); private static string APP_NAME = "Jenkins"; private static string TARGET_DIR = "E:/Project Files/Unity Project/2018.3/jenkins/Build"; private static string JDK_DIR = "F:/Program Files/Java/jdk1.8.0_25"; private static string ANDROID_SDK_DIR = "F:/AndroidSDK"; private static string[] FindEnabledEditorScenes() { List<string> EditorScenes = new List<string>(); foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes) { if (!scene.enabled) continue; EditorScenes.Add(scene.path); } return EditorScenes.ToArray(); } [MenuItem("Jenkins/Auto Build")] public static void AutoBuild() { //Jenkins使用system账号,读取注册表路径为HKEY_USER;手动打开Unity使用user账号,读取注册表路径为HKEY_CURRENT_USER; EditorPrefs.SetString("jdkPath", JDK_DIR); EditorPrefs.SetString("AndroidSdkRoot", ANDROID_SDK_DIR); string version = GetJenkinsParameter("Version"); string suffix = string.Empty; #if UNITY_STANDALONE_WIN suffix = ".exe"; #elif UNITY_ANDROID suffix = ".apk"; #elif UNITY_IOS suffix = ".ipa"; #endif string targetFilePath = TARGET_DIR + "/" + APP_NAME + "_" + version + suffix; GenericBuild(SCENES, targetFilePath, EditorUserBuildSettings.activeBuildTarget, BuildOptions.None); } public static void GenericBuild(string[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options) { BuildReport report = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options); Debug.Log(report); } private static string GetJenkinsParameter(string paramName) { foreach (var command in Environment.GetCommandLineArgs()) { if (command.StartsWith(paramName) == true) { return command.Split(‘-‘)[1]; } } return string.Empty; } }
标签:磁盘 start pip ret 路径 账号 getc private pre
原文地址:https://www.cnblogs.com/smallrainf/p/10746152.html