示例#1
0
        private void LoadDefaults()
        {
            Language = Configuration.CodeGeneration.GetLanguage();
            RootPath = Configuration.CodeGeneration.GetOutputPath();
            RootFile = Configuration.CodeGeneration.GetOutputFile();

            RootPath = RootPath.Replace("\\.\\", "\\");

            CodeGenerationFileType[] types =
            {
                CodeGenerationFileType.AttributeConstants,
                CodeGenerationFileType.Entities,
                CodeGenerationFileType.OptionSets,
                CodeGenerationFileType.Requests,
                CodeGenerationFileType.Responses,
                CodeGenerationFileType.ServiceContext
            };

            foreach (var type in types)
            {
                var    options = Configuration.CodeGeneration.GetOutputOptions(type);
                string file    = options.GetComputedFile(RootPath);
                string path    = Path.GetDirectoryName(file);

                OutputFiles.Add(type, file);
                OutputPaths.Add(type, path);
            }
        }
示例#2
0
        public static void Main(string[] args)
        {
            try
            {
                string projectJsonFileName = Path.GetFullPath("project.json");

                string projectDirectory = System.IO.Path.GetDirectoryName(projectJsonFileName);

                var workspace         = new BuildWorkspace(ProjectReaderSettings.ReadFromEnvironment());
                var frameworkContexts = workspace.GetProjectContextCollection(projectDirectory)
                                        .FrameworkOnlyContexts;

                var rids = RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers();

                foreach (var frameworkContext in frameworkContexts)
                {
                    var runtimeContext = workspace.GetRuntimeContext(frameworkContext, rids);

                    OutputPaths paths = runtimeContext.GetOutputPaths("Debug");
                    Console.WriteLine("TargetFramework: " + frameworkContext.Identity.TargetFramework);
                    Console.WriteLine("Executable: " + paths.RuntimeFiles.Executable);
                    Console.WriteLine();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
示例#3
0
        private void CopyCompilationOutput(OutputPaths outputPaths)
        {
            var dest   = outputPaths.RuntimeOutputPath;
            var source = outputPaths.CompilationOutputPath;

            // No need to copy if dest and source are the same
            if (string.Equals(dest, source, StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            foreach (var file in outputPaths.CompilationFiles.All())
            {
                var destFileName  = file.Replace(source, dest);
                var directoryName = Path.GetDirectoryName(destFileName);
                if (!Directory.Exists(directoryName))
                {
                    Directory.CreateDirectory(directoryName);
                }

                if ((file.EndsWith(".pdb") || file.EndsWith(".mdb")) && !File.Exists(file))
                {
                    continue;
                }

                File.Copy(file, destFileName, true);
            }
        }
示例#4
0
 public Executable(ProjectContext context, OutputPaths outputPaths, LibraryExporter exporter)
 {
     _context                = context;
     _outputPaths            = outputPaths;
     _runtimeOutputPath      = outputPaths.RuntimeOutputPath;
     _intermediateOutputPath = outputPaths.IntermediateOutputDirectoryPath;
     _exporter               = exporter;
 }
示例#5
0
 public Executable(ProjectContext context, OutputPaths outputPaths, LibraryExporter exporter, string configuration)
 {
     _context                = context;
     _outputPaths            = outputPaths;
     _runtimeOutputPath      = outputPaths.RuntimeOutputPath;
     _intermediateOutputPath = outputPaths.IntermediateOutputDirectoryPath;
     _exporter               = exporter;
     _compilerOptions        = _context.ProjectFile.GetCompilerOptions(_context.TargetFramework, configuration);
 }
        public DotNetProjectContext(ProjectContext wrappedProject, string configuration, string outputPath)
        {
            _project = wrappedProject;
            _paths   = wrappedProject.GetOutputPaths(configuration, null, outputPath);

            _isExecutable = wrappedProject.ProjectFile.GetCompilerOptions(wrappedProject.TargetFramework, configuration).EmitEntryPoint ?? wrappedProject.ProjectFile.GetCompilerOptions(null, configuration).EmitEntryPoint.GetValueOrDefault();

            _assemblyLoadContext = wrappedProject.CreateLoadContext(configuration);

            Configuration = configuration;
        }
        public DotNetProjectContext(ProjectContext wrappedProject, string configuration, string outputPath)
        {
            Debug.Assert(wrappedProject != null, "wrappedProject is null.");
            Debug.Assert(!string.IsNullOrEmpty(configuration), "configuration is null or empty.");

            _project = wrappedProject;
            _paths   = wrappedProject.GetOutputPaths(configuration, /* buildBasePath: */ null, outputPath);

            // Workaround https://github.com/dotnet/cli/issues/3164
            _isExecutable = wrappedProject.ProjectFile.GetCompilerOptions(wrappedProject.TargetFramework, configuration).EmitEntryPoint
                            ?? wrappedProject.ProjectFile.GetCompilerOptions(null, configuration).EmitEntryPoint.GetValueOrDefault();

            Configuration = configuration;
        }
示例#8
0
        /// <summary>
        /// Filters which export's RuntimeAssets should get copied to the output path.
        /// </summary>
        /// <returns>
        /// True if the asset should be copied to the output path; otherwise, false.
        /// </returns>
        private static bool ShouldCopyExportRuntimeAsset(ProjectContext context, OutputPaths buildOutputPaths, LibraryExport export, LibraryAsset asset)
        {
            // The current project has the host .exe in its runtime assets, but it shouldn't be copied
            // to the output path during publish. The host will come from the export that has the real host in it.

            if (context.RootProject.Identity == export.Library.Identity)
            {
                if (asset.ResolvedPath == buildOutputPaths.RuntimeFiles.Executable)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#9
0
 public UEBuildGame(TargetDescriptor InDesc, TargetRules InRulesObject, RulesAssembly InRulesAssembly, FileReference InTargetCsFilename)
     : base(InDesc, InRulesObject, InRulesAssembly, "UE4", InTargetCsFilename)
 {
     if (ShouldCompileMonolithic())
     {
         if (!UnrealBuildTool.IsDesktopPlatform(Platform))
         {
             // We are compiling for a console...
             // We want the output to go into the <GAME>\Binaries folder
             if (!InRulesObject.bOutputToEngineBinaries)
             {
                 OutputPaths = OutputPaths.Select(Path => new FileReference(Path.FullName.Replace("Engine\\Binaries", InDesc.TargetName + "\\Binaries"))).ToList();
             }
         }
     }
 }
示例#10
0
 public UEBuildGame(TargetDescriptor InDesc, TargetRules InRulesObject, string InTargetCsFilename)
     : base(InDesc, InRulesObject, "UE4", InTargetCsFilename)
 {
     if (ShouldCompileMonolithic())
     {
         if (!UnrealBuildTool.IsDesktopPlatform(Platform) || Platform == UnrealTargetPlatform.WinRT || Platform == UnrealTargetPlatform.WinRT_ARM)
         {
             // We are compiling for a console...
             // We want the output to go into the <GAME>\Binaries folder
             if (!InRulesObject.bOutputToEngineBinaries)
             {
                 OutputPaths = OutputPaths.Select(Path => Path.Replace("Engine\\Binaries", InDesc.TargetName + "\\Binaries")).ToList();
             }
         }
     }
 }
示例#11
0
        private void CopyCompilationOutput(OutputPaths outputPaths)
        {
            var dest   = outputPaths.RuntimeOutputPath;
            var source = outputPaths.CompilationOutputPath;

            foreach (var file in outputPaths.CompilationFiles.All())
            {
                var destFileName  = file.Replace(source, dest);
                var directoryName = Path.GetDirectoryName(destFileName);
                if (!Directory.Exists(directoryName))
                {
                    Directory.CreateDirectory(directoryName);
                }
                File.Copy(file, destFileName, true);
            }
        }
        string ResolveOutputPath(
            IEnumerable <ProjectContext> frameworkContexts,
            BuildWorkspace workspace,
            string configuration,
            IEnumerable <string> rids)
        {
            foreach (ProjectContext frameworkContext in frameworkContexts)
            {
                ProjectContext runtimeContext = workspace.GetRuntimeContext(frameworkContext, rids);

                OutputPaths paths = runtimeContext.GetOutputPaths(configuration);
                if (File.Exists(paths.RuntimeFiles.Executable))
                {
                    return(paths.RuntimeFiles.Executable);
                }
            }

            return(null);
        }
        void HandleProcessEnded()
        {
            OperationResult result = new OperationResult();

            result.ExitCode = _process.ExitCode;

            Output?.Invoke("Process exited with code " + result.ExitCode, result.ExitCode == 0 ? LogVerbosity.Log : LogVerbosity.Error);

            if (_operationParameters.RunTests)
            {
                string     reportFilePath = OutputPaths.GetTestReportFilePath(_operation.GetOutputPath(_operationParameters));
                TestReport report         = TestReport.Load(reportFilePath);
                if (report != null)
                {
                    result.TestReport = report;
                }
                else
                {
                    Output?.Invoke("Expected test report at " + reportFilePath + " but didn't find one", LogVerbosity.Error);
                }

                if (result.TestReport != null)
                {
                    foreach (Test test in result.TestReport.Tests)
                    {
                        Output?.Invoke(EnumUtils.GetName(test.State).ToUpperInvariant().PadRight(7) + " - " + test.FullTestPath, test.State == TestState.Success ? LogVerbosity.Log : LogVerbosity.Error);
                        foreach (TestEntry entry in test.Entries)
                        {
                            if (entry.Event.Type != TestEventType.Info)
                            {
                                Output?.Invoke("".PadRight(9) + " - " + entry.Event.Message, entry.Event.Type == TestEventType.Error ? LogVerbosity.Error : LogVerbosity.Warning);
                            }
                        }
                    }
                    int  testsPassed = result.TestReport.Tests.Count(t => t.State == TestState.Success);
                    bool allPassed   = testsPassed == result.TestReport.Tests.Count;
                    Output?.Invoke(testsPassed + " of " + result.TestReport.Tests.Count + " tests passed", allPassed ? LogVerbosity.Log : LogVerbosity.Error);
                }
            }

            Ended?.Invoke(result);
        }
示例#14
0
 public void Pop()
 {
     OutputPaths.Pop();
 }
示例#15
0
文件: Executable.cs 项目: wtgodbe/cli
 public Executable(ProjectContext context, OutputPaths outputPaths, LibraryExporter exporter, string configuration)
     : this(context, outputPaths, outputPaths.RuntimeOutputPath, outputPaths.IntermediateOutputDirectoryPath, exporter, configuration)
 {
 }
示例#16
0
 public Executable(ProjectContext context, OutputPaths outputPaths, LibraryExporter exporter)
 {
     _context     = context;
     _outputPaths = outputPaths;
     _exporter    = exporter;
 }