-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CompileCorrespondingBuildFilesAction.java
Project Status API integration with bazel for CLion (#6585) Integration with the new Project Status Widget that is added in CLion 242. Implement py imports handling (#6606) Some `py_...` rules allow for an `imports` attribute. The attribute allows control over how the Python files are vended in terms of modules. This change will mean that the use of the `imports` attribute in Bazel targets is reflected in how the modules are auto-completed and recognized in the IDE. Update CompileCorrespondingBuildFilesAction.java button name change Update CompileCorrespondingBuildFilesAction.java Added build folder action Update BlazeBuildService.java review remarks fix
- Loading branch information
1 parent
90f0f5f
commit 9f87422
Showing
39 changed files
with
1,524 additions
and
575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 0 additions & 101 deletions
101
base/src/com/google/idea/blaze/base/actions/CompileCorrespondingBuildFilesAction.java
This file was deleted.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
base/src/com/google/idea/blaze/base/actions/CompileFolderAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2024 The Bazel Authors. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.google.idea.blaze.base.actions; | ||
|
||
import com.google.idea.blaze.base.build.BlazeBuildService; | ||
import com.google.idea.blaze.base.model.primitives.*; | ||
import com.google.idea.blaze.base.lang.buildfile.search.BlazePackage; | ||
import com.google.idea.common.actions.ActionPresentationHelper; | ||
import com.intellij.openapi.actionSystem.*; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.vfs.VirtualFile; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
/** Action to compile all build files in folder if folder picked or compile corresponding build file if file picked */ | ||
public class CompileFolderAction extends BlazeProjectAction { | ||
|
||
@Override | ||
protected void actionPerformedInBlazeProject(Project project, AnActionEvent e) { | ||
runBuild(project, e); | ||
} | ||
|
||
protected void runBuild(Project project, AnActionEvent e) { | ||
VirtualFile vf = e.getData(CommonDataKeys.VIRTUAL_FILE); | ||
WorkspaceRoot root = WorkspaceRoot.fromProject(project); | ||
WorkspacePath path = root.workspacePathForSafe(new File(vf.getPath())); | ||
try { | ||
List<TargetExpression> dt = List.of(TargetExpression.fromString("//" + path.toString() + "/...")); | ||
BlazeBuildService.getInstance(project).buildFolder(vf.getName(),dt); | ||
} catch (InvalidTargetException ex) { | ||
throw new RuntimeException(ex); | ||
} | ||
} | ||
|
||
@Override | ||
protected void updateForBlazeProject(Project project, AnActionEvent e) { | ||
Presentation presentation = e.getPresentation(); | ||
|
||
DataContext dataContext = e.getDataContext(); | ||
VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); | ||
BlazePackage blazePackage = BuildFileUtils.getBuildFile(project, virtualFile); | ||
|
||
boolean enabled = blazePackage != null; | ||
presentation.setVisible(enabled || !ActionPlaces.isPopupPlace(e.getPlace())); | ||
presentation.setEnabled(enabled); | ||
|
||
ActionPresentationHelper.of(e) | ||
.disableIf(virtualFile == null) | ||
.disableIf(!virtualFile.isDirectory()) | ||
.setText("Compile " + virtualFile.getName() + "/...:all") | ||
.hideInContextMenuIfDisabled() | ||
.commit(); | ||
} | ||
|
||
@Override | ||
protected QuerySyncStatus querySyncSupport() { | ||
return QuerySyncStatus.SUPPORTED; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.