public static async Task <bool> BuildAsync(MonoBuildInfo buildInfo) { if (BuildsInProgress.Contains(buildInfo)) { throw new InvalidOperationException("A build is already in progress"); } BuildsInProgress.Add(buildInfo); try { MonoBuildTab buildTab = GodotSharpEditor.Instance.MonoBottomPanel.GetBuildTabFor(buildInfo); try { RemoveOldIssuesFile(buildInfo); } catch (IOException e) { buildTab.OnBuildExecFailed($"Cannot remove issues file: {GetIssuesFilePath(buildInfo)}"); Console.Error.WriteLine(e); } try { int exitCode = await BuildSystem.BuildAsync(buildInfo); if (exitCode != 0) { PrintVerbose($"MSBuild exited with code: {exitCode}. Log file: {GetLogFilePath(buildInfo)}"); } buildTab.OnBuildExit(exitCode == 0 ? MonoBuildTab.BuildResults.Success : MonoBuildTab.BuildResults.Error); return(exitCode == 0); } catch (Exception e) { buildTab.OnBuildExecFailed($"The build method threw an exception.\n{e.GetType().FullName}: {e.Message}"); Console.Error.WriteLine(e); return(false); } } finally { BuildsInProgress.Remove(buildInfo); } }
public override void StopAction() // stops any action that is meant to be used like placing object or building { buildSystem = (GameObject.FindGameObjectWithTag("BuildSystem")).GetComponent <BuildSystem>(); if (isStructure) { buildSystem.CancelBuild(); } else if (isFurniture) { buildSystem.CancelFurniturePlacement(); } else { Debug.Log("Not structure nor furniture"); } }
public void Should_Return_False_If_Running_On_TeamCity() { // Given var appVeyorProvider = Substitute.For <IAppVeyorProvider>(); var teamCityProvider = Substitute.For <ITeamCityProvider>(); appVeyorProvider.IsRunningOnAppVeyor.Returns(false); teamCityProvider.IsRunningOnTeamCity.Returns(true); var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider); // When var result = buildSystem.IsLocalBuild; // Then Assert.False(result); }
public CommonTarget( Platform platform, DevEnv devEnv, Optimization optimization, Blob blob, BuildSystem buildSystem, Android.AndroidBuildType androidBuildType ) { Platform = platform; DevEnv = devEnv; Optimization = optimization; Blob = blob; BuildSystem = buildSystem; AndroidBuildType = androidBuildType; }
public CommonTarget( Platform platform, Compiler compiler, DevEnv devEnv, Optimization optimization, Blob blob, BuildSystem buildSystem ) { Platform = platform; Compiler = compiler; DevEnv = devEnv; Optimization = optimization; Blob = blob; BuildSystem = buildSystem; }
public override void Place() { buildSystem = (GameObject.FindGameObjectWithTag("BuildSystem")).GetComponent <BuildSystem>(); if (isStructure) { buildSystem.NewBuild(placeablePrefab); } else if (isFurniture) { buildSystem.NewFurniture(placeablePrefab); } else { Debug.Log("Not structure nor furniture"); } }
public bool Run(BuildSystem.ProcessTextReceivedDelegate textReceived, string target, params string[] parameters) { if (string.IsNullOrWhiteSpace(target)) { throw new ArgumentNullException("target"); } var arguments = string.Format("/t:{0}{1}", target, string.Join("", parameters.Select(p => string.Format(" /p:{0}", p)))); var buildSystem = BuildSystem.StartRunProcess(Executable, string.Join(" ", arguments), Environment.CurrentDirectory, textReceived: textReceived); buildSystem.WaitForExit(); return(buildSystem.ExitCode != 0); }
public static MsbuildRunnerResult BuildProject(BuildSystem buildSystem, string projectPath, string[] arguments = null, string configuration = "Release", bool?outOfProc = null, string verbosityLevel = "normal") { var allArgs = new List <string> { $"-verbosity:{verbosityLevel}", $"-p:Configuration={configuration}", GetQuotedPropertySwitch(buildSystem, "WixMSBuildProps", MsbuildUtilities.WixPropsPath), // Node reuse means that child msbuild processes can stay around after the build completes. // Under that scenario, the root msbuild does not reliably close its streams which causes us to hang. "-nr:false", }; if (outOfProc.HasValue) { allArgs.Add($"-p:RunWixToolsOutOfProc={outOfProc.Value}"); } if (arguments != null) { allArgs.AddRange(arguments); } switch (buildSystem) { case BuildSystem.DotNetCoreSdk: { allArgs.Add(projectPath); var result = DotnetRunner.Execute("msbuild", allArgs.ToArray()); return(new MsbuildRunnerResult { ExitCode = result.ExitCode, Output = result.StandardOutput, }); } case BuildSystem.MSBuild: case BuildSystem.MSBuild64: { return(MsbuildRunner.Execute(projectPath, allArgs.ToArray(), buildSystem == BuildSystem.MSBuild64)); } default: { throw new NotImplementedException(); } } }
public void Build_Positive_PerformCommandLineDevelopmentBuildTest() { string scenes = "Assets/Editor/Build/Tests/Scenes/BuildScene.unity Assets/Editor/Build/Tests/Scenes/BuildScene2.unity"; string locationPath = Path.Combine("Build/BuildEditorTest", Path.Combine(BuildTarget.StandaloneWindows64.ToString(), Application.productName + ".exe")); string[] expectedArguments = new[] { "--DevBuild", "--Target Windows64", "--Path " + locationPath, "--Scenes " + scenes }; BuildOptions options = BuildOptions.Development | BuildOptions.AllowDebugging; BuildSystem.m_commandLine.GetCommandLineArgs().Returns(expectedArguments); BuildSummary summary = BuildSystem.CommandLineBuild(); BuildSystem.m_commandLine.Received().GetCommandLineArgs(); Assert.AreEqual(BuildResult.Succeeded, summary.result, "Commandline build did not yield in succcess"); Assert.AreEqual(options, summary.options, "Did not return the correct BuildOptions"); }
/// <summary> /// /// </summary> /// <param name="system"></param> public BuildContext(BuildSystem system, BuildType type) { _buildType = type; _buildState = BuildState.None; _buildSystem = system; _properties = new BuildProperties(); _objects = new BuildDictionary <object>(); _targetPlatform = String.Empty; _targetConfiguration = String.Empty; _tocContext = new BuildTocContext(); _buildOutputs = new List <BuildTuple <BuildFormatType, string> >(); // Reset to the default properties this.Reset(); }
public void Should_Return_True_If_Running_On_TeamCity() { // Given var appVeyorProvider = Substitute.For <IAppVeyorProvider>(); var teamCityProvider = Substitute.For <ITeamCityProvider>(); var myGetProvider = Substitute.For <IMyGetProvider>(); var bambooProvider = Substitute.For <IBambooProvider>(); teamCityProvider.IsRunningOnTeamCity.Returns(true); var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider); // When var result = buildSystem.IsRunningOnTeamCity; // Then Assert.True(result); }
private void Start() { //Initializing variables _buildSystem = GameObject.Find("UniversalManager").GetComponent <BuildSystem>(); spawnSystem = GameObject.Find("UniversalManager").GetComponent <EnemySpawnSystem>(); _player = GameObject.Find("Player").GetComponent <Player>(); //Difficulty is increased by increasing the health of the enemy. //Health/Bounty is scaled by the current wave and a specified scale factor. float healthScale = (health * scaleFactor); health += (healthScale * spawnSystem.currentWave); float bountyScale = (float)(bounty * moneyScaleFactor); bounty += (int)(bountyScale * spawnSystem.currentWave); baseHealth = health; }
/// <summary> /// Returns cached dependency for GoddamnEngine project. /// </summary> /// <returns>Cached dependency for GoddamnEngine project.</returns> public static Dependency GetGoddamnEngineDependency() { if (s_GoddamnEngineDependency == null) { var goddamnEngineDependencyPath = Path.Combine(BuildSystem.GetSdkLocation(), "Source", "Projects", "GoddamnEngine", "GoddamnEngine.gddep.cs"); if (File.Exists(goddamnEngineDependencyPath)) { s_GoddamnEngineDependency = DependencyFactory.Create(goddamnEngineDependencyPath); Debug.Assert(s_GoddamnEngineDependency.Enumerator is ProjectDependencyEnumerator); } else { throw new BuildSystemException("GoddamnEngine dependency was not found at \"{0}\".", goddamnEngineDependencyPath); } } return(s_GoddamnEngineDependency); }
public void CanBuildSimpleMsiPackageWithIceSuppressions(BuildSystem buildSystem) { var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); using (var fs = new TestDataFolderFileSystem()) { fs.Initialize(sourceFolder); var baseFolder = fs.BaseFolder; var binFolder = Path.Combine(baseFolder, @"bin\"); var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] { MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "SuppressIces", "ICE45;ICE46"), }); result.AssertSuccess(); } }
public Target( Platform platform, DevEnv devEnv, Optimization optimization, OutputType outputType = OutputType.Lib, Blob blob = Blob.NoBlob, BuildSystem buildSystem = BuildSystem.MSBuild, DotNetFramework framework = DotNetFramework.v3_5 ) { Platform = platform; DevEnv = devEnv; Optimization = optimization; OutputType = outputType; Framework = framework; BuildSystem = buildSystem; Blob = blob; }
public void BuildTest_NoConfig() { var projectMock = new Mock <IProject>(MockBehavior.Strict); bool CreateDefaults = false; BuildSystem target = new BuildSystem(projectMock.Object, CreateDefaults); try { target.Build(); } catch (Exception ex) { if (!ex.Message.Contains("config")) { Assert.Fail("Incorrect exception"); } } Assert.Fail("Exception was not thrown"); }
public void Should_Return_True_If_Running_On_Bitrise() { // Given var appVeyorProvider = Substitute.For <IAppVeyorProvider>(); var teamCityProvider = Substitute.For <ITeamCityProvider>(); var myGetProvider = Substitute.For <IMyGetProvider>(); var bambooProvider = Substitute.For <IBambooProvider>(); var continuaCIProvider = Substitute.For <IContinuaCIProvider>(); var jenkinsProvider = Substitute.For <IJenkinsProvider>(); var bitriseProvider = Substitute.For <IBitriseProvider>(); bitriseProvider.IsRunningOnBitrise.Returns(true); var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider, jenkinsProvider, bitriseProvider); // When var result = buildSystem.IsRunningOnBitrise; // Then Assert.True(result); }
public void CanBuildSimpleMsiPackageWithWarningSuppressions(BuildSystem buildSystem) { var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); using (var fs = new TestDataFolderFileSystem()) { fs.Initialize(sourceFolder); var baseFolder = fs.BaseFolder; var binFolder = Path.Combine(baseFolder, @"bin\"); var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] { MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "SuppressSpecificWarnings", "1118;1102"), }); result.AssertSuccess(); var warnings = result.Output.Where(line => line.Contains(": warning")); Assert.Empty(warnings); } }
public static string GetQuotedPropertySwitch(BuildSystem buildSystem, string propertyName, string valueToQuote) { switch (buildSystem) { case BuildSystem.DotNetCoreSdk: { return($"-p:{propertyName}=\\\"{valueToQuote}\\\""); } case BuildSystem.MSBuild: case BuildSystem.MSBuild64: { return($"-p:{propertyName}=\"{valueToQuote}\""); } default: { throw new NotImplementedException(); } } }
public void ReportsInnerExceptionForUnexpectedExceptions(BuildSystem buildSystem) { var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); using (var fs = new TestDataFolderFileSystem()) { fs.Initialize(sourceFolder); var baseFolder = fs.BaseFolder; var binFolder = Path.Combine(baseFolder, @"bin\"); var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] { MsbuildUtilities.GetQuotedPropertySwitch(buildSystem, "WixToolDir", Path.Combine(MsbuildUtilities.WixMsbuildPath, "broken", "net461")), }, outOfProc: true); Assert.Equal(1, result.ExitCode); var expectedMessage = "System.PlatformNotSupportedException: Could not find platform specific 'wixnative.exe' ---> System.IO.FileNotFoundException: Could not find internal piece of WiX Toolset from"; Assert.Contains(result.Output, m => m.Contains(expectedMessage)); } }
public void Should_Return_True_If_Not_Running_On_Any() { // Given var appVeyorProvider = Substitute.For <IAppVeyorProvider>(); var teamCityProvider = Substitute.For <ITeamCityProvider>(); var myGetProvider = Substitute.For <IMyGetProvider>(); var bambooProvider = Substitute.For <IBambooProvider>(); var continuaCIProvider = Substitute.For <IContinuaCIProvider>(); appVeyorProvider.IsRunningOnAppVeyor.Returns(false); teamCityProvider.IsRunningOnTeamCity.Returns(false); myGetProvider.IsRunningOnMyGet.Returns(false); bambooProvider.IsRunningOnBamboo.Returns(false); continuaCIProvider.IsRunningOnContinuaCI.Returns(false); var buildSystem = new BuildSystem(appVeyorProvider, teamCityProvider, myGetProvider, bambooProvider, continuaCIProvider); // When var result = buildSystem.IsLocalBuild; // Then Assert.True(result); }
public void Build_Positive_PerformWithNoScenesSelected() { string locationPath = Path.Combine("Build/BuildEditorTest", Path.Combine(BuildTarget.StandaloneWindows64.ToString(), Application.productName + ".exe")); string[] expectedArguments = new[] { "--DevBuild", "--Target Windows64", "--Path " + locationPath }; BuildOptions options = BuildOptions.Development | BuildOptions.AllowDebugging; // This is for temporary remove any selected scenes in Editor build settings EditorBuildSettingsScene[] tempSceneSettings = EditorBuildSettings.scenes; EditorBuildSettings.scenes = null; BuildSystem.m_commandLine.GetCommandLineArgs().Returns(expectedArguments); BuildSummary summary = BuildSystem.CommandLineBuild(); BuildSystem.m_commandLine.Received().GetCommandLineArgs(); EditorBuildSettings.scenes = tempSceneSettings; Assert.AreEqual(BuildResult.Succeeded, summary.result, "Commandline build did not yield in succcess"); Assert.AreEqual(options, summary.options, "Did not return the correct BuildOptions"); }
public void MainOutputTest() { FilePath outputPath = new FilePath(@"C:\Users\Test\Test.8xp"); var projectMock = new Mock <IProject>(MockBehavior.Strict); var configMock = new Mock <IBuildConfig>(MockBehavior.Strict); var stepMock = new Mock <IInternalBuildStep>(MockBehavior.Strict); var stepsList = new List <IBuildStep>(); configMock.Setup(c => c.Steps).Returns(stepsList); stepMock.Setup(s => s.IsMainOutput).Returns(true).Verifiable(); stepMock.Setup(s => s.OutputFile).Returns(outputPath); stepsList.Add(stepMock.Object); bool CreateDefaults = false; BuildSystem target = new BuildSystem(projectMock.Object, CreateDefaults); target.AddConfig(configMock.Object, true); Assert.AreEqual(outputPath, target.MainOutput); configMock.Verify(); stepMock.Verify(); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is BaseTool) { BaseTool baseTool = targeted as BaseTool; if (baseTool.CraftSystem == Engines.Craft.DefCarpentry.CraftSystem) { WoodworkersTool tool = new WoodworkersTool(baseTool.UsesRemaining, baseTool.ItemID); tool.Name = baseTool.DefaultName + ": a Woodworker's Tool"; if (from.AddToBackpack(tool)) { baseTool.Delete(); from.SendGump(new BuildGump(from, DefWoodworking.BuildSystem, tool, "")); } } else { from.SendMessage("That is not a woodworking tool."); } } else if (targeted is BaseBuildingTool) { BaseBuildingTool tool = targeted as BaseBuildingTool; BuildSystem syst = tool.BuildSystem; if (syst == DefWoodworking.BuildSystem) { from.SendGump(new BuildGump(from, syst, tool, "")); } else { from.SendMessage("That is not a woodworking tool."); } } else { from.SendMessage("That is not a woodworking tool."); } }
private void AssertWixpdb(BuildSystem buildSystem, string wixpdbType, string[] expectedOutputFiles) { var sourceFolder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); using (var fs = new TestDataFolderFileSystem()) { fs.Initialize(sourceFolder); var baseFolder = fs.BaseFolder; var binFolder = Path.Combine(baseFolder, @"bin\"); var projectPath = Path.Combine(baseFolder, "MsiPackage.wixproj"); var result = MsbuildUtilities.BuildProject(buildSystem, projectPath, new[] { wixpdbType == null ? String.Empty : $"-p:WixPdbType={wixpdbType}", }); result.AssertSuccess(); var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) .Select(s => s.Substring(baseFolder.Length + 1)) .OrderBy(s => s) .ToArray(); WixAssert.CompareLineByLine(expectedOutputFiles, paths); } }
public override void OnDoubleClick(Mobile from) { if (IsChildOf(from.Backpack) || Parent == from) { BuildSystem system = this.BuildSystem; int num = system.CanBuild(from, this, null); if (num > 0) { from.SendLocalizedMessage(num); } else { BuildContext context = system.GetContext(from); from.SendGump(new BuildGump(from, system, this, null)); } } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } }
private static void AddAllInclusionsFromDependencies(CPPProject.Profile Profile, SourceBuilder Builder) { if (Builder == null) { return; } if (Builder.SelectedRule.LibraryUseType != BuildRules.LibraryUseTypes.UseOnly) { Profile.AddPreprocessorDefinition(BuildSystemHelper.GetAPIPreprocessor(Builder.BuildRule.ModuleName, (Builder.SelectedRule.LibraryUseType == BuildRules.LibraryUseTypes.DynamicLibrary ? BuildSystemHelper.APIPreprocessorTypes.Import : BuildSystemHelper.APIPreprocessorTypes.Empty))); Profile.AddPreprocessorDefinition(BuildSystemHelper.GetExternPreprocessor(Builder.BuildRule.ModuleName, BuildSystemHelper.ExternPreprocessorTypes.Empty)); string[] libFiles = FileSystemUtilites.GetAllFiles(Builder.BinariesPath, "*" + EnvironmentHelper.StaticLibraryExtentions); if (libFiles != null) { foreach (string libFile in libFiles) { Profile.AddIncludeLibraries(libFile); } } } if (Builder.SelectedRule.DependencyModulesName == null) { return; } foreach (string dep in Builder.SelectedRule.DependencyModulesName) { SourceBuilder builder = BuildSystem.GetSourceBuilder(dep); AddAllInclusionsFromDependencies(Profile, builder); } }
private static bool IsBuildTagged(BuildSystem buildSystem) { return(buildSystem.AppVeyor.Environment.Repository.Tag.IsTag && !string.IsNullOrWhiteSpace(buildSystem.AppVeyor.Environment.Repository.Tag.Name)); }
// // Summary: // The method called whenever a PLAYER tries to break an object. // Parameters: // foreground: // Whether or not the block to be destroyed is in the foreground. // position: // The position of the block to destroy (world coords) private void PlayerBreakBlock(bool foreground, Vector2 position) { BuildSystem.BreakBlockWorld(foreground, position); }
public static IEnumerable <string> GetToolCommandLines(MsbuildRunnerResult result, string toolName, string operation, BuildSystem buildSystem, bool?outOfProc = null) { var expectedOutOfProc = buildSystem == BuildSystem.DotNetCoreSdk || outOfProc.HasValue && outOfProc.Value; var expectedToolExe = !expectedOutOfProc ? $"({toolName}.exe)" : buildSystem == BuildSystem.DotNetCoreSdk ? $"{toolName}.dll\"" : $"{toolName}.exe"; var expectedToolCommand = $"{expectedToolExe} {operation}"; return(result.Output.Where(line => line.Contains(expectedToolCommand))); }