Skip to content

Commit

Permalink
[2020.3 compat] remove obsolete StatementParsing.FUTURE flag from s…
Browse files Browse the repository at this point in the history
…dkcompat

The Enum does not exist anymore in the 2020.3 sdk

PiperOrigin-RevId: 355938588
  • Loading branch information
AlexeyGy authored and copybara-github committed Feb 5, 2021
1 parent abe429e commit bce2fd8
Show file tree
Hide file tree
Showing 18 changed files with 562 additions and 2 deletions.
2 changes: 2 additions & 0 deletions base/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ intellij_plugin_library(
"intellij-ue-2020.1": ["sdkcompat/v201/META-INF/blaze-base-v201.xml"],
"intellij-2020.2": ["sdkcompat/v201/META-INF/blaze-base-v201.xml"],
"intellij-ue-2020.2": ["sdkcompat/v201/META-INF/blaze-base-v201.xml"],
"intellij-2020.3": ["sdkcompat/v201/META-INF/blaze-base-v201.xml"],
"intellij-ue-2020.3": ["sdkcompat/v201/META-INF/blaze-base-v201.xml"],
"clion-2019.3": [],
"clion-2020.1": ["sdkcompat/v201/META-INF/blaze-base-v201.xml"],
"clion-2020.2": ["sdkcompat/v201/META-INF/blaze-base-v201.xml"],
Expand Down
20 changes: 18 additions & 2 deletions intellij_platform_sdk/build_defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ INDIRECT_IJ_PRODUCTS = {
"intellij-latest": "intellij-2020.1",
"intellij-latest-mac": "intellij-2020.1-mac",
"intellij-beta": "intellij-2020.2",
"intellij-canary": "intellij-2020.2",
"intellij-canary": "intellij-2020.3",
"intellij-ue-latest": "intellij-ue-2020.1",
"intellij-ue-latest-mac": "intellij-ue-2020.1-mac",
"intellij-ue-beta": "intellij-ue-2020.2",
"intellij-ue-canary": "intellij-ue-2020.2",
"intellij-ue-canary": "intellij-ue-2020.3",
"android-studio-latest": "android-studio-4.1",
"android-studio-beta": "android-studio-4.2",
"android-studio-beta-mac": "android-studio-4.2-mac",
Expand All @@ -36,6 +36,14 @@ DIRECT_IJ_PRODUCTS = {
ide = "intellij",
directory = "intellij_ce_2020_2",
),
"intellij-2020.3": struct(
ide = "intellij",
directory = "intellij_ce_2020_3",
),
"intellij-2020.3-mac": struct(
ide = "intellij",
directory = "intellij_ce_2020_3",
),
"intellij-ue-2020.1": struct(
ide = "intellij-ue",
directory = "intellij_ue_2020_1",
Expand All @@ -52,6 +60,14 @@ DIRECT_IJ_PRODUCTS = {
ide = "intellij-ue",
directory = "intellij_ue_2020_2",
),
"intellij-ue-2020.3": struct(
ide = "intellij-ue",
directory = "intellij_ue_2020_3",
),
"intellij-ue-2020.3-mac": struct(
ide = "intellij-ue",
directory = "intellij_ue_2020_3",
),
"android-studio-4.1": struct(
ide = "android-studio",
directory = "android_studio_4_1",
Expand Down
2 changes: 2 additions & 0 deletions sdkcompat/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ java_library(
"intellij-ue-2020.1": ["//sdkcompat/v201"],
"intellij-2020.2": ["//sdkcompat/v202"],
"intellij-ue-2020.2": ["//sdkcompat/v202"],
"intellij-2020.3": ["//sdkcompat/v203"],
"intellij-ue-2020.3": ["//sdkcompat/v203"],
"clion-2019.3": ["//sdkcompat/v193"],
"clion-2020.1": ["//sdkcompat/v201"],
"clion-2020.2": ["//sdkcompat/v202"],
Expand Down
40 changes: 40 additions & 0 deletions sdkcompat/v203/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Description: Indirections for SDK changes to the underlying platform library.

load("//intellij_platform_sdk:build_defs.bzl", "select_for_ide")

licenses(["notice"])

java_library(
name = "v203",
srcs = glob([
"com/google/idea/sdkcompat/general/**",
"com/google/idea/sdkcompat/formatter/**",
"com/google/idea/sdkcompat/platform/**",
"com/google/idea/sdkcompat/python/**",
"com/google/idea/sdkcompat/vcs/**",
]) + select_for_ide(
android_studio = glob([
"com/google/idea/sdkcompat/cpp/**",
"com/google/idea/sdkcompat/java/**",
]),
clion = glob([
"com/google/idea/sdkcompat/clion/**",
"com/google/idea/sdkcompat/cpp/**",
]),
intellij = glob([
"com/google/idea/sdkcompat/java/**",
"com/google/idea/sdkcompat/scala/**",
]),
intellij_ue = glob([
"com/google/idea/sdkcompat/java/**",
"com/google/idea/sdkcompat/scala/**",
]),
),
visibility = ["//sdkcompat:__pkg__"],
deps = [
"//intellij_platform_sdk:jsr305",
"//intellij_platform_sdk:plugin_api",
"//third_party/python",
"//third_party/scala",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.google.idea.sdkcompat.clion;

import com.intellij.openapi.project.Project;
import com.jetbrains.cidr.execution.CidrConsoleBuilder;

/** Api compat with 2020.2 #api201 */
public class CidrConsoleBuilderAdapter extends CidrConsoleBuilder {

public CidrConsoleBuilderAdapter(Project project) {
super(project, null, null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.google.idea.sdkcompat.clion;

import com.jetbrains.cidr.execution.CidrLauncher;

/** Api compat with 2020.2 #api201 */
public abstract class CidrLauncherAdapter extends CidrLauncher {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.google.idea.sdkcompat.clion;

import com.jetbrains.cidr.cpp.toolchains.CPPToolchains.Toolchain;

/** Api compat with 2020.1 #api193 */
public class ToolchainCompat {
public static String getDefaultName() {
return Toolchain.getDefault();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.google.idea.sdkcompat.cpp;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.cidr.lang.workspace.headerRoots.HeadersSearchPath;
import com.jetbrains.cidr.lang.workspace.headerRoots.HeadersSearchRoot;
import com.jetbrains.cidr.lang.workspace.headerRoots.IncludedHeadersRoot;

/**
* Compat for {@link IncludedHeadersRoot}.
*
* <p>#api201
*/
public class IncludedHeadersRootCompat {
public static boolean isUserHeaders(IncludedHeadersRoot root) {
return root.getKind() == HeadersSearchPath.Kind.USER;
}

public static HeadersSearchRoot create(
Project project, VirtualFile vf, boolean recursive, boolean isUserHeader) {
HeadersSearchPath.Kind kind =
isUserHeader ? HeadersSearchPath.Kind.USER : HeadersSearchPath.Kind.SYSTEM;
return IncludedHeadersRoot.create(project, vf, recursive, kind);
}

private IncludedHeadersRootCompat() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.google.idea.sdkcompat.cpp;

import com.intellij.openapi.project.Project;
import com.intellij.util.messages.ListenerDescriptor;
import com.intellij.util.messages.MessageBus;
import com.intellij.util.messages.MessageBusOwner;
import com.intellij.util.messages.impl.MessageBusFactoryImpl;

/** Compat for 2020.1 api changes #api193 */
public class MessageBusSupplier {
public static MessageBus createMessageBus(Project project) {
return MessageBusFactoryImpl.createRootBus(new MessageBusOwnerForProject(project));
}

private static class MessageBusOwnerForProject implements MessageBusOwner {
private final Project realOwner;

MessageBusOwnerForProject(Project project) {
realOwner = project;
}

@Override
public Object createListener(ListenerDescriptor listenerDescriptor) {
throw new UnsupportedOperationException();
}

@Override
public boolean isDisposed() {
return realOwner.isDisposed();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.google.idea.sdkcompat.cpp;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.cidr.lang.preprocessor.OCImportGraph;
import java.util.Collection;

/** Compat utilities for {@link OCImportGraph}. */
public class OCImportGraphCompat {
// #api193
public static Collection<VirtualFile> getAllHeaderRoots(Project project, VirtualFile headerFile) {
return OCImportGraph.getInstance(project).getAllHeaderRoots(headerFile);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.google.idea.sdkcompat.cpp;

import com.jetbrains.cidr.lang.workspace.OCWorkspaceEventImpl;

/**
* Compat methods for {@link OCWorkspaceEventImpl}.
*
* <p>#api201
*/
public class OCWorkspaceEventCompat {
private OCWorkspaceEventCompat() {}

public static OCWorkspaceEventImpl newEvent(
boolean resolveConfigurationsChanged,
boolean sourceFilesChanged,
boolean compilerSettingsChanged,
boolean clientVersionChanged) {
return new OCWorkspaceEventImpl(
resolveConfigurationsChanged,
sourceFilesChanged,
compilerSettingsChanged,
clientVersionChanged);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.google.idea.sdkcompat.formatter;

import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleManager;

/**
* Compat for {@code DelegatingCodeStyleManager}. {@link CodeStyleManager} got a new method in
* 2020.2. #api201
*/
public class DelegatingCodeStyleManagerCompat {

private DelegatingCodeStyleManagerCompat() {}

// #api201: Method introduced in 2020.2. If not overridden, an exception is thrown upon class
// creation.
public static void scheduleReformatWhenSettingsComputed(CodeStyleManager delegate, PsiFile file) {
delegate.scheduleReformatWhenSettingsComputed(file);
}
}
Loading

0 comments on commit bce2fd8

Please sign in to comment.