Search in sources :

Example 31 with VisibleForTesting

use of com.android.annotations.VisibleForTesting in project android by JetBrains.

the class ResourceFolderRepositoryFileCacheImpl method stampVersion.

@Override
@VisibleForTesting
public void stampVersion(@NotNull File rootDir, int version) {
    File versionFile = new File(rootDir, CACHE_VERSION_FILENAME);
    try {
        FileUtil.ensureExists(rootDir);
        final DataOutputStream out = new DataOutputStream(new FileOutputStream(versionFile));
        try {
            out.writeInt(version);
            myCacheVersion = version;
        } finally {
            out.close();
        }
    } catch (FileNotFoundException e) {
        getLogger().error("Could not write cache version to file: " + versionFile, e);
    } catch (IOException e) {
        getLogger().error("Could not write cache version to file: " + versionFile, e);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VisibleForTesting(com.android.annotations.VisibleForTesting)

Example 32 with VisibleForTesting

use of com.android.annotations.VisibleForTesting in project android by JetBrains.

the class AndroidTestPackage method getClassFilter.

@Override
@VisibleForTesting
public TestClassFilter getClassFilter(JUnitConfiguration.Data data) throws CantRunException {
    TestClassFilter classFilter = super.getClassFilter(data);
    JUnitConfiguration configuration = getConfiguration();
    Module[] modules = configuration instanceof AndroidJUnitConfiguration ? ((AndroidJUnitConfiguration) configuration).getModulesToCompile() : configuration.getModules();
    for (Module module : modules) {
        TestArtifactSearchScopes testArtifactSearchScopes = TestArtifactSearchScopes.get(module);
        if (testArtifactSearchScopes != null) {
            classFilter = classFilter.intersectionWith(testArtifactSearchScopes.getAndroidTestExcludeScope());
        }
    }
    return classFilter;
}
Also used : TestArtifactSearchScopes(com.android.tools.idea.testartifacts.scopes.TestArtifactSearchScopes) JUnitConfiguration(com.intellij.execution.junit.JUnitConfiguration) Module(com.intellij.openapi.module.Module) TestClassFilter(com.intellij.execution.junit.TestClassFilter) VisibleForTesting(com.android.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.android.annotations.VisibleForTesting)32 VirtualFile (com.intellij.openapi.vfs.VirtualFile)10 File (java.io.File)7 NotNull (org.jetbrains.annotations.NotNull)7 Module (com.intellij.openapi.module.Module)5 ResourceType (com.android.resources.ResourceType)3 StudioLoggerProgressIndicator (com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator)3 Nullable (com.android.annotations.Nullable)2 GradleVersion (com.android.ide.common.repository.GradleVersion)2 Revision (com.android.repository.Revision)2 Device (com.android.sdklib.devices.Device)2 ModuleImporter (com.android.tools.idea.gradle.project.ModuleImporter)2 GradleFacet (com.android.tools.idea.gradle.project.facet.gradle.GradleFacet)2 NdkModuleModel (com.android.tools.idea.gradle.project.model.NdkModuleModel)2 VfsUtil.findFileByIoFile (com.intellij.openapi.vfs.VfsUtil.findFileByIoFile)2 PsiFile (com.intellij.psi.PsiFile)2 BufferedImage (java.awt.image.BufferedImage)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 Nullable (org.jetbrains.annotations.Nullable)2 ApiObjectFactory (com.android.build.gradle.internal.ApiObjectFactory)1