Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
 private void CreateGeneratorTemps(CodeGen cg)
 {
     for (int i = 0; i < GeneratorTemps; i++)
     {
         cg.Allocator.AddGeneratorTemp(EnvironmentFactory.MakeEnvironmentReference(SymbolTable.StringToId("temp$" + i)).CreateSlot(cg.EnvironmentSlot));
     }
 }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        /*
         * 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);
        }
Ejemplo n.º 6
0
 public UpdateEnvironmentsHandler(
     SheepItDbContext dbContext,
     EnvironmentFactory environmentFactory)
 {
     _dbContext          = dbContext;
     _environmentFactory = environmentFactory;
 }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 9
0
        public Project Load(string targetFramework, EnvironmentOptions environmentOptions)
        {
            if (environmentOptions == null)
            {
                throw new ArgumentNullException(nameof(environmentOptions));
            }

            return(Load(targetFramework, EnvironmentFactory.GetBuildEnvironment(targetFramework, environmentOptions)));
        }
Ejemplo n.º 10
0
        /// <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)));
        }
Ejemplo n.º 11
0
        public Project Load(EnvironmentOptions environmentOptions)
        {
            if (environmentOptions == null)
            {
                throw new ArgumentNullException(nameof(environmentOptions));
            }

            return(Load(null, EnvironmentFactory.GetBuildEnvironment(environmentOptions)));
        }
Ejemplo n.º 12
0
        public void HaveACountPlusOneAfterAddingANewGenFormEnvironment()
        {
            var count = _genFormEnvironments.Count;

            var genFormEnv = EnvironmentFactory.CreateGenFormEnvironment("Test", "Test", "Test", "test");

            _genFormEnvironments.Add(genFormEnv);

            Assert.AreEqual(count + 1, _genFormEnvironments.Count);
        }
Ejemplo n.º 13
0
    //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);
    }
Ejemplo n.º 14
0
 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());
     }
 }
Ejemplo n.º 16
0
 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());
     }
 }
Ejemplo n.º 17
0
 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;
 }
Ejemplo n.º 18
0
        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();
        }
Ejemplo n.º 19
0
        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);
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        /// <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));
        }
Ejemplo n.º 22
0
        // 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));
            }
        }
Ejemplo n.º 23
0
        // 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);
        }
Ejemplo n.º 24
0
        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));
            }
        }
Ejemplo n.º 25
0
        /// <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 });
        }
Ejemplo n.º 26
0
        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);
            }
        }
Ejemplo n.º 27
0
        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++;
        }
Ejemplo n.º 29
0
 /// <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));
Ejemplo n.º 30
0
 void createBasicEnv(float i_0, float d)
 {
     EnvironmentFactory.CreateMultiEnvironment(d, i_0, sources, isDynamic);
 }