public ProcessedArgs(string key, string name, string version, string organization, bool installLoaderTargets,
                             IAnalysisPropertyProvider cmdLineProperties, IAnalysisPropertyProvider globalFileProperties,
                             IAnalysisPropertyProvider scannerEnvProperties, ILogger logger)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentNullException(nameof(key));
            }

            ProjectKey     = key;
            ProjectName    = name;
            ProjectVersion = version;
            Organization   = organization;

            CmdLineProperties         = cmdLineProperties ?? throw new ArgumentNullException(nameof(cmdLineProperties));
            this.globalFileProperties = globalFileProperties ?? throw new ArgumentNullException(nameof(globalFileProperties));
            ScannerEnvProperties      = scannerEnvProperties ?? throw new ArgumentNullException(nameof(scannerEnvProperties));
            InstallLoaderTargets      = installLoaderTargets;

            if (Organization == null && this.globalFileProperties.TryGetValue(SonarProperties.Organization, out var filePropertiesOrganization))
            {
                logger.LogError(Resources.ERROR_Organization_Provided_In_SonarQubeAnalysis_file);
                IsOrganizationValid = false;
            }
            else
            {
                IsOrganizationValid = true;
            }

            AggregateProperties = new AggregatePropertiesProvider(cmdLineProperties, globalFileProperties, ScannerEnvProperties);
            if (!AggregateProperties.TryGetValue(SonarProperties.HostUrl, out this.sonarQubeUrl))
            {
                this.sonarQubeUrl = "http://localhost:9000";
            }
        }
Esempio n. 2
0
        public ProcessedArgs(string key, string name, string version, string organization, bool installLoaderTargets,
                             IAnalysisPropertyProvider cmdLineProperties, IAnalysisPropertyProvider globalFileProperties,
                             IAnalysisPropertyProvider scannerEnvProperties)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentNullException("key");
            }

            ProjectKey     = key;
            ProjectName    = name;
            ProjectVersion = version;
            Organization   = organization;

            CmdLineProperties         = cmdLineProperties ?? throw new ArgumentNullException("cmdLineProperties");
            this.globalFileProperties = globalFileProperties ?? throw new ArgumentNullException("globalFileProperties");
            ScannerEnvProperties      = scannerEnvProperties ?? throw new ArgumentNullException("scannerEnvProperties");
            InstallLoaderTargets      = installLoaderTargets;

            AggregateProperties = new AggregatePropertiesProvider(cmdLineProperties, globalFileProperties, ScannerEnvProperties);
            if (!AggregateProperties.TryGetValue(SonarProperties.HostUrl, out sonarQubeUrl))
            {
                sonarQubeUrl = "http://localhost:9000";
            }
        }