diff options
author | 2017-08-07 21:47:54 +0200 | |
---|---|---|
committer | 2017-08-08 13:02:47 +0200 | |
commit | 963db879575132933d9254406b4c76a8f10b0ad1 (patch) | |
tree | 917fb0d48edadedd2fd2b97e77b0fbc6f4bc6cf9 /src/test/java/com/google/devtools/build/android | |
parent | bd36e5f77c4c891132cb7578779946fa89c394ec (diff) |
Remove special ordering of resources from PlaceholderIdFieldInitializerBuilder
Before this change, PlaceholderIdFieldInitializerBuilder attempted to exactly
mimic the behavior of Aapt and Gradle in assigning resource IDs. However,
nothing should be relying on that specific behavior.
Even if code for some reason is relying on that behavior (by, for example,
doing math on a resource ID to get another resource ID), this code is currently
only used to compile library resource files, which are not actually used in
finished android_binary targets.
This change removes the part that relies on a specific ordering of
ResourceTypes; it instead just relies on the names and ordering within
ResourceType. This makes things a bit simpler and also ensures new resource
types added to the ResourceType enum will be picked up automatically.
In particular, this change will allow us to use the new Font resource type as
soon as it is released in android_ide_common.
RELNOTES: none
PiperOrigin-RevId: 164497262
Diffstat (limited to 'src/test/java/com/google/devtools/build/android')
-rw-r--r-- | src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java b/src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java index 72eac32a7f..62e20479a6 100644 --- a/src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java +++ b/src/test/java/com/google/devtools/build/android/AndroidResourceClassWriterTest.java @@ -86,11 +86,11 @@ public class AndroidResourceClassWriterTest { "package com.carroll.lewis;", "public final class R {", "public static final class id {", - "public static int AdiosButton = 0x7f030000;", - "public static int HelloView = 0x7f030001;", + "public static int AdiosButton = 0x7f020000;", + "public static int HelloView = 0x7f020001;", "}", "public static final class layout {", - "public static int some_layout = 0x7f020000;", + "public static int some_layout = 0x7f030000;", "}", "}" ); @@ -99,17 +99,17 @@ public class AndroidResourceClassWriterTest { .withClass("com.carroll.lewis.R$id") .classContentsIsEqualTo( ImmutableMap.of( - "AdiosButton", 0x7f030000, - "HelloView", 0x7f030001), - ImmutableMap.<String, List<Integer>>of(), + "AdiosButton", 0x7f020000, + "HelloView", 0x7f020001), + ImmutableMap.of(), false ); assertAbout(paths) .that(target) .withClass("com.carroll.lewis.R$layout") .classContentsIsEqualTo( - ImmutableMap.of("some_layout", 0x7f020000), - ImmutableMap.<String, List<Integer>>of(), + ImmutableMap.of("some_layout", 0x7f030000), + ImmutableMap.of(), false ); } |