Search in sources :

Example 1 with BuckBuildCommandHandler

use of com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler in project buck by facebook.

the class BuckBuildAction method executeOnPooledThread.

@Override
public void executeOnPooledThread(final AnActionEvent e) {
    Project project = e.getProject();
    if (project == null) {
        return;
    }
    BuckBuildManager buildManager = BuckBuildManager.getInstance(project);
    String target = buildManager.getCurrentSavedTarget(project);
    // Initiate a buck build
    BuckModule buckModule = project.getComponent(BuckModule.class);
    buckModule.attach(target);
    if (target == null) {
        buildManager.showNoTargetMessage(project);
        return;
    }
    BuckBuildCommandHandler handler = new BuckBuildCommandHandler(project, project.getBaseDir(), BuckCommand.BUILD);
    handler.command().addParameter(target);
    buildManager.runBuckCommandWhileConnectedToBuck(handler, ACTION_TITLE, buckModule);
}
Also used : Project(com.intellij.openapi.project.Project) BuckModule(com.facebook.buck.intellij.ideabuck.config.BuckModule) BuckBuildManager(com.facebook.buck.intellij.ideabuck.build.BuckBuildManager) BuckBuildCommandHandler(com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler)

Example 2 with BuckBuildCommandHandler

use of com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler in project buck by facebook.

the class BuckInstallAction method executeOnPooledThread.

@Override
public void executeOnPooledThread(final AnActionEvent e) {
    Project project = e.getProject();
    BuckBuildManager buildManager = BuckBuildManager.getInstance(project);
    String target = buildManager.getCurrentSavedTarget(project);
    BuckModule buckModule = project.getComponent(BuckModule.class);
    buckModule.attach(target);
    if (target == null) {
        buildManager.showNoTargetMessage(project);
        return;
    }
    BuckSettingsProvider.State state = BuckSettingsProvider.getInstance().getState();
    if (state == null) {
        return;
    }
    BuckBuildCommandHandler handler = new BuckBuildCommandHandler(project, project.getBaseDir(), BuckCommand.INSTALL);
    if (state.customizedInstallSetting) {
        // Split the whole command line into different parameters.
        String commands = state.customizedInstallSettingCommand;
        Matcher matcher = Pattern.compile("([^\"]\\S*|\".+?\")\\s*").matcher(commands);
        while (matcher.find()) {
            handler.command().addParameter(matcher.group(1));
        }
    } else {
        if (state.runAfterInstall) {
            handler.command().addParameter("-r");
        }
        if (state.multiInstallMode) {
            handler.command().addParameter("-x");
        }
        if (state.uninstallBeforeInstalling) {
            handler.command().addParameter("-u");
        }
    }
    handler.command().addParameter(target);
    buildManager.runBuckCommandWhileConnectedToBuck(handler, ACTION_TITLE, buckModule);
}
Also used : Project(com.intellij.openapi.project.Project) BuckModule(com.facebook.buck.intellij.ideabuck.config.BuckModule) Matcher(java.util.regex.Matcher) BuckBuildManager(com.facebook.buck.intellij.ideabuck.build.BuckBuildManager) BuckSettingsProvider(com.facebook.buck.intellij.ideabuck.config.BuckSettingsProvider) BuckBuildCommandHandler(com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler)

Example 3 with BuckBuildCommandHandler

use of com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler in project buck by facebook.

the class BuckProjectGenerationAction method executeOnPooledThread.

@Override
public void executeOnPooledThread(final AnActionEvent e) {
    Project project = e.getProject();
    BuckBuildManager buildManager = BuckBuildManager.getInstance(project);
    String target = buildManager.getCurrentSavedTarget(project);
    BuckModule buckModule = project.getComponent(BuckModule.class);
    buckModule.attach(target);
    if (target == null) {
        buildManager.showNoTargetMessage(project);
        return;
    }
    BuckBuildCommandHandler handler = new BuckBuildCommandHandler(project, project.getBaseDir(), BuckCommand.PROJECT);
    handler.command().addParameter(target);
    buildManager.runBuckCommandWhileConnectedToBuck(handler, ACTION_TITLE, buckModule);
}
Also used : Project(com.intellij.openapi.project.Project) BuckModule(com.facebook.buck.intellij.ideabuck.config.BuckModule) BuckBuildManager(com.facebook.buck.intellij.ideabuck.build.BuckBuildManager) BuckBuildCommandHandler(com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler)

Example 4 with BuckBuildCommandHandler

use of com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler in project buck by facebook.

the class BuckTestAction method executeOnPooledThread.

@Override
public void executeOnPooledThread(final AnActionEvent e) {
    Project project = e.getProject();
    BuckBuildManager buildManager = BuckBuildManager.getInstance(project);
    String target = buildManager.getCurrentSavedTarget(project);
    BuckModule buckModule = project.getComponent(BuckModule.class);
    buckModule.attach(target);
    if (target == null) {
        buildManager.showNoTargetMessage(project);
        return;
    }
    // Initiate a buck test
    BuckBuildCommandHandler handler = new BuckBuildCommandHandler(project, project.getBaseDir(), BuckCommand.TEST);
    handler.command().addParameter(target);
    buildManager.runBuckCommandWhileConnectedToBuck(handler, ACTION_TITLE, buckModule);
}
Also used : Project(com.intellij.openapi.project.Project) BuckModule(com.facebook.buck.intellij.ideabuck.config.BuckModule) BuckBuildManager(com.facebook.buck.intellij.ideabuck.build.BuckBuildManager) BuckBuildCommandHandler(com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler)

Example 5 with BuckBuildCommandHandler

use of com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler in project buck by facebook.

the class BuckUninstallAction method executeOnPooledThread.

@Override
public void executeOnPooledThread(final AnActionEvent e) {
    Project project = e.getProject();
    BuckBuildManager buildManager = BuckBuildManager.getInstance(project);
    String target = buildManager.getCurrentSavedTarget(project);
    BuckModule buckModule = project.getComponent(BuckModule.class);
    buckModule.attach(target);
    if (target == null) {
        buildManager.showNoTargetMessage(project);
        return;
    }
    // Initiate a buck uninstall
    BuckBuildCommandHandler handler = new BuckBuildCommandHandler(project, project.getBaseDir(), BuckCommand.UNINSTALL);
    handler.command().addParameter(target);
    buildManager.runBuckCommandWhileConnectedToBuck(handler, ACTION_TITLE, buckModule);
}
Also used : Project(com.intellij.openapi.project.Project) BuckModule(com.facebook.buck.intellij.ideabuck.config.BuckModule) BuckBuildManager(com.facebook.buck.intellij.ideabuck.build.BuckBuildManager) BuckBuildCommandHandler(com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler)

Aggregations

BuckBuildCommandHandler (com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler)6 BuckModule (com.facebook.buck.intellij.ideabuck.config.BuckModule)6 BuckBuildManager (com.facebook.buck.intellij.ideabuck.build.BuckBuildManager)5 Project (com.intellij.openapi.project.Project)5 Matcher (java.util.regex.Matcher)2 BuckSettingsProvider (com.facebook.buck.intellij.ideabuck.config.BuckSettingsProvider)1 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)1 Key (com.intellij.openapi.util.Key)1