Merge branch 'stable-2.10' into stable-2.11
* stable-2.10:
Bump to Gerrit 2.10.6 APIs
Change-Id: I55346419780396b46fe0e01fdf73a0b79016fb39
diff --git a/BUCK b/BUCK
index 2bed3d6..0babbba 100644
--- a/BUCK
+++ b/BUCK
@@ -7,7 +7,7 @@
manifest_entries = [
'Gerrit-PluginName: uploadvalidator',
'Gerrit-ApiType: plugin',
- 'Gerrit-ApiVersion: 2.10.6',
+ 'Gerrit-ApiVersion: 2.11',
'Gerrit-Module: com.googlesource.gerrit.plugins.uploadvalidator.Module',
],
)
diff --git a/VERSION b/VERSION
index 3a7a6e8..f5bb986 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
# Used by BUCK to include "Implementation-Version" in plugin Manifest.
# If this file doesn't exist the output of 'git describe' is used
# instead.
-PLUGIN_VERSION = '1.0-SNAPSHOT'
+PLUGIN_VERSION = '2.11'
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK
index 12bfc1a..31c52aa 100644
--- a/lib/gerrit/BUCK
+++ b/lib/gerrit/BUCK
@@ -1,6 +1,6 @@
include_defs('//bucklets/maven_jar.bucklet')
-VER = '2.10'
+VER = '2.11'
REPO = MAVEN_CENTRAL
maven_jar(
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index ea22a6d..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<!--
-Copyright (C) 2014 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>com.googlesource.gerrit.plugins.uploadvalidator</groupId>
- <artifactId>uploadvalidator</artifactId>
- <packaging>jar</packaging>
- <version>2.10.6</version>
- <name>uploadvalidator</name>
-
- <properties>
- <Gerrit-ApiType>plugin</Gerrit-ApiType>
- <Gerrit-ApiVersion>${project.version}</Gerrit-ApiVersion>
- </properties>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <archive>
- <manifestEntries>
- <Gerrit-PluginName>uploadvalidator</Gerrit-PluginName>
- <Gerrit-Module>com.googlesource.gerrit.plugins.uploadvalidator.Module</Gerrit-Module>
-
- <Implementation-Vendor>Gerrit Code Review</Implementation-Vendor>
- <Implementation-URL>http://code.google.com/p/gerrit/</Implementation-URL>
-
- <Implementation-Title>${Gerrit-ApiType} ${project.artifactId}</Implementation-Title>
- <Implementation-Version>${project.version}</Implementation-Version>
-
- <Gerrit-ApiType>${Gerrit-ApiType}</Gerrit-ApiType>
- <Gerrit-ApiVersion>${Gerrit-ApiVersion}</Gerrit-ApiVersion>
- </manifestEntries>
- </archive>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>com.google.gerrit</groupId>
- <artifactId>gerrit-${Gerrit-ApiType}-api</artifactId>
- <version>${Gerrit-ApiVersion}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <id>snapshot-repository</id>
- <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
- </repository>
- </repositories>
-</project>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/PathValidator.java b/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/PathValidator.java
index 4cca012..39bfc28 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/PathValidator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/PathValidator.java
@@ -38,21 +38,24 @@
List<String> files = new ArrayList<>();
if (c.getParentCount() > 0) {
- Git git = new Git(repo);
- List<DiffEntry> diffEntries =
- git.diff().setOldTree(getTreeIterator(repo, c.getName() + "^"))
- .setNewTree(getTreeIterator(repo, c.getName())).call();
+ List<DiffEntry> diffEntries;
+ try (Git git = new Git(repo)) {
+ diffEntries = git.diff()
+ .setOldTree(getTreeIterator(repo, c.getName() + "^"))
+ .setNewTree(getTreeIterator(repo, c.getName())).call();
+ }
for (DiffEntry e : diffEntries) {
if (e.getNewPath() != null) {
files.add(e.getNewPath());
}
}
} else {
- TreeWalk tw = new TreeWalk(repo);
- tw.addTree(c.getTree());
- tw.setRecursive(true);
- while (tw.next()) {
- files.add(tw.getPathString());
+ try (TreeWalk tw = new TreeWalk(repo)) {
+ tw.addTree(c.getTree());
+ tw.setRecursive(true);
+ while (tw.next()) {
+ files.add(tw.getPathString());
+ }
}
}
@@ -62,12 +65,9 @@
private AbstractTreeIterator getTreeIterator(Repository repo, String name)
throws IOException {
CanonicalTreeParser p = new CanonicalTreeParser();
- ObjectReader or = repo.newObjectReader();
- try {
+ try (ObjectReader or = repo.newObjectReader()) {
p.reset(or, new RevWalk(repo).parseTree(repo.resolve(name)));
return p;
- } finally {
- or.close();
}
}
}
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 4c56ed6..8b5de99 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -1,10 +1,7 @@
Build
=====
-This plugin can be built with Buck or Maven.
-
-Buck
-----
+This plugin is built using Buck.
Two build modes are supported: Standalone and in Gerrit tree.
The standalone build mode is recommended, as this mode doesn't require
@@ -62,16 +59,3 @@
```
./tools/eclipse/project.py
```
-
-Maven
------
-
-Note that the Maven build is provided for compatibility reasons, but
-it is considered to be deprecated and will be removed in a future
-version of this plugin.
-
-To build with Maven, run
-
-```
-mvn clean package
-```