Skip to content

Commit 08db7a0

Browse files
committed
remove support for different projectview files
1 parent 89dcd81 commit 08db7a0

File tree

6 files changed

+19
-67
lines changed

6 files changed

+19
-67
lines changed

base/src/META-INF/blaze-base.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,13 @@
449449
</extensions>
450450

451451
<extensions defaultExtensionNs="com.intellij">
452-
<fileTypeFactory implementation="com.google.idea.blaze.base.lang.projectview.language.ProjectViewFileTypeFactory"/>
452+
<fileType
453+
language="projectview"
454+
name="projectview"
455+
implementationClass="com.google.idea.blaze.base.lang.projectview.language.ProjectViewFileType"
456+
fieldName="INSTANCE"
457+
extensions="bazelproject"/>
458+
453459
<lang.parserDefinition language="projectview" implementationClass="com.google.idea.blaze.base.lang.projectview.parser.ProjectViewParserDefinition"/>
454460
<lang.commenter language="projectview" implementationClass="com.google.idea.blaze.base.lang.projectview.formatting.ProjectViewCommenter"/>
455461
<lang.foldingBuilder language="projectview" implementationClass="com.google.idea.blaze.base.lang.projectview.formatting.ProjectViewFoldingBuilder"/>

base/src/com/google/idea/blaze/base/lang/projectview/language/ProjectViewFileTypeFactory.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

base/src/com/google/idea/blaze/base/projectview/ProjectViewStorageManager.java

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,22 @@
3131
*/
3232
public abstract class ProjectViewStorageManager {
3333

34-
private static final String BLAZE_EXTENSION = "blazeproject";
35-
private static final String BAZEL_EXTENSION = "bazelproject";
36-
private static final String LEGACY_EXTENSION = "asproject";
37-
38-
public static final ImmutableList<String> VALID_EXTENSIONS =
39-
ImmutableList.of(BLAZE_EXTENSION, BAZEL_EXTENSION, LEGACY_EXTENSION);
34+
public static final String EXTENSION = "bazelproject";
4035

4136
public static boolean isProjectViewFile(@NotNull File file) {
4237
return isProjectViewFile(file.getName());
4338
}
4439

4540
public static boolean isProjectViewFile(String fileName) {
46-
for (String ext : VALID_EXTENSIONS) {
47-
if (fileName.endsWith("." + ext)) {
48-
return true;
49-
}
50-
}
51-
return false;
41+
return fileName.endsWith("." + EXTENSION);
5242
}
5343

54-
public static String getProjectViewFileName(BuildSystemName buildSystemName) {
55-
switch (buildSystemName) {
56-
case Blaze:
57-
return "." + BLAZE_EXTENSION;
58-
case Bazel:
59-
return "." + BAZEL_EXTENSION;
60-
default:
61-
throw new IllegalArgumentException("Unrecognized build system type: " + buildSystemName);
62-
}
44+
public static String getProjectViewFileName() {
45+
return "." + EXTENSION;
6346
}
6447

65-
public static File getLocalProjectViewFileName(
66-
BuildSystemName buildSystemName, File projectDataDirectory) {
67-
return new File(projectDataDirectory, getProjectViewFileName(buildSystemName));
48+
public static File getLocalProjectViewFileName(File projectDataDirectory) {
49+
return new File(projectDataDirectory, getProjectViewFileName());
6850
}
6951

7052
public static ProjectViewStorageManager getInstance() {

base/src/com/google/idea/blaze/base/settings/Blaze.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ public static ProjectType getUpToDateProjectTypeBeforeSync(@Nonnull Project proj
8888
/**
8989
* Returns the build system associated with this project, or falls back to the default blaze build
9090
* system if the project is null or not a blaze project.
91+
*
92+
* @deprecated Since we do not support Blaze anymore, this check is redundant and can be removed in
93+
* the future.
9194
*/
95+
@Deprecated
9296
public static BuildSystemName getBuildSystemName(@Nullable Project project) {
9397
BlazeImportSettings importSettings =
9498
project == null

base/src/com/google/idea/blaze/base/wizard2/ui/BlazeEditProjectViewControl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,7 @@ public void updateBuilder(BlazeNewProjectBuilder builder) {
587587
String projectName = projectNameField.getText().trim();
588588
File projectDataDir = getProjectDataDir();
589589
String projectDataDirectory = projectDataDir.getPath();
590-
File localProjectViewFile =
591-
ProjectViewStorageManager.getLocalProjectViewFileName(
592-
builder.getBuildSystem(), new File(projectDataDirectory));
590+
File localProjectViewFile = ProjectViewStorageManager.getLocalProjectViewFileName(new File(projectDataDirectory));
593591

594592
BlazeSelectProjectViewOption selectProjectViewOption = builder.getProjectViewOption();
595593
boolean useSharedProjectView = projectViewUi.getUseSharedProjectView();

base/src/com/google/idea/blaze/base/wizard2/ui/BlazeSelectProjectViewControl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public void commit() {
6464
}
6565

6666
private static String getTitle(BlazeNewProjectBuilder builder) {
67-
String projectViewString =
68-
ProjectViewStorageManager.getProjectViewFileName(builder.getBuildSystem());
67+
String projectViewString = ProjectViewStorageManager.getProjectViewFileName();
6968
return String.format("Select project view (%s file)", projectViewString);
7069
}
7170
}

0 commit comments

Comments
 (0)