Search in sources :

Example 6 with InstantRunBuildInfo

use of com.android.tools.fd.client.InstantRunBuildInfo in project android by JetBrains.

the class InstantRunManager method pushArtifacts.

/**
   * Pushes the artifacts obtained from the {@link InstantRunContext} to the given device.
   * If the app is running, the artifacts are sent directly to the server running as part of the app.
   * Otherwise, we save it to a file on the device.
   */
public UpdateMode pushArtifacts(@NotNull IDevice device, @NotNull InstantRunContext context, @NotNull UpdateMode updateMode) throws InstantRunPushFailedException, IOException {
    InstantRunClient client = getInstantRunClient(context);
    assert client != null;
    InstantRunBuildInfo instantRunBuildInfo = context.getInstantRunBuildInfo();
    assert instantRunBuildInfo != null;
    updateMode = client.pushPatches(device, instantRunBuildInfo, updateMode, InstantRunSettings.isRestartActivity(), InstantRunSettings.isShowToastEnabled());
    if ((updateMode == UpdateMode.HOT_SWAP || updateMode == UpdateMode.WARM_SWAP)) {
        refreshDebugger(context.getApplicationId());
    }
    return updateMode;
}
Also used : InstantRunBuildInfo(com.android.tools.fd.client.InstantRunBuildInfo) InstantRunClient(com.android.tools.fd.client.InstantRunClient)

Example 7 with InstantRunBuildInfo

use of com.android.tools.fd.client.InstantRunBuildInfo in project android by JetBrains.

the class InstantRunManager method transferLocalIdToDeviceId.

/**
   * Called after a build & successful push to device: updates the build id on the device to whatever the
   * build id was assigned by Gradle.
   *
   * @param device the device to push to
   * @param module a module context, normally the main app module (but if it's a library module
   *               the infrastructure will look for other app modules
   */
public static void transferLocalIdToDeviceId(@NotNull IDevice device, @NotNull InstantRunContext context) {
    InstantRunBuildInfo buildInfo = context.getInstantRunBuildInfo();
    assert buildInfo != null;
    String localTimestamp = buildInfo.getTimeStamp();
    assert !StringUtil.isEmpty(localTimestamp) : "Unable to detect build timestamp";
    InstantRunClient.transferBuildIdToDevice(device, localTimestamp, context.getApplicationId(), ILOGGER);
}
Also used : InstantRunBuildInfo(com.android.tools.fd.client.InstantRunBuildInfo)

Example 8 with InstantRunBuildInfo

use of com.android.tools.fd.client.InstantRunBuildInfo in project android by JetBrains.

the class InstantRunBuildAnalyzer method getIrDebugSignals.

@NotNull
private Map<String, String> getIrDebugSignals(@NotNull DeployType deployType) {
    Map<String, String> m = new HashMap<>();
    m.put("deployType", deployType.toString());
    m.put("canReuseProcessHandler", Boolean.toString(canReuseProcessHandler()));
    m.put("androidGradlePluginVersion", myContext.getGradlePluginVersion().toString());
    BuildSelection selection = myContext.getBuildSelection();
    if (selection != null) {
        m.put("buildSelection.mode", selection.getBuildMode().toString());
        m.put("buildSelection.why", selection.why.toString());
    }
    InstantRunBuildInfo buildInfo = myContext.getInstantRunBuildInfo();
    if (buildInfo != null) {
        m.put("buildinfo.buildMode", buildInfo.getBuildMode());
        m.put("buildinfo.verifierStatus", buildInfo.getVerifierStatus());
        m.put("buildinfo.format", Integer.toString(buildInfo.getFormat()));
        List<InstantRunArtifact> artifacts = buildInfo.getArtifacts();
        m.put("buildinfo.nArtifacts", Integer.toString(artifacts.size()));
        for (int i = 0; i < artifacts.size(); i++) {
            InstantRunArtifact artifact = artifacts.get(i);
            String prefix = "buildInfo.artifact[" + i + "]";
            m.put(prefix + ".type", artifact.type.toString());
            m.put(prefix + ".file", artifact.file.getName());
        }
    }
    return m;
}
Also used : InstantRunBuildInfo(com.android.tools.fd.client.InstantRunBuildInfo) HashMap(java.util.HashMap) InstantRunArtifact(com.android.tools.fd.client.InstantRunArtifact) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

InstantRunBuildInfo (com.android.tools.fd.client.InstantRunBuildInfo)8 InstantRunArtifact (com.android.tools.fd.client.InstantRunArtifact)2 NotNull (org.jetbrains.annotations.NotNull)2 InstantRunClient (com.android.tools.fd.client.InstantRunClient)1 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 RetryingInstaller (com.android.tools.idea.run.RetryingInstaller)1 LaunchTasksProvider (com.android.tools.idea.run.tasks.LaunchTasksProvider)1 UpdateSessionTasksProvider (com.android.tools.idea.run.tasks.UpdateSessionTasksProvider)1 InstantRunIdeBuildCause (com.google.wireless.android.sdk.stats.InstantRun.InstantRunIdeBuildCause)1 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)1 ExecutionException (com.intellij.execution.ExecutionException)1 ProcessHandler (com.intellij.execution.process.ProcessHandler)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 Project (com.intellij.openapi.project.Project)1 File (java.io.File)1 HashMap (java.util.HashMap)1 Nullable (org.jetbrains.annotations.Nullable)1