Extract part of EnvironmentGroup that's necessary for constraint calculation, so we don't have to have the whole package.

Memory increase should be minimal because there aren't that many environment groups, but it's further minimized by breaking an inner class UnpackagedEnvironmentGroup out of EnvironmentGroup. Previously, each EnvironmentGroup cost 40 bytes (24 bytes for first three fields, 8 for next two, 8 for last field because of alignment). Each UnpackagedEnvironmentGroup costs 32 bytes (4 fields), while the EnvironmentGroup now costs 24 bytes. So a loss of 16 bytes per EnvironmentGroup: shouldn't be noticeable.

PiperOrigin-RevId: 185837140
diff --git a/src/test/java/com/google/devtools/build/lib/packages/EnvironmentGroupTest.java b/src/test/java/com/google/devtools/build/lib/packages/EnvironmentGroupTest.java
index f9dde14..a1835bc 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/EnvironmentGroupTest.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/EnvironmentGroupTest.java
@@ -73,18 +73,20 @@
 
   @Test
   public void testIsDefault() throws Exception {
-    assertThat(group.isDefault(Label.parseAbsolute("//pkg:foo"))).isTrue();
-    assertThat(group.isDefault(Label.parseAbsolute("//pkg:bar"))).isFalse();
-    assertThat(group.isDefault(Label.parseAbsolute("//pkg:baz"))).isFalse();
-    assertThat(group.isDefault(Label.parseAbsolute("//pkg:not_in_group"))).isFalse();
+    EnvironmentLabels unpackedGroup = group.getEnvironmentLabels();
+    assertThat(unpackedGroup.isDefault(Label.parseAbsolute("//pkg:foo"))).isTrue();
+    assertThat(unpackedGroup.isDefault(Label.parseAbsolute("//pkg:bar"))).isFalse();
+    assertThat(unpackedGroup.isDefault(Label.parseAbsolute("//pkg:baz"))).isFalse();
+    assertThat(unpackedGroup.isDefault(Label.parseAbsolute("//pkg:not_in_group"))).isFalse();
   }
 
   @Test
   public void testFulfillers() throws Exception {
-    assertThat(group.getFulfillers(Label.parseAbsolute("//pkg:baz")))
+    EnvironmentLabels unpackedGroup = group.getEnvironmentLabels();
+    assertThat(unpackedGroup.getFulfillers(Label.parseAbsolute("//pkg:baz")))
         .containsExactly(Label.parseAbsolute("//pkg:foo"), Label.parseAbsolute("//pkg:bar"));
-    assertThat(group.getFulfillers(Label.parseAbsolute("//pkg:bar")))
+    assertThat(unpackedGroup.getFulfillers(Label.parseAbsolute("//pkg:bar")))
         .containsExactly(Label.parseAbsolute("//pkg:foo"));
-    assertThat(group.getFulfillers(Label.parseAbsolute("//pkg:foo"))).isEmpty();
+    assertThat(unpackedGroup.getFulfillers(Label.parseAbsolute("//pkg:foo"))).isEmpty();
   }
 }