mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
IDEA-242008 Devkit: determine current since/until build for all setups reliably
Gradle setups GitOrigin-RevId: a80ff4b1796f518e2bb97d5413d1c7ef2fd358c6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
adfe20a74a
commit
c2392db0c9
@@ -13,5 +13,6 @@
|
||||
<orderEntry type="module" module-name="intellij.spellchecker" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.xml.analysis.impl" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.devkit.tests" />
|
||||
<orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,14 @@
|
||||
<idea-plugin>
|
||||
<id>foo</id>
|
||||
<vendor>JetBrains</vendor>
|
||||
<version>1.0</version>
|
||||
|
||||
<error descr="Could not determine target platform version, please check project setup"><applicationListeners>
|
||||
|
||||
</applicationListeners></error>
|
||||
|
||||
|
||||
<error descr="Could not determine target platform version, please check project setup"><projectListeners>
|
||||
|
||||
</projectListeners></error>
|
||||
</idea-plugin>
|
||||
@@ -101,25 +101,9 @@ class PluginXmlFunctionalTest extends JavaCodeInsightFixtureTestCase {
|
||||
moduleBuilder.addLibrary("coreImpl", coreImpl)
|
||||
}
|
||||
|
||||
void testListeners() {
|
||||
myFixture.addClass("public class MyCollectionWithoutDefaultCTOR implements java.util.Collection {" +
|
||||
" public MyCollectionWithoutDefaultCTOR(String something) {}" +
|
||||
"}")
|
||||
doHighlightingTest("Listeners.xml")
|
||||
}
|
||||
|
||||
// absence of since-build tested only in DevKit setup, see PluginXmlPluginModuleTest
|
||||
void testListenersPre193() {
|
||||
doHighlightingTest("ListenersPre193.xml")
|
||||
}
|
||||
|
||||
void testListenersOsAttributePre201() {
|
||||
doHighlightingTest("ListenersOsAttributePre201.xml")
|
||||
}
|
||||
|
||||
void testListenersDepends() {
|
||||
myFixture.copyFileToProject(getTestName(false) + ".xml", "META-INF/plugin.xml")
|
||||
doHighlightingTest("ListenersDepends-dependency.xml")
|
||||
// Gradle-like setup, but JBList not in Library
|
||||
void testListenerUnresolvedTargetPlatform() {
|
||||
doHighlightingTest("ListenersUnresolvedTargetPlatform.xml")
|
||||
}
|
||||
|
||||
void testExtensionI18n() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.devkit.codeInsight;
|
||||
|
||||
import com.intellij.testFramework.TestDataFile;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.idea.devkit.DevkitJavaTestsUtil;
|
||||
import org.jetbrains.idea.devkit.inspections.PluginModuleTestCase;
|
||||
@@ -21,14 +22,38 @@ public class PluginXmlPluginModuleTest extends PluginModuleTestCase {
|
||||
}
|
||||
|
||||
public void testPluginWithoutVersionInPluginModule() {
|
||||
myFixture.testHighlighting(false, false, false, "pluginWithoutVersionInPluginModule.xml");
|
||||
doHighlightingTest("pluginWithoutVersionInPluginModule.xml");
|
||||
}
|
||||
|
||||
public void testListeners() {
|
||||
myFixture.addClass("public class MyCollectionWithoutDefaultCTOR implements java.util.Collection {" +
|
||||
" public MyCollectionWithoutDefaultCTOR(String something) {}" +
|
||||
"}");
|
||||
doHighlightingTest("Listeners.xml");
|
||||
}
|
||||
|
||||
public void testListenersNoSinceBuild() {
|
||||
myFixture.testHighlighting(false, false, false, "ListenersNoSinceBuild.xml");
|
||||
doHighlightingTest("ListenersNoSinceBuild.xml");
|
||||
}
|
||||
|
||||
public void testListenersNoPluginIdStandalone() {
|
||||
myFixture.testHighlighting(false, false, false, "ListenersNoPluginIdStandalone.xml");
|
||||
doHighlightingTest("ListenersNoPluginIdStandalone.xml");
|
||||
}
|
||||
|
||||
public void testListenersPre193() {
|
||||
doHighlightingTest("ListenersPre193.xml");
|
||||
}
|
||||
|
||||
public void testListenersOsAttributePre201() {
|
||||
doHighlightingTest("ListenersOsAttributePre201.xml");
|
||||
}
|
||||
|
||||
public void testListenersDepends() {
|
||||
setPluginXml("ListenersDepends.xml");
|
||||
doHighlightingTest("ListenersDepends-dependency.xml");
|
||||
}
|
||||
|
||||
private void doHighlightingTest(@TestDataFile String path) {
|
||||
myFixture.testHighlighting(false, false, false, path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.idea.devkit.util;
|
||||
|
||||
import com.intellij.openapi.util.BuildNumber;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class PluginPlatformInfoTest extends JavaCodeInsightFixtureTestCase {
|
||||
|
||||
public void testGradle2020_1() {
|
||||
doTestResolved("something:2020.1", "201");
|
||||
}
|
||||
|
||||
public void testGradle2016_2() {
|
||||
doTestResolved("something:2016.2", "162");
|
||||
}
|
||||
|
||||
private void doTestResolved(String libraryName, String expectedBuildNumber) {
|
||||
setupPlatformLibrary(libraryName);
|
||||
|
||||
final PluginPlatformInfo info = PluginPlatformInfo.forModule(getModule());
|
||||
assertEquals(PluginPlatformInfo.PlatformResolveStatus.GRADLE, info.getResolveStatus());
|
||||
assertEquals(BuildNumber.fromString(expectedBuildNumber), info.getSinceBuildNumber());
|
||||
assertNull(info.getMainIdeaPlugin());
|
||||
}
|
||||
|
||||
public void testGradleUnresolvedNoPlatformClass() {
|
||||
doTestUnresolved(null);
|
||||
}
|
||||
|
||||
public void testGradleUnresolvedPlatformClassNotInLibrary() {
|
||||
myFixture.addClass("package com.intellij.ui.components; public class JBList {}");
|
||||
doTestUnresolved(null);
|
||||
}
|
||||
|
||||
public void testGradleUnresolvedLibraryNameNoVersion() {
|
||||
doTestUnresolved("something");
|
||||
}
|
||||
|
||||
public void testGradleUnresolvedLibraryBadVersion() {
|
||||
doTestUnresolved("something:20.");
|
||||
}
|
||||
|
||||
public void testGradleUnresolvedLibraryBadVersionPrefix() {
|
||||
doTestUnresolved("something:123.45");
|
||||
}
|
||||
|
||||
public void testGradleUnresolvedLibraryMissingBranchVersion() {
|
||||
doTestUnresolved("something:2012345");
|
||||
}
|
||||
|
||||
private void doTestUnresolved(@Nullable String libraryName) {
|
||||
if (libraryName != null) {
|
||||
setupPlatformLibrary(libraryName);
|
||||
}
|
||||
|
||||
final PluginPlatformInfo info = PluginPlatformInfo.forModule(getModule());
|
||||
assertEquals(PluginPlatformInfo.PlatformResolveStatus.UNRESOLVED, info.getResolveStatus());
|
||||
assertNull(info.getSinceBuildNumber());
|
||||
}
|
||||
|
||||
private void setupPlatformLibrary(String libraryName) {
|
||||
String platformApiJar = PathUtil.getJarPathForClass(JBList.class);
|
||||
File file = new File(platformApiJar);
|
||||
PsiTestUtil.addLibrary(getModule(), libraryName, file.getParent(), file.getName());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user