Skip to content

Commit

Permalink
Revert "added psw status to simple integration test"
Browse files Browse the repository at this point in the history
This reverts commit c2906ad.

Let's wait with this until we drop 241. Don't want to introduce sdk compat for tests.
  • Loading branch information
LeFrosch authored and ujohnny committed Nov 7, 2024
1 parent 9ec05cd commit 763e4b9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 41 deletions.
8 changes: 6 additions & 2 deletions clwb/src/META-INF/clwb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

<programRunner implementation="com.google.idea.blaze.clwb.run.BlazeCppRunner"/>

<postStartupActivity implementation="com.google.idea.blaze.plugin.ClwbProjectSpecificInitializer"/>

<editorNotificationProvider implementation="com.google.idea.blaze.clwb.BazelCNotificationProvider"/>
<moduleType id="BLAZE_CPP_MODULE" implementationClass="com.google.idea.blaze.clwb.BlazeCppModuleType"/>
<postStartupActivity implementation="com.google.idea.blaze.clwb.run.producers.NonBlazeProducerSuppressor"/>
Expand All @@ -50,4 +48,10 @@
<CppSupportChecker implementation="com.google.idea.blaze.clwb.ClwbSupportsCpp" />
<CppEnvironmentProvider implementation="com.google.idea.blaze.clwb.MSVCEnvironmentProvider" />
</extensions>

<project-components>
<component>
<implementation-class>com.google.idea.blaze.plugin.ClwbProjectSpecificInitializer</implementation-class>
</component>
</project-components>
</idea-plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@
package com.google.idea.blaze.plugin;

import com.google.idea.blaze.clwb.CLionNotificationProvider;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupActivity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.VisibleForTesting;

/** Runs on project startup, and customizes CLion UI. */
public class ClwbProjectSpecificInitializer implements StartupActivity.DumbAware {
@Override
public void runActivity(@NotNull Project project) {
runStartupActivity(project);
public class ClwbProjectSpecificInitializer implements ProjectComponent {

private final Project project;

public ClwbProjectSpecificInitializer(Project project) {
this.project = project;
}

@VisibleForTesting
public static void runStartupActivity(Project project) {
@Override
public void projectOpened() {
CLionNotificationProvider.register(project);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import static com.google.common.truth.Truth.assertThat;
import static com.google.idea.blaze.clwb.base.Assertions.assertContainsHeader;
import static com.google.idea.blaze.clwb.base.Assertions.assertProjectStatus;

import com.intellij.openapi.util.SystemInfo;
import com.jetbrains.cidr.lang.workspace.compiler.ClangCompilerKind;
import com.jetbrains.cidr.lang.workspace.compiler.GCCCompilerKind;
import com.jetbrains.cidr.lang.workspace.compiler.MSVCCompilerKind;
import com.google.idea.blaze.clwb.base.ClwbIntegrationTestCase;
import com.jetbrains.cidr.project.ui.widget.Status;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand All @@ -24,7 +22,6 @@ public void testClwb() {

checkCompiler();
checkTest();
checkStatus();
}

private void checkCompiler() {
Expand All @@ -47,10 +44,4 @@ private void checkTest() {
assertContainsHeader("iostream", compilerSettings);
assertContainsHeader("catch2/catch_test_macros.hpp", compilerSettings);
}

private void checkStatus() {
final var file = findProjectFile("main/hello-world.cc");

assertProjectStatus(getProject(), file, Status.OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@
import static com.google.common.truth.Truth.assertWithMessage;

import com.google.common.truth.StringSubject;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.cidr.lang.workspace.OCCompilerSettings;
import com.jetbrains.cidr.lang.workspace.headerRoots.HeadersSearchRoot;
import com.jetbrains.cidr.project.ui.widget.Status;
import com.jetbrains.cidr.project.ui.widget.WidgetStatus;
import com.jetbrains.cidr.project.ui.widget.WidgetStatusProvider;
import java.util.Objects;
import java.util.regex.Pattern;

public class Assertions {

private final static Pattern defineRx = Pattern.compile("#define ([^ ]+) ?(.*)");

public static void assertContainsHeader(String fileName, OCCompilerSettings settings) {
Expand Down Expand Up @@ -80,15 +74,4 @@ public static StringSubject assertDefine(String symbol, OCCompilerSettings setti

return assertWithMessage("symbol is not defined: " + symbol).that((String) null);
}

public static void assertProjectStatus(Project project, VirtualFile file, Status expected) {
final var actual = WidgetStatusProvider.Companion.getEP_NAME().getExtensionList().stream()
.map((it) -> it.getWidgetStatus(project, file))
.filter(Objects::nonNull)
.findFirst()
.map(WidgetStatus::getStatus)
.orElse(null);

assertThat(actual).isEqualTo(expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.idea.blaze.base.wizard2.BlazeProjectImportBuilder;
import com.google.idea.blaze.base.wizard2.CreateFromScratchProjectViewOption;
import com.google.idea.blaze.base.wizard2.WorkspaceTypeData;
import com.google.idea.blaze.plugin.ClwbProjectSpecificInitializer;
import com.google.idea.testing.ServiceHelper;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
Expand Down Expand Up @@ -202,9 +201,6 @@ protected void setUpProject() throws Exception {
}

builder.builder().commitToProject(myProject);

// run startup activities, needs to be done manually
ClwbProjectSpecificInitializer.runStartupActivity(myProject);
}

protected @Language("projectview") String projectViewText() {
Expand Down

0 comments on commit 763e4b9

Please sign in to comment.