Guest User

Untitled

a guest
Jan 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. cmd.exe /C " chcp 1252 & E:VisualStudioMSBuild15.0Binmsbuild.exe /m /p:Configuration=Release /p:Platform=x86 "E:Jenkinsworkspace00_BUILDSMY_PROJECTMy Project.sln" " && exit %%ERRORLEVEL%%
  2.  
  3. <!-- language: lang-c# -->
  4.  
  5. using UnityEngine;
  6. using UnityEditor;
  7. using System.Collections;
  8. using System.Collections.Generic;
  9. using System;
  10.  
  11. namespace JENKINS
  12. {
  13. public class AutoBuilder : ScriptableObject
  14. {
  15. static string[] SCENES = FindEnabledEditorScenes();
  16.  
  17. // Use real app name here
  18. /* Anyway the App will have the name as configured within the Unity-Editor
  19. This Appname is just for the Folder in which to Build */
  20. static string APP_NAME;
  21. static string TARGET_DIR;
  22.  
  23. [MenuItem("Custom/CI/Windows Mixed Reality Build (UWP)")]
  24. public static void PerformWindowsMixedRealityBuild()
  25. {
  26. APP_NAME = GetArg("-appName");
  27. TARGET_DIR = GetArg("-buildFolder");
  28. Debug.Log("Jenkins-Build: APP_NAME: " + APP_NAME + " TARGET_DIR: " + TARGET_DIR);
  29.  
  30. GenericBuild(SCENES, TARGET_DIR + "/" + APP_NAME, BuildTargetGroup.WSA, BuildTarget.WSAPlayer, BuildOptions.AllowDebugging);
  31. }
  32.  
  33. private static string[] FindEnabledEditorScenes()
  34. {
  35. List<string> EditorScenes = new List<string>();
  36.  
  37. foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes)
  38. {
  39. if (!scene.enabled) continue;
  40. EditorScenes.Add(scene.path);
  41. }
  42.  
  43. return EditorScenes.ToArray();
  44. }
  45.  
  46. private static void GenericBuild(string[] scenes, string app_target, BuildTargetGroup build_target_group, BuildTarget build_target, BuildOptions build_options)
  47. {
  48. EditorUserBuildSettings.SwitchActiveBuildTarget(build_target_group, BuildTarget.WSAPlayer);
  49.  
  50. string res = BuildPipeline.BuildPlayer(scenes, app_target, build_target, build_options);
  51. if (res.Length > 0)
  52. {
  53. throw new Exception("BuildPlayer failure: " + res);
  54. }
  55. }
  56.  
  57. /**
  58. * Get Arguments from the command line by name
  59. */
  60. private static string GetArg(string name)
  61. {
  62. var args = System.Environment.GetCommandLineArgs();
  63.  
  64. for (int i = 0; i < args.Length; i++)
  65. {
  66. if (args[i] == name && args.Length > i + 1)
  67. {
  68. return args[i + 1];
  69. }
  70. }
  71.  
  72. return null;
  73. }
  74. }
  75. }
  76.  
  77. <PathToYourUnityInstallation>EditorUnity.exe -quit -batchmode -username 'xxxxxxxxxxxxx' -password 'xxxxxxxxxxx' -logFile uniytImportLog.txt -importPackage E:UnityPackageAutoBuilder.unitypackage
  78.  
  79. <PathToYourUnityInstallation>EditorUnity.exe -quit -batchmode -username 'xxxxxxxxxxxxx' -password 'xxxxxxxxxxx' -logFile uniytBuildLog.txt -buildTarget wsaplayer -executeMethod JENKINS.AutoBuilder.PerformWindowsMixedRealityBuild -appName %JOB_NAME% -buildFolder %WORKSPACE%0_BUILD
  80.  
  81. <PathToYourUnityInstallation>EditorDataPlaybackEnginesMetroSupportToolsnuget.exe restore %WORKSPACE%0_BUILD%JOB_NAME%%App_Name%
  82.  
  83. cmd.exe /C " chcp 1252 & <PathToYourVisual-StudioInstallation>MSBuild15.0Binmsbuild.exe /m /t:restore /p:Configuration=Release /p:Platform=x86 "%WORKSPACE%0_BUILD%JOB_NAME%%App_Name%" "
  84.  
  85. cmd.exe /C " chcp 1252 & <PathToYourVisual-StudioInstallation>MSBuild15.0Binmsbuild.exe /m /t:restore /p:Configuration=Release /p:Platform=x86 "%WORKSPACE%0_BUILD%JOB_NAME%%App_Name%" "
  86.  
  87. "%WORKSPACE%00_BUILD%JOB_NAME%%App_Name%AppPackages"
Add Comment
Please, Sign In to add comment