Exemplo n.º 1
0
        /// <summary>
        /// Creates an instance of <see cref="DeploymentParameters"/>.
        /// </summary>
        /// <param name="applicationPath">Source code location of the target location to be deployed.</param>
        /// <param name="serverType">Where to be deployed on.</param>
        /// <param name="runtimeFlavor">Flavor of the clr to run against.</param>
        /// <param name="runtimeArchitecture">Architecture of the runtime to be used.</param>
        public DeploymentParameters(
            string applicationPath,
            ServerType serverType,
            RuntimeFlavor runtimeFlavor,
            RuntimeArchitecture runtimeArchitecture)
        {
            if (string.IsNullOrEmpty(applicationPath))
            {
                throw new ArgumentException("Value cannot be null.", nameof(applicationPath));
            }

            if (!Directory.Exists(applicationPath))
            {
                throw new DirectoryNotFoundException(string.Format("Application path {0} does not exist.", applicationPath));
            }

            if (runtimeArchitecture == RuntimeArchitecture.x86)
            {
                throw new NotSupportedException("32 bit compilation is not yet supported. Don't remove the tests, just disable them for now.");
            }

            ApplicationPath = applicationPath;
            ServerType      = serverType;
            RuntimeFlavor   = runtimeFlavor;
            EnvironmentVariables.Add(new KeyValuePair <string, string>("ASPNETCORE_DETAILEDERRORS", "true"));
        }
Exemplo n.º 2
0
        private void PrepareTestEnvironment()
        {
            var homeDir = RootDir.CreateDirectory(".home");
            var xdgDir  = RootDir.CreateDirectory(".xdg");

            EnvironmentVariables.Add("XDG_CONFIG_HOME", xdgDir.Path);
            EnvironmentVariables.Add("HOME", homeDir.Path);

            if (PathUtils.IsUnixLikePlatform)
            {
                EnvironmentVariables.Add("MICROSOFT_SOURCELINK_TEST_ENVIRONMENT_ETC_DIR", homeDir.Path);

                xdgDir.CreateDirectory("git").CreateFile("config").WriteAllText(@"[remote ""origin2""]url = http://github.com/test-org/test-repo2");
            }
            else
            {
                var gitInstallDir = RootDir.CreateDirectory(".gitinstall");
                var gitExeDir     = gitInstallDir.CreateDirectory("bin");
                gitExeDir.CreateFile("git.exe");
                var etcDir = gitInstallDir.CreateDirectory("mingw64").CreateDirectory("etc");

                etcDir.CreateFile("gitconfig").WriteAllText(@"[remote ""origin2""]url = http://github.com/test-org/test-repo2");

                var programDataDir = RootDir.CreateDirectory(".programdata");

                EnvironmentVariables.Add("USERPROFILE", homeDir.Path);
                EnvironmentVariables.Add("PATH", gitExeDir.Path);
                EnvironmentVariables.Add("PROGRAMDATA", programDataDir.Path);
            }
        }
Exemplo n.º 3
0
        protected override void Read(IPropertySet pset)
        {
            base.Read(pset);
            ExternalConsole = pset.GetValue(nameof(ExternalConsole), false);

            // read from run config if CurrentProfile.* is empty, for backward compatibility
            if (!pset.HasProperty(nameof(EnvironmentVariables)) && EnvironmentVariables.Count == 0)
            {
                EnvironmentVariables.Add("ASPNETCORE_ENVIRONMENT", "Development");
            }
#pragma warning disable CS0618 //disables warnings threw by obsolete methods used in nameof()
            if (CurrentProfile.LaunchBrowser == null)
            {
                CurrentProfile.LaunchBrowser = pset.GetValue(nameof(LaunchBrowser), true);
            }
            if (string.IsNullOrEmpty(CurrentProfile.TryGetApplicationUrl()))
            {
                if (CurrentProfile.OtherSettings == null)
                {
                    CurrentProfile.OtherSettings = new Dictionary <string, object> (StringComparer.Ordinal);
                }

                CurrentProfile.OtherSettings ["applicationUrl"] = pset.GetValue(nameof(ApplicationURL), "http://localhost:5000/");
            }
            if (string.IsNullOrEmpty(CurrentProfile.LaunchUrl))
            {
                CurrentProfile.LaunchUrl = pset.GetValue(nameof(LaunchUrl), null);
            }
#pragma warning restore CS0618
        }
Exemplo n.º 4
0
        protected override void Initialize(Project project)
        {
            webProject = project.GetFlavor <DotNetCoreProjectExtension> ()?.IsWeb ?? false;
            base.Initialize(project);
            ExternalConsole = !webProject;
            if (!webProject)
            {
                return;
            }
            // Pick up/import default values from "launchSettings.json"
            var launchSettingsJsonPath = Path.Combine(project.BaseDirectory, "Properties", "launchSettings.json");
            var launchSettingsJson     = File.Exists(launchSettingsJsonPath) ? JObject.Parse(File.ReadAllText(launchSettingsJsonPath)) : null;
            var settings = (launchSettingsJson?.GetValue("profiles") as JObject)?.GetValue(project.Name) as JObject;

            LaunchBrowser = settings?.GetValue("launchBrowser")?.Value <bool?> () ?? true;
            LaunchUrl     = settings?.GetValue("launchUrl")?.Value <string> () ?? null;
            foreach (var pair in (settings?.GetValue("environmentVariables") as JObject)?.Properties() ?? Enumerable.Empty <JProperty> ())
            {
                if (!EnvironmentVariables.ContainsKey(pair.Name))
                {
                    EnvironmentVariables.Add(pair.Name, pair.Value.Value <string> ());
                }
            }
            ApplicationURL = settings?.GetValue("applicationUrl")?.Value <string> () ?? "http://localhost:5000/";
        }
Exemplo n.º 5
0
 internal void AddEnvironmentVariablesFromProject(IProject project)
 {
     foreach (var environmentVariable in project.EnvironmentVariables)
     {
         EnvironmentVariables.Add(environmentVariable.Key, environmentVariable.Value);
     }
 }
        internal VcProjectConfigurationItem(string name = "") : base(name)
        {
            IsActivate           = false;
            ProjectPropertyGroup = new VcProjectPropertyGroup(name);

            EnvironmentVariables.Add("$(Configuration)", string.Empty);
            EnvironmentVariables.Add("$(Platform)", string.Empty);
        }
Exemplo n.º 7
0
 protected override void Start()
 {
     if (!ROS_Node.Instance.ROS2)
     {
         EnvironmentVariables.Add("ROS_MASTER_URI", ROS_Node.Config.ros_master_uri);
         EnvironmentVariables.Add("ROS_IP", ROS_Node.Config.ros_ip);
     }
     base.Start();
 }
        public EnvironmentData()
        {
            CurrentDirectory = Environment.CurrentDirectory;

            foreach (DictionaryEntry e in Environment.GetEnvironmentVariables())
            {
                EnvironmentVariables.Add(e.Key.ToString(), e.Value.ToString());
            }
        }
Exemplo n.º 9
0
 protected override void Read(IPropertySet pset)
 {
     base.Read(pset);
     ExternalConsole = pset.GetValue(nameof(ExternalConsole), false);
     if (!pset.HasProperty(nameof(EnvironmentVariables)))
     {
         EnvironmentVariables.Add("ASPNETCORE_ENVIRONMENT", "Development");
     }
     LaunchBrowser  = pset.GetValue(nameof(LaunchBrowser), true);
     ApplicationURL = pset.GetValue(nameof(ApplicationURL), "http://localhost:5000/");
     LaunchUrl      = pset.GetValue(nameof(LaunchUrl), null);
 }
Exemplo n.º 10
0
        internal VcProject(string name = "", string guid = "") : base(name, guid)
        {
            ConfigurationItems = new List <VcProjectConfigurationItem>();
            HeaderFileItems    = new List <HeaderFile>();
            SourceFileItems    = new List <SourceFile>();

            EnvironmentVariables.Add("$(ProjectDir)", string.Empty);
            EnvironmentVariables.Add("$(ProjectName)", string.Empty);
            EnvironmentVariables.Add("$(ProjectExt)", string.Empty);
            EnvironmentVariables.Add("$(ProjectFileName)", string.Empty);
            EnvironmentVariables.Add("$(ProjectGuid)", string.Empty);
            EnvironmentVariables.Add("$(ProjectPath)", string.Empty);
        }
Exemplo n.º 11
0
 protected override void Initialize(Project project)
 {
     base.Initialize(project);
     ExternalConsole = true;
     if (project.GetFlavor <DotNetCoreProjectExtension> ()?.IsWeb ?? false && string.IsNullOrEmpty(ApplicationURL))
     {
         var tcpListner = new TcpListener(IPAddress.Loopback, 0);
         tcpListner.Start();
         ApplicationURL = $"http://localhost:{((IPEndPoint)tcpListner.LocalEndpoint).Port}";
         tcpListner.Stop();
         EnvironmentVariables.Add("ASPNETCORE_ENVIRONMENT", "Development");
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// Set the environment variables
        /// </summary>
        protected override void ExecuteTask()
        {
            if (EnvName != null && _value != null)
            {
                // add single environment variable
                EnvironmentVariables.Add(new EnvironmentVariable(EnvName, _value));
            }

            foreach (EnvironmentVariable env in EnvironmentVariables)
            {
                SetSingleEnvironmentVariable(env.VariableName, env.Value);
            }
        }
 public RhinoDebuggerStartInfo(RhinoExecutionCommand cmd)
     : base(new Mono.Debugging.Soft.SoftDebuggerListenArgs("Rhino", System.Net.IPAddress.Loopback, 0))
 {
     Command      = cmd.Command;
     Arguments    = cmd.Arguments;
     RhinoVersion = cmd.RhinoVersion;
     foreach (var env in cmd.EnvironmentVariables)
     {
         EnvironmentVariables.Add(env.Key, env.Value);
     }
     ApplicationPath  = cmd.ApplicationPath;
     ExecutablePath   = cmd.ExecutablePath;
     WorkingDirectory = cmd.WorkingDirectory;
 }
Exemplo n.º 14
0
        public override async Task Setup(DotNetInstallation dotNetInstall, string outputDir, bool useExistingSetup, ITestOutputHelper output)
        {
            if (!useExistingSetup)
            {
                using (var setupSection = new IndentedTestOutputHelper("Setup " + Name, output))
                {
                    await CloneAspNetJitBenchRepo(outputDir, setupSection);
                    await CreateStore(dotNetInstall, outputDir, setupSection);
                    await Publish(dotNetInstall, outputDir, setupSection);
                }
            }

            string tfm = DotNetSetup.GetTargetFrameworkMonikerForFrameworkVersion(dotNetInstall.FrameworkVersion);

            WorkingDirPath = GetWebAppPublishDirectory(dotNetInstall, outputDir, tfm);
            EnvironmentVariables.Add("DOTNET_SHARED_STORE", GetWebAppStoreDir(outputDir));
        }
Exemplo n.º 15
0
        public override async Task Setup(DotNetInstallation dotNetInstall, string outputDir, bool useExistingSetup, ITestOutputHelper output)
        {
            if (!useExistingSetup)
            {
                using (var setupSection = new IndentedTestOutputHelper("Setup " + Name, output))
                {
                    await SetupSourceToCompile(outputDir, dotNetInstall.FrameworkDir, useExistingSetup, setupSection);
                    await Publish(dotNetInstall, outputDir, setupSection);
                }
            }

            string tfm = DotNetSetup.GetTargetFrameworkMonikerForFrameworkVersion(dotNetInstall.FrameworkVersion);

            WorkingDirPath = GetAppPublishDirectory(dotNetInstall, outputDir, tfm);
            EnvironmentVariables.Add("DOTNET_MULTILEVEL_LOOKUP", "0");
            EnvironmentVariables.Add("UseSharedCompilation", "false");
        }
        protected override void Read(IPropertySet pset)
        {
            base.Read(pset);
            ExternalConsole = pset.GetValue(nameof(ExternalConsole), !webProject);
            if (!webProject)
            {
                return;
            }
            if (!pset.HasProperty(nameof(EnvironmentVariables)))
            {
                EnvironmentVariables.Add("ASPNETCORE_ENVIRONMENT", "Development");
            }
#pragma warning disable CS0618 // Type or member is obsolete
            LaunchBrowser  = pset.GetValue(nameof(LaunchBrowser), true);
            ApplicationURL = pset.GetValue(nameof(ApplicationURL), "http://localhost:5000/");
            LaunchUrl      = pset.GetValue(nameof(LaunchUrl), null);
#pragma warning restore CS0618 // Type or member is obsolete
        }
Exemplo n.º 17
0
        /// <summary>
        /// Adds an environment variable specification of the form <b>NAME</b> or
        /// <b>NAME=VALUE</b> to the shim to be passed on to the Docker container.
        /// </summary>
        /// <param name="variable">The variable specification.</param>
        public void AddEnvironmentVariable(string variable)
        {
            Covenant.Requires <ArgumentNullException>(!string.IsNullOrWhiteSpace(variable));

            var fields = variable.Split(new char[] { '=' }, 2);

            if (fields.Length == 2)
            {
                var name = fields[0];

                if (string.IsNullOrWhiteSpace(name) || name.Contains(' '))
                {
                    throw new ArgumentException($"Environment variable [{variable}] specification is not valid.");
                }
            }

            EnvironmentVariables.Add(variable);
        }
Exemplo n.º 18
0
    public DeploymentParameters(DeploymentParameters parameters)
    {
        foreach (var propertyInfo in typeof(DeploymentParameters).GetProperties())
        {
            if (propertyInfo.CanWrite)
            {
                propertyInfo.SetValue(this, propertyInfo.GetValue(parameters));
            }
        }

        foreach (var kvp in parameters.EnvironmentVariables)
        {
            EnvironmentVariables.Add(kvp);
        }

        foreach (var kvp in parameters.PublishEnvironmentVariables)
        {
            PublishEnvironmentVariables.Add(kvp);
        }
    }
Exemplo n.º 19
0
        protected override void Initialize(Project project)
        {
            base.Initialize(project);
            ExternalConsole = false;
            // Pick up/import default values from "launchSettings.json"
            var launchSettingsJsonPath = Path.Combine(project.BaseDirectory, "Properties", "launchSettings.json");
            var launchSettingsJson     = File.Exists(launchSettingsJsonPath) ? JObject.Parse(File.ReadAllText(launchSettingsJsonPath)) : null;
            var settings = (launchSettingsJson?.GetValue("profiles") as JObject)?.GetValue(project.Name) as JObject;

            LaunchBrowser = settings?.GetValue("launchBrowser")?.Value <bool?> () ?? true;
            LaunchUrl     = settings?.GetValue("launchUrl")?.Value <string> () ?? null;
            foreach (var pair in (settings?.GetValue("environmentVariables") as JObject)?.Properties() ?? Enumerable.Empty <JProperty> ())
            {
                if (!EnvironmentVariables.ContainsKey(pair.Name))
                {
                    EnvironmentVariables.Add(pair.Name, pair.Value.Value <string> ());
                }
            }
            ApplicationURL = GetApplicationUrl(settings, EnvironmentVariables);
        }
Exemplo n.º 20
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Do the job
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void ExecuteTask()
        {
            try
            {
                if (VariableName != null && Value != null)
                {
                    // add single environment variable
                    EnvironmentVariables.Add(new EnvironmentVariable(VariableName, Value));
                }

                foreach (EnvironmentVariable env in EnvironmentVariables)
                {
                    SetSingleEnvironmentVariable(env.VariableName, env.Value);
                }

                if (m_fGlobal)
                {
                    SetGlobalEnvironmentVariables();
                }
            }
            catch (Exception e)
            {
                BuildException buildEx = e as BuildException;
                if (buildEx != null)
                {
                    throw new BuildException(
                              string.Format("Exception setting environment variable {1}: {0}", e.Message,
                                            buildEx.Data["Name"]), Location, e);
                }
                else
                {
                    throw new BuildException(
                              string.Format("Exception setting environment variables: {0}", e.Message),
                              Location, e);
                }
            }
        }
Exemplo n.º 21
0
 public void AddEnvironmentVariable()
 {
     EnvironmentVariables.Add(new EnvironmentVariableListItemModel());
 }
Exemplo n.º 22
0
        public CreateContainerParametersBuilder AddEnvironmentVariable(string variable)
        {
            EnvironmentVariables.Add(variable);

            return(this);
        }