@Override protected AndroidManifest getAppManifest(Config config) { if (config.constants() == Void.class) { Logger.error("Field 'constants' not specified in @Config annotation"); Logger.error("This is required when using RobolectricGradleTestRunner!"); throw new RuntimeException("No 'constants' field in @Config annotation!"); } final String type = getType(config); final String flavor = getFlavor(config); final String applicationId = getApplicationId(config); final FileFsFile res; if (FileFsFile.from(BUILD_OUTPUT, "res", flavor, type).exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type); } else { // Use res/merged if the output directory doesn't exist for Data Binding compatibility res = FileFsFile.from(BUILD_OUTPUT, "res/merged", flavor, type); } final FileFsFile assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type); final FileFsFile manifest; if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) { manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml"); } else { // Fallback to the location for library manifests manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml"); } Logger.debug("Robolectric assets directory: " + assets.getPath()); Logger.debug(" Robolectric res directory: " + res.getPath()); Logger.debug(" Robolectric manifest path: " + manifest.getPath()); Logger.debug(" Robolectric package name: " + applicationId); return new AndroidManifest(manifest, res, assets, applicationId); }
@Override protected AndroidManifest getAppManifest(Config config) { if (config.constants() == Void.class) { Logger.error("Field 'constants' not specified in @Config annotation"); Logger.error("This is required when using RobolectricGradleTestRunner!"); throw new RuntimeException("No 'constants' field in @Config annotation!"); } final String type = getType(config); final String flavor = getFlavor(config); final String packageName = getPackageName(config); final FileFsFile res; final FileFsFile assets; final FileFsFile manifest; if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type); } else { res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res"); } if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) { assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type); } else { assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets"); } if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) { manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "androidTest", flavor, type, "AndroidManifest.xml"); } else { manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml"); } Logger.debug("Robolectric assets directory: " + assets.getPath()); Logger.debug(" Robolectric res directory: " + res.getPath()); Logger.debug(" Robolectric manifest path: " + manifest.getPath()); Logger.debug(" Robolectric package name: " + packageName); return new AndroidManifest(manifest, res, assets, packageName); }
@Override protected AndroidManifest getAppManifest(Config config) { if (config.constants() == Void.class) { Logger.error("Field 'constants' not specified in @Config annotation"); Logger.error("This is required when using RobolectricGradleTestRunner!"); throw new RuntimeException("No 'constants' field in @Config annotation!"); } final String type = getType(config); final String flavor = getFlavor(config); final String packageName = getPackageName(config); final FileFsFile res; final FileFsFile assets; final FileFsFile manifest; // res/merged added in Android Gradle plugin 1.3-beta1 // Recognize new name for data binding layouts until later plugin version if (FileFsFile.from(BUILD_OUTPUT, "data-binding-layout-out").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "data-binding-layout-out", flavor, type); } else if (FileFsFile.from(BUILD_OUTPUT, "res", "merged").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", "merged", flavor, type); } else if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type); } else { res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res"); } if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) { assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type); } else { assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets"); } if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) { manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml"); } else { manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml"); } Logger.debug("Robolectric assets directory: " + assets.getPath()); Logger.debug(" Robolectric res directory: " + res.getPath()); Logger.debug(" Robolectric manifest path: " + manifest.getPath()); Logger.debug(" Robolectric package name: " + packageName); return new AndroidManifest(manifest, res, assets, packageName); }
@Override protected AndroidManifest getAppManifest(final Config config) { if (config.constants() == Void.class) { Logger.error("Field 'constants' not specified in @Config annotation"); Logger.error("This is required when using RobolectricGradleTestRunner!"); throw new RuntimeException("No 'constants' field in @Config annotation!"); } final String type = getType(config); final String flavor = getFlavor(config); final String packageName = getPackageName(config); final FileFsFile res; final FileFsFile assets; final FileFsFile manifest; // res/merged added in Android Gradle plugin 1.3-beta1 if (FileFsFile.from(BUILD_OUTPUT, "res", "merged").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", "merged", flavor, type); } else if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type); } else { res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res"); } if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) { assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type); } else { assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets"); } if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) { manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml"); } else { manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml"); } Logger.debug("Robolectric assets directory: " + assets.getPath()); Logger.debug(" Robolectric res directory: " + res.getPath()); Logger.debug(" Robolectric manifest path: " + manifest.getPath()); Logger.debug(" Robolectric package name: " + packageName); return new AndroidManifest(manifest, res, assets) { @Override public String getRClassName() throws Exception { return com.kickstarter.R.class.getName(); } }; }
@Override protected AndroidManifest getAppManifest(Config config) { if (config.constants() == Void.class) { Logger.error("Field 'constants' not specified in @Config annotation"); Logger.error("This is required when using RobolectricGradleTestRunner!"); throw new RuntimeException("No 'constants' field in @Config annotation!"); } final String type = getType(config); final String flavor = getFlavor(config); final String packageName = getPackageName(config); final FileFsFile res; final FileFsFile assets; final FileFsFile manifest; // res/merged added in Android Gradle plugin 1.3-beta1 if (FileFsFile.from(BUILD_OUTPUT, "res", "merged").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", "merged", flavor, type); } else if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type); } else { res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res"); } if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) { assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type); } else { assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets"); } if (FileFsFile.from(BUILD_OUTPUT, "manifests", "test", flavor, type, "AndroidManifest.xml").exists()) { manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "test", flavor, type, "AndroidManifest.xml"); } else if (FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml").exists()) { manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml"); } else { manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml"); } Logger.debug("Robolectric assets directory: " + assets.getPath()); Logger.debug(" Robolectric res directory: " + res.getPath()); Logger.debug(" Robolectric manifest path: " + manifest.getPath()); Logger.debug(" Robolectric package name: " + packageName); return new AndroidManifest(manifest, res, assets, packageName); }
@Override protected AndroidManifest getAppManifest(Config config) { if (config.constants() == Void.class) { Logger.error("Field 'constants' not specified in @Config annotation"); Logger.error("This is required when using RobolectricGradleTestRunner!"); throw new RuntimeException("No 'constants' field in @Config annotation!"); } final String type = getType(config); final String flavor = getFlavor(config); final String packageName = getPackageName(config); final FileFsFile res; final FileFsFile assets; final FileFsFile manifest; if (FileFsFile.from(BUILD_OUTPUT, "data-binding-layout-out").exists()) { // Android gradle plugin 1.5.0+ puts the merged layouts in data-binding-layout-out. // https://github.com/robolectric/robolectric/issues/2143 res = FileFsFile.from(BUILD_OUTPUT, "data-binding-layout-out", flavor, type); } else if (FileFsFile.from(BUILD_OUTPUT, "res", "merged").exists()) { // res/merged added in Android Gradle plugin 1.3-beta1 res = FileFsFile.from(BUILD_OUTPUT, "res", "merged", flavor, type); } else if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type); } else { res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res"); } if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) { assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type); } else { assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets"); } if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) { manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "full", flavor, type, "AndroidManifest.xml"); } else { manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml"); } Logger.debug("Robolectric assets directory: " + assets.getPath()); Logger.debug(" Robolectric res directory: " + res.getPath()); Logger.debug(" Robolectric manifest path: " + manifest.getPath()); Logger.debug(" Robolectric package name: " + packageName); return new AndroidManifest(manifest, res, assets, packageName); }
@Override protected AndroidManifest getAppManifest(Config config) { final String cwd = System.getProperty("user.dir"); Logger.debug("Current working directory: " + cwd); if (config.constants() == Void.class) { Logger.error("Field 'constants' not specified in @Config annotation"); Logger.error("This is required when using RobolectricGradleTestRunner!"); throw new RuntimeException("No 'constants' field in @Config annotation!"); } final String type = getType(config); final String flavor = getFlavor(config); final String packageName = getPackageName(config); final FileFsFile res; final FileFsFile assets; final FileFsFile manifest; if (FileFsFile.from(BUILD_OUTPUT, "res").exists()) { res = FileFsFile.from(BUILD_OUTPUT, "res", flavor, type); } else { res = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "res"); } if (FileFsFile.from(BUILD_OUTPUT, "assets").exists()) { assets = FileFsFile.from(BUILD_OUTPUT, "assets", flavor, type); } else { assets = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "assets"); } if (FileFsFile.from(BUILD_OUTPUT, "manifests").exists()) { // [CUSTOMIZED] The default implementation uses `full` instead of `aapt`. manifest = FileFsFile.from(BUILD_OUTPUT, "manifests", "aapt", flavor, type, "AndroidManifest.xml"); } else { manifest = FileFsFile.from(BUILD_OUTPUT, "bundles", flavor, type, "AndroidManifest.xml"); } Logger.debug("Robolectric assets directory: " + assets.getPath()); Logger.debug(" Robolectric res directory: " + res.getPath()); Logger.debug(" Robolectric manifest path: " + manifest.getPath()); Logger.debug(" Robolectric package name: " + packageName); return new AndroidManifest(manifest, res, assets, packageName); }