本文整理汇总了Java中org.robolectric.res.FileFsFile类的典型用法代码示例。如果您正苦于以下问题:Java FileFsFile类的具体用法?Java FileFsFile怎么用?Java FileFsFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileFsFile类属于org.robolectric.res包,在下文中一共展示了FileFsFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@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);
}
示例2: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@Override
protected AndroidManifest getAppManifest(Config config) {
AndroidManifest appManifest = super.getAppManifest(config);
FsFile androidManifestFile = appManifest.getAndroidManifestFile();
if (androidManifestFile.exists()) {
return appManifest;
} else {
androidManifestFile = FileFsFile.from(appManifest.getAndroidManifestFile().getPath()
.replace("manifests/full", "manifests/aapt"));
return new AndroidManifest(androidManifestFile, appManifest.getResDirectory(), appManifest.getAssetsDirectory());
}
}
示例3: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
AndroidManifest appManifest = super.getAppManifest(config);
FsFile androidManifestFile = appManifest.getAndroidManifestFile();
if (androidManifestFile.exists()) {
return appManifest;
} else {
String moduleRoot = getModuleRootPath(config);
androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/full"));
FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath());
FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());
return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
}
}
示例4: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
AndroidManifest appManifest = super.getAppManifest(config);
FsFile androidManifestFile = appManifest.getAndroidManifestFile();
if (androidManifestFile.exists()) {
return appManifest;
} else {
String moduleRoot = getModuleRootPath(config);
androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/full"));
FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath());
FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());
return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
}
}
示例5: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@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);
}
示例6: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
AndroidManifest appManifest = super.getAppManifest(config);
FsFile androidManifestFile = appManifest.getAndroidManifestFile();
if (androidManifestFile.exists()) {
return appManifest;
} else {
String moduleRoot = getModuleRootPath(config);
androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/full"));
FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath().replace("/res", "").replace("bundles", "res"));
FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath().replace("/assets", "").replace("bundles", "assets"));
return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
}
}
示例7: createFile
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
public File createFile(AndroidManifest manifest, String fileName, String contents) throws Exception {
File assetBase = ((FileFsFile) manifest.getAssetsDirectory()).getFile();
File file = new File(assetBase, fileName);
file.getParentFile().mkdirs();
FileWriter fileWriter = new FileWriter(file);
try {
fileWriter.write(contents);
} finally {
fileWriter.close();
}
assetsToDelete.add(file);
return file;
}
示例8: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
AndroidManifest appManifest = super.getAppManifest(config);
FsFile androidManifestFile = appManifest.getAndroidManifestFile();
if (androidManifestFile.exists()) {
return appManifest;
} else {
androidManifestFile = FileFsFile.from(MODULE_ROOT, "src/main/AndroidManifest.xml");
FsFile resDirectory = FileFsFile.from(MODULE_ROOT, "src/main/res");
FsFile assetsDirectory = FileFsFile.from(MODULE_ROOT, "src/main/assets");
return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
}
}
示例9: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
AndroidManifest appManifest = super.getAppManifest(config);
FsFile androidManifestFile = appManifest.getAndroidManifestFile();
if (androidManifestFile.exists()) {
return appManifest;
} else {
String moduleRoot = getModuleRootPath(config);
androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath());
FsFile resDirectory = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("AndroidManifest.xml", "res"));
FsFile assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("AndroidManifest.xml", "assets"));
return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
}
}
示例10: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
AndroidManifest appManifest = super.getAppManifest(config);
FsFile androidManifestFile = appManifest.getAndroidManifestFile();
FsFile resDirectory;
FsFile assetsDirectory;
String moduleRoot = getModuleRootPath(config);
androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/aapt"));
if(appManifest.getResDirectory().getPath().contains("release")) {
resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath().replace("release", "default"));
assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath().replace("release", "default"));
}else{
resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath().replace("bundles/debug/res", "res/merged/debug"));
assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());
}
System.out.print(androidManifestFile.getPath() + '\n');
System.out.print(resDirectory.getPath() + '\n');
System.out.print(assetsDirectory.getPath() + '\n');
return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
}
示例11: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
protected AndroidManifest getAppManifest(Config config) {
AndroidManifest appManifest = super.getAppManifest(config);
FsFile androidManifestFile = appManifest.getAndroidManifestFile();
FsFile resDirectory;
FsFile assetsDirectory;
String moduleRoot = getModuleRootPath(config);
androidManifestFile = FileFsFile.from(moduleRoot, appManifest.getAndroidManifestFile().getPath().replace("bundles", "manifests/aapt"));
if(appManifest.getResDirectory().getPath().contains("release")) {
resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath().replace("release", "default"));
assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath().replace("release", "default"));
}else{
resDirectory = FileFsFile.from(moduleRoot, appManifest.getResDirectory().getPath());
assetsDirectory = FileFsFile.from(moduleRoot, appManifest.getAssetsDirectory().getPath());
}
System.out.print(androidManifestFile.getPath() + '\n');
System.out.print(resDirectory.getPath() + '\n');
System.out.print(assetsDirectory.getPath() + '\n');
return new AndroidManifest(androidManifestFile, resDirectory, assetsDirectory);
}
示例12: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@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);
}
示例13: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@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();
}
};
}
示例14: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@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);
}
示例15: getAppManifest
import org.robolectric.res.FileFsFile; //导入依赖的package包/类
@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);
}