Config.java revision c7482da584ddaa03f91afa7b785ed17fa084aa47
1cfb3d242306311ce27ec51bf511764377c173a7cKiran Ryali + Christian Williamspackage org.robolectric.annotation; 2dd40f718cf785a56e63c0685feeb73d266c13e3fWenhui Yao 39cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrishimport android.app.Application; 4f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport org.jetbrains.annotations.NotNull; 5f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 6f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.Annotation; 7f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.Documented; 8f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.ElementType; 9f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.Retention; 10f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.RetentionPolicy; 11f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.lang.annotation.Target; 12f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williamsimport java.util.Arrays; 13c77f5791f081893a18f9db753bb5022269a7c5a6Simon Arlottimport java.util.HashSet; 1423a26cc3e5b33c0503a99847292ac99817f5af43Christian Williamsimport java.util.Properties; 15c77f5791f081893a18f9db753bb5022269a7c5a6Simon Arlottimport java.util.Set; 16f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 17dd40f718cf785a56e63c0685feeb73d266c13e3fWenhui Yao/** 18c7482da584ddaa03f91afa7b785ed17fa084aa47Erich Douglass * Configuration settings that can be used on a per-class or per-test basis. 19dd40f718cf785a56e63c0685feeb73d266c13e3fWenhui Yao */ 20f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams@Documented 21f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams@Retention(RetentionPolicy.RUNTIME) 22f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams@Target({ElementType.TYPE, ElementType.METHOD}) 237be4d2ba0e45483ad70cbd994955ae1b70afafdcKiran Ryali + Christian Williamspublic @interface Config { 2429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public static final String NONE = "--none"; 2529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public static final String DEFAULT = "--default"; 266b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public static final String DEFAULT_RES_FOLDER = "res"; 276b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public static final String DEFAULT_ASSET_FOLDER = "assets"; 2829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 2929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 30074a38a2ee8dd8cb1904853aebf2f30146d563a2Mike Grafton * The Android SDK level to emulate. If not specified, Robolectric defaults to API 16. 3183bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * 3283bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * @return The Android SDK level to emulate. 3329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 34b2a2e594372228d4e4cae61730152d4e1047c8a7Erich Douglass int emulateSdk() default -1; 3529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 3629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 3729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * The Android manifest file to load; Robolectric will look relative to the current directory. 3829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * Resources and assets will be loaded relative to the manifest. 3929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * 4029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * If not specified, Robolectric defaults to {@code AndroidManifest.xml}. 4129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * 4229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * If your project has no manifest or resources, use {@link Config#NONE}. 4383bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * 4483bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * @return The Android manifest file to load. 4529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 4629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams String manifest() default DEFAULT; 4729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 4829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 499cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish * The {@link android.app.Application} class to use in the test, this takes precedence over any application 509cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish * specified in the AndroidManifest.xml. 5183bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * 5283bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * @return The {@link android.app.Application} class to use in the test. 539cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish */ 549cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish Class<? extends Application> application() default Application.class; 559cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish 569cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish /** 5729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * Qualifiers for the resource resolution, such as "fr-normal-port-hdpi". 5829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * 5983bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * @return Qualifiers used for resource resolution. 6029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 6129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams String qualifiers() default ""; 6229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 6329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 646b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * The directory from which to load resources. This should be relative to the directory containing AndroidManifest.xml. 6583bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * 666b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * <p> 675277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John * If not specified, Robolectric defaults to {@code res}. 6883bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * 6983bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * @return Android resource directory. 705277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John */ 716b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass String resourceDir() default DEFAULT_RES_FOLDER; 726b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass 736b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass /** 746b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * The directory from which to load assets. This should be relative to the directory containing AndroidManifest.xml. 7583bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * 766b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * <p> 776b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass * If not specified, Robolectric defaults to {@code assets}. 7883bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * 7983bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * @return Android asset directory. 806b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass */ 816b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass String assetDir() default DEFAULT_ASSET_FOLDER; 825277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John 835277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John /** 8429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * The Android SDK level to report in Build.VERSION.SDK_INT. 8529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * 8683bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * @return The Android SDK level to report. 8729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 8829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams int reportSdk() default -1; 8929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 9029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams /** 9129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams * A list of shadow classes to enable, in addition to those that are already present. 9283bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * 9383bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * @return A list of additional shadow classes to enable. 9429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams */ 9529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Class<?>[] shadows() default {}; 9629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 97ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson /** 98ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson * A list of folders containing Android Libraries on which this project depends. 9983bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * 10083bcaf5aa4b64a2223cfada134ef02e5c8ff660aErich Douglass * @return A list of Android Libraries. 101ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson */ 102ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson String[] libraries() default {}; 103ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 10429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public class Implementation implements Config { 10529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final int emulateSdk; 10629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final String manifest; 10729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final String qualifiers; 1085277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John private final String resourceDir; 1096b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass private final String assetDir; 11029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final int reportSdk; 11129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private final Class<?>[] shadows; 1129cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish private final Class<? extends Application> application; 113ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson private final String[] libraries; 11429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams 11529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public static Config fromProperties(Properties configProperties) { 11629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (configProperties == null || configProperties.size() == 0) return null; 11729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return new Implementation( 11829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Integer.parseInt(configProperties.getProperty("emulateSdk", "-1")), 11929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams configProperties.getProperty("manifest", DEFAULT), 12029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams configProperties.getProperty("qualifiers", ""), 1216b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass configProperties.getProperty("resourceDir", Config.DEFAULT_RES_FOLDER), 1226b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass configProperties.getProperty("assetDir", Config.DEFAULT_ASSET_FOLDER), 12329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Integer.parseInt(configProperties.getProperty("reportSdk", "-1")), 1249cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish parseClasses(configProperties.getProperty("shadows", "")), 125ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson parseApplication(configProperties.getProperty("application", "android.app.Application")), 126ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson parsePaths(configProperties.getProperty("libraries", "")) 12729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams ); 12829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 12923a26cc3e5b33c0503a99847292ac99817f5af43Christian Williams 13029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private static Class<?>[] parseClasses(String classList) { 13129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (classList.length() == 0) return new Class[0]; 13229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams String[] classNames = classList.split("[, ]+"); 13329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Class[] classes = new Class[classNames.length]; 13429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams for (int i = 0; i < classNames.length; i++) { 13529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams try { 13629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams classes[i] = Implementation.class.getClassLoader().loadClass(classNames[i]); 13729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } catch (ClassNotFoundException e) { 13829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams throw new RuntimeException(e); 13923a26cc3e5b33c0503a99847292ac99817f5af43Christian Williams } 14029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 14129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return classes; 14229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 14323a26cc3e5b33c0503a99847292ac99817f5af43Christian Williams 1449cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish private static <T extends Application> Class<T> parseApplication(String className) { 1459cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish try { 1469cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish Class<T> aClass = (Class<T>) Implementation.class.getClassLoader().loadClass(className); 1479cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish return aClass; 1489cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish } catch (ClassNotFoundException e) { 1499cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish throw new RuntimeException(e); 1509cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish } 1519cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish } 1529cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish 153ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson private static String[] parsePaths(String pathList) { 154ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson if (pathList.length() == 0) return new String[0]; 155ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson return pathList.split("[, ]+"); 156ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson } 157ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 1586b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public Implementation(int emulateSdk, String manifest, String qualifiers, String resourceDir, String assetDir, int reportSdk, Class<?>[] shadows, Class<? extends Application> application, String[] libraries) { 15929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.emulateSdk = emulateSdk; 16029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.manifest = manifest; 16129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.qualifiers = qualifiers; 1625277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John this.resourceDir = resourceDir; 1636b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass this.assetDir = assetDir; 16429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.reportSdk = reportSdk; 16529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.shadows = shadows; 1669cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish this.application = application; 167ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson this.libraries = libraries; 16829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 169f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 17029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public Implementation(Config baseConfig, Config overlayConfig) { 171b2a2e594372228d4e4cae61730152d4e1047c8a7Erich Douglass this.emulateSdk = pick(baseConfig.emulateSdk(), overlayConfig.emulateSdk(), -1); 17229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.manifest = pick(baseConfig.manifest(), overlayConfig.manifest(), DEFAULT); 17329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.qualifiers = pick(baseConfig.qualifiers(), overlayConfig.qualifiers(), ""); 1746b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass this.resourceDir = pick(baseConfig.resourceDir(), overlayConfig.resourceDir(), Config.DEFAULT_RES_FOLDER); 1756b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass this.assetDir = pick(baseConfig.assetDir(), overlayConfig.assetDir(), Config.DEFAULT_ASSET_FOLDER); 17629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.reportSdk = pick(baseConfig.reportSdk(), overlayConfig.reportSdk(), -1); 177ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 178c77f5791f081893a18f9db753bb5022269a7c5a6Simon Arlott Set<Class<?>> shadows = new HashSet<Class<?>>(); 17929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams shadows.addAll(Arrays.asList(baseConfig.shadows())); 18029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams shadows.addAll(Arrays.asList(overlayConfig.shadows())); 18129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams this.shadows = shadows.toArray(new Class[shadows.size()]); 182ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 1839cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish this.application = pick(baseConfig.application(), overlayConfig.application(), null); 184ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 185ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson Set<String> libraries = new HashSet<String>(); 186ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson libraries.addAll(Arrays.asList(baseConfig.libraries())); 187ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson libraries.addAll(Arrays.asList(overlayConfig.libraries())); 188ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson this.libraries = libraries.toArray(new String[libraries.size()]); 18929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 190f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 19129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams private <T> T pick(T baseValue, T overlayValue, T nullValue) { 19229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return overlayValue.equals(nullValue) ? baseValue : overlayValue; 19329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 194f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 1956b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 1966b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public int emulateSdk() { 19729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return emulateSdk; 19829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 199f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 2006b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2016b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public String manifest() { 20229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return manifest; 20329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 20448f95f3e0955035946f7c416dec56219a9b19886Christian Williams 2059cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish @Override 2069cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish public Class<? extends Application> application() { 2079cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish return application; 2089cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish } 2099cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish 2106b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2116b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public String qualifiers() { 21229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return qualifiers; 21329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 214f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 2155277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John @Override 2165277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John public String resourceDir() { 2175277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John return resourceDir; 2185277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John } 2195277f871bca2be31c657ace35ae305285b2e0c55Ryan Spore and Trevor John 2206b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2216b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public String assetDir() { 2226b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass return assetDir; 2236b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass } 2246b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass 2256b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2266b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public int reportSdk() { 22729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return reportSdk; 22829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 229f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 2306b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2316b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public Class<?>[] shadows() { 23229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return shadows; 23329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 234f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 2356b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @Override 2366b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public String[] libraries() { 237ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson return libraries; 238ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson } 239ed898f2b5b7312af4779636638d081aa6ebd9e13Andrew Richardson 2406b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass @NotNull @Override 2416b00d4156e2e6bb2d262458a2650a109ddc76c76Erich Douglass public Class<? extends Annotation> annotationType() { 24229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return Config.class; 24329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 244f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 24529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams @Override 24629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public boolean equals(Object o) { 24729a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (this == o) return true; 24829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (o == null || getClass() != o.getClass()) return false; 249f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 25029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams Implementation other = (Implementation) o; 251f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 25229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (emulateSdk != other.emulateSdk) return false; 25329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (reportSdk != other.reportSdk) return false; 25429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (!qualifiers.equals(other.qualifiers)) return false; 25529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams if (!Arrays.equals(shadows, other.shadows)) return false; 2569cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish if (application != other.application) return false; 257f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 25829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return true; 25929a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 260f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams 26129a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams @Override 26229a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams public int hashCode() { 26329a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams int result = emulateSdk; 26429a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams result = 31 * result + qualifiers.hashCode(); 26529a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams result = 31 * result + reportSdk; 26629a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams result = 31 * result + Arrays.hashCode(shadows); 2679cc9bde8928b83e5de9cd1c521e157e1a584b2fdJonathan Gerrish result = 31 * result + application.hashCode(); 26829a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams return result; 269f6df8a55ac378dee35324bc865fb4d741dcb4824Christian Williams } 27029a8359eaef1ee9f40c967d3c4b5c1117c8c2a43Christian Williams } 271dd40f718cf785a56e63c0685feeb73d266c13e3fWenhui Yao} 272