You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SystemInfo.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * SonarQube Runner - Distribution
  3. * Copyright (C) 2011 SonarSource
  4. * dev@sonar.codehaus.org
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
  19. */
  20. package org.sonar.runner;
  21. import org.sonar.runner.impl.Logs;
  22. import org.sonar.runner.api.RunnerVersion;
  23. class SystemInfo {
  24. private SystemInfo() {
  25. // only static methods
  26. }
  27. static void print() {
  28. Logs.info("SonarQube Runner " + RunnerVersion.version());
  29. Logs.info(java());
  30. Logs.info(os());
  31. String runnerOpts = System.getenv("SONAR_RUNNER_OPTS");
  32. if (runnerOpts != null) {
  33. Logs.info("SONAR_RUNNER_OPTS=" + runnerOpts);
  34. }
  35. }
  36. static String java() {
  37. StringBuilder sb = new StringBuilder();
  38. sb
  39. .append("Java ")
  40. .append(System.getProperty("java.version"))
  41. .append(" ")
  42. .append(System.getProperty("java.vendor"));
  43. String bits = System.getProperty("sun.arch.data.model");
  44. if ("32".equals(bits) || "64".equals(bits)) {
  45. sb.append(" (").append(bits).append("-bit)");
  46. }
  47. return sb.toString();
  48. }
  49. static String os() {
  50. StringBuilder sb = new StringBuilder();
  51. sb
  52. .append(System.getProperty("os.name"))
  53. .append(" ")
  54. .append(System.getProperty("os.version"))
  55. .append(" ")
  56. .append(System.getProperty("os.arch"));
  57. return sb.toString();
  58. }
  59. }