Skip to content
Permalink
Browse files
220: webrev version unknown message
Reviewed-by: rwestberg
  • Loading branch information
edvbld committed Jan 21, 2020
1 parent f99220d commit f4cc4619cb51e0173e89346e5349e988060876e5
Showing 25 changed files with 103 additions and 12 deletions.
@@ -62,6 +62,7 @@ dependencies {
implementation project(':process')
implementation project(':args')
implementation project(':proxy')
implementation project(':version')

testImplementation project(':test')
}
@@ -31,6 +31,7 @@
requires org.openjdk.skara.process;
requires org.openjdk.skara.proxy;
requires org.openjdk.skara.network;
requires org.openjdk.skara.version;

requires java.sql;

@@ -27,6 +27,7 @@
import org.openjdk.skara.network.URIBuilder;
import org.openjdk.skara.json.*;
import org.openjdk.skara.proxy.HttpProxy;
import org.openjdk.skara.version.Version;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -123,6 +124,10 @@ public static void main(String... args) {
.fullname("once")
.helptext("Instead of repeatedly executing periodical task, run each task exactly once")
.optional(),
Switch.shortcut("v")
.fullname("version")
.helptext("Show version")
.optional(),
Switch.shortcut("l")
.fullname("list-bots")
.helptext("List all available bots and then exit")
@@ -144,6 +149,11 @@ public static void main(String... args) {
System.exit(0);
}

if (arguments.contains("version")) {
System.out.println(Version.fromManifest().orElse("unknown"));
System.exit(0);
}

Path jsonFile = arguments.at(0).via(Paths::get);
var jsonConfig = readConfiguration(jsonFile);

@@ -44,6 +44,7 @@ dependencies {
implementation project(':json')
implementation project(':email')
implementation project(':webrev')
implementation project(':version')

testImplementation project(':test')
}
@@ -31,6 +31,7 @@
requires org.openjdk.skara.email;
requires org.openjdk.skara.webrev;
requires org.openjdk.skara.network;
requires org.openjdk.skara.version;
requires java.logging;
requires java.net.http;

@@ -27,6 +27,7 @@
import org.openjdk.skara.network.URIBuilder;
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.webrev.Webrev;
import org.openjdk.skara.version.Version;

import java.io.*;
import java.net.URI;
@@ -56,7 +57,9 @@ class WebrevStorage {

private void generate(PullRequest pr, Repository localRepository, Path folder, Hash base, Hash head) throws IOException {
Files.createDirectories(folder);
Webrev.repository(localRepository).output(folder)
Webrev.repository(localRepository)
.output(folder)
.version(Version.fromManifest().orElse("unknown"))
.generate(base, head);
}

@@ -42,13 +42,7 @@ dependencies {
implementation project(':issuetracker')
implementation project(':proxy')
implementation project(':ssh')
}


jar {
manifest {
attributes("Implementation-Title": "org.openjdk.skara.cli", "Implementation-Version": archiveVersion)
}
implementation project(':version')
}

images {
@@ -31,6 +31,7 @@
requires org.openjdk.skara.forge;
requires org.openjdk.skara.proxy;
requires org.openjdk.skara.ssh;
requires org.openjdk.skara.version;

requires java.net.http;
requires java.logging;
@@ -28,6 +28,7 @@
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.webrev.*;
import org.openjdk.skara.proxy.HttpProxy;
import org.openjdk.skara.version.Version;

import java.io.*;
import java.nio.file.*;
@@ -27,6 +27,7 @@
import org.openjdk.skara.host.*;
import org.openjdk.skara.vcs.Repository;
import org.openjdk.skara.proxy.HttpProxy;
import org.openjdk.skara.version.Version;

import java.io.*;
import java.net.URI;
@@ -28,6 +28,7 @@
import org.openjdk.skara.jcheck.*;
import org.openjdk.skara.vcs.openjdk.*;
import org.openjdk.skara.proxy.HttpProxy;
import org.openjdk.skara.version.Version;

import java.io.IOException;
import java.net.URI;
@@ -29,6 +29,7 @@
import org.openjdk.skara.json.JSONValue;
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.vcs.openjdk.CommitMessageParsers;
import org.openjdk.skara.version.Version;

import java.io.IOException;
import java.net.*;
@@ -27,6 +27,7 @@
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.vcs.openjdk.*;
import org.openjdk.skara.vcs.openjdk.convert.*;
import org.openjdk.skara.version.Version;

import java.io.*;
import java.nio.file.*;
@@ -31,6 +31,7 @@
import org.openjdk.skara.proxy.HttpProxy;
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.vcs.openjdk.CommitMessageParsers;
import org.openjdk.skara.version.Version;

import java.io.IOException;
import java.net.URI;
@@ -24,6 +24,7 @@

import org.openjdk.skara.args.*;
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.version.Version;

import java.io.*;
import java.nio.file.*;
@@ -26,6 +26,7 @@
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.forge.*;
import org.openjdk.skara.proxy.HttpProxy;
import org.openjdk.skara.version.Version;

import java.io.*;
import java.net.*;
@@ -23,6 +23,7 @@
package org.openjdk.skara.cli;

import org.openjdk.skara.args.*;
import org.openjdk.skara.version.Version;

import java.io.IOException;
import java.net.URI;
@@ -24,6 +24,7 @@

import org.openjdk.skara.args.*;
import org.openjdk.skara.vcs.ReadOnlyRepository;
import org.openjdk.skara.version.Version;

import java.io.IOException;
import java.util.*;
@@ -24,6 +24,7 @@

import org.openjdk.skara.args.*;
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.version.Version;

import java.io.IOException;
import java.nio.file.*;
@@ -26,6 +26,7 @@
import org.openjdk.skara.proxy.HttpProxy;
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.webrev.*;
import org.openjdk.skara.version.Version;

import java.io.*;
import java.net.URI;
@@ -27,6 +27,7 @@
import org.openjdk.skara.vcs.*;
import org.openjdk.skara.vcs.openjdk.*;
import org.openjdk.skara.vcs.openjdk.convert.*;
import org.openjdk.skara.version.Version;

import java.io.*;
import java.nio.file.*;
@@ -44,6 +44,7 @@ include 'webrev'
include 'network'
include 'forge'
include 'issuetracker'
include 'version'

include 'bots:bridgekeeper'
include 'bots:cli'
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

module {
name = 'org.openjdk.skara.version'
}

jar {
manifest {
attributes("Implementation-Title": "org.openjdk.skara.version", "Implementation-Version": archiveVersion)
}
}

publishing {
publications {
version(MavenPublication) {
from components.java
}
}
}
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
module org.openjdk.skara.version {
exports org.openjdk.skara.version;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -20,15 +20,15 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package org.openjdk.skara.cli;
package org.openjdk.skara.version;

import java.io.IOException;
import java.util.jar.Manifest;
import java.util.Optional;

class Version {
public class Version {
private static String version = null;
static Optional<String> fromManifest() {
public static Optional<String> fromManifest() {
if (version == null) {
try {
var resources = Version.class.getClassLoader().getResources("META-INF/MANIFEST.MF");

0 comments on commit f4cc461

Please sign in to comment.