• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.robolectric.res;
2 
3 import java.util.List;
4 import javax.annotation.Nonnull;
5 import org.robolectric.manifest.AndroidManifest;
6 
7 public class ResourceMerger {
8   @Nonnull
buildResourceTable(AndroidManifest appManifest)9   public PackageResourceTable buildResourceTable(AndroidManifest appManifest) {
10     ResourceRemapper resourceRemapper = new ResourceRemapper(appManifest.getRClass());
11 
12     ResourcePath appResourcePath = appManifest.getResourcePath();
13     List<ResourcePath> allResourcePaths = appManifest.getIncludedResourcePaths();
14     for (ResourcePath resourcePath : allResourcePaths) {
15       if (!resourcePath.equals(appResourcePath) && resourcePath.getRClass() != null) {
16         resourceRemapper.remapRClass(resourcePath.getRClass());
17       }
18     }
19 
20     return new ResourceTableFactory().newResourceTable(appManifest.getPackageName(),
21         allResourcePaths.toArray(new ResourcePath[allResourcePaths.size()]));
22   }
23 }
24