// Should be called from a Lazy
        private IDictionary <string, string> GetAllEnvironmentVariables()
        {
            IDictionary <string, string> environment = FrontEndUtilities.GetEngineEnvironment(m_frontEndHost.Engine, m_frontEndName);

            // Check if we are (supposedly) in the cloud (if the special folder exists)
            if (!FileUtilities.Exists(m_manuallyDroppedDependenciesPath.Value.ToString(m_context.PathTable)))
            {
                return(environment);
            }
            else
            {
                return(SpecialCloudConfiguration.OverrideEnvironmentForCloud(environment, m_manuallyDroppedDependenciesPath.Value, m_context));
            }
        }
Beispiel #2
0
        private Task <SandboxedProcessResult> ExecuteCMakeRunner(AbsolutePath argumentsFile, IEnumerable <AbsolutePath> searchLocations)
        {
            AbsolutePath pathToTool = Configuration.Layout.BuildEngineDirectory.Combine(Context.PathTable, m_relativePathToCMakeRunner);
            string       rootString = ProjectRoot.ToString(Context.PathTable);

            AbsolutePath outputDirectory = argumentsFile.GetParent(Context.PathTable);

            FileUtilities.CreateDirectory(outputDirectory.ToString(Context.PathTable)); // Ensure it exists
            SerializeToolArguments(argumentsFile, searchLocations);

            void CleanUpOnResult()
            {
                try
                {
                    FileUtilities.DeleteFile(argumentsFile.ToString(Context.PathTable));
                }
                catch (BuildXLException e)
                {
                    Tracing.Logger.Log.CouldNotDeleteToolArgumentsFile(
                        Context.LoggingContext,
                        m_resolverSettings.Location(Context.PathTable),
                        argumentsFile.ToString(Context.PathTable),
                        e.Message);
                }
            }

            var environment = FrontEndUtilities.GetEngineEnvironment(Engine, m_frontEnd.Name);

            // TODO: This manual configuration is temporary. Remove after the cloud builders have the correct configuration
            var pathToManuallyDroppedTools = Configuration.Layout.BuildEngineDirectory.Combine(Context.PathTable, RelativePath.Create(Context.StringTable, @"tools\CmakeNinjaPipEnvironment"));

            if (FileUtilities.Exists(pathToManuallyDroppedTools.ToString(Context.PathTable)))
            {
                environment = SpecialCloudConfiguration.OverrideEnvironmentForCloud(environment, pathToManuallyDroppedTools, Context);
            }

            var buildParameters = BuildParameters.GetFactory().PopulateFromDictionary(new ReadOnlyDictionary <string, string>(environment));

            return(FrontEndUtilities.RunSandboxedToolAsync(
                       Context,
                       pathToTool.ToString(Context.PathTable),
                       buildStorageDirectory: outputDirectory.ToString(Context.PathTable),
                       fileAccessManifest: GenerateFileAccessManifest(pathToTool.GetParent(Context.PathTable)),
                       arguments: I($@"""{argumentsFile.ToString(Context.PathTable)}"""),
                       workingDirectory: rootString,
                       description: "CMakeRunner",
                       buildParameters,
                       onResult: CleanUpOnResult));
        }