private string GetDebugType(BuildEnvironment environment, Csc csc) { var debugType = csc.DebugType; var evaluated = _expressionEngine.EvaluateExpression(debugType, environment); return(evaluated); }
private static void BuildWorkerForTarget(string workerType, BuildTarget buildTarget, BuildOptions buildOptions, BuildEnvironment targetEnvironment) { Debug.LogFormat("Building \"{0}\" for worker platform: \"{1}\", environment: \"{2}\"", buildTarget, workerType, targetEnvironment); var spatialOSBuildConfiguration = SpatialOSBuildConfiguration.instance; var workerBuildData = new WorkerBuildData(workerType, buildTarget); var scenes = spatialOSBuildConfiguration.GetScenePathsForWorker(workerType); var buildPlayerOptions = new BuildPlayerOptions { options = buildOptions, target = buildTarget, scenes = scenes, locationPathName = workerBuildData.BuildScratchDirectory }; var result = BuildPipeline.BuildPlayer(buildPlayerOptions); if (result.summary.result != BuildResult.Succeeded) { throw new BuildFailedException($"Build failed for {workerType}"); } var zipPath = Path.Combine(PlayerBuildDirectory, workerBuildData.PackageName); var basePath = Path.Combine(EditorPaths.BuildScratchDirectory, workerBuildData.PackageName); Zip(zipPath, basePath, targetEnvironment == BuildEnvironment.Cloud); }
internal static Packager PreparePackager(string configuration, ILogger logger) { try { var be = new BuildEnvironment() { NugetPaths = /*new List<string> */ { @"C:\nuget\nuget.exe", "nuget.exe" }, Configuration = configuration }; return(new Packager { Packagers = { new FolderPackager(logger), new WinRTPackager(be, logger), new Win32Packager(be, logger) } }); } catch (Exception ex) { Debug.Write("Prepare Package error: " + ex.Message); } throw new NotImplementedException(); }
public void Run(BuildEnvironment environment, Node task, IProjectDependencyGraph graph, ILogger logger) { var resolve = (ResolveAssemblyReference)task; var assemblies = _expressionEngine.EvaluateItemList(resolve.Assemblies, environment); var rootPath = environment.Properties[Properties.MSBuildProjectDirectory]; var builder = new StringBuilder(); for (int i = 0; i < assemblies.Length; ++i) { var fileName = ResolveReference(assemblies[i], rootPath); if (fileName != null) { builder.Append(fileName); builder.Append(Tokenizer.ItemListSeparator); } } if (builder.Length > 0) { builder.Remove(builder.Length - 1, 1); } environment.Output["ResolvedFiles"] = builder.ToString(); }
public Lists(BuildEnvironment environment) : base(environment) { Observable.Interval(TimeSpan.FromSeconds(1)).Take(100).Do(x => this.SetModel((int)x)). Subscribe(); }
private bool GetNoLogo(BuildEnvironment environment, Csc csc) { var target = csc.NoLogo; var evaluated = _expressionEngine.EvaluateCondition(target, environment); return(evaluated); }
public void TestEvaluateItem1() { var item = new ProjectItem("Compile", "Build.exe"); var environment = new BuildEnvironment { Properties = { { Properties.MSBuildProjectDirectory, Directory.GetCurrentDirectory() } } }; _engine.Evaluate(item, environment); environment.Items.Count().Should().Be(1); var evaluated = environment.Items.First(); evaluated.Type.Should().Be("Compile"); evaluated.Include.Should().Be("Build.exe"); evaluated.Metadata.Count().Should().Be(10); evaluated[Metadatas.Extension].Should().Be(".exe"); evaluated[Metadatas.Filename].Should().Be("Build"); evaluated[Metadatas.Identity].Should().Be("Build.exe"); evaluated[Metadatas.RootDir].Should().Be(System.IO.Path.GetPathRoot(Directory.GetCurrentDirectory())); evaluated[Metadatas.RelativeDir].Should().Be(string.Empty); evaluated[Metadatas.RecursiveDir].Should().Be(string.Empty); evaluated[Metadatas.FullPath].Should().Be(Path.Combine(Directory.GetCurrentDirectory(), "Build.exe")); }
/// <summary> /// Creates a new HTTPS-only web host /// </summary> /// <param name="ipAddress">The IP address of the host</param> /// <param name="port">The port of the host</param> /// <param name="certificate">The name of the SSL certificate to use</param> /// <returns></returns> public IWebHost CreateHttps(IPAddress ipAddress, int?port = 443, X509Certificate2 certificate = null) { var environment = BuildEnvironment.GetBuildEnvironment(); Console.WriteLine($"Build Environment: {environment.EnvironmentName}"); var host = Microsoft.AspNetCore.WebHost .CreateDefaultBuilder() .ConfigureKestrel(options => { if (certificate != null) { options.ConfigureHttpsDefaults(opt => { opt.ServerCertificate = certificate; opt.ClientCertificateMode = ClientCertificateMode.AllowCertificate; }); } options.Listen(ipAddress, port.Value, c => { if (certificate != null) { c.UseHttps(certificate); } }); }) .UseEnvironment(environment.EnvironmentName) .UseStartup <Startup>() .ConfigureLogging(logging => { // todo: }) .UseNLog(); return(host.Build()); }
private List <Target> TryFindTargets( BuildEnvironment environment, ILogger logger, IReadOnlyDictionary <string, Target> availableTargets, string expression) { var targetNames = _expressionEngine.EvaluateExpression(expression, environment) .Split(new[] { Tokenizer.ItemListSeparator }, StringSplitOptions.RemoveEmptyEntries); var targets = new List <Target>(targetNames.Length); for (var i = 0; i < targetNames.Length; ++i) { var name = targetNames[i].Trim(); if (!string.IsNullOrEmpty(name)) { Target target; if (!availableTargets.TryGetValue(name, out target)) { logger.WriteWarning("No such target \"{0}\"", name); } else { targets.Add(target); } } } return(targets); }
internal ProjectAnalyzer(AnalyzerManager manager, string projectFilePath, XDocument projectDocument) { Manager = manager; ProjectFilePath = projectFilePath; var projectFolder = Path.GetDirectoryName(projectFilePath); _projectDocument = TweakProjectDocument(projectDocument, projectFolder); // Get the paths _buildEnvironment = EnvironmentFactory.GetBuildEnvironment(projectFilePath, _projectDocument); // Preload/enforce referencing some required assemblies // ReSharper disable once UnusedVariable var copy = new Copy(); var solutionDir = manager.SolutionDirectory ?? projectFolder; _globalProperties = _buildEnvironment.GetGlobalProperties(solutionDir); // Create the logger if (manager.ProjectLogger != null) { _logger = new ConsoleLogger(manager.LoggerVerbosity, x => manager.ProjectLogger.LogInformation(x), null, null); } }
private string GetDefines(BuildEnvironment environment, Csc csc) { var defines = csc.DefineConstants; var evaluated = _expressionEngine.EvaluateExpression(defines, environment); return(evaluated); }
public void TestEvaluateProject2() { var item = new ItemGroup { new ProjectItem { Type = "None", Include = "foo.txt" } }; var project = new Project { Filename = @"C:\work\interestingproject\foo.csproj", ItemGroups = { item } }; var environment = new BuildEnvironment(); _engine.Evaluate(project, environment); environment.Items.Count().Should().Be(1); var actualItem = environment.Items.First(); actualItem.Should().NotBeNull(); actualItem.Include.Should().Be("foo.txt"); actualItem[Metadatas.FullPath].Should().Be(@"C:\work\interestingproject\foo.txt"); actualItem[Metadatas.Directory].Should().Be(@"work\interestingproject\"); actualItem[Metadatas.Extension].Should().Be(".txt"); actualItem[Metadatas.Filename].Should().Be("foo"); actualItem[Metadatas.Identity].Should().Be("foo.txt"); actualItem[Metadatas.RelativeDir].Should().Be(""); actualItem[Metadatas.RootDir].Should().Be(@"C:\"); }
private string GetErrorReport(BuildEnvironment environment, Csc csc) { var error = csc.ErrorReport; var evaluated = _expressionEngine.EvaluateExpression(error, environment); return(evaluated); }
private string GetDisabledWarnings(BuildEnvironment environment, Csc csc) { var disabled = csc.DisabledWarnings; var evaluated = _expressionEngine.EvaluateExpression(disabled, environment); return(evaluated); }
private bool HighEntropyVA(BuildEnvironment environment, Csc csc) { var entropy = csc.HighEntropyVA; var evaluated = _expressionEngine.EvaluateCondition(entropy, environment); return(evaluated); }
private string GetFileAlignment(BuildEnvironment environment, Csc csc) { var alignment = csc.FileAlignment; var evaluated = _expressionEngine.EvaluateExpression(alignment, environment); return(evaluated); }
private string GetOutputAssembly(BuildEnvironment environment, Csc csc) { var asm = csc.OutputAssembly; var evaluated = _expressionEngine.EvaluateExpression(asm, environment); return(evaluated); }
private string GetBaseAddress(BuildEnvironment environment, Csc csc) { var address = csc.BaseAddress; var evaluated = _expressionEngine.EvaluateExpression(address, environment); return(evaluated); }
public IProject CreateCodeBuildProject(string identification, string projectName, IRole role, Dictionary <string, object> buildSpec, IBuildImage buildImage = null, ComputeType?computeType = null, bool enableIndependentTrigger = false) { if (buildImage == null) { buildImage = LinuxBuildImage.AMAZON_LINUX_2_3; } if (computeType == null) { computeType = ComputeType.SMALL; } var buildEnvironment = new BuildEnvironment { BuildImage = buildImage, ComputeType = computeType }; var buildSpecObject = BuildSpec.FromObject(buildSpec); if (enableIndependentTrigger) { return(HandlerResources.AwsCdkCodeBuildHandler.CreateCodeBuildProject(identification, projectName, role, buildSpecObject, buildEnvironment)); } else { return(HandlerResources.AwsCdkCodeBuildHandler.CreateCodeBuildPipelineProject(identification, projectName, role, buildSpecObject, buildEnvironment)); } }
public void ToItemList(IFileSystem fileSystem, BuildEnvironment environment, List <ProjectItem> items) { foreach (var item in _arguments) { item.ToItemList(fileSystem, environment, items); } }
public static List <ApplicationBuild> GetLastestBuildsByApplicationAndEnvironment(int appId, string environmentName) { List <ApplicationBuild> retval = new List <ApplicationBuild>(); using (var context = new Repository.BetaDepotContext()) { BuildEnvironment e = context.Environments.Where(w => w.EnvironmentName == environmentName).FirstOrDefault(); int environmentId = e == null ? -1 : e.Id; var latestBuilds = (from b in context.Builds where (b.Application == context.Applications.Where(w => w.Id == appId).FirstOrDefault()) && (b.Environment == context.Environments.Where(w => w.Id == environmentId).FirstOrDefault()) group b by b.Id into g select new { buildId = g.Key, Date = g.Max(t => t.AddedDtm) }).ToList(); var join = from l in latestBuilds join b in context.Builds on l.buildId equals b.Id select b; retval = join.ToList(); } return(retval); }
private static void CheckExpectedSettings( TeamBuildSettings actual, BuildEnvironment expectedEnvironment, string expectedAnalysisDir, string expectedBuildUri, string expectedCollectionUri, string expectedBuildDir, string expectedSourcesDir) { actual.Should().NotBeNull("Returned settings should never be null"); actual.BuildEnvironment.Should().Be(expectedEnvironment, "Unexpected build environment returned"); actual.AnalysisBaseDirectory.Should().Be(expectedAnalysisDir, "Unexpected analysis base directory returned"); actual.BuildDirectory.Should().Be(expectedBuildDir, "Unexpected build directory returned"); actual.BuildUri.Should().Be(expectedBuildUri, "Unexpected build uri returned"); actual.TfsUri.Should().Be(expectedCollectionUri, "Unexpected tfs uri returned"); if (actual.BuildEnvironment == BuildEnvironment.NotTeamBuild) { actual.SourcesDirectory.Should().BeNull("Should not be able to set the sources directory"); } else { actual.SourcesDirectory.Should().Be(expectedSourcesDir, "Unexpected sources directory returned"); } // Check the calculated values actual.SonarConfigDirectory.Should().Be(Path.Combine(expectedAnalysisDir, "conf"), "Unexpected config dir"); actual.SonarOutputDirectory.Should().Be(Path.Combine(expectedAnalysisDir, "out"), "Unexpected output dir"); actual.SonarBinDirectory.Should().Be(Path.Combine(expectedAnalysisDir, "bin"), "Unexpected bin dir"); actual.AnalysisConfigFilePath.Should().Be(Path.Combine(expectedAnalysisDir, "conf", FileConstants.ConfigFileName), "Unexpected analysis file path"); actual.SonarScannerWorkingDirectory.Should().Be(Directory.GetParent(expectedAnalysisDir).FullName, "Unexpected sonar-scanner working dir"); }
private static void BuildWorkerForTarget(string workerType, BuildTarget buildTarget, BuildOptions buildOptions, BuildEnvironment targetEnvironment) { Debug.Log($"Building \"{buildTarget}\" for worker platform: \"{workerType}\", environment: \"{targetEnvironment}\""); var spatialOSBuildConfiguration = SpatialOSBuildConfiguration.GetInstance(); var workerBuildData = new WorkerBuildData(workerType, buildTarget); var scenes = spatialOSBuildConfiguration.GetScenePathsForWorker(workerType); var buildPlayerOptions = new BuildPlayerOptions { options = buildOptions, target = buildTarget, scenes = scenes, locationPathName = workerBuildData.BuildScratchDirectory }; var result = BuildPipeline.BuildPlayer(buildPlayerOptions); if (result.summary.result != BuildResult.Succeeded) { throw new BuildFailedException($"Build failed for {workerType}"); } if (buildTarget == BuildTarget.Android || buildTarget == BuildTarget.iOS) { // Mobile clients can only be run locally, no need to package them return; } var zipPath = Path.Combine(PlayerBuildDirectory, workerBuildData.PackageName); var basePath = Path.Combine(EditorPaths.BuildScratchDirectory, workerBuildData.PackageName); Zip(zipPath, basePath, targetEnvironment == BuildEnvironment.Cloud); }
public void Run(BuildEnvironment environment, Node task, IProjectDependencyGraph graph, ILogger logger) { var copy = (Copy)task; ProjectItem[] sourceFiles = _expressionEngine.EvaluateItemList(copy.SourceFiles, environment); ProjectItem[] destinationFiles = _expressionEngine.EvaluateItemList(copy.DestinationFiles, environment); if (sourceFiles.Length != destinationFiles.Length) { throw new BuildException( string.Format("SourceFiles and DestinationFiles must be of the same length, but \"{0}\" and \"{1}\" are not", sourceFiles.Length, destinationFiles.Length)); } string directory = environment.Properties[Properties.MSBuildProjectDirectory]; var copied = new ProjectItem[sourceFiles.Length]; for (int i = 0; i < sourceFiles.Length; ++i) { ProjectItem source = sourceFiles[i]; ProjectItem destination = destinationFiles[i]; if (Copy(directory, source, destination, logger)) { copied[i] = destination; } } }
public override CSResult BuildToCS(BuildEnvironment Env) { CSLineList cs = new CSLineList(); if (Env.CurrentContext.VariableExists(Variable.Name)) { BuildVariable existingVar = Env.CurrentContext.GetVariable(Variable.Name); if (existingVar.Type != BuildVariableType.String) { existingVar.Type = BuildVariableType.String; existingVar.CodeCount++; cs.Add(existingVar.CSType + " " + existingVar.CodeName + " = Console.ReadLine();", T.LineNumber); } else { cs.Add(existingVar.CodeName + " = Console.ReadLine();", T.LineNumber); } } else { BuildVariable newVar = new BuildVariable(BuildVariableType.String, Variable.Name); Env.CurrentContext.AddVariable(newVar); cs.Add(newVar.CSType + " " + newVar.CodeName + " = Console.ReadLine();", T.LineNumber); } return(new CSResult() { GeneratedCS = cs }); }
public object Evaluate(IFileSystem fileSystem, BuildEnvironment environment) { var value = Parameter.ToString(fileSystem, environment); switch (Operation) { case FunctionOperation.Exists: return(Exists(fileSystem, environment, value)); case FunctionOperation.HasTrailingSlash: var path = value; if (path == null) { return(false); } if (path.EndsWith("\\")) { return(true); } if (path.EndsWith("/")) { return(true); } return(false); default: throw new InvalidEnumArgumentException("Operation", (int)Operation, typeof(FunctionOperation)); } }
public override CSResult BuildToCS(BuildEnvironment Env) { if (ToSay is VariableParseNode) { VariableParseNode vpn = ToSay as VariableParseNode; if (Env.CurrentContext.VariableExists(vpn.Name)) { BuildVariable variable = Env.CurrentContext.GetVariable(vpn.Name); return(new CSResult() { GeneratedCS = new CSLineList() { new CSLine("Console.Write(" + variable.Name + ");", T.LineNumber) } }); } return(new CSResult() { GeneratedCS = new CSLineList() { new CSLine("Console.Write(\"mysterious\");", T.LineNumber) } }); } else { throw new NotImplementedException(); } }
public RunCommand(BuildEnvironment buildEnv, ITestOutputHelper _testOutput, string label = "") : base(buildEnv, _testOutput, false, label) { WithEnvironmentVariable("DOTNET_ROOT", buildEnv.DotNet); WithEnvironmentVariable("DOTNET_INSTALL_DIR", Path.GetDirectoryName(buildEnv.DotNet) !); WithEnvironmentVariable("DOTNET_MULTILEVEL_LOOKUP", "0"); WithEnvironmentVariable("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", "1"); }
public BuildDriver(Log log, BuildTarget target, BuildOptions options, Project project, UnoConfig config) : base(log) { _target = target; _options = options; _project = project; _config = config; Log.MaxErrorCount = options.MaxErrorCount; Log.WarningLevel = options.WarningLevel; Log.Reset(); if (target.IsObsolete) { Log.Warning("The build target " + target.Quote() + " is obsolete and might not work any more."); } _anim = Log.StartAnimation("Configuring"); PrintRow("Project file", project.FullPath); _compilerOptions = new CompilerOptions { BuildTarget = _target.Identifier, Configuration = _options.Configuration.ToString(), OutputDirectory = !string.IsNullOrEmpty(_options.OutputDirectory) ? Path.GetFullPath(_options.OutputDirectory) : project.OutputDirectory, MainClass = _options.MainClass, Debug = _options.Configuration != BuildConfiguration.Release, Parallel = _options.Parallel, Strip = _options.Strip ?? _target.DefaultStrip, CanCacheIL = _options.PackageCache != null }; if (_options.Test) { _options.Defines.Add("UNO_TEST"); _compilerOptions.TestOptions = new TestOptions { TestServerUrl = _options.TestServerUrl, Filter = _options.TestFilter }; } _cache = _options.PackageCache ?? new PackageCache(Log, _config); PrintRow("Search paths", _cache.SearchPaths); _compiler = new Compiler( Log, _target.CreateBackend(config), GetPackage(), _compilerOptions); _env = _compiler.Environment; _backend = _compiler.Backend; _input = _compiler.Input; if (_options.Clean) { _compiler.Disk.DeleteDirectory(_env.OutputDirectory); } _file = new BuildFile(_env.OutputDirectory); }
public void Run(BuildEnvironment environment, Node task, IProjectDependencyGraph graph, ILogger logger) { var error = (Error)task; string text = _expressionEngine.EvaluateExpression(error.Text, environment); logger.WriteError(" {0}", text); }
public static void EnableServiceMessages(this ILogger log) { serviceMessagesEnabled = true; buildEnvironment = (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("BUILD_BUILDID")) && string.IsNullOrEmpty(Environment.GetEnvironmentVariable("AGENT_WORKFOLDER"))) ? string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TEAMCITY_VERSION")) ? BuildEnvironment.NoneOrUnknown : BuildEnvironment.TeamCity : BuildEnvironment.TeamFoundationBuild; log.Information("Build environment is {Environment:l}", buildEnvironment); }
public static void EnableServiceMessages(this ILog log) { serviceMessagesEnabled = true; buildEnvironment = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("BUILD_BUILDID")) ? string.IsNullOrEmpty(Environment.GetEnvironmentVariable("TEAMCITY_VERSION")) ? BuildEnvironment.NoneOrUnknown : BuildEnvironment.TeamCity : BuildEnvironment.TeamFoundationBuild; log.InfoFormat("Build environment is {0}", buildEnvironment); }
static LogExtensions() { serviceMessagesEnabled = false; buildEnvironment = BuildEnvironment.NoneOrUnknown; // As per: http://confluence.jetbrains.com/display/TCD65/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages Escapes = new Dictionary<string, string> { {"|", "||"}, {"'", "|'"}, {"\n", "|n"}, {"\r", "|r"}, {"\u0085", "|x"}, {"\u2028", "|l"}, {"\u2029", "|p"}, {"[", "|["}, {"]", "|]"} }; }
private static void CheckExpectedSettings(TeamBuildSettings actual, BuildEnvironment expectedEnvironment, string expectedAnalysisDir, string expectedBuildUri, string expectedCollectionUri, string expectedBuildDir) { Assert.IsNotNull(actual, "Returned settings should never be null"); Assert.AreEqual(expectedEnvironment, actual.BuildEnvironment, "Unexpected build environment returned"); Assert.AreEqual(expectedAnalysisDir, actual.AnalysisBaseDirectory, "Unexpected analysis base directory returned"); Assert.AreEqual(expectedBuildDir, actual.BuildDirectory, "Unexpected build directory returned"); Assert.AreEqual(expectedBuildUri, actual.BuildUri, "Unexpected build uri returned"); Assert.AreEqual(expectedCollectionUri, actual.TfsUri, "Unexpected tfs uri returned"); // Check the calculated values Assert.AreEqual(Path.Combine(expectedAnalysisDir, "conf"), actual.SonarConfigDirectory, "Unexpected config dir"); Assert.AreEqual(Path.Combine(expectedAnalysisDir, "out"), actual.SonarOutputDirectory, "Unexpected output dir"); Assert.AreEqual(Path.Combine(expectedAnalysisDir, "bin"), actual.SonarBinDirectory, "Unexpected bin dir"); Assert.AreEqual(Path.Combine(expectedAnalysisDir, "conf", FileConstants.ConfigFileName), actual.AnalysisConfigFilePath, "Unexpected analysis file path"); }
private static void CheckExpectedSettings( TeamBuildSettings actual, BuildEnvironment expectedEnvironment, string expectedAnalysisDir, string expectedBuildUri, string expectedCollectionUri, string expectedBuildDir, string expectedSourcesDir) { Assert.IsNotNull(actual, "Returned settings should never be null"); Assert.AreEqual(expectedEnvironment, actual.BuildEnvironment, "Unexpected build environment returned"); Assert.AreEqual(expectedAnalysisDir, actual.AnalysisBaseDirectory, "Unexpected analysis base directory returned"); Assert.AreEqual(expectedBuildDir, actual.BuildDirectory, "Unexpected build directory returned"); Assert.AreEqual(expectedBuildUri, actual.BuildUri, "Unexpected build uri returned"); Assert.AreEqual(expectedCollectionUri, actual.TfsUri, "Unexpected tfs uri returned"); if (actual.BuildEnvironment == BuildEnvironment.NotTeamBuild) { Assert.IsNull(actual.SourcesDirectory, "Should not be able to set the sources directory"); } else { Assert.AreEqual(expectedSourcesDir, actual.SourcesDirectory, "Unexpected sources directory returned"); } // Check the calculated values Assert.AreEqual(Path.Combine(expectedAnalysisDir, "conf"), actual.SonarConfigDirectory, "Unexpected config dir"); Assert.AreEqual(Path.Combine(expectedAnalysisDir, "out"), actual.SonarOutputDirectory, "Unexpected output dir"); Assert.AreEqual(Path.Combine(expectedAnalysisDir, "bin"), actual.SonarBinDirectory, "Unexpected bin dir"); Assert.AreEqual(Path.Combine(expectedAnalysisDir, "conf", FileConstants.ConfigFileName), actual.AnalysisConfigFilePath, "Unexpected analysis file path"); Assert.AreEqual(Directory.GetParent(expectedAnalysisDir).FullName, actual.SonarRunnerWorkingDirectory, "Unexpected sonar-runner working dir"); }