Move common Prolog predicates to 'gerrit' package

Because user code will need to import our common rules, move them
to a shorter name "gerrit". This is not likely to collide with any
classes in a running server as we will eventually narrow down the
set of classes available to the PrologEnvironment to a smaller set
than the entire running server, and we aren't likely to ever use a
3rd party library from the gerrit.com domain.

Change-Id: I8f111ea2cb58229159d3a72c081a3808cc6c3438
This commit is contained in:
Shawn O. Pearce
2011-06-15 09:35:07 -07:00
parent 92d912bc5c
commit 1418b1beb0
9 changed files with 12 additions and 17 deletions

View File

@@ -180,7 +180,6 @@ limitations under the License.
<configuration> <configuration>
<target> <target>
<property name="gensrc" location="${project.build.directory}/generated-sources"/> <property name="gensrc" location="${project.build.directory}/generated-sources"/>
<property name="pkg" location="${gensrc}/prolog-java/com/google/gerrit/rules"/>
<java classname="com.googlecode.prolog_cafe.compiler.Compiler" <java classname="com.googlecode.prolog_cafe.compiler.Compiler"
fork="true" fork="true"
@@ -189,8 +188,8 @@ limitations under the License.
<arg value="--show-stack-trace"/> <arg value="--show-stack-trace"/>
<arg value="-O"/> <arg value="-O"/>
<arg value="-am"/><arg value="${gensrc}/prolog-am"/> <arg value="-am"/><arg value="${gensrc}/prolog-am"/>
<arg value="-s" /><arg value="${pkg}/common"/> <arg value="-s" /><arg value="${gensrc}/prolog-java"/>
<arg value="src/main/prolog/common_rules.pl"/> <arg value="src/main/prolog/gerrit_common.pl"/>
</java> </java>
</target> </target>
</configuration> </configuration>

View File

@@ -34,7 +34,7 @@ import com.googlecode.prolog_cafe.lang.Term;
public class PrologEnvironment extends BufferingPrologControl { public class PrologEnvironment extends BufferingPrologControl {
private static final String[] PACKAGE_LIST = { private static final String[] PACKAGE_LIST = {
Prolog.BUILTIN, Prolog.BUILTIN,
"com.google.gerrit.rules.common", "gerrit",
}; };
public static interface Factory { public static interface Factory {

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.gerrit.rules.common; package gerrit;
import com.google.gerrit.reviewdb.Account; import com.google.gerrit.reviewdb.Account;
import com.google.gerrit.reviewdb.ReviewDb; import com.google.gerrit.reviewdb.ReviewDb;

View File

@@ -1,6 +1,6 @@
// Copyright 2011 Google Inc. All Rights Reserved. // Copyright 2011 Google Inc. All Rights Reserved.
package com.google.gerrit.rules.common; package gerrit;
import com.google.gerrit.common.data.ApprovalType; import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.common.data.ApprovalTypes; import com.google.gerrit.common.data.ApprovalTypes;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.gerrit.rules.common; package gerrit;
import com.google.gerrit.common.data.Permission; import com.google.gerrit.common.data.Permission;
import com.google.gerrit.common.data.PermissionRange; import com.google.gerrit.common.data.PermissionRange;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.gerrit.rules.common; package gerrit;
import com.google.gerrit.common.data.ApprovalType; import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.common.data.ApprovalTypes; import com.google.gerrit.common.data.ApprovalTypes;

View File

@@ -12,10 +12,7 @@
%% See the License for the specific language governing permissions and %% See the License for the specific language governing permissions and
%% limitations under the License. %% limitations under the License.
:- op(1150, fx, (package)). :- package 'gerrit'.
:- op(1150, fx, (public)).
:- package 'com.google.gerrit.rules.common'.
'$init' :- init. '$init' :- init.

View File

@@ -12,20 +12,19 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package com.google.gerrit.rules.common; package com.google.gerrit.rules;
import com.google.gerrit.common.data.ApprovalType; import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.common.data.ApprovalTypes; import com.google.gerrit.common.data.ApprovalTypes;
import com.google.gerrit.reviewdb.ApprovalCategory; import com.google.gerrit.reviewdb.ApprovalCategory;
import com.google.gerrit.reviewdb.ApprovalCategoryValue; import com.google.gerrit.reviewdb.ApprovalCategoryValue;
import com.google.gerrit.rules.PrologTestCase;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
public class CommonRulesTest extends PrologTestCase { public class GerritCommonTest extends PrologTestCase {
@Override @Override
public void setUp() throws Exception { public void setUp() throws Exception {
super.setUp(); super.setUp();
@@ -35,7 +34,7 @@ public class CommonRulesTest extends PrologTestCase {
verifiedCategory() verifiedCategory()
)); ));
load("common_rules_test.pl", new AbstractModule() { load("gerrit_common_test.pl", new AbstractModule() {
@Override @Override
protected void configure() { protected void configure() {
bind(ApprovalTypes.class).toInstance(types); bind(ApprovalTypes.class).toInstance(types);

View File

@@ -12,7 +12,7 @@
%% See the License for the specific language governing permissions and %% See the License for the specific language governing permissions and
%% limitations under the License. %% limitations under the License.
:- package 'com.google.gerrit.rules.common'. :- package 'gerrit'.
%% not_same %% not_same