private static void version(@Nonnull PrintStream out) { BuildMetadata metadata = BuildMetadata.getInstance(); out.println("Anarres Java C Preprocessor version " + metadata.getVersion() + " change-id " + metadata.getChangeId()); out.println("Copyright (C) 2007-2015 Shevek (http://www.anarres.org/)."); out.println("This is free software; see the source for copying conditions. There is NO"); out.println("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); } }
/** @throws RuntimeException if the properties file cannot be found on the classpath. */ @Nonnull public static synchronized BuildMetadata getInstance() { try { if (INSTANCE == null) INSTANCE = new BuildMetadata(); return INSTANCE; } catch (IOException e) { throw new RuntimeException(e); } }
@Test public void testMetadata() throws Exception { BuildMetadata metadata = BuildMetadata.getInstance(); LOG.info("Version is " + metadata.getVersion()); LOG.info("BuildDate is " + metadata.getBuildDate()); LOG.info("ChangeId is " + metadata.getChangeId()); }
.forHelp(); OptionSpec<?> versionOption = parser.acceptsAll(Arrays.asList("version"), "Displays the product version (" + BuildMetadata.getInstance().getVersion() + ") and exits.") .forHelp();