public override IEnumerator Execute(UTContext context)
    {
        var isSaveCopy  = saveCopy.EvaluateIn(context);
        var theFileName = "";

        if (isSaveCopy)
        {
            theFileName = filename.EvaluateIn(context);
            if (string.IsNullOrEmpty(theFileName))
            {
                throw new UTFailBuildException("You need to specify a file name when saving a copy of a scene.", this);
            }
            theFileName = UTFileUtils.FullPathToProjectPath(theFileName);

            UTFileUtils.EnsureParentFolderExists(UTFileUtils.CombineToPath(UTFileUtils.ProjectRoot, theFileName));
        }
        if (!EditorApplication.SaveScene(theFileName, isSaveCopy))
        {
            throw new UTFailBuildException("Saving the scene failed.", this);
        }
        yield return("");
    }
Example #2
0
    public override IEnumerator Execute(UTContext context)
    {
        var theScene = scene.EvaluateIn(context);

        if (string.IsNullOrEmpty(theScene))
        {
            throw new UTFailBuildException("You need to specify a path where the scene should be saved to.", this);
        }
        theScene = UTFileUtils.FullPathToProjectPath(theScene);

        var theFullPath = UTFileUtils.CombineToPath(UTFileUtils.ProjectRoot, theScene);

        if (File.Exists(theFullPath))
        {
            throw new UTFailBuildException("There is already a file at '" + theScene + "'.", this);
        }

        UTFileUtils.EnsureParentFolderExists(theFullPath);
        EditorApplication.NewScene();
        EditorApplication.SaveScene(theScene, false);
        yield return("");
    }
    public override IEnumerator Execute(UTContext context)
    {
        var theBaseDirectory = baseDirectory.EvaluateIn(context);

        if (string.IsNullOrEmpty(theBaseDirectory))
        {
            theBaseDirectory = UTFileUtils.ProjectAssets;
        }

        var theOutputFileName = outputFileName.EvaluateIn(context);

        if (string.IsNullOrEmpty(theOutputFileName))
        {
            throw new UTFailBuildException("Output file name must be set", this);
        }


        if (!theOutputFileName.EndsWith(".zip"))
        {
            Debug.LogWarning("Output filename should end with .zip.", this);
        }

        if (!appendToExistingFile.EvaluateIn(context))
        {
            if (File.Exists(theOutputFileName))
            {
                if (UTPreferences.DebugMode)
                {
                    Debug.Log("Deleting existing ZIP file: " + theOutputFileName);
                }
                File.Delete(theOutputFileName);
            }
        }

        var theIncludes = EvaluateAll(includes, context);
        var theExcludes = EvaluateAll(excludes, context);

        var fileList = UTFileUtils.CalculateFileset(theBaseDirectory, theIncludes, theExcludes, UTFileUtils.FileSelectionMode.Files);

        if (fileList.Length == 0)
        {
            throw new UTFailBuildException("There is nothing to ZIP.", this);
        }

        Debug.Log("Zipping " + fileList.Length + " files.", this);

        UTFileUtils.EnsureParentFolderExists(theOutputFileName);

        var doFlatten = flattenStructure.EvaluateIn(context);
        var theBaseFolderInZipFile = baseFolderInZIPFile.EvaluateIn(context);

        using (ZipFile zf = new ZipFile(theOutputFileName)) {
            foreach (var file in fileList)
            {
                if (UTPreferences.DebugMode)
                {
                    Debug.Log("Zipping: " + file, this);
                }
                if (doFlatten)
                {
                    zf.AddFile(file, theBaseFolderInZipFile);
                }
                else
                {
                    var relativePath = UTFileUtils.StripBasePath(UTFileUtils.GetParentPath(file), theBaseDirectory);
                    zf.AddFile(file, UTFileUtils.CombineToPath(theBaseFolderInZipFile, relativePath));
                }
                yield return("");
            }
            zf.Save();
        }

        Debug.Log("ZIP file created at " + theOutputFileName, this);
        yield return("");
    }
Example #4
0
    public override IEnumerator Execute(UTContext context)
    {
        var theOutputFile = outputFileName.EvaluateIn(context);

        if (string.IsNullOrEmpty(theOutputFile))
        {
            throw new UTFailBuildException("You must specify an output file name.", this);
        }

        var theBundleType = bundleType.EvaluateIn(context);

        var theFiles = new string[0];

        if (theBundleType == UTTypeOfBundle.SimpleAssetBundle || !useScenesFromBuildSettings.EvaluateIn(context))
        {
            var theIncludes = EvaluateAll(includes, context);
            var theExcludes = EvaluateAll(excludes, context);
            theFiles = UTFileUtils.CalculateFileset(theIncludes, theExcludes);

            UTFileUtils.FullPathToProjectPath(theFiles);
        }
        else
        {
            var scenes = EditorBuildSettings.scenes;
            theFiles = Array.ConvertAll <EditorBuildSettingsScene, string> (scenes, scene => scene.path);
        }

        if (UTPreferences.DebugMode)
        {
            foreach (var file in theFiles)
            {
                Debug.Log("Including: " + file, this);
            }
        }
        Debug.Log("Including " + theFiles.Length + " assets/scenes.");

        if (theBundleType == UTTypeOfBundle.StreamedScenes && theFiles.Length == 0)
        {
            throw new UTFailBuildException("No scenes have been selected. Unable to build a streamed scenes asset bundle with no scenes.", this);
        }

        var     theMainAsset  = "";
        UObject realMainAsset = null;

        UObject[] realAssets = null;

        if (theBundleType == UTTypeOfBundle.SimpleAssetBundle)
        {
            theMainAsset = mainAsset.EvaluateIn(context);
            if (!String.IsNullOrEmpty(theMainAsset))
            {
                if (theMainAsset.Contains("*"))
                {
                    var finalList = UTFileUtils.CalculateFileset(new string[] { theMainAsset }, new string[0]);
                    if (finalList.Length != 1)
                    {
                        throw new UTFailBuildException("Main asset wildcard " + theMainAsset + " yielded " +
                                                       finalList.Length + " results but should yield exactly one asset.", this);
                    }
                    theMainAsset = UTFileUtils.FullPathToProjectPath(finalList [0]);
                }

                // now get the real objects for the paths
                realMainAsset = AssetDatabase.LoadMainAssetAtPath(theMainAsset);

                if (realMainAsset == null)
                {
                    throw new UTFailBuildException("Unable to load the main asset " + theMainAsset + " from asset database.", this);
                }
            }

            realAssets = Array.ConvertAll <string, UObject> (theFiles, file => {
                var result = AssetDatabase.LoadMainAssetAtPath(file);
                if (result == null)
                {
                    throw new UTFailBuildException("Unable to load the asset " + file, this);
                }
                return(result);
            });
        }


        var theBuildTarget = targetPlatform.EvaluateIn(context);

        if (pushDependencies.EvaluateIn(context))
        {
            UTAssetDependencyStack.Push();
        }

        try {
            UTFileUtils.EnsureParentFolderExists(theOutputFile);
            if (theBundleType == UTTypeOfBundle.StreamedScenes)
            {
                Debug.Log("Building streamed scenes asset bundle.");
                var result = BuildPipeline.BuildStreamedSceneAssetBundle(theFiles, theOutputFile, theBuildTarget);
                if (!string.IsNullOrEmpty(result))
                {
                    throw new UTFailBuildException("Building streamed scene asset bundle failed. " + result, this);
                }
            }
            else
            {
                Debug.Log("Building asset bundle.");
                var realCollectDependencies      = collectDependencies.EvaluateIn(context);
                var realCompleteAssets           = completeAssets.EvaluateIn(context);
                var realDisableWriteTypeTree     = disableWriteTypeTree.EvaluateIn(context);
                var realDeterministicAssetBundle = deterministicAssetBundle.EvaluateIn(context);


                var buildOpts = (BuildAssetBundleOptions)0;

                if (realCollectDependencies)
                {
                    buildOpts |= BuildAssetBundleOptions.CollectDependencies;
                }

                if (realCompleteAssets)
                {
                    buildOpts |= BuildAssetBundleOptions.CompleteAssets;
                }

                if (realDisableWriteTypeTree)
                {
                    buildOpts |= BuildAssetBundleOptions.DisableWriteTypeTree;
                }

                if (realDeterministicAssetBundle)
                {
                    buildOpts |= BuildAssetBundleOptions.DeterministicAssetBundle;
                }

                if (!BuildPipeline.BuildAssetBundle(realMainAsset, realAssets, theOutputFile, buildOpts, theBuildTarget))
                {
                    throw new UTFailBuildException("Building asset bundle failed.", this);
                }
            }
            Debug.Log("Built asset bundle at " + theOutputFile);
        } finally {
            if (popAllDependencies.EvaluateIn(context))
            {
                UTAssetDependencyStack.PopAll();
            }
            else if (popDependencies.EvaluateIn(context))
            {
                UTAssetDependencyStack.Pop();
            }
        }
        yield return("");
    }
    public override IEnumerator Execute(UTContext context)
    {
        var theOutput = outputFileName.EvaluateIn(context);

        if (string.IsNullOrEmpty(theOutput))
        {
            throw new UTFailBuildException("You must specify an output file name.", this);
        }

        if (theOutput.StartsWith(Application.dataPath))
        {
            throw new UTFailBuildException("Building a player inside the assets folder will break the build. Please place it somewhere else.", this);
        }


        var theTarget = targetPlatform.EvaluateIn(context);

        if (addPlatformExtension.EvaluateIn(context))
        {
            theOutput += GetPlatformExtension(theTarget);
            UTFileUtils.EnsureParentFolderExists(theOutput);
        }

#if UNITY_4_1
        // workaround for UNITY_4_1 offering StandaloneOSXUniversal but not being able to build for it.
        if (theTarget == BuildTarget.StandaloneOSXUniversal)
        {
            theTarget = BuildTarget.StandaloneOSXIntel;
        }
#endif

        var useBuildSettings = useScenesFromBuildSettings.EvaluateIn(context);

        string[] scenes;
        if (!useBuildSettings)
        {
            // get them from includes/excludes
            var theIncludes = EvaluateAll(includes, context);
            var theExcludes = EvaluateAll(excludes, context);

            var fileSet = UTFileUtils.CalculateFileset(theIncludes, theExcludes);
            if (fileSet.Length == 0)
            {
                throw new UTFailBuildException("The file set yielded no scenes to include into the player.", this);
            }

            scenes = fileSet;
        }
        else
        {
            var scenesFromEditor = EditorBuildSettings.scenes;
            if (scenesFromEditor.Length == 0)
            {
                throw new UTFailBuildException("There are no scenes set up in the editor build settings.", this);
            }
            var active = Array.FindAll(scenesFromEditor, scene => scene.enabled);
            scenes = Array.ConvertAll(active, scene => scene.path);
        }

        if (UTPreferences.DebugMode)
        {
            foreach (var entry in scenes)
            {
                Debug.Log("Adding scene: " + entry, this);
            }
        }

        BuildOptions buildOptions = BuildOptions.None;
        if (developmentBuild.EvaluateIn(context))
        {
            buildOptions |= BuildOptions.Development;
        }

        if (runTheBuiltPlayer.EvaluateIn(context))
        {
            buildOptions |= BuildOptions.AutoRunPlayer;
        }

        if (showTheBuiltPlayer.EvaluateIn(context))
        {
            buildOptions |= BuildOptions.ShowBuiltPlayer;
        }

        if (buildStreamedScenes.EvaluateIn(context))
        {
            buildOptions |= BuildOptions.BuildAdditionalStreamedScenes;
        }

        if (acceptExternalModifications.EvaluateIn(context))
        {
            buildOptions |= BuildOptions.AcceptExternalModificationsToPlayer;
        }

        if (connectWithProfiler.EvaluateIn(context))
        {
            buildOptions |= BuildOptions.ConnectWithProfiler;
        }

        if (allowDebugging.EvaluateIn(context))
        {
            buildOptions |= BuildOptions.AllowDebugging;
        }

        if (uncompressedAssetBundle.EvaluateIn(context))
        {
            buildOptions |= BuildOptions.UncompressedAssetBundle;
        }

        if (theTarget == BuildTarget.WebPlayer || theTarget == BuildTarget.WebPlayerStreamed)
        {
            if (offlineDeployment.EvaluateIn(context))
            {
                buildOptions |= BuildOptions.WebPlayerOfflineDeployment;
            }
            if (deployOnline.EvaluateIn(context))
            {
                //buildOptions |= BuildOptions.DeployOnline;
            }
        }

        if (theTarget == BuildTarget.iOS)
        {
            if (symlinkLibraries.EvaluateIn(context))
            {
                buildOptions |= BuildOptions.SymlinkLibraries;
            }
        }


        Debug.Log("Building " + ObjectNames.NicifyVariableName(theTarget.ToString()) + " player including " + scenes.Length + " scenes to " + theOutput);
        yield return("");

        if (pushDependencies.EvaluateIn(context))
        {
            UTAssetDependencyStack.Push();
        }
        try {
            // build the player.
            var result = BuildPipeline.BuildPlayer(scenes, theOutput, theTarget, buildOptions);
            if (!string.IsNullOrEmpty(result))
            {
                throw new UTFailBuildException("Building the player failed. " + result, this);
            }
        }
        finally {
            if (popAllDependencies.EvaluateIn(context))
            {
                UTAssetDependencyStack.PopAll();
            }
            else if (popDependencies.EvaluateIn(context))
            {
                UTAssetDependencyStack.Pop();
            }
        }
    }
    public override IEnumerator Execute(UTContext context)
    {
        var theBaseDirectory = baseDirectory.EvaluateIn(context);

        if (string.IsNullOrEmpty(theBaseDirectory))
        {
            theBaseDirectory = UTFileUtils.ProjectRoot;
        }


        if (!Directory.Exists(theBaseDirectory))
        {
            throw new UTFailBuildException("The base directory " + theBaseDirectory + " does not exist.", this);
        }

        theBaseDirectory = UTFileUtils.NormalizeSlashes(theBaseDirectory);

        var theTargetDirectory = targetDirectory.EvaluateIn(context);

        if (string.IsNullOrEmpty(theTargetDirectory))
        {
            throw new UTFailBuildException("You must specify a target directory.", this);
        }
        theTargetDirectory = UTFileUtils.NormalizeSlashes(theTargetDirectory);

        var theIncludes = EvaluateAll(includes, context);
        var theExcludes = EvaluateAll(excludes, context);
        var doFlatten   = flattenStructure.EvaluateIn(context);

        var theFiles  = UTFileUtils.CalculateFileset(theBaseDirectory, theIncludes, theExcludes, UTFileUtils.FileSelectionMode.Files);
        var theCopies = UTFileUtils.Repath(theFiles, theBaseDirectory, theTargetDirectory, doFlatten);

        Debug.Log("Copying " + theFiles.Length + " files to " +
                  theTargetDirectory + (doFlatten ? " and flattening " : " and preserving ") + " the directory structure.", this);

        var doOverwrite = overwriteExisting.EvaluateIn(context);
        var doOnlyNewer = onlyIfNewer.EvaluateIn(context);

        for (int i = 0; i < theFiles.Length; i++)
        {
            context.LocalProgress = ((float)i) / ((float)theFiles.Length);
            FileInfo src    = new FileInfo(theFiles[i]);
            FileInfo target = new FileInfo(theCopies[i]);
            if (!doOverwrite && target.Exists)
            {
                if (UTPreferences.DebugMode)
                {
                    Debug.Log("File " + theCopies[i] + " exists. Not overwriting it.");
                }
                continue;
            }
            if (doOverwrite && doOnlyNewer && src.LastWriteTime.CompareTo(target.LastWriteTime) <= 0)
            {
                if (UTPreferences.DebugMode)
                {
                    Debug.Log("File " + theFiles[i] + " is not newer than " + theCopies[i] + ". Not copying it.", this);
                }
                continue;
            }
            if (UTPreferences.DebugMode)
            {
                Debug.Log("Copying " + theFiles[i] + " to " + theCopies[i], this);
            }
            UTFileUtils.EnsureParentFolderExists(theCopies[i]);
            src.CopyTo(theCopies[i], doOverwrite);
            yield return("");
        }
    }
    public override System.Collections.IEnumerator Execute(UTContext context)
    {
        if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.WebPlayer ||
            EditorUserBuildSettings.activeBuildTarget == BuildTarget.WebPlayerStreamed)
        {
            Debug.LogWarning("You have currently set the build target to 'Web Player'. This may cause interference with actions that access the internet. If you get an error message about cross domain policy from this action, switch the target to 'PC and Mac Standalone' and try again.");
        }

        var theNexusUrl = nexusUrl.EvaluateIn(context);

        if (string.IsNullOrEmpty(theNexusUrl))
        {
            throw new UTFailBuildException("You need to specify the nexus URL", this);
        }

        var theRepoId = repositoryId.EvaluateIn(context);

        if (string.IsNullOrEmpty(theRepoId))
        {
            throw new UTFailBuildException("You need to specify the repository id.", this);
        }


        var theUserName = userName.EvaluateIn(context);
        var thePassword = password.EvaluateIn(context);

        var theGroupId = groupId.EvaluateIn(context);

        if (string.IsNullOrEmpty(theGroupId))
        {
            throw new UTFailBuildException("You need to specify the group id.", this);
        }

        var theArtifactId = artifactId.EvaluateIn(context);

        if (string.IsNullOrEmpty(theArtifactId))
        {
            throw new UTFailBuildException("You need to specify the artifact id.", this);
        }

        var theVersion = version.EvaluateIn(context);

        if (string.IsNullOrEmpty(theVersion))
        {
            throw new UTFailBuildException("You need to specify the version.", this);
        }


        var thePackaging = packaging.EvaluateIn(context);

        if (string.IsNullOrEmpty(thePackaging))
        {
            throw new UTFailBuildException("You need to specify the packaging.", this);
        }

        var theExtension  = extension.EvaluateIn(context);
        var theClassifier = classifier.EvaluateIn(context);

        var theOutputFileName = outputFileName.EvaluateIn(context);

        if (string.IsNullOrEmpty(theOutputFileName))
        {
            throw new UTFailBuildException("You need to specify the output file name.", this);
        }

        if (Directory.Exists(theOutputFileName))
        {
            throw new UTFailBuildException("The specified output file " + theOutputFileName + " is a directory.", this);
        }

        UTFileUtils.EnsureParentFolderExists(theOutputFileName);

        // TODO: ignore SSL certs if required
        using (var wc = new WebClient()) {
            if (!string.IsNullOrEmpty(theUserName))
            {
                wc.Credentials = new NetworkCredential(theUserName, thePassword);
            }


            Uri uri = new Uri(theNexusUrl + "/service/local/artifact/maven/content?" +
                              "g=" + Uri.EscapeUriString(theGroupId) +
                              "&a=" + Uri.EscapeUriString(theArtifactId) +
                              "&v=" + Uri.EscapeUriString(theVersion) +
                              "&r=" + Uri.EscapeUriString(theRepoId) +
                              "&p=" + Uri.EscapeUriString(thePackaging) +
                              (!string.IsNullOrEmpty(theClassifier) ? "&c=" + Uri.EscapeUriString(theClassifier) : "") +
                              (!string.IsNullOrEmpty(theExtension) ? "&e=" + Uri.EscapeUriString(theExtension) : ""));


            downloadFinished          = false;
            error                     = false;
            wc.DownloadFileCompleted += delegate(object sender, AsyncCompletedEventArgs e) {
                downloadFinished = true;
                error            = e.Error != null;
                if (error)
                {
                    Debug.LogError("An error occured while downloading. " + e.Error.Message, this);
                }
            };

            wc.DownloadFileAsync(uri, theOutputFileName);

            do
            {
                yield return("");

                if (context.CancelRequested)
                {
                    wc.CancelAsync();
                }
            } while(!downloadFinished);

            if (!error && !context.CancelRequested)
            {
                Debug.Log("Successfully downloaded artifact to " + theOutputFileName + ".", this);
            }

            if (context.CancelRequested)
            {
                File.Delete(theOutputFileName);
            }
        }
    }
Example #8
0
    public override IEnumerator Execute(UTContext context)
    {
        var theOutputFileName = outputFileName.EvaluateIn(context);

        if (string.IsNullOrEmpty(theOutputFileName))
        {
            throw new UTFailBuildException("Output file name must be set", this);
        }

        if (!theOutputFileName.EndsWith(".unitypackage"))
        {
            Debug.LogWarning("Output filename should end with .unitypackage.", this);
        }

        var theIncludes = EvaluateAll(includes, context);
        var theExcludes = EvaluateAll(excludes, context);

        var fileList = UTFileUtils.CalculateFileset(theIncludes, theExcludes);

        UTFileUtils.FullPathToProjectPath(fileList);

        var theFinalList = new List <string>();

        theFinalList.AddRange(fileList);

        var doIncludeProjectSettings = includeProjectSettings.EvaluateIn(context);

        if (doIncludeProjectSettings == IncludeProjectSettingsMode.Some)
        {
            var theSettingsIncludes = EvaluateAll(settingsIncludes, context);
            var theSettingsExcludes = EvaluateAll(settingsExcludes, context);

            var settingsFileList = UTFileUtils.CalculateFileset(UTFileUtils.ProjectSettings, theSettingsIncludes, theSettingsExcludes, UTFileUtils.FileSelectionMode.Files);
            UTFileUtils.FullPathToProjectPath(settingsFileList);
            theFinalList.AddRange(settingsFileList);
        }

        if (theFinalList.Count == 0 && doIncludeProjectSettings != IncludeProjectSettingsMode.All)
        {
            throw new UTFailBuildException("There is nothing to export.", this);
        }

        if (UTPreferences.DebugMode)
        {
            foreach (var entry in theFinalList)
            {
                Debug.Log("Exporting: " + entry, this);
            }
        }

        Debug.Log("Exporting " + theFinalList.Count + " files.", this);

        ExportPackageOptions flags = ExportPackageOptions.Default;

        var doIncludeDependencies = includeDependencies.EvaluateIn(context);

        if (doIncludeDependencies)
        {
            flags = flags | ExportPackageOptions.IncludeDependencies;
        }

        if (doIncludeProjectSettings == IncludeProjectSettingsMode.All)
        {
            flags = flags | ExportPackageOptions.IncludeLibraryAssets;
        }

        UTFileUtils.EnsureParentFolderExists(theOutputFileName);
        AssetDatabase.ExportPackage(theFinalList.ToArray(), theOutputFileName, flags);
        Debug.Log("Package exported to " + theOutputFileName, this);
        yield return("");
    }
Example #9
0
    public override IEnumerator Execute(UTContext context)
    {
        var realIncludes = EvaluateAll(includes, context);
        var realExcludes = EvaluateAll(excludes, context);

        var theBaseDirectory = baseDirectory != null?baseDirectory.EvaluateIn(context) : null;

        if (string.IsNullOrEmpty(theBaseDirectory))
        {
            theBaseDirectory = Application.dataPath;
        }

        if (!Directory.Exists(theBaseDirectory))
        {
            throw new UTFailBuildException("The base directory " + theBaseDirectory + " does not exist or is not a directory", this);
        }


        var fileList = UTFileUtils.CalculateFileset(theBaseDirectory, realIncludes, realExcludes, UTFileUtils.FileSelectionMode.Files);

        if (fileList.Length == 0)
        {
            throw new UTFailBuildException("No files were selected for build. Please check includes and excludes.", this);
        }

        var realOutputFile = outputFile.EvaluateIn(context);

        if (!realOutputFile.EndsWith(".dll"))
        {
            if (UTPreferences.DebugMode)
            {
                Debug.LogWarning("The output file does not end with .dll. The built DLL will not be picked up by Unity.");
            }
        }

        UTFileUtils.EnsureParentFolderExists(realOutputFile);

        if (UTPreferences.DebugMode)
        {
            foreach (var file in fileList)
            {
                Debug.Log("Compiling " + file);
            }
        }
        else
        {
            Debug.Log("Compiling " + fileList.Length + " files.");
        }

        var compiler = new CSharpCodeProvider();
        CompilerParameters parameters = new CompilerParameters();
        var doIncludeEngineDll        = true;

        if (includeEngineDll != null)           // can happen when we migrate older automation plans which didn't have this setting.
        {
            doIncludeEngineDll = includeEngineDll.EvaluateIn(context);
        }
        if (doIncludeEngineDll)
        {
            parameters.ReferencedAssemblies.Add(UnityDll());
        }
        if (includeEditorDll.EvaluateIn(context))
        {
            parameters.ReferencedAssemblies.Add(UnitEditorDll());
        }

        var realAssemblies = EvaluateAll(referencedAssemblies, context);

        foreach (var asm in realAssemblies)
        {
            parameters.ReferencedAssemblies.Add(asm);
        }

        parameters.GenerateExecutable = false;
        parameters.OutputAssembly     = realOutputFile;

        var theSymbols = defineSymbols.EvaluateIn(context);

        if (!string.IsNullOrEmpty(theSymbols))
        {
            parameters.CompilerOptions = "/define:" + theSymbols.Trim();
        }

        var theAdditionalOptions = additionalCompilerOptions.EvaluateIn(context);

        if (!string.IsNullOrEmpty(theAdditionalOptions))
        {
            parameters.CompilerOptions += " " + theAdditionalOptions.Trim();
        }

        SetPath();
        CompilerResults results = compiler.CompileAssemblyFromFile(parameters, fileList);

        if (UTPreferences.DebugMode)
        {
            var output = results.Output;
            foreach (var line in output)
            {
                Debug.Log(line);
            }
        }

        var errors    = results.Errors;
        var hadErrors = false;

        foreach (CompilerError error in errors)
        {
            if (error.IsWarning)
            {
                Debug.LogWarning(error.ToString());
            }
            else
            {
                hadErrors = true;
                Debug.LogError(error.ToString());                   // TODO link errors to file.
            }
        }
        if (hadErrors)
        {
            throw new UTFailBuildException("There were compilation errors.", this);
        }
        Debug.Log("Built " + realOutputFile + " from " + fileList.Length + " source file(s).");
        yield return("");
    }