Ejemplo n.º 1
0
#pragma warning restore 649

        /// <inheritdoc />
        public ReturnCode Run()
        {
            if (m_Parameters.ScriptInfo != null)
            {
                BuildCacheUtility.SetTypeDB(m_Parameters.ScriptInfo);
                return(ReturnCode.SuccessNotRun);
            }

            // We need to ensure the directory is empty so prior results or other artifacts in this directory do not influence the build result
            if (Directory.Exists(m_Parameters.ScriptOutputFolder))
            {
                Directory.Delete(m_Parameters.ScriptOutputFolder, true);
                Directory.CreateDirectory(m_Parameters.ScriptOutputFolder);
            }

            m_Results.ScriptResults = PlayerBuildInterface.CompilePlayerScripts(m_Parameters.GetScriptCompilationSettings(), m_Parameters.ScriptOutputFolder);
            m_Parameters.ScriptInfo = m_Results.ScriptResults.typeDB;
            BuildCacheUtility.SetTypeDB(m_Parameters.ScriptInfo);

            if (m_Results.ScriptResults.assemblies.IsNullOrEmpty() && m_Results.ScriptResults.typeDB == null)
            {
                return(ReturnCode.Error);
            }
            return(ReturnCode.Success);
        }
#pragma warning restore 649

        public ReturnCode Run()
        {
            var    settings     = m_BuildParameters.GetScriptCompilationSettings();
            string outputFolder = m_BuildParameters.GetOutputFilePathForIdentifier(BuilderConsts.OutputAssemblies);
            var    results      = PlayerBuildInterface.CompilePlayerScripts(settings, outputFolder);

            if (results.assemblies == null || !results.assemblies.Any())
            {
                return(ReturnCode.Error);
            }

            string[] asmdefGuids = AssetDatabase.FindAssets("t:Asmdef", new[] { m_ModificationParameters.ScriptsPath });
            string[] asmdefNames = asmdefGuids
                                   .Select(AssetDatabase.GUIDToAssetPath)
                                   .Select(AssetDatabase.LoadAssetAtPath <AssemblyDefinitionAsset>)
                                   .Select(GetAssemblyName)
                                   .ToArray();
            foreach (string filePath in Directory.GetFiles(outputFolder))
            {
                if (asmdefNames.All(i => !filePath.Contains(i)))
                {
                    File.Delete(filePath);
                }
            }

            return(ReturnCode.Success);
        }
Ejemplo n.º 3
0
#pragma warning restore 649

        /// <inheritdoc />
        public ReturnCode Run()
        {
            if (m_Parameters.ScriptInfo != null)
            {
                return(ReturnCode.SuccessNotRun);
            }

            m_Results.ScriptResults = PlayerBuildInterface.CompilePlayerScripts(m_Parameters.GetScriptCompilationSettings(), m_Parameters.ScriptOutputFolder);
            m_Parameters.ScriptInfo = m_Results.ScriptResults.typeDB;

            if (m_Results.ScriptResults.assemblies.IsNullOrEmpty() && m_Results.ScriptResults.typeDB == null)
            {
                return(ReturnCode.Error);
            }
            return(ReturnCode.Success);
        }
Ejemplo n.º 4
0
#pragma warning restore 649

        public ReturnCode Run()
        {
            if (m_Parameters.ScriptInfo != null)
            {
                return(ReturnCode.SuccessNotRun);
            }

            // TODO: Replace with call to GetTempOrCachePath
            // TODO: Create tasks to copy scripts to correct output folder?
            m_Results.ScriptResults = PlayerBuildInterface.CompilePlayerScripts(m_Parameters.GetScriptCompilationSettings(), m_Parameters.TempOutputFolder);
            m_Parameters.ScriptInfo = m_Results.ScriptResults.typeDB;

            if (m_Results.ScriptResults.assemblies.IsNullOrEmpty() && m_Results.ScriptResults.typeDB == null)
            {
                return(ReturnCode.Error);
            }
            return(ReturnCode.Success);
        }