Introduce gerrit-owners-parent.
This is in preparation for creating an auto assigning plugin that uses
the owners config.
diff --git a/gerrit-owners/pom.xml b/gerrit-owners/pom.xml
new file mode 100644
index 0000000..acfd9c9
--- /dev/null
+++ b/gerrit-owners/pom.xml
@@ -0,0 +1,173 @@
+<!--
+Copyright (c) 2013 VMware, Inc. All Rights Reserved.
+-->
+<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>
+
+ <parent>
+ <groupId>com.vmware.gerrit</groupId>
+ <artifactId>gerrit-owners-parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>gerrit-owners</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>gerrit-owners</name>
+
+ <properties>
+ <jacksonVersion>2.2.0</jacksonVersion>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prolog-to-java</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <property name="gensrc" location="${project.build.directory}/generated-sources"/>
+
+ <java classname="com.googlecode.prolog_cafe.compiler.Compiler"
+ fork="true"
+ failonerror="true"
+ classpathref="maven.compile.classpath">
+ <arg value="--show-stack-trace"/>
+ <arg value="-O"/>
+ <arg value="-am"/><arg value="${gensrc}/prolog-am"/>
+ <arg value="-s" /><arg value="${gensrc}/prolog-java"/>
+ <arg value="src/main/prolog/gerrit_owners.pl"/>
+ </java>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources/prolog-java</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <configuration>
+ <createDependencyReducedPom>false</createDependencyReducedPom>
+ <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+ <artifactSet>
+ <excludes>
+ <exclude>com.gerritforge:*</exclude>
+ <exclude>com.google.gerrit:*</exclude>
+ <exclude>org.bouncycastle:*</exclude>
+ <exclude>org.slf4j:*</exclude>
+ <exclude>com.google.guava:*</exclude>
+ <exclude>org.eclipse.jgit:*</exclude>
+ <exclude>wsdl4j:wsdl4j:*</exclude>
+ </excludes>
+ </artifactSet>
+ <transformers>
+ <transformer
+ implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <manifestEntries>
+ <Implementation-Vendor>VMware, Inc.</Implementation-Vendor>
+ <Implementation-URL>http://github.com/vadims/gerrit-owners</Implementation-URL>
+ <Implementation-Title>${Gerrit-ApiType} ${project.artifactId}</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <Gerrit-ApiType>${Gerrit-ApiType}</Gerrit-ApiType>
+ <Gerrit-ApiVersion>${project.version}</Gerrit-ApiVersion>
+ </manifestEntries>
+ </transformer>
+ </transformers>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gerrit</groupId>
+ <artifactId>gerrit-${Gerrit-ApiType}-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.gerrit</groupId>
+ <artifactId>gerrit-server</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.googlecode.prolog-cafe</groupId>
+ <artifactId>PrologCafe</artifactId>
+ <version>1.3</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.gitective</groupId>
+ <artifactId>gitective-core</artifactId>
+ <version>0.9.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jacksonVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jacksonVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-yaml</artifactId>
+ <version>${jacksonVersion}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/main/java/com/vmware/gerrit/owners/OwnerPredicateProvider.java b/gerrit-owners/src/main/java/com/vmware/gerrit/owners/OwnerPredicateProvider.java
similarity index 89%
rename from src/main/java/com/vmware/gerrit/owners/OwnerPredicateProvider.java
rename to gerrit-owners/src/main/java/com/vmware/gerrit/owners/OwnerPredicateProvider.java
index 1d9b722..73d5b0f 100644
--- a/src/main/java/com/vmware/gerrit/owners/OwnerPredicateProvider.java
+++ b/gerrit-owners/src/main/java/com/vmware/gerrit/owners/OwnerPredicateProvider.java
@@ -8,6 +8,9 @@
import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.rules.PredicateProvider;
+/**
+ * Gerrit OWNERS Prolog Predicate Provider.
+ */
@Listen
public class OwnerPredicateProvider implements PredicateProvider {
@Override
diff --git a/src/main/java/com/vmware/gerrit/owners/OwnersConfig.java b/gerrit-owners/src/main/java/com/vmware/gerrit/owners/OwnersConfig.java
similarity index 100%
rename from src/main/java/com/vmware/gerrit/owners/OwnersConfig.java
rename to gerrit-owners/src/main/java/com/vmware/gerrit/owners/OwnersConfig.java
diff --git a/src/main/java/com/vmware/gerrit/owners/OwnersStoredValues.java b/gerrit-owners/src/main/java/com/vmware/gerrit/owners/OwnersStoredValues.java
similarity index 93%
rename from src/main/java/com/vmware/gerrit/owners/OwnersStoredValues.java
rename to gerrit-owners/src/main/java/com/vmware/gerrit/owners/OwnersStoredValues.java
index 28003ac..3299ed6 100644
--- a/src/main/java/com/vmware/gerrit/owners/OwnersStoredValues.java
+++ b/gerrit-owners/src/main/java/com/vmware/gerrit/owners/OwnersStoredValues.java
@@ -25,7 +25,7 @@
PrologEnvironment env = (PrologEnvironment) engine.control;
AccountResolver resolver = env.getInjector().getInstance(AccountResolver.class);
- return new PathOwners(repository, resolver, patchList);
+ return new PathOwners(resolver, repository, patchList);
}
};
diff --git a/src/main/java/com/vmware/gerrit/owners/PathOwners.java b/gerrit-owners/src/main/java/com/vmware/gerrit/owners/PathOwners.java
similarity index 96%
rename from src/main/java/com/vmware/gerrit/owners/PathOwners.java
rename to gerrit-owners/src/main/java/com/vmware/gerrit/owners/PathOwners.java
index 83466b4..f68d16f 100644
--- a/src/main/java/com/vmware/gerrit/owners/PathOwners.java
+++ b/gerrit-owners/src/main/java/com/vmware/gerrit/owners/PathOwners.java
@@ -26,19 +26,23 @@
import java.util.Map;
import java.util.Set;
+/**
+ * Calculates the owners of a patch list.
+ */
+// TODO(vspivak): provide assisted factory
public class PathOwners {
private static final Logger log = LoggerFactory.getLogger(PathOwners.class);
private final SetMultimap<String, Account.Id> owners;
- private final Repository repository;
-
private final AccountResolver resolver;
+ private final Repository repository;
+
private final PatchList patchList;
- public PathOwners(Repository repository, AccountResolver resolver, PatchList patchList) {
+ public PathOwners(AccountResolver resolver, Repository repository, PatchList patchList) {
this.repository = repository;
this.resolver = resolver;
this.patchList = patchList;
diff --git a/src/main/java/com/vmware/gerrit/owners/PathOwnersEntry.java b/gerrit-owners/src/main/java/com/vmware/gerrit/owners/PathOwnersEntry.java
similarity index 81%
rename from src/main/java/com/vmware/gerrit/owners/PathOwnersEntry.java
rename to gerrit-owners/src/main/java/com/vmware/gerrit/owners/PathOwnersEntry.java
index e97187c..c0209ac 100644
--- a/src/main/java/com/vmware/gerrit/owners/PathOwnersEntry.java
+++ b/gerrit-owners/src/main/java/com/vmware/gerrit/owners/PathOwnersEntry.java
@@ -9,7 +9,12 @@
import java.util.HashSet;
import java.util.Set;
-public class PathOwnersEntry {
+/**
+ * Path Owners Entry.
+ * <p/>
+ * Used internally by PathOwners to represent and compute the owners at a specific path.
+ */
+class PathOwnersEntry {
private String ownersPath;
private Set<Account.Id> owners;
diff --git a/src/main/java/gerrit_owners/PRED_owner_2.java b/gerrit-owners/src/main/java/gerrit_owners/PRED_owner_2.java
similarity index 100%
rename from src/main/java/gerrit_owners/PRED_owner_2.java
rename to gerrit-owners/src/main/java/gerrit_owners/PRED_owner_2.java
diff --git a/src/main/prolog/gerrit_owners.pl b/gerrit-owners/src/main/prolog/gerrit_owners.pl
similarity index 100%
rename from src/main/prolog/gerrit_owners.pl
rename to gerrit-owners/src/main/prolog/gerrit_owners.pl
diff --git a/pom.xml b/pom.xml
index 2ef8852..525455e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,17 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
<!--
-Copyright (C) 2012 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.
+Copyright (c) 2013 VMware, Inc. All Rights Reserved.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -19,184 +8,121 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.vmware.gerrit</groupId>
- <artifactId>gerrit-owners</artifactId>
- <packaging>jar</packaging>
+ <artifactId>gerrit-owners-parent</artifactId>
+ <packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
- <name>gerrit-owners</name>
+
+ <name>gerrit-owners-parent</name>
+ <url>http://github.com/vadims/gerrit-owners</url>
<properties>
<Gerrit-ApiType>plugin</Gerrit-ApiType>
- <Gerrit-ApiVersion>2.7-SNAPSHOT</Gerrit-ApiVersion>
+ <Gerrit-ApiVersion>2.6-SNAPSHOT</Gerrit-ApiVersion>
+
+ <project.build.sourceEncoding>
+ UTF-8
+ </project.build.sourceEncoding>
+ <project.reporting.outputEncoding>
+ UTF-8
+ </project.reporting.outputEncoding>
</properties>
+ <modules>
+ <module>gerrit-owners</module>
+ </modules>
+
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>1.6</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>prolog-to-java</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <target>
- <property name="gensrc" location="${project.build.directory}/generated-sources"/>
-
- <java classname="com.googlecode.prolog_cafe.compiler.Compiler"
- fork="true"
- failonerror="true"
- classpathref="maven.compile.classpath">
- <arg value="--show-stack-trace"/>
- <arg value="-O"/>
- <arg value="-am"/><arg value="${gensrc}/prolog-am"/>
- <arg value="-s" /><arg value="${gensrc}/prolog-java"/>
- <arg value="src/main/prolog/gerrit_owners.pl"/>
- </java>
- </target>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.8</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${project.build.directory}/generated-sources/prolog-java</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
- <configuration>
- <createDependencyReducedPom>false</createDependencyReducedPom>
- <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
- <artifactSet>
- <excludes>
- <exclude>com.gerritforge:*</exclude>
- <exclude>com.google.gerrit:*</exclude>
- <exclude>org.bouncycastle:*</exclude>
- <exclude>org.slf4j:*</exclude>
- <exclude>com.google.guava:*</exclude>
- <exclude>org.eclipse.jgit:*</exclude>
- <exclude>wsdl4j:wsdl4j:*</exclude>
- </excludes>
- </artifactSet>
- <transformers>
- <transformer
- implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <manifestEntries>
- <Implementation-Vendor>VMware, Inc.</Implementation-Vendor>
- <Implementation-URL>http://github.com/vadims/gerrit-owners</Implementation-URL>
- <Implementation-Title>${Gerrit-ApiType} ${project.artifactId}</Implementation-Title>
- <Implementation-Version>${project.version}</Implementation-Version>
- <Gerrit-ApiType>${Gerrit-ApiType}</Gerrit-ApiType>
- <Gerrit-ApiVersion>${project.version}</Gerrit-ApiVersion>
- </manifestEntries>
- </transformer>
- </transformers>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>shade</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
</plugins>
</build>
<dependencies>
<dependency>
- <groupId>com.google.gerrit</groupId>
- <artifactId>gerrit-${Gerrit-ApiType}-api</artifactId>
- <version>${Gerrit-ApiVersion}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.gerrit</groupId>
- <artifactId>gerrit-server</artifactId>
- <version>${Gerrit-ApiVersion}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.googlecode.prolog-cafe</groupId>
- <artifactId>PrologCafe</artifactId>
- <version>1.3</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.gitective</groupId>
- <artifactId>gitective-core</artifactId>
- <version>0.9.9</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.2.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.2.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.dataformat</groupId>
- <artifactId>jackson-dataformat-yaml</artifactId>
- <version>2.1.4</version>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gerrit</groupId>
+ <artifactId>gerrit-${Gerrit-ApiType}-api</artifactId>
+ <version>${Gerrit-ApiVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.gerrit</groupId>
+ <artifactId>gerrit-server</artifactId>
+ <version>${Gerrit-ApiVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>3.0</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<repositories>
<repository>
<id>gerrit-api-repository</id>