'Autobuild'에 해당되는 글 2건

  1. 2018/05/23 글뻥 Unity on Jenkins Step 2.
  2. 2018/04/24 글뻥 Unity on Jenkins Step 1.

Now We just run the test using Menu in Unity3D.

사용자 삽입 이미지

If you didn't get any error, Push your code any VCS (This Article based P4V)

I. Basic Information : your mind
II. Source Code Management
사용자 삽입 이미지
1. Add Perforce Credentials
2. Select node type (We use the Streams)
3. Select Stream codeline (Path)
4. Type Workspace name format 
5. (Important) populate is just Sync only
   - Check Force sync / Populate have list / Quiet perforce messageIII. 
6. input "Perforce Depot path" in Polling build filters.

III. Build Triggers 
사용자 삽입 이미지

1. Build periodically: H 07 * * 1-5 (by 7 am on every Mon~Fri)

IV. Build : Unity
사용자 삽입 이미지
1. Select Unity version and commandline : -quit -batchmode -projectPath ${WORKSPACE}/Prototype/SCM  -executeMethod ProjectBuilder.PerformiOSBuild

V. Build: XCODE (General)
사용자 삽입 이미지
* Important: Output directory

VI. Build: XCODE Code signing
사용자 삽입 이미지

VII. Build : Advanced Xcode
사용자 삽입 이미지

 
VIII. Build Execute shell

사용자 삽입 이미지

rm -rf ${WORKSPACE}/Prototype/SCM/$(date +'%m%d%y')_build
mkdir ${WORKSPACE}/Prototype/SCM/$(date +'%m%d%y')_build
cp ${WORKSPACE}/Prototype/SCM/*.ipa ${WORKSPACE}/Prototype/SCM/$(date +'%m%d%y')_build/$(date +'%m%d%y%H%M').ipa
cp -rf ${WORKSPACE}/Prototype/SCM/$(date +'%m%d%y')_build /Volumes/CorgiMobile/
rm -rf ${WORKSPACE}/Prototype/SCM/$(date +'%m%d%y')_build

Done Jenkins setup!

Now, Build your source code on Jenkins.

If you see the Xcode Error, Please open Xcode and open the built code from Unity.
You could fix your problem on XCODE. (Before testing on Xcode, Should click the "Clean")

If you get the success on XCODE. Please save the project and try to build on Jenkins.

* Don't remove or update the project files.

Cheers!

2018/05/23 08:38 2018/05/23 08:38
Create "Editor" folder on "Asset" folder first.
and make a "ProjectBuilder.cs" file in "Editor" folder.

* This script tested on Unity 2018

using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;

class ProjectBuilder {
    static string[] SCENES = FindEnabledEditorScenes();
    static string APP_NAME = "Your Project name";
    static string TARGET_DIR = "build";

    [MenuItem ("ForYou/CI/Build IOS")]
    staticvoidPerformiOSBuild ()
    {
        BuildOptions opt = BuildOptions.AcceptExternalModificationsToPlayer;
                    /*
                     BuildOptions.SymlinkLibraries |
                     BuildOptions.Development |
                     BuildOptions.ConnectWithProfiler |
                     BuildOptions.AllowDebugging |
                     BuildOptions.Development; 
                     */
 
        //PlayerSettings.iOS.sdkVersion = iOSSdkVersion.DeviceSDK; 
        //PlayerSettings.iOS.targetOSVersionString = "11.0";
        //PlayerSettings.statusBarHidden = true;
        //PlayerSettings.iOS.cameraUsageDescription = "ARMode";
 
         PlayerSettings.SetScriptingBackend(BuildTargetGroup.iOS, ScriptingImplementation.IL2CPP);
         char sep = Path.DirectorySeparatorChar;
         string buildDirectory = Path.GetFullPath(".") + sep + TARGET_DIR;
         Directory.CreateDirectory(buildDirectory);
 
         string BUILD_TARGET_PATH = buildDirectory + "/ios";
         Directory.CreateDirectory(BUILD_TARGET_PATH);
 
         GenericBuild(SCENES, BUILD_TARGET_PATH, BuildTargetGroup.iOS, BuildTarget.iOS, opt);
    }

    [MenuItem ("ForYou/CI/Build Android")]
    staticvoidPerformAndroidBuild ()
    {
        string target_filename = APP_NAME + ".apk";
        GenericBuild(SCENES, target_filename, BuildTargetGroup.Android, BuildTarget.Android ,BuildOptions.None);
    }
    
    [MenuItem ("ForYou/CI/Build Window")]
    static void PerformWindowsBuild () {
        string target_filename = APP_NAME + ".exe";
        GenericBuild(SCENES, target_filename, BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows, BuildOptions.None);
    }

    [MenuItem ("ForYou/CI/Build Mac")]
    static void PerformMacBuild () {
        string target_filename = APP_NAME + ".app";
        GenericBuild(SCENES, target_filename, BuildTargetGroup.Standalone, BuildTarget.StandaloneOSX, BuildOptions.None);
    }

   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();
   }

    static void GenericBuild(string[] scenes, string target_filename, BuildTargetGroup build_group, BuildTarget build_target, BuildOptions build_options)
    {
        EditorUserBuildSettings.SwitchActiveBuildTarget(build_group, build_target);
        UnityEditor.Build.Reporting.BuildReport res = BuildPipeline.BuildPlayer(scenes, target_filename, build_target, build_options);
    }
}


You could copy & paste it. and Test it on Unity3d Editor.

Next time, Continue.



2018/04/24 08:22 2018/04/24 08:22