as32: Update to 181 platform api
This commit is contained in:
@@ -0,0 +1,151 @@
|
|||||||
|
/*
|
||||||
|
* 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/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.resolve
|
||||||
|
|
||||||
|
import com.intellij.openapi.util.Key
|
||||||
|
import org.jetbrains.kotlin.container.StorageComponentContainer
|
||||||
|
import org.jetbrains.kotlin.container.composeContainer
|
||||||
|
import org.jetbrains.kotlin.container.useInstance
|
||||||
|
import org.jetbrains.kotlin.name.FqName
|
||||||
|
import org.jetbrains.kotlin.platform.PlatformToKotlinClassMap
|
||||||
|
import org.jetbrains.kotlin.psi.KtFile
|
||||||
|
import org.jetbrains.kotlin.psi.UserDataProperty
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.checkers.*
|
||||||
|
import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator
|
||||||
|
import org.jetbrains.kotlin.resolve.checkers.*
|
||||||
|
import org.jetbrains.kotlin.resolve.lazy.DelegationFilter
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.SyntheticScopes
|
||||||
|
import org.jetbrains.kotlin.storage.LockBasedStorageManager
|
||||||
|
import org.jetbrains.kotlin.types.DynamicTypesSettings
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
abstract class TargetPlatform(val platformName: String) {
|
||||||
|
override fun toString() = platformName
|
||||||
|
|
||||||
|
abstract val platformConfigurator: PlatformConfigurator
|
||||||
|
abstract fun getDefaultImports(includeKotlinComparisons: Boolean): List<ImportPath>
|
||||||
|
open val excludedImports: List<FqName> get() = emptyList()
|
||||||
|
|
||||||
|
abstract val multiTargetPlatform: MultiTargetPlatform
|
||||||
|
|
||||||
|
object Common : TargetPlatform("Default") {
|
||||||
|
private val defaultImports =
|
||||||
|
LockBasedStorageManager().createMemoizedFunction<Boolean, List<ImportPath>> { includeKotlinComparisons ->
|
||||||
|
ArrayList<ImportPath>().apply {
|
||||||
|
listOf(
|
||||||
|
"kotlin.*",
|
||||||
|
"kotlin.annotation.*",
|
||||||
|
"kotlin.collections.*",
|
||||||
|
"kotlin.ranges.*",
|
||||||
|
"kotlin.sequences.*",
|
||||||
|
"kotlin.text.*",
|
||||||
|
"kotlin.io.*"
|
||||||
|
).forEach { add(ImportPath.fromString(it)) }
|
||||||
|
|
||||||
|
if (includeKotlinComparisons) {
|
||||||
|
add(ImportPath.fromString("kotlin.comparisons.*"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getDefaultImports(includeKotlinComparisons: Boolean): List<ImportPath> = defaultImports(includeKotlinComparisons)
|
||||||
|
|
||||||
|
override val platformConfigurator =
|
||||||
|
object : PlatformConfigurator(
|
||||||
|
DynamicTypesSettings(), listOf(), listOf(), listOf(), listOf(), listOf(),
|
||||||
|
IdentifierChecker.Default, OverloadFilter.Default, PlatformToKotlinClassMap.EMPTY, DelegationFilter.Default,
|
||||||
|
OverridesBackwardCompatibilityHelper.Default,
|
||||||
|
DeclarationReturnTypeSanitizer.Default
|
||||||
|
) {
|
||||||
|
override fun configureModuleComponents(container: StorageComponentContainer) {
|
||||||
|
container.useInstance(SyntheticScopes.Empty)
|
||||||
|
container.useInstance(TypeSpecificityComparator.NONE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override val multiTargetPlatform: MultiTargetPlatform
|
||||||
|
get() = MultiTargetPlatform.Common
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val DEFAULT_DECLARATION_CHECKERS = listOf(
|
||||||
|
DataClassDeclarationChecker(),
|
||||||
|
ConstModifierChecker,
|
||||||
|
UnderscoreChecker,
|
||||||
|
InlineParameterChecker,
|
||||||
|
InfixModifierChecker(),
|
||||||
|
SinceKotlinAnnotationValueChecker,
|
||||||
|
RequireKotlinAnnotationValueChecker,
|
||||||
|
ReifiedTypeParameterAnnotationChecker(),
|
||||||
|
DynamicReceiverChecker,
|
||||||
|
DelegationChecker(),
|
||||||
|
KClassWithIncorrectTypeArgumentChecker,
|
||||||
|
SuspendOperatorsCheckers,
|
||||||
|
InlineClassDeclarationChecker
|
||||||
|
)
|
||||||
|
|
||||||
|
private val DEFAULT_CALL_CHECKERS = listOf(
|
||||||
|
CapturingInClosureChecker(), InlineCheckerWrapper(), SafeCallChecker(),
|
||||||
|
DeprecatedCallChecker, CallReturnsArrayOfNothingChecker(), InfixCallChecker(), OperatorCallChecker(),
|
||||||
|
ConstructorHeaderCallChecker, ProtectedConstructorCallChecker, ApiVersionCallChecker,
|
||||||
|
CoroutineSuspendCallChecker, BuilderFunctionsCallChecker, DslScopeViolationCallChecker, MissingDependencyClassChecker,
|
||||||
|
CallableReferenceCompatibilityChecker(), LateinitIntrinsicApplicabilityChecker,
|
||||||
|
UnderscoreUsageChecker, AssigningNamedArgumentToVarargChecker(),
|
||||||
|
PrimitiveNumericComparisonCallChecker, LambdaWithSuspendModifierCallChecker
|
||||||
|
)
|
||||||
|
private val DEFAULT_TYPE_CHECKERS = emptyList<AdditionalTypeChecker>()
|
||||||
|
private val DEFAULT_CLASSIFIER_USAGE_CHECKERS = listOf(
|
||||||
|
DeprecatedClassifierUsageChecker(), ApiVersionClassifierUsageChecker, MissingDependencyClassChecker.ClassifierUsage
|
||||||
|
)
|
||||||
|
private val DEFAULT_ANNOTATION_CHECKERS = listOf<AdditionalAnnotationChecker>(
|
||||||
|
ExperimentalMarkerDeclarationAnnotationChecker
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
abstract class PlatformConfigurator(
|
||||||
|
private val dynamicTypesSettings: DynamicTypesSettings,
|
||||||
|
additionalDeclarationCheckers: List<DeclarationChecker>,
|
||||||
|
additionalCallCheckers: List<CallChecker>,
|
||||||
|
additionalTypeCheckers: List<AdditionalTypeChecker>,
|
||||||
|
additionalClassifierUsageCheckers: List<ClassifierUsageChecker>,
|
||||||
|
additionalAnnotationCheckers: List<AdditionalAnnotationChecker>,
|
||||||
|
private val identifierChecker: IdentifierChecker,
|
||||||
|
private val overloadFilter: OverloadFilter,
|
||||||
|
private val platformToKotlinClassMap: PlatformToKotlinClassMap,
|
||||||
|
private val delegationFilter: DelegationFilter,
|
||||||
|
private val overridesBackwardCompatibilityHelper: OverridesBackwardCompatibilityHelper,
|
||||||
|
private val declarationReturnTypeSanitizer: DeclarationReturnTypeSanitizer
|
||||||
|
) {
|
||||||
|
private val declarationCheckers: List<DeclarationChecker> = DEFAULT_DECLARATION_CHECKERS + additionalDeclarationCheckers
|
||||||
|
private val callCheckers: List<CallChecker> = DEFAULT_CALL_CHECKERS + additionalCallCheckers
|
||||||
|
private val typeCheckers: List<AdditionalTypeChecker> = DEFAULT_TYPE_CHECKERS + additionalTypeCheckers
|
||||||
|
private val classifierUsageCheckers: List<ClassifierUsageChecker> =
|
||||||
|
DEFAULT_CLASSIFIER_USAGE_CHECKERS + additionalClassifierUsageCheckers
|
||||||
|
private val annotationCheckers: List<AdditionalAnnotationChecker> = DEFAULT_ANNOTATION_CHECKERS + additionalAnnotationCheckers
|
||||||
|
|
||||||
|
abstract fun configureModuleComponents(container: StorageComponentContainer)
|
||||||
|
|
||||||
|
val platformSpecificContainer = composeContainer(this::class.java.simpleName) {
|
||||||
|
useInstance(dynamicTypesSettings)
|
||||||
|
declarationCheckers.forEach { useInstance(it) }
|
||||||
|
callCheckers.forEach { useInstance(it) }
|
||||||
|
typeCheckers.forEach { useInstance(it) }
|
||||||
|
classifierUsageCheckers.forEach { useInstance(it) }
|
||||||
|
annotationCheckers.forEach { useInstance(it) }
|
||||||
|
useInstance(identifierChecker)
|
||||||
|
useInstance(overloadFilter)
|
||||||
|
useInstance(platformToKotlinClassMap)
|
||||||
|
useInstance(delegationFilter)
|
||||||
|
useInstance(overridesBackwardCompatibilityHelper)
|
||||||
|
useInstance(declarationReturnTypeSanitizer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun createContainer(id: String, platform: TargetPlatform, init: StorageComponentContainer.() -> Unit) =
|
||||||
|
composeContainer(id, platform.platformConfigurator.platformSpecificContainer, init)
|
||||||
|
|
||||||
|
|
||||||
|
var KtFile.targetPlatform: TargetPlatform? by UserDataProperty(Key.create("TARGET_PLATFORM"))
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
|
|
||||||
plugins {
|
|
||||||
kotlin("jvm")
|
|
||||||
id("jps-compatible")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
testCompile(project(":core:descriptors"))
|
|
||||||
testCompile(project(":core:descriptors.jvm"))
|
|
||||||
testCompile(project(":core:deserialization"))
|
|
||||||
testCompile(project(":compiler:util"))
|
|
||||||
testCompile(project(":compiler:backend"))
|
|
||||||
testCompile(project(":compiler:ir.ir2cfg"))
|
|
||||||
testCompile(project(":compiler:frontend"))
|
|
||||||
testCompile(project(":compiler:frontend.java"))
|
|
||||||
testCompile(project(":compiler:util"))
|
|
||||||
testCompile(project(":compiler:cli-common"))
|
|
||||||
testCompile(project(":compiler:cli"))
|
|
||||||
testCompile(project(":compiler:light-classes"))
|
|
||||||
testCompile(project(":compiler:serialization"))
|
|
||||||
testCompile(project(":kotlin-preloader"))
|
|
||||||
testCompile(project(":compiler:daemon-common"))
|
|
||||||
testCompile(project(":js:js.serializer"))
|
|
||||||
testCompile(project(":js:js.frontend"))
|
|
||||||
testCompile(project(":js:js.translator"))
|
|
||||||
testCompileOnly(project(":plugins:android-extensions-compiler"))
|
|
||||||
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
|
||||||
testCompile(projectTests(":compiler:tests-common-jvm6"))
|
|
||||||
testCompileOnly(project(":kotlin-reflect-api"))
|
|
||||||
testCompile(commonDep("junit:junit"))
|
|
||||||
testCompile(project(":kotlin-scripting-compiler"))
|
|
||||||
testCompile(project(":kotlin-scripting-misc"))
|
|
||||||
testCompile(project(":kotlin-script-util"))
|
|
||||||
testCompile(androidDxJar()) { isTransitive = false }
|
|
||||||
testCompile(intellijCoreDep()) { includeJars("intellij-core"); isTransitive = false }
|
|
||||||
testCompile(intellijDep()) {
|
|
||||||
includeJars("openapi", "idea", "idea_rt", "guava", "trove4j", "picocontainer", "asm-all", "log4j", "jdom", "bootstrap", "annotations", rootProject = rootProject)
|
|
||||||
isTransitive = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
"main" { }
|
|
||||||
"test" { projectDefault() }
|
|
||||||
}
|
|
||||||
|
|
||||||
testsJar {}
|
|
||||||
+336
@@ -0,0 +1,336 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2000-2016 JetBrains s.r.o.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.test.testFramework;
|
||||||
|
|
||||||
|
import com.intellij.core.CoreASTFactory;
|
||||||
|
import com.intellij.lang.*;
|
||||||
|
import com.intellij.lang.impl.PsiBuilderFactoryImpl;
|
||||||
|
import com.intellij.mock.MockFileDocumentManagerImpl;
|
||||||
|
import com.intellij.openapi.Disposable;
|
||||||
|
import com.intellij.openapi.application.PathManager;
|
||||||
|
import com.intellij.openapi.editor.Document;
|
||||||
|
import com.intellij.openapi.editor.EditorFactory;
|
||||||
|
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||||
|
import com.intellij.openapi.extensions.Extensions;
|
||||||
|
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||||
|
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
|
||||||
|
import com.intellij.openapi.fileTypes.FileTypeFactory;
|
||||||
|
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||||
|
import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||||
|
import com.intellij.openapi.progress.ProgressManager;
|
||||||
|
import com.intellij.openapi.progress.impl.CoreProgressManager;
|
||||||
|
import com.intellij.openapi.util.Disposer;
|
||||||
|
import com.intellij.openapi.util.Key;
|
||||||
|
import com.intellij.openapi.util.TextRange;
|
||||||
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
|
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||||
|
import com.intellij.pom.PomModel;
|
||||||
|
import com.intellij.pom.core.impl.PomModelImpl;
|
||||||
|
import com.intellij.pom.tree.TreeAspect;
|
||||||
|
import com.intellij.psi.*;
|
||||||
|
import com.intellij.psi.impl.*;
|
||||||
|
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
|
||||||
|
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl;
|
||||||
|
import com.intellij.psi.util.CachedValuesManager;
|
||||||
|
import com.intellij.testFramework.LightVirtualFile;
|
||||||
|
import com.intellij.testFramework.TestDataFile;
|
||||||
|
import com.intellij.util.CachedValuesManagerImpl;
|
||||||
|
import com.intellij.util.Function;
|
||||||
|
import com.intellij.util.messages.MessageBus;
|
||||||
|
import com.intellij.util.messages.MessageBusFactory;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import org.jetbrains.annotations.NonNls;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.kotlin.test.testFramework.mock.*;
|
||||||
|
import org.picocontainer.ComponentAdapter;
|
||||||
|
import org.picocontainer.MutablePicoContainer;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@SuppressWarnings("ALL")
|
||||||
|
public abstract class KtParsingTestCase extends KtPlatformLiteFixture {
|
||||||
|
public static final Key<Document> HARD_REF_TO_DOCUMENT_KEY = Key.create("HARD_REF_TO_DOCUMENT_KEY");
|
||||||
|
protected String myFilePrefix = "";
|
||||||
|
protected String myFileExt;
|
||||||
|
protected final String myFullDataPath;
|
||||||
|
protected PsiFile myFile;
|
||||||
|
private MockPsiManager myPsiManager;
|
||||||
|
private PsiFileFactoryImpl myFileFactory;
|
||||||
|
protected Language myLanguage;
|
||||||
|
private final ParserDefinition[] myDefinitions;
|
||||||
|
private final boolean myLowercaseFirstLetter;
|
||||||
|
|
||||||
|
protected KtParsingTestCase(@NonNls @NotNull String dataPath, @NotNull String fileExt, @NotNull ParserDefinition... definitions) {
|
||||||
|
this(dataPath, fileExt, false, definitions);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected KtParsingTestCase(@NonNls @NotNull String dataPath, @NotNull String fileExt, boolean lowercaseFirstLetter, @NotNull ParserDefinition... definitions) {
|
||||||
|
myDefinitions = definitions;
|
||||||
|
myFullDataPath = getTestDataPath() + "/" + dataPath;
|
||||||
|
myFileExt = fileExt;
|
||||||
|
myLowercaseFirstLetter = lowercaseFirstLetter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
initApplication();
|
||||||
|
ComponentAdapter component = getApplication().getPicoContainer().getComponentAdapter(ProgressManager.class.getName());
|
||||||
|
|
||||||
|
Extensions.registerAreaClass("IDEA_PROJECT", null);
|
||||||
|
myProject = new MockProjectEx(getTestRootDisposable());
|
||||||
|
myPsiManager = new MockPsiManager(myProject);
|
||||||
|
myFileFactory = new PsiFileFactoryImpl(myPsiManager);
|
||||||
|
MutablePicoContainer appContainer = getApplication().getPicoContainer();
|
||||||
|
registerComponentInstance(appContainer, MessageBus.class, MessageBusFactory.newMessageBus(getApplication()));
|
||||||
|
final MockEditorFactory editorFactory = new MockEditorFactory();
|
||||||
|
registerComponentInstance(appContainer, EditorFactory.class, editorFactory);
|
||||||
|
registerComponentInstance(appContainer, FileDocumentManager.class, new MockFileDocumentManagerImpl(new Function<CharSequence, Document>() {
|
||||||
|
@Override
|
||||||
|
public Document fun(CharSequence charSequence) {
|
||||||
|
return editorFactory.createDocument(charSequence);
|
||||||
|
}
|
||||||
|
}, HARD_REF_TO_DOCUMENT_KEY));
|
||||||
|
registerComponentInstance(appContainer, PsiDocumentManager.class, new MockPsiDocumentManager());
|
||||||
|
registerApplicationService(PsiBuilderFactory.class, new PsiBuilderFactoryImpl());
|
||||||
|
registerApplicationService(DefaultASTFactory.class, new CoreASTFactory());
|
||||||
|
registerApplicationService(ReferenceProvidersRegistry.class, new ReferenceProvidersRegistryImpl());
|
||||||
|
|
||||||
|
registerApplicationService(ProgressManager.class, new CoreProgressManager());
|
||||||
|
|
||||||
|
myProject.registerService(CachedValuesManager.class, new CachedValuesManagerImpl(myProject, new PsiCachedValuesFactory(myPsiManager)));
|
||||||
|
myProject.registerService(PsiManager.class, myPsiManager);
|
||||||
|
|
||||||
|
this.registerExtensionPoint(FileTypeFactory.FILE_TYPE_FACTORY_EP, FileTypeFactory.class);
|
||||||
|
registerExtensionPoint(MetaLanguage.EP_NAME, MetaLanguage.class);
|
||||||
|
|
||||||
|
for (ParserDefinition definition : myDefinitions) {
|
||||||
|
addExplicitExtension(LanguageParserDefinitions.INSTANCE, definition.getFileNodeType().getLanguage(), definition);
|
||||||
|
}
|
||||||
|
if (myDefinitions.length > 0) {
|
||||||
|
configureFromParserDefinition(myDefinitions[0], myFileExt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// That's for reparse routines
|
||||||
|
final PomModelImpl pomModel = new PomModelImpl(myProject);
|
||||||
|
myProject.registerService(PomModel.class, pomModel);
|
||||||
|
new TreeAspect(pomModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void configureFromParserDefinition(ParserDefinition definition, String extension) {
|
||||||
|
myLanguage = definition.getFileNodeType().getLanguage();
|
||||||
|
myFileExt = extension;
|
||||||
|
addExplicitExtension(LanguageParserDefinitions.INSTANCE, this.myLanguage, definition);
|
||||||
|
registerComponentInstance(
|
||||||
|
getApplication().getPicoContainer(), FileTypeManager.class,
|
||||||
|
new KtMockFileTypeManager(new KtMockLanguageFileType(myLanguage, myFileExt)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void addExplicitExtension(final LanguageExtension<T> instance, final Language language, final T object) {
|
||||||
|
instance.addExplicitExtension(language, object);
|
||||||
|
Disposer.register(myProject, new Disposable() {
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
instance.removeExplicitExtension(language, object);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected <T> void registerExtensionPoint(final ExtensionPointName<T> extensionPointName, Class<T> aClass) {
|
||||||
|
super.registerExtensionPoint(extensionPointName, aClass);
|
||||||
|
Disposer.register(myProject, new Disposable() {
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
Extensions.getRootArea().unregisterExtensionPoint(extensionPointName.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> void registerApplicationService(final Class<T> aClass, T object) {
|
||||||
|
getApplication().registerService(aClass, object);
|
||||||
|
Disposer.register(myProject, new Disposable() {
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
getApplication().getPicoContainer().unregisterComponent(aClass.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public MockProjectEx getProject() {
|
||||||
|
return myProject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MockPsiManager getPsiManager() {
|
||||||
|
return myPsiManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception {
|
||||||
|
super.tearDown();
|
||||||
|
myFile = null;
|
||||||
|
myProject = null;
|
||||||
|
myPsiManager = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getTestDataPath() {
|
||||||
|
return PathManager.getHomePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public final String getTestName() {
|
||||||
|
return getTestName(myLowercaseFirstLetter);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean includeRanges() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean skipSpaces() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean checkAllPsiRoots() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doTest(boolean checkResult) {
|
||||||
|
String name = getTestName();
|
||||||
|
try {
|
||||||
|
String text = loadFile(name + "." + myFileExt);
|
||||||
|
myFile = createPsiFile(name, text);
|
||||||
|
ensureParsed(myFile);
|
||||||
|
assertEquals("light virtual file text mismatch", text, ((LightVirtualFile)myFile.getVirtualFile()).getContent().toString());
|
||||||
|
assertEquals("virtual file text mismatch", text, LoadTextUtil.loadText(myFile.getVirtualFile()));
|
||||||
|
assertEquals("doc text mismatch", text, myFile.getViewProvider().getDocument().getText());
|
||||||
|
assertEquals("psi text mismatch", text, myFile.getText());
|
||||||
|
ensureCorrectReparse(myFile);
|
||||||
|
if (checkResult){
|
||||||
|
checkResult(name, myFile);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
toParseTreeText(myFile, skipSpaces(), includeRanges());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doTest(String suffix) throws IOException {
|
||||||
|
String name = getTestName();
|
||||||
|
String text = loadFile(name + "." + myFileExt);
|
||||||
|
myFile = createPsiFile(name, text);
|
||||||
|
ensureParsed(myFile);
|
||||||
|
assertEquals(text, myFile.getText());
|
||||||
|
checkResult(name + suffix, myFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doCodeTest(String code) throws IOException {
|
||||||
|
String name = getTestName();
|
||||||
|
myFile = createPsiFile("a", code);
|
||||||
|
ensureParsed(myFile);
|
||||||
|
assertEquals(code, myFile.getText());
|
||||||
|
checkResult(myFilePrefix + name, myFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PsiFile createPsiFile(String name, String text) {
|
||||||
|
return createFile(name + "." + myFileExt, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PsiFile createFile(@NonNls String name, String text) {
|
||||||
|
LightVirtualFile virtualFile = new LightVirtualFile(name, myLanguage, text);
|
||||||
|
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||||
|
return createFile(virtualFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PsiFile createFile(LightVirtualFile virtualFile) {
|
||||||
|
return myFileFactory.trySetupPsiForFile(virtualFile, myLanguage, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkResult(@NonNls @TestDataFile String targetDataName, final PsiFile file) throws IOException {
|
||||||
|
doCheckResult(myFullDataPath, file, checkAllPsiRoots(), targetDataName, skipSpaces(), includeRanges());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void doCheckResult(String testDataDir,
|
||||||
|
PsiFile file,
|
||||||
|
boolean checkAllPsiRoots,
|
||||||
|
String targetDataName,
|
||||||
|
boolean skipSpaces,
|
||||||
|
boolean printRanges) throws IOException {
|
||||||
|
FileViewProvider provider = file.getViewProvider();
|
||||||
|
Set<Language> languages = provider.getLanguages();
|
||||||
|
|
||||||
|
if (!checkAllPsiRoots || languages.size() == 1) {
|
||||||
|
doCheckResult(testDataDir, targetDataName + ".txt", toParseTreeText(file, skipSpaces, printRanges).trim());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Language language : languages) {
|
||||||
|
PsiFile root = provider.getPsi(language);
|
||||||
|
String expectedName = targetDataName + "." + language.getID() + ".txt";
|
||||||
|
doCheckResult(testDataDir, expectedName, toParseTreeText(root, skipSpaces, printRanges).trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkResult(String actual) throws IOException {
|
||||||
|
String name = getTestName();
|
||||||
|
doCheckResult(myFullDataPath, myFilePrefix + name + ".txt", actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkResult(@TestDataFile @NonNls String targetDataName, String actual) throws IOException {
|
||||||
|
doCheckResult(myFullDataPath, targetDataName, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void doCheckResult(String fullPath, String targetDataName, String actual) throws IOException {
|
||||||
|
String expectedFileName = fullPath + File.separatorChar + targetDataName;
|
||||||
|
KtUsefulTestCase.assertSameLinesWithFile(expectedFileName, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static String toParseTreeText(PsiElement file, boolean skipSpaces, boolean printRanges) {
|
||||||
|
return DebugUtil.psiToString(file, skipSpaces, printRanges);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String loadFile(@NonNls @TestDataFile String name) throws IOException {
|
||||||
|
return loadFileDefault(myFullDataPath, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String loadFileDefault(String dir, String name) throws IOException {
|
||||||
|
return FileUtil.loadFile(new File(dir, name), CharsetToolkit.UTF8, true).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ensureParsed(PsiFile file) {
|
||||||
|
file.accept(new PsiElementVisitor() {
|
||||||
|
@Override
|
||||||
|
public void visitElement(PsiElement element) {
|
||||||
|
element.acceptChildren(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ensureCorrectReparse(@NotNull PsiFile file) {
|
||||||
|
String psiToStringDefault = DebugUtil.psiToString(file, false, false);
|
||||||
|
String fileText = file.getText();
|
||||||
|
DiffLog diffLog = (new BlockSupportImpl(file.getProject())).reparseRange(
|
||||||
|
file, file.getNode(), TextRange.allOf(fileText), fileText, new EmptyProgressIndicator(), fileText);
|
||||||
|
diffLog.performActualPsiChange(file);
|
||||||
|
|
||||||
|
TestCase.assertEquals(psiToStringDefault, DebugUtil.psiToString(file, false, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -54,7 +54,7 @@ class KotlinCallerChooser(
|
|||||||
previousTree: Tree?,
|
previousTree: Tree?,
|
||||||
callback: Consumer<Set<PsiElement>>
|
callback: Consumer<Set<PsiElement>>
|
||||||
): CallerChooserBase<PsiElement>(declaration, project, title, previousTree, "dummy." + KotlinFileType.EXTENSION, callback) {
|
): CallerChooserBase<PsiElement>(declaration, project, title, previousTree, "dummy." + KotlinFileType.EXTENSION, callback) {
|
||||||
override fun createTreeNode(method: PsiElement?, called: com.intellij.util.containers.HashSet<PsiElement>, cancelCallback: Runnable): KotlinMethodNode {
|
override fun createTreeNode(method: PsiElement, called: HashSet<PsiElement>, cancelCallback: Runnable): KotlinMethodNode {
|
||||||
return KotlinMethodNode(method, called, myProject, cancelCallback)
|
return KotlinMethodNode(method, called, myProject, cancelCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-5
@@ -8,13 +8,13 @@ package org.jetbrains.kotlin.idea.configuration
|
|||||||
import com.intellij.openapi.util.io.FileUtil
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.nio.file.Path
|
||||||
|
|
||||||
abstract class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTest() {
|
abstract class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTest() {
|
||||||
@Throws(IOException::class)
|
override fun getProjectDirOrFile(): Path {
|
||||||
override fun getIprFile(): File {
|
|
||||||
val tempDir = FileUtil.generateRandomTemporaryPath()
|
val tempDir = FileUtil.generateRandomTemporaryPath()
|
||||||
FileUtil.createTempDirectory("temp", null)
|
FileUtil.createTempDirectory("temp", null)
|
||||||
|
myFilesToDelete.add(tempDir)
|
||||||
|
|
||||||
FileUtil.copyDir(File(projectRoot), tempDir)
|
FileUtil.copyDir(File(projectRoot), tempDir)
|
||||||
|
|
||||||
@@ -24,8 +24,9 @@ abstract class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTes
|
|||||||
if (!File(projectFilePath).exists()) {
|
if (!File(projectFilePath).exists()) {
|
||||||
val dotIdeaPath = projectRoot + "/.idea"
|
val dotIdeaPath = projectRoot + "/.idea"
|
||||||
Assert.assertTrue("Project file or '.idea' dir should exists in " + projectRoot, File(dotIdeaPath).exists())
|
Assert.assertTrue("Project file or '.idea' dir should exists in " + projectRoot, File(dotIdeaPath).exists())
|
||||||
return File(projectRoot)
|
return File(projectRoot).toPath()
|
||||||
}
|
}
|
||||||
return File(projectFilePath)
|
|
||||||
|
return File(projectFilePath).toPath()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-7
@@ -35,7 +35,7 @@ import org.jetbrains.kotlin.idea.framework.KotlinSdkType
|
|||||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase
|
||||||
import org.jetbrains.kotlin.utils.PathUtil
|
import org.jetbrains.kotlin.utils.PathUtil
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.nio.file.Path
|
||||||
|
|
||||||
abstract class AbstractConfigureKotlinTest : PlatformTestCase() {
|
abstract class AbstractConfigureKotlinTest : PlatformTestCase() {
|
||||||
override fun setUp() {
|
override fun setUp() {
|
||||||
@@ -126,16 +126,14 @@ abstract class AbstractConfigureKotlinTest : PlatformTestCase() {
|
|||||||
val modules: Array<Module>
|
val modules: Array<Module>
|
||||||
get() = ModuleManager.getInstance(myProject).modules
|
get() = ModuleManager.getInstance(myProject).modules
|
||||||
|
|
||||||
@Throws(IOException::class)
|
override fun getProjectDirOrFile(): Path {
|
||||||
override fun getIprFile(): File {
|
|
||||||
val projectFilePath = projectRoot + "/projectFile.ipr"
|
val projectFilePath = projectRoot + "/projectFile.ipr"
|
||||||
TestCase.assertTrue("Project file should exists " + projectFilePath, File(projectFilePath).exists())
|
TestCase.assertTrue("Project file should exists " + projectFilePath, File(projectFilePath).exists())
|
||||||
return File(projectFilePath)
|
return File(projectFilePath).toPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
override fun doCreateProject(projectFile: Path): Project {
|
||||||
override fun doCreateProject(projectFile: File): Project? {
|
return myProjectManager.loadProject(projectFile.toFile().path)!!
|
||||||
return myProjectManager.loadProject(projectFile.path)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val projectName: String
|
private val projectName: String
|
||||||
|
|||||||
+8
-5
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea.configuration
|
|||||||
|
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import com.intellij.openapi.application.impl.ApplicationImpl
|
import com.intellij.openapi.application.impl.ApplicationImpl
|
||||||
|
import com.intellij.openapi.util.io.FileUtil
|
||||||
import org.jetbrains.kotlin.config.ApiVersion
|
import org.jetbrains.kotlin.config.ApiVersion
|
||||||
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||||
import org.jetbrains.kotlin.config.LanguageVersion
|
import org.jetbrains.kotlin.config.LanguageVersion
|
||||||
@@ -25,13 +26,15 @@ import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgu
|
|||||||
import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings
|
import org.jetbrains.kotlin.idea.project.getLanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||||
import org.junit.Assert
|
import org.junit.Assert
|
||||||
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
import java.nio.file.Path
|
||||||
|
|
||||||
open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest() {
|
open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest() {
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
fun testNoKotlincExistsNoSettingsRuntime10() {
|
fun testNoKotlincExistsNoSettingsRuntime10() {
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
application.doNotSave(false)
|
application.isSaveAllowed = true
|
||||||
Assert.assertEquals(LanguageVersion.KOTLIN_1_0, module.languageVersionSettings.languageVersion)
|
Assert.assertEquals(LanguageVersion.KOTLIN_1_0, module.languageVersionSettings.languageVersion)
|
||||||
Assert.assertEquals(LanguageVersion.KOTLIN_1_0, myProject.getLanguageVersionSettings(null).languageVersion)
|
Assert.assertEquals(LanguageVersion.KOTLIN_1_0, myProject.getLanguageVersionSettings(null).languageVersion)
|
||||||
application.saveAll()
|
application.saveAll()
|
||||||
@@ -40,7 +43,7 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
|||||||
|
|
||||||
fun testNoKotlincExistsNoSettingsLatestRuntime() {
|
fun testNoKotlincExistsNoSettingsLatestRuntime() {
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
application.doNotSave(false)
|
application.isSaveAllowed = true
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, myProject.getLanguageVersionSettings(null).languageVersion)
|
Assert.assertEquals(LanguageVersion.LATEST_STABLE, myProject.getLanguageVersionSettings(null).languageVersion)
|
||||||
application.saveAll()
|
application.saveAll()
|
||||||
@@ -49,7 +52,7 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
|||||||
|
|
||||||
fun testKotlincExistsNoSettingsLatestRuntimeNoVersionAutoAdvance() {
|
fun testKotlincExistsNoSettingsLatestRuntimeNoVersionAutoAdvance() {
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
application.doNotSave(false)
|
application.isSaveAllowed = true
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, myProject.getLanguageVersionSettings(null).languageVersion)
|
Assert.assertEquals(LanguageVersion.LATEST_STABLE, myProject.getLanguageVersionSettings(null).languageVersion)
|
||||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
||||||
@@ -62,7 +65,7 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
|||||||
|
|
||||||
fun testDropKotlincOnVersionAutoAdvance() {
|
fun testDropKotlincOnVersionAutoAdvance() {
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
application.doNotSave(false)
|
application.isSaveAllowed = true
|
||||||
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
Assert.assertEquals(LanguageVersion.LATEST_STABLE, module.languageVersionSettings.languageVersion)
|
||||||
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
KotlinCommonCompilerArgumentsHolder.getInstance(project).update {
|
||||||
autoAdvanceLanguageVersion = true
|
autoAdvanceLanguageVersion = true
|
||||||
@@ -97,7 +100,7 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
|||||||
fun testLoadAndSaveProjectWithV2FacetConfig() {
|
fun testLoadAndSaveProjectWithV2FacetConfig() {
|
||||||
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
|
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||||
application.doNotSave(false)
|
application.isSaveAllowed = true
|
||||||
application.saveAll()
|
application.saveAll()
|
||||||
val moduleFileContentAfter = String(module.moduleFile!!.contentsToByteArray())
|
val moduleFileContentAfter = String(module.moduleFile!!.contentsToByteArray())
|
||||||
Assert.assertEquals(moduleFileContentBefore, moduleFileContentAfter)
|
Assert.assertEquals(moduleFileContentBefore, moduleFileContentAfter)
|
||||||
|
|||||||
@@ -39,15 +39,28 @@ import org.junit.Assert
|
|||||||
|
|
||||||
class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() {
|
class CommonIntentionActionsTest : LightPlatformCodeInsightFixtureTestCase() {
|
||||||
private class SimpleMethodRequest(
|
private class SimpleMethodRequest(
|
||||||
project: Project,
|
project: Project,
|
||||||
override val methodName: String,
|
private val methodName: String,
|
||||||
override val modifiers: Collection<JvmModifier> = emptyList(),
|
private val modifiers: Collection<JvmModifier> = emptyList(),
|
||||||
override val returnType: ExpectedTypes = emptyList(),
|
private val returnType: ExpectedTypes = emptyList(),
|
||||||
override val annotations: Collection<AnnotationRequest> = emptyList(),
|
private val annotations: Collection<AnnotationRequest> = emptyList(),
|
||||||
override val parameters: List<ExpectedParameter> = emptyList(),
|
private val parameters: List<Pair<SuggestedNameInfo, List<ExpectedType>>> = emptyList(),
|
||||||
override val targetSubstitutor: JvmSubstitutor = PsiJvmSubstitutor(project, PsiSubstitutor.EMPTY)
|
private val targetSubstitutor: JvmSubstitutor = PsiJvmSubstitutor(project, PsiSubstitutor.EMPTY)
|
||||||
) : CreateMethodRequest {
|
) : CreateMethodRequest {
|
||||||
override val isValid: Boolean = true
|
override fun getTargetSubstitutor(): JvmSubstitutor = targetSubstitutor
|
||||||
|
|
||||||
|
override fun getModifiers() = modifiers
|
||||||
|
|
||||||
|
override fun getMethodName() = methodName
|
||||||
|
|
||||||
|
override fun getAnnotations() = annotations
|
||||||
|
|
||||||
|
override fun getParameters() = parameters
|
||||||
|
|
||||||
|
override fun getReturnType() = returnType
|
||||||
|
|
||||||
|
override fun isValid(): Boolean = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NameInfo(vararg names: String) : SuggestedNameInfo(names)
|
private class NameInfo(vararg names: String) : SuggestedNameInfo(names)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ dependencies {
|
|||||||
compile(projectRuntimeJar(":kotlin-preloader"))
|
compile(projectRuntimeJar(":kotlin-preloader"))
|
||||||
compile(project(":idea:idea-jps-common"))
|
compile(project(":idea:idea-jps-common"))
|
||||||
compileOnly(group = "org.jetbrains", name = "annotations", version = "13.0")
|
compileOnly(group = "org.jetbrains", name = "annotations", version = "13.0")
|
||||||
compileOnly(intellijDep()) { includeJars("jdom", "trove4j", "jps-model", "openapi", "util", "asm-all") }
|
compileOnly(intellijDep()) { includeJars("jdom", "trove4j", "jps-model", "openapi", "platform-api", "util", "asm-all") }
|
||||||
compileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
compileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
||||||
testCompileOnly(project(":kotlin-reflect-api"))
|
testCompileOnly(project(":kotlin-reflect-api"))
|
||||||
testCompile(project(":compiler:incremental-compilation-impl"))
|
testCompile(project(":compiler:incremental-compilation-impl"))
|
||||||
@@ -26,7 +26,7 @@ dependencies {
|
|||||||
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
||||||
testCompile(projectTests(":kotlin-build-common"))
|
testCompile(projectTests(":kotlin-build-common"))
|
||||||
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
testCompileOnly(intellijDep("jps-standalone")) { includeJars("jps-builders", "jps-builders-6") }
|
||||||
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "log4j") }
|
testCompileOnly(intellijDep()) { includeJars("openapi", "idea", "platform-api", "log4j") }
|
||||||
testCompile(intellijDep("jps-build-test"))
|
testCompile(intellijDep("jps-build-test"))
|
||||||
compilerModules.forEach {
|
compilerModules.forEach {
|
||||||
testRuntime(project(it))
|
testRuntime(project(it))
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
|
|
||||||
plugins {
|
|
||||||
kotlin("jvm")
|
|
||||||
id("jps-compatible")
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
testRuntime(intellijDep())
|
|
||||||
|
|
||||||
compile(project(":compiler:util"))
|
|
||||||
compile(project(":jps-plugin"))
|
|
||||||
compile(project(":plugins:android-extensions-compiler"))
|
|
||||||
compileOnly(intellijDep()) { includeJars("openapi", "jps-builders", "jps-model", "jdom") }
|
|
||||||
compileOnly(intellijPluginDep("android")) { includeJars("jps/android-jps-plugin") }
|
|
||||||
compile(intellijPluginDep("android")) { includeJars("jps/android-jps-plugin") }
|
|
||||||
|
|
||||||
testCompile(projectTests(":jps-plugin"))
|
|
||||||
testCompile(project(":compiler:tests-common"))
|
|
||||||
testCompile(commonDep("junit:junit"))
|
|
||||||
testCompile(projectDist(":kotlin-test:kotlin-test-jvm"))
|
|
||||||
testCompile(projectTests(":kotlin-build-common"))
|
|
||||||
testCompileOnly(intellijDep()) { includeJars("openapi", "jps-builders") }
|
|
||||||
testCompileOnly(intellijDep("jps-build-test")) { includeJars("jps-build-test") }
|
|
||||||
testCompileOnly(intellijDep()) { includeJars("jps-model") }
|
|
||||||
|
|
||||||
testRuntime(intellijPluginDep("android"))
|
|
||||||
testRuntime(intellijPluginDep("smali"))
|
|
||||||
testRuntime(intellijDep("jps-build-test"))
|
|
||||||
testRuntime(intellijDep("jps-standalone"))
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
"main" { projectDefault() }
|
|
||||||
"test" { projectDefault() }
|
|
||||||
}
|
|
||||||
|
|
||||||
projectTest {
|
|
||||||
workingDir = rootDir
|
|
||||||
useAndroidSdk()
|
|
||||||
}
|
|
||||||
|
|
||||||
testsJar {}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
|
|
||||||
description = "Kotlin SamWithReceiver IDEA Plugin"
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
kotlin("jvm")
|
|
||||||
id("jps-compatible")
|
|
||||||
}
|
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile(project(":kotlin-sam-with-receiver-compiler-plugin"))
|
|
||||||
compile(project(":plugins:annotation-based-compiler-plugins-ide-support"))
|
|
||||||
compile(project(":compiler:util"))
|
|
||||||
compile(project(":compiler:frontend"))
|
|
||||||
compile(project(":compiler:frontend.java"))
|
|
||||||
compile(project(":idea:idea-core"))
|
|
||||||
compile(project(":idea:idea-android"))
|
|
||||||
compile(project(":idea"))
|
|
||||||
compile(project(":idea:idea-jvm"))
|
|
||||||
compile(intellijDep()) { includeJars("openapi", "extensions", "util") }
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
|
||||||
"main" { projectDefault() }
|
|
||||||
"test" {}
|
|
||||||
}
|
|
||||||
|
|
||||||
runtimeJar()
|
|
||||||
|
|
||||||
ideaPlugin()
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user