Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow importing project that contains existing project directory #5211

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

brian-mcnamara
Copy link
Contributor

This change prevents deleting the .ijwb/.idea directory when importing the project. This is useful for cases where the project checks-in the project files to VCS. Examples where this is useful are copyright configuration, VCS settings, code style among others.

One thing to note, loadProject is marked as @internal.

@brian-mcnamara brian-mcnamara marked this pull request as ready for review August 7, 2023 22:52
@github-actions github-actions bot added product: Android Studio Android Studio plugin product: CLion CLion plugin product: IntelliJ IntelliJ plugin product: GoLand GoLand plugin awaiting-review Awaiting review from Bazel team on PRs labels Aug 7, 2023
@brian-mcnamara brian-mcnamara force-pushed the projectTemplate branch 2 times, most recently from 7c4f351 to 305e6a1 Compare August 8, 2023 00:19
@brian-mcnamara
Copy link
Contributor Author

brian-mcnamara commented Aug 8, 2023

More and more I think about this, I feel like I may be missing something that exists. We checkin files under .idea for reasons mentioned above, and I'd be surprised if users of bazel do not have some way of sharing/managing settings. Let me know if I'm missing something

public @Nullable Project createProject(String name, String path) {
//Allows checked in files to be used. createProject deletes the directory.
if (new File(path, Project.DIRECTORY_STORE_FOLDER).exists()) {
return ProjectManagerEx.getInstanceEx().loadProject(Path.of(path));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if existing project is incomplete?

@mai93 mai93 assigned tpasternak and blorente and unassigned mai93 Aug 14, 2023
version.bzl Outdated Show resolved Hide resolved
if (workspaceIdeaDir.exists() && workspaceIdeaDir.isDirectory()) {
Path bazelProjectPath = currentPath.resolve(Project.DIRECTORY_STORE_FOLDER);
try {
FileUtil.copyDirContent(workspaceIdeaDir, bazelProjectPath.toFile());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this conditional based on some registry value to not happen for everyone from now on?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating it...

@@ -43,4 +57,31 @@ public List<Module> commit(
public BlazeNewProjectBuilder builder() {
return builder;
}

@Override
public @Nullable Project createProject(String name, String path) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this be called on Auto Import?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

@dkashyn-sfdc
Copy link
Contributor

@brian-mcnamara could you please make sure that checks are not failing?

@agluszak agluszak self-assigned this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review Awaiting review from Bazel team on PRs product: Android Studio Android Studio plugin product: CLion CLion plugin product: GoLand GoLand plugin product: IntelliJ IntelliJ plugin
Projects
Status: Untriaged
Development

Successfully merging this pull request may close these issues.

6 participants