Search in sources :

Example 1 with AndroidGradleTaskManager

use of com.android.tools.idea.gradle.task.AndroidGradleTaskManager in project freeline by alibaba.

the class GradleUtil method executeTask.

/**
 * 执行task
 *
 * @param project
 * @param taskName
 * @param args
 * @param listener
 */
public static void executeTask(Project project, String taskName, String args, ExternalSystemTaskNotificationListener listener) {
    AndroidGradleTaskManager manager = new AndroidGradleTaskManager();
    List<String> taskNames = new ArrayList<String>();
    if (taskName != null) {
        taskNames.add(taskName);
    }
    List<String> vmOptions = new ArrayList<String>();
    List<String> params = new ArrayList<String>();
    if (args != null) {
        params.add(args);
    }
    if (listener == null) {
        listener = new ExternalSystemTaskNotificationListenerAdapter() {
        };
    }
    manager.executeTasks(ExternalSystemTaskId.create(GradleConstants.SYSTEM_ID, ExternalSystemTaskType.EXECUTE_TASK, project), taskNames, project.getBasePath(), null, vmOptions, params, null, listener);
}
Also used : AndroidGradleTaskManager(com.android.tools.idea.gradle.task.AndroidGradleTaskManager) ExternalSystemTaskNotificationListenerAdapter(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListenerAdapter)

Aggregations

AndroidGradleTaskManager (com.android.tools.idea.gradle.task.AndroidGradleTaskManager)1 ExternalSystemTaskNotificationListenerAdapter (com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListenerAdapter)1