Search in sources :

Example 16 with AndroidVersion

use of com.android.sdklib.AndroidVersion in project android by JetBrains.

the class InstantRunBuilderTest method fullBuildIfExecutorSwitchedOnApiBelow21.

@Test
public void fullBuildIfExecutorSwitchedOnApiBelow21() throws Exception {
    myDumpsysPackageOutput = DUMPSYS_PACKAGE_EXISTS;
    myDeviceBuildTimetamp = "100";
    myAppInForeground = true;
    myRunConfigContext.setSameExecutorAsPreviousSession(false);
    when(myDevice.getVersion()).thenReturn(new AndroidVersion(20, null));
    setUpDeviceForHotSwap();
    myBuilder.build(myTaskRunner, Collections.emptyList());
    assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV,FULL_APK -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
}
Also used : AndroidVersion(com.android.sdklib.AndroidVersion) Test(org.junit.Test)

Example 17 with AndroidVersion

use of com.android.sdklib.AndroidVersion in project android by JetBrains.

the class InstantRunBuilderTest method fullBuildIfBuildTimestampsDoNotMatch.

@Test
public void fullBuildIfBuildTimestampsDoNotMatch() throws Exception {
    myDumpsysPackageOutput = DUMPSYS_PACKAGE_EXISTS;
    myDeviceBuildTimetamp = "123";
    when(myDevice.getVersion()).thenReturn(new AndroidVersion(23, null));
    setUpDeviceForHotSwap();
    myBuilder.build(myTaskRunner, Collections.emptyList());
    assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV,FULL_APK -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
}
Also used : AndroidVersion(com.android.sdklib.AndroidVersion) Test(org.junit.Test)

Example 18 with AndroidVersion

use of com.android.sdklib.AndroidVersion in project android by JetBrains.

the class InstantRunBuilderTest method fullBuildWhenPackageNotInstalledOnDevice.

@Test
public void fullBuildWhenPackageNotInstalledOnDevice() throws Exception {
    myDumpsysPackageOutput = DUMPSYS_NO_SUCH_PACKAGE;
    when(myDevice.getVersion()).thenReturn(new AndroidVersion(23, null));
    myBuilder.build(myTaskRunner, Collections.emptyList());
    assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV,FULL_APK -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
}
Also used : AndroidVersion(com.android.sdklib.AndroidVersion) Test(org.junit.Test)

Example 19 with AndroidVersion

use of com.android.sdklib.AndroidVersion in project android by JetBrains.

the class InstantRunBuilderTest method noRebuildIfNoArtifactsAfterHotswapBuild.

@Test
public void noRebuildIfNoArtifactsAfterHotswapBuild() throws Exception {
    myDumpsysPackageOutput = DUMPSYS_PACKAGE_EXISTS;
    myDeviceBuildTimetamp = "100";
    myAppInForeground = true;
    myRunConfigContext.setSameExecutorAsPreviousSession(true);
    when(myDevice.getVersion()).thenReturn(new AndroidVersion(23, null));
    setUpDeviceForHotSwap();
    when(myInstantRunContext.getInstantRunBuildInfo()).thenReturn(InstantRunBuildInfo.get(BUILD_INFO)).thenReturn(InstantRunBuildInfo.get(BUILD_INFO_NO_ARTIFACTS));
    myBuilder.build(myTaskRunner, Collections.emptyList());
    assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV -Pandroid.injected.coldswap.mode=MULTIAPK :app:assemble", myTaskRunner.getBuilds());
}
Also used : AndroidVersion(com.android.sdklib.AndroidVersion) Test(org.junit.Test)

Example 20 with AndroidVersion

use of com.android.sdklib.AndroidVersion in project android by JetBrains.

the class InstantRunBuilderTest method cleanRerunForcesClean.

@Test
public void cleanRerunForcesClean() throws Exception {
    myRunConfigContext.setCleanRerun(true);
    when(myDevice.getVersion()).thenReturn(new AndroidVersion(23, null));
    myBuilder.build(myTaskRunner, Collections.emptyList());
    assertEquals("gradlew -Pandroid.optional.compilation=INSTANT_DEV,FULL_APK -Pandroid.injected.coldswap.mode=MULTIAPK clean :app:gen :app:assemble", myTaskRunner.getBuilds());
}
Also used : AndroidVersion(com.android.sdklib.AndroidVersion) Test(org.junit.Test)

Aggregations

AndroidVersion (com.android.sdklib.AndroidVersion)89 Test (org.junit.Test)21 NotNull (org.jetbrains.annotations.NotNull)14 IAndroidTarget (com.android.sdklib.IAndroidTarget)12 IDevice (com.android.ddmlib.IDevice)11 Nullable (org.jetbrains.annotations.Nullable)9 MockPlatformTarget (com.android.sdklib.internal.androidTarget.MockPlatformTarget)8 Module (com.intellij.openapi.module.Module)8 File (java.io.File)8 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)8 AndroidPlatform (org.jetbrains.android.sdk.AndroidPlatform)8 DetailsTypes (com.android.sdklib.repository.meta.DetailsTypes)6 Project (com.intellij.openapi.project.Project)5 Abi (com.android.sdklib.devices.Abi)4 InstantRunGradleSupport (com.android.tools.idea.fd.gradle.InstantRunGradleSupport)4 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)4 OutputFile (com.android.build.OutputFile)3 TypeDetails (com.android.repository.impl.meta.TypeDetails)3 AvdInfo (com.android.sdklib.internal.avd.AvdInfo)3 ModelWizardDialog (com.android.tools.idea.wizard.model.ModelWizardDialog)3