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:
@@ -180,7 +180,6 @@ limitations under the License.
|
||||
<configuration>
|
||||
<target>
|
||||
<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"
|
||||
fork="true"
|
||||
@@ -189,8 +188,8 @@ limitations under the License.
|
||||
<arg value="--show-stack-trace"/>
|
||||
<arg value="-O"/>
|
||||
<arg value="-am"/><arg value="${gensrc}/prolog-am"/>
|
||||
<arg value="-s" /><arg value="${pkg}/common"/>
|
||||
<arg value="src/main/prolog/common_rules.pl"/>
|
||||
<arg value="-s" /><arg value="${gensrc}/prolog-java"/>
|
||||
<arg value="src/main/prolog/gerrit_common.pl"/>
|
||||
</java>
|
||||
</target>
|
||||
</configuration>
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.googlecode.prolog_cafe.lang.Term;
|
||||
public class PrologEnvironment extends BufferingPrologControl {
|
||||
private static final String[] PACKAGE_LIST = {
|
||||
Prolog.BUILTIN,
|
||||
"com.google.gerrit.rules.common",
|
||||
"gerrit",
|
||||
};
|
||||
|
||||
public static interface Factory {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.rules.common;
|
||||
package gerrit;
|
||||
|
||||
import com.google.gerrit.reviewdb.Account;
|
||||
import com.google.gerrit.reviewdb.ReviewDb;
|
||||
@@ -1,6 +1,6 @@
|
||||
// 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.ApprovalTypes;
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// 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.PermissionRange;
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// 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.ApprovalTypes;
|
||||
@@ -12,10 +12,7 @@
|
||||
%% See the License for the specific language governing permissions and
|
||||
%% limitations under the License.
|
||||
|
||||
:- op(1150, fx, (package)).
|
||||
:- op(1150, fx, (public)).
|
||||
|
||||
:- package 'com.google.gerrit.rules.common'.
|
||||
:- package 'gerrit'.
|
||||
'$init' :- init.
|
||||
|
||||
|
||||
@@ -12,20 +12,19 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// 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.ApprovalTypes;
|
||||
import com.google.gerrit.reviewdb.ApprovalCategory;
|
||||
import com.google.gerrit.reviewdb.ApprovalCategoryValue;
|
||||
import com.google.gerrit.rules.PrologTestCase;
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class CommonRulesTest extends PrologTestCase {
|
||||
public class GerritCommonTest extends PrologTestCase {
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@@ -35,7 +34,7 @@ public class CommonRulesTest extends PrologTestCase {
|
||||
verifiedCategory()
|
||||
));
|
||||
|
||||
load("common_rules_test.pl", new AbstractModule() {
|
||||
load("gerrit_common_test.pl", new AbstractModule() {
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(ApprovalTypes.class).toInstance(types);
|
||||
@@ -12,7 +12,7 @@
|
||||
%% See the License for the specific language governing permissions and
|
||||
%% limitations under the License.
|
||||
|
||||
:- package 'com.google.gerrit.rules.common'.
|
||||
:- package 'gerrit'.
|
||||
|
||||
|
||||
%% not_same
|
||||
Reference in New Issue
Block a user