Exemple #1
0
        public static void BuildUpliftDll()
        {
            UnityInstallation unity = UnityInstallationUtils.Current();

            BuildLibraryData Data = new BuildLibraryData();

            Data.References = new string[] {
                unity.Paths().Managed("UnityEditor.dll"),
                unity.Paths().Managed("UnityEngine.dll")
            };

            // All under Uplift except Testing code
            List <string> FileList = new List <string>();

            FileList.AddRange(FileSystemUtil.GetFiles(Helper.PathCombine("Assets", "Plugins", "Editor", "Uplift")).Where(f => f.EndsWith(".cs") && !f.Contains("Testing")));
            // FileList.AddRange (FileSystemUtil.GetFiles (Helper.PathCombine ("Assets", "Plugins", "Editor", "BuildTool")).Where (f => f.EndsWith(".cs")));
            FileList.AddRange(FileSystemUtil.GetFiles(Helper.PathCombine("Assets", "Plugins", "Editor", "UnityHacks")).Where(f => f.EndsWith(".cs")));
            Data.Files = FileList.ToArray();

            Data.SdkLevel  = 2;
            Data.OutFile   = UpliftDLL;
            Data.useUnsafe = true;
            Data.Defines   = EditorUserBuildSettings.activeScriptCompilationDefines;

            unity.BuildLibrary(Data);
        }
Exemple #2
0
        public void BuildLibrary(BuildLibraryData data)
        {
            FileSystemUtil.EnsureParentExists(data.OutFile);

            string ReferenceString = string.Join(",", data.References.Select(s => Helper.ArgEscape(s)).ToArray());

            List <string> args = new List <string>();

            args.Add("-r:" + ReferenceString);
            args.Add("-target:library");
            args.Add("-sdk:" + data.SdkLevel.ToString());
            args.Add("-out:" + data.OutFile);
            if (data.Defines != null && data.Defines.Length > 0)
            {
                args.Add("-define:" + string.Join(";", data.Defines));
            }
            if (data.useUnsafe)
            {
                args.Add("-unsafe");
            }
            args.AddRange(data.Files);

            Helper.RunProcess(Helper.ArgEscape(Paths().Mcs()), args.ToArray());
            UnityEngine.Debug.LogFormat("Library '{0}' built!", data.OutFile);
        }