public static int Main(string[] args)
        {
            var logger = new ConsoleLogger();

            Utilities.LogAssemblyVersion(logger, typeof(Program).Assembly, Resources.AssemblyDescription);
            IBootstrapperSettings settings;

            if (ArgumentProcessor.IsHelp(args))
            {
                logger.LogInfo("");
                logger.LogInfo("Usage: ");
                logger.LogInfo("");
                logger.LogInfo("  {0} [begin|end] /key:project_key [/name:project_name] [/version:project_version] [/d:sonar.key=value] [/s:settings_file]", System.AppDomain.CurrentDomain.FriendlyName);
                logger.LogInfo("");
                logger.LogInfo("    When executing the begin phase, at least the project key must be defined.");
                logger.LogInfo("    Other properties can dynamically be defined with '/d:'. For example, '/d:sonar.verbose=true'.");
                logger.LogInfo("    A settings file can be used to define properties. If no settings file path is given, the file SonarQube.Analysis.xml in the installation directory will be used.");
                logger.LogInfo("    Only the token should be passed during the end phase, if it was used during the begin phase.");

                return(SuccessCode);
            }

            if (!ArgumentProcessor.TryProcessArgs(args, logger, out settings))
            {
                // The argument processor will have logged errors
                return(ErrorCode);
            }

            IProcessorFactory processorFactory = new DefaultProcessorFactory(logger);
            BootstrapperClass bootstrapper     = new BootstrapperClass(processorFactory, settings, logger);

            return(bootstrapper.Execute());
        }
Beispiel #2
0
        public static int Execute(string[] args, ILogger logger)
        {
            logger.SuspendOutput();

            if (ArgumentProcessor.IsHelp(args))
            {
                logger.LogInfo("");
                logger.LogInfo("Usage: ");
                logger.LogInfo("");
                logger.LogInfo("  {0} [begin|end] /key:project_key [/name:project_name] [/version:project_version] [/d:sonar.key=value] [/s:settings_file]", System.AppDomain.CurrentDomain.FriendlyName);
                logger.LogInfo("");
                logger.LogInfo("    When executing the begin phase, at least the project key must be defined.");
                logger.LogInfo("    Other properties can dynamically be defined with '/d:'. For example, '/d:sonar.verbose=true'.");
                logger.LogInfo("    A settings file can be used to define properties. If no settings file path is given, the file SonarQube.Analysis.xml in the installation directory will be used.");
                logger.LogInfo("    Only the token should be passed during the end phase, if it was used during the begin phase.");

                logger.ResumeOutput();
                return(SuccessCode);
            }

            if (!ArgumentProcessor.TryProcessArgs(args, logger, out IBootstrapperSettings settings))
            {
                logger.ResumeOutput();
                // The argument processor will have logged errors
                Environment.ExitCode = ErrorCode;
                return(ErrorCode);
            }

            IProcessorFactory processorFactory = new DefaultProcessorFactory(logger);
            var bootstrapper = new BootstrapperClass(processorFactory, settings, logger);
            var exitCode     = bootstrapper.Execute();

            Environment.ExitCode = exitCode;
            return(exitCode);
        }
Beispiel #3
0
        public static int Main(string[] args)
        {
            var logger = new ConsoleLogger();

            Utilities.LogAssemblyVersion(logger, typeof(Program).Assembly, Resources.AssemblyDescription);
            IBootstrapperSettings settings;

            if (!ArgumentProcessor.TryProcessArgs(args, logger, out settings))
            {
                // The argument processor will have logged errors
                return(ErrorCode);
            }

            IProcessorFactory processorFactory = new DefaultProcessorFactory(logger);
            BootstrapperClass bootstrapper     = new BootstrapperClass(processorFactory, settings, logger);

            return(bootstrapper.Execute());
        }