Remove a few minor lib.syntax -> lib.packages dependencies.

We want to move Skylark as down on the dependency graph as possible. The immediate motivation is to move Label to the lib.cmdline package, but this is a good idea nevertheless.

--
MOS_MIGRATED_REVID=103178549
diff --git a/src/main/java/com/google/devtools/build/lib/pkgcache/PackageCacheOptions.java b/src/main/java/com/google/devtools/build/lib/pkgcache/PackageCacheOptions.java
index 83067b7..eea6b03 100644
--- a/src/main/java/com/google/devtools/build/lib/pkgcache/PackageCacheOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/pkgcache/PackageCacheOptions.java
@@ -14,11 +14,14 @@
 
 package com.google.devtools.build.lib.pkgcache;
 
+import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableList;
 import com.google.devtools.build.lib.Constants;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
 import com.google.devtools.build.lib.cmdline.PackageIdentifier;
 import com.google.devtools.build.lib.packages.ConstantRuleVisibility;
 import com.google.devtools.build.lib.packages.RuleVisibility;
-import com.google.devtools.build.lib.syntax.CommaSeparatedPackageNameListConverter;
 import com.google.devtools.common.options.Converter;
 import com.google.devtools.common.options.Converters;
 import com.google.devtools.common.options.Option;
@@ -152,4 +155,35 @@
       category = "undocumented",
       help = "Allows the command to fetch external dependencies")
   public boolean fetch;
+
+  /**
+   * A converter from strings containing comma-separated names of packages to lists of strings.
+   */
+  public static class CommaSeparatedPackageNameListConverter
+      implements Converter<List<PackageIdentifier>> {
+
+    private static final Splitter COMMA_SPLITTER = Splitter.on(',');
+
+    @Override
+    public List<PackageIdentifier> convert(String input) throws OptionsParsingException {
+      if (Strings.isNullOrEmpty(input)) {
+        return ImmutableList.of();
+      }
+      ImmutableList.Builder<PackageIdentifier> list = ImmutableList.builder();
+      for (String s : COMMA_SPLITTER.split(input)) {
+        try {
+          list.add(PackageIdentifier.parse(s));
+        } catch (LabelSyntaxException e) {
+          throw new OptionsParsingException(e.getMessage());
+        }
+      }
+      return list.build();
+    }
+
+    @Override
+    public String getTypeDescription() {
+      return "comma-separated list of package names";
+    }
+
+  }
 }
diff --git a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleConfiguredTargetBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleConfiguredTargetBuilder.java
index f2bb02c..f9fd58f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleConfiguredTargetBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/SkylarkRuleConfiguredTargetBuilder.java
@@ -99,7 +99,9 @@
    */
   private static void addRuleToStackTrace(EvalException ex, Rule rule, BaseFunction ruleImpl) {
     if (ex instanceof EvalExceptionWithStackTrace) {
-      ((EvalExceptionWithStackTrace) ex).registerRule(rule, ruleImpl);
+      ((EvalExceptionWithStackTrace) ex).registerRule(
+          String.format("%s(name = '%s')", rule.getRuleClass(), rule.getName()),
+          rule.getLocation(), ruleImpl);
     }
   }
 
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/CommaSeparatedPackageNameListConverter.java b/src/main/java/com/google/devtools/build/lib/syntax/CommaSeparatedPackageNameListConverter.java
deleted file mode 100644
index 78faf36..0000000
--- a/src/main/java/com/google/devtools/build/lib/syntax/CommaSeparatedPackageNameListConverter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2014 Google Inc. All rights reserved.
-//
-// 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.
-package com.google.devtools.build.lib.syntax;
-
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableList;
-import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
-import com.google.devtools.build.lib.cmdline.PackageIdentifier;
-import com.google.devtools.common.options.Converter;
-import com.google.devtools.common.options.OptionsParsingException;
-
-import java.util.List;
-
-/**
- * A converter from strings containing comma-separated names of packages to lists of strings.
- */
-public class CommaSeparatedPackageNameListConverter
-    implements Converter<List<PackageIdentifier>> {
-
-  private static final Splitter SPACE_SPLITTER = Splitter.on(',');
-
-  @Override
-  public List<PackageIdentifier> convert(String input) throws OptionsParsingException {
-    if (Strings.isNullOrEmpty(input)) {
-      return ImmutableList.of();
-    }
-    ImmutableList.Builder<PackageIdentifier> list = ImmutableList.builder();
-    for (String s : SPACE_SPLITTER.split(input)) {
-      try {
-        list.add(PackageIdentifier.parse(s));
-      } catch (LabelSyntaxException e) {
-        throw new OptionsParsingException(e.getMessage());
-      }
-    }
-    return list.build();
-  }
-
-  @Override
-  public String getTypeDescription() {
-    return "comma-separated list of package names";
-  }
-
-}
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java b/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
index 9ec6860..bf25d70 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/EvalExceptionWithStackTrace.java
@@ -16,7 +16,6 @@
 import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
 import com.google.devtools.build.lib.events.Location;
-import com.google.devtools.build.lib.packages.Rule;
 
 import java.util.Deque;
 import java.util.LinkedList;
@@ -74,7 +73,7 @@
   /**
    * Adds the given {@code Rule} to the stack trace.
    */
-  public void registerRule(Rule rule, BaseFunction ruleImpl) {
+  public void registerRule(String rule, Location location, BaseFunction ruleImpl) {
     /* We have to model the transition from BUILD file to bzl file manually since the stack trace
      * mechanism cannot do that by itself (because, for example, the rule implementation does not
      * have a corresponding FuncallExpression).
@@ -105,8 +104,7 @@
      *
      * */
     addStackFrame(ruleImpl.getName(), ruleImpl.getLocation());
-    addStackFrame(String.format("%s(name = '%s')", rule.getRuleClass(), rule.getName()),
-        rule.getLocation(), false);
+    addStackFrame(rule, location, false);
   }
 
   /**