/// <summary> /// Builds the requested target framework(s). /// </summary> /// <param name="targetFrameworks">The set of target frameworks to build.</param> /// <param name="environmentOptions">The environment options to use for the build.</param> /// <returns>A dictionary of target frameworks to <see cref="AnalyzerResult"/>.</returns> public AnalyzerResults Build(string[] targetFrameworks, EnvironmentOptions environmentOptions) { if (environmentOptions == null) { throw new ArgumentNullException(nameof(environmentOptions)); } // If the set of target frameworks is empty, just build the default if (targetFrameworks == null || targetFrameworks.Length == 0) { targetFrameworks = new string[] { null }; } // Reset the cache before every build in case MSBuild cached something from a project reference build Manager.BuildManager.ResetCaches(); // Create a new build envionment for each target AnalyzerResults results = new AnalyzerResults(); foreach (string targetFramework in targetFrameworks) { BuildEnvironment buildEnvironment = EnvironmentFactory.GetBuildEnvironment(targetFramework, environmentOptions); string[] targetsToBuild = buildEnvironment.TargetsToBuild; Restore(buildEnvironment, ref targetsToBuild); results.Add(BuildTargets(buildEnvironment, targetFramework, targetsToBuild)); } return(results); }
private void CreateGeneratorTemps(CodeGen cg) { for (int i = 0; i < GeneratorTemps; i++) { cg.Allocator.AddGeneratorTemp(EnvironmentFactory.MakeEnvironmentReference(SymbolTable.StringToId("temp$" + i)).CreateSlot(cg.EnvironmentSlot)); } }
/// <summary> /// Builds the requested target framework(s). /// </summary> /// <param name="targetFrameworks">The set of target frameworks to build.</param> /// <param name="environmentOptions">The environment options to use for the build.</param> /// <returns>A dictionary of target frameworks to <see cref="AnalyzerResult"/>.</returns> public AnalyzerResults Build(string[] targetFrameworks, EnvironmentOptions environmentOptions) { if (environmentOptions == null) { throw new ArgumentNullException(nameof(environmentOptions)); } // If the set of target frameworks is empty, just build the default if (targetFrameworks == null || targetFrameworks.Length == 0) { targetFrameworks = new string[] { null }; } // Create a new build envionment for each target AnalyzerResults results = new AnalyzerResults(); foreach (string targetFramework in targetFrameworks) { BuildEnvironment buildEnvironment = EnvironmentFactory.GetBuildEnvironment(targetFramework, environmentOptions); string[] targetsToBuild = buildEnvironment.TargetsToBuild; Restore(buildEnvironment, ref targetsToBuild); results.Add(BuildTargets(buildEnvironment, targetFramework, targetsToBuild, true)); } return(results); }
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); } }
/* * public static async Task<OauthAccess> DoLoginIsmael(string username, string password) * { * OauthAccess oauthAccess = null; * string url = "https://ismael.dbalab.it/gateway/auu/v1/oauth/token"; * * httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", "aXNtYWVsOg=="); * httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); * * var httpContent = new HttpRequestMessage(HttpMethod.Post, url); * DependencyService.Get<ILogging>().Info("POST request", url); * * var values = new List<KeyValuePair<string, string>>(); * values.Add(new KeyValuePair<string, string>("grant_type", "password")); * values.Add(new KeyValuePair<string, string>("username", username)); * values.Add(new KeyValuePair<string, string>("password", password)); * httpContent.Content = new FormUrlEncodedContent(values); * * var response = await httpClient.SendAsync(httpContent); * * if (response.IsSuccessStatusCode) * { * var responseBodyAsText = response.Content.ReadAsStringAsync().Result; * oauthAccess = JsonConvert.DeserializeObject<OauthAccess>(responseBodyAsText); * } * else * { * DependencyService.Get<ILogging>().Info("Test.PostPage", "Errore"); * } * * return oauthAccess; * } */ public static async Task <LoginResponse> DoLogin(string username, string password) { IEnvironment myEnv = EnvironmentFactory.GetInstance(); DependencyService.Get <ILogging>().Info("Selected Environment", myEnv.GetEnvName()); string url = myEnv.GetEndpointUrl() + myEnv.GetLoginUrl(); LoginResponse loginResponse = null; httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var httpContent = new HttpRequestMessage(HttpMethod.Post, url); DependencyService.Get <ILogging>().Info("POST request", url); JObject oJsonObject = new JObject(); oJsonObject.Add("username", username); oJsonObject.Add("password", password); httpContent.Content = new StringContent(oJsonObject.ToString(), Encoding.UTF8, "application/json"); var response = await httpClient.SendAsync(httpContent); if (response.IsSuccessStatusCode) { var responseBodyAsText = response.Content.ReadAsStringAsync().Result; loginResponse = JsonConvert.DeserializeObject <LoginResponse>(responseBodyAsText); } else { DependencyService.Get <ILogging>().Info("Test.PostPage", "Errore"); } return(loginResponse); }
public UpdateEnvironmentsHandler( SheepItDbContext dbContext, EnvironmentFactory environmentFactory) { _dbContext = dbContext; _environmentFactory = environmentFactory; }
public void ContainTheNewGenFormEnvironmentAfterAddingIt() { var genFormEnv = EnvironmentFactory.CreateGenFormEnvironment("Test", "Test", "Test", "Test"); _genFormEnvironments.Add(genFormEnv); Assert.IsTrue(_genFormEnvironments.Any(e => e.MachineName == genFormEnv.MachineName && e.Name == genFormEnv.Name)); }
public void IsFrameworkTargetFrameworkForTfm(string targetFramework, bool expected) { // Given, When bool result = EnvironmentFactory.IsFrameworkTargetFramework(targetFramework); // Then result.ShouldBe(expected); }
public Project Load(string targetFramework, EnvironmentOptions environmentOptions) { if (environmentOptions == null) { throw new ArgumentNullException(nameof(environmentOptions)); } return(Load(targetFramework, EnvironmentFactory.GetBuildEnvironment(targetFramework, environmentOptions))); }
/// <summary> /// Builds a specific target framework. /// </summary> /// <param name="targetFramework">The target framework to build.</param> /// <param name="environmentOptions">The environment options to use for the build.</param> /// <returns>The result of the build process.</returns> public AnalyzerResults Build(string targetFramework, EnvironmentOptions environmentOptions) { if (environmentOptions == null) { throw new ArgumentNullException(nameof(environmentOptions)); } return(Build(targetFramework, EnvironmentFactory.GetBuildEnvironment(targetFramework, environmentOptions))); }
public Project Load(EnvironmentOptions environmentOptions) { if (environmentOptions == null) { throw new ArgumentNullException(nameof(environmentOptions)); } return(Load(null, EnvironmentFactory.GetBuildEnvironment(environmentOptions))); }
public void HaveACountPlusOneAfterAddingANewGenFormEnvironment() { var count = _genFormEnvironments.Count; var genFormEnv = EnvironmentFactory.CreateGenFormEnvironment("Test", "Test", "Test", "test"); _genFormEnvironments.Add(genFormEnv); Assert.AreEqual(count + 1, _genFormEnvironments.Count); }
//Calls the factory classes and passes the values of the import window inputs public void Import() { var xmlBaseFactory = new XmlBaseFactory(); xmlBaseFactory.Read(_mapFile); var buildingFactory = new BuildingFactory(xmlBaseFactory, _buildingMaterial); var roofFactory = new RoofFactory(xmlBaseFactory, _roofMaterial); var roadFactory = new RoadFactory(xmlBaseFactory, _roadMaterial, _footwayMaterial); var environmentFactory = new EnvironmentFactory(xmlBaseFactory, _greenMaterial); }
private GenFormEnvironment TryCreateEnvironment() { try { return(EnvironmentFactory.CreateGenFormEnvironment(MachineName, EnvironmentName, Provider, ConnectionString)); } catch (Exception e) { return(null); } }
public string AddEnvironmentToMachineWithDatabaseLogPathExportPath(string environment, string machine, string database, string logpath, string exportpath) { try { _environments.Add(EnvironmentFactory.CreateGenFormEnvironment(machine, environment, "provider", database, logpath, exportpath)); return(Success); } catch (System.Exception e) { return(e.ToString()); } }
public void UseEnvironmentCollectionToAddANewGenFormEnvironment() { try { var genEnv = EnvironmentFactory.CreateGenFormEnvironment("Test", "Test", "Test", "Test"); Isolate.WhenCalled(() => _environments.Add(null)).IgnoreCall(); _genFormEnvironments.Add(genEnv); Isolate.Verify.WasCalledWithAnyArguments(() => _environments.Add(null)); } catch (System.Exception e) { Assert.Fail(e.ToString()); } }
public CreateProjectHandler( SheepItDbContext dbContext, PackageFactory packageFactory, DeploymentProcessFactory deploymentProcessFactory, EnvironmentFactory environmentFactory, ProjectFactory projectFactory, ComponentFactory componentFactory) { _dbContext = dbContext; _packageFactory = packageFactory; _deploymentProcessFactory = deploymentProcessFactory; _environmentFactory = environmentFactory; _projectFactory = projectFactory; _componentFactory = componentFactory; }
public VillageWindow() { InitializeComponent(); g = drawing_panel.CreateGraphics(); pen = new Pen(Color.Black); shapeFactory = new ShapeFactory(); itemFactory = new ItemFactory(); environmentFactory = new EnvironmentFactory(); commandFactory = new GameControlCommandFactory(); gameFactory = new GameFactory(); inputValidation = new InputValidation(); }
public void ContainAnEnvironmentWithDatabaseTestEnvironmentTestDatabaseTestDbLogPathTestLpAndExportPathTestEpAfterAdding() { var genfenv = EnvironmentFactory.CreateGenFormEnvironment("Test", "Test", "Test", "TestDb", "TestLp", "TestEp"); Assert.AreEqual("TestDb", genfenv.Database); Assert.AreEqual("TestLp", genfenv.LogPath); Assert.AreEqual("TestEp", genfenv.ExportPath); _genFormEnvironments.Add(genfenv); genfenv = _genFormEnvironments.Single(e => e.MachineName == genfenv.MachineName && e.Name == genfenv.Name); Assert.IsNotNull(genfenv); Assert.AreEqual("TestDb", genfenv.Database); Assert.AreEqual("TestLp", genfenv.LogPath); Assert.AreEqual("TestEp", genfenv.ExportPath); }
public ConfigurationProviderTests() { var fileProviderOptions = new FileProviderOptions { BasePath = BasePath }; var environmentFactory = new EnvironmentFactory(); var hierarchyProvider = new HierarchyProvider(fileProviderOptions, environmentFactory); var fileReader = new FileReader(); var fileParser = new FileParser(); var propertiesFilter = new OverrideFilter(); var fileProvider = new FileProvider(hierarchyProvider, fileReader, fileParser, propertiesFilter); var objectBuilder = new ObjectBuilder.ObjectBuilder(); _sut = new ConfigurationProvider(fileProvider, objectBuilder); }
/// <summary> /// Builds all target framework(s) with the specified build environment options. /// </summary> /// <param name="environmentOptions">The environment options to use for the build.</param> /// <returns>A dictionary of target frameworks to <see cref="AnalyzerResult"/>.</returns> public AnalyzerResults BuildAllTargetFrameworks(EnvironmentOptions environmentOptions) { if (environmentOptions == null) { throw new ArgumentNullException(nameof(environmentOptions)); } // Load the project with the default build environment to get the evaluated target frameworks Project project = Load(EnvironmentFactory.GetBuildEnvironment(environmentOptions)); // Get all evaluated target frameworks from the Project and build them // but don't worry about getting a single target framework, it'll build the default string[] targetFrameworks = ProjectFile.GetTargetFrameworks( new[] { project.GetPropertyValue(ProjectFileNames.TargetFrameworks) }, null, null); return(Build(targetFrameworks, environmentOptions)); }
// The project file path should already be normalized internal ProjectAnalyzer(AnalyzerManager manager, string projectFilePath) { Manager = manager; ProjectFile = new ProjectFile(projectFilePath, manager.ProjectTransformer); EnvironmentFactory = new EnvironmentFactory(Manager, ProjectFile); // Set the solution directory global property string solutionDir = manager.SolutionDirectory ?? Path.GetDirectoryName(projectFilePath); SetGlobalProperty(MsBuildProperties.SolutionDir, solutionDir); // Create the logger if (manager.ProjectLogger != null) { AddLogger(new ConsoleLogger(manager.LoggerVerbosity, x => manager.ProjectLogger.LogInformation(x), null, null)); } }
// The project file path should already be normalized internal ProjectAnalyzer(AnalyzerManager manager, string projectFilePath, ProjectInSolution projectInSolution) { Manager = manager; Logger = Manager.LoggerFactory?.CreateLogger <ProjectAnalyzer>(); ProjectFile = new ProjectFile(projectFilePath, manager.ProjectTransformer); EnvironmentFactory = new EnvironmentFactory(Manager, ProjectFile); ProjectInSolution = projectInSolution; SolutionDirectory = string.IsNullOrEmpty(manager.SolutionFilePath) ? Path.GetDirectoryName(projectFilePath) : Path.GetDirectoryName(manager.SolutionFilePath); // Get (or create) a project GUID ProjectGuid = projectInSolution == null ? GuidUtility.Create(GuidUtility.UrlNamespace, ProjectFile.Path.Substring(SolutionDirectory.Length)) : Guid.Parse(projectInSolution.ProjectGuid); // Set the solution directory global property SetGlobalProperty(MsBuildProperties.SolutionDir, SolutionDirectory); }
internal ProjectAnalyzer(AnalyzerManager manager, string projectFilePath, XDocument projectDocument) { // Preload/enforce referencing some required asemblies Copy copy = new Copy(); Manager = manager; ProjectFile = new ProjectFile(projectFilePath, projectDocument, manager.ProjectTransformer); EnvironmentFactory = new EnvironmentFactory(Manager, ProjectFile); // Set the solution directory global property string solutionDir = manager.SolutionDirectory ?? Path.GetDirectoryName(projectFilePath); SetGlobalProperty(MsBuildProperties.SolutionDir, solutionDir); // Create the logger if (manager.ProjectLogger != null) { AddLogger(new ConsoleLogger(manager.LoggerVerbosity, x => manager.ProjectLogger.LogInformation(x), null, null)); } }
/// <summary> /// Emits the body of the function that creates a Generator object. Also creates another /// CodeGen for the inner method which implements the user code defined in the generator. /// </summary> private void EmitGeneratorBody(CodeGen _impl) { CodeGen ncg = CreateMethod(_impl); ncg.EmitLineInfo = _impl.EmitLineInfo; ncg.Allocator.GlobalAllocator.PrepareForEmit(ncg); Slot flowedContext = _impl.ContextSlot; // If there are no locals in the generator than we don't need the environment if (HasEnvironment) { // Environment creation is emitted into outer function that returns the generator // function and then flowed into the generator method on each call via the Generator // instance. _impl.EnvironmentSlot = EmitEnvironmentAllocation(_impl); flowedContext = CreateEnvironmentContext(_impl); InitializeGeneratorEnvironment(_impl); // Promote env storage to local variable // envStorage = ((FunctionEnvironment)context.Locals).Tuple EnvironmentFactory.EmitGetStorageFromContext(ncg); ncg.EnvironmentSlot = EnvironmentFactory.CreateEnvironmentSlot(ncg); ncg.EnvironmentSlot.EmitSet(ncg); CreateGeneratorTemps(ncg); } CreateReferenceSlots(ncg); // Emit the generator body EmitGenerator(ncg); flowedContext.EmitGet(_impl); _impl.EmitDelegateConstruction(ncg, _next, false); _impl.EmitNew(_generator, new Type[] { typeof(CodeContext), _next }); }
internal ProjectAnalyzer(AnalyzerManager manager, string projectFilePath, XDocument projectDocument, BuildEnvironment buildEnvironment) { Manager = manager; ProjectFilePath = projectFilePath; _projectDocument = TweakProjectDocument(manager, projectDocument ?? XDocument.Load(projectFilePath)); // Get the paths _buildEnvironment = buildEnvironment ?? EnvironmentFactory.GetBuildEnvironment(projectFilePath, _projectDocument); // Preload/enforce referencing some required asemblies Copy copy = new Copy(); // Set the solution directory global property string solutionDir = manager.SolutionDirectory ?? Path.GetDirectoryName(projectFilePath); SetGlobalProperty(MsBuildProperties.SolutionDir, solutionDir); // Create the logger if (manager.ProjectLogger != null) { _logger = new ConsoleLogger(manager.LoggerVerbosity, x => manager.ProjectLogger.LogInformation(x), null, null); } }
internal ProjectAnalyzer(AnalyzerManager manager, string projectFilePath, XDocument projectDocument) { Manager = manager; ProjectFilePath = projectFilePath; _projectDocument = TweakProjectDocument(projectDocument); // Get the paths _buildEnvironment = EnvironmentFactory.GetBuildEnvironment(projectFilePath, _projectDocument); // Preload/enforce referencing some required asemblies Copy copy = new Copy(); // Set global properties string solutionDir = manager.SolutionDirectory ?? Path.GetDirectoryName(projectFilePath); _globalProperties = _buildEnvironment.GetGlobalProperties(solutionDir); // Create the logger if (manager.ProjectLogger != null) { _logger = new ConsoleLogger(manager.LoggerVerbosity, x => LoggerExtensions.LogInformation(manager.ProjectLogger, x), null, null); } }
private void SpawnSingle() { var type = SpawnUtils.GetRandomSpawnEnvironmentType(); var poolManager = CoreManager.Instance.GetData <PoolManager>(); var common = ScriptableUtils.GetCommonElements(); var view = (CollisionView)poolManager.GetItem <EnvironmentType>((int)type); var model = EnvironmentFactory.GetEnvironmentModel(type); var controller = new EnvironmentController(model, view); var position = SpawnUtils.GetRandomSpawnPosition(_player.transform, common.SpawnInnerRange, common.SpawnOutRange); view.transform.position = position; controller.PlayerCollision -= OnPlayerCollision; controller.PlayerCollision += OnPlayerCollision; controller.Die -= OnEnemyDie; controller.Die += OnEnemyDie; _environment.Add(controller); _count++; }
/// <summary> /// Builds a specific target framework. /// </summary> /// <param name="targetFramework">The target framework to build.</param> /// <returns>The result of the build process.</returns> public AnalyzerResults Build(string targetFramework) => Build(targetFramework, EnvironmentFactory.GetBuildEnvironment(targetFramework));
void createBasicEnv(float i_0, float d) { EnvironmentFactory.CreateMultiEnvironment(d, i_0, sources, isDynamic); }