diff --git a/buildSrc/gradle.properties.as40 b/buildSrc/gradle.properties.as40 new file mode 100644 index 00000000000..a2e24c7566f --- /dev/null +++ b/buildSrc/gradle.properties.as40 @@ -0,0 +1,8 @@ +org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8 + +cacheRedirectorEnabled=true + +#buildSrc.kotlin.repo=https://jcenter.bintray.com +#buildSrc.kotlin.version=1.1.50 + +intellijUltimateEnabled=false diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as40 b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidJpsBuildTestCase.java.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as40 b/compiler/android-tests/tests/org/jetbrains/kotlin/android/tests/AndroidRunner.java.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as40 b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as40 new file mode 100644 index 00000000000..399e7858931 --- /dev/null +++ b/generators/tests/org/jetbrains/kotlin/generators/tests/GenerateTests.kt.as40 @@ -0,0 +1,1232 @@ +/* + * Copyright 2010-2017 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.generators.tests + +import org.jetbrains.kotlin.AbstractDataFlowValueRenderingTest +import org.jetbrains.kotlin.addImport.AbstractAddImportTest +import org.jetbrains.kotlin.allopen.AbstractBytecodeListingTestForAllOpen +import org.jetbrains.kotlin.android.parcel.AbstractParcelBytecodeListingTest +import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBoxTest +import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidBytecodeShapeTest +import org.jetbrains.kotlin.android.synthetic.test.AbstractAndroidSyntheticPropertyDescriptorTest +import org.jetbrains.kotlin.checkers.* +import org.jetbrains.kotlin.copyright.AbstractUpdateKotlinCopyrightTest +import org.jetbrains.kotlin.findUsages.AbstractFindUsagesTest +import org.jetbrains.kotlin.findUsages.AbstractKotlinFindUsagesWithLibraryTest +import org.jetbrains.kotlin.formatter.AbstractFormatterTest +import org.jetbrains.kotlin.formatter.AbstractTypingIndentationTestBase +import org.jetbrains.kotlin.generators.tests.generator.TestGroup +import org.jetbrains.kotlin.generators.tests.generator.muteExtraSuffix +import org.jetbrains.kotlin.generators.tests.generator.testGroup +import org.jetbrains.kotlin.generators.util.KT_OR_KTS +import org.jetbrains.kotlin.generators.util.KT_OR_KTS_WITHOUT_DOTS_IN_NAME +import org.jetbrains.kotlin.generators.util.KT_WITHOUT_DOTS_IN_NAME +import org.jetbrains.kotlin.idea.AbstractExpressionSelectionTest +import org.jetbrains.kotlin.idea.index.AbstractKotlinTypeAliasByExpansionShortNameIndexTest +import org.jetbrains.kotlin.idea.AbstractSmartSelectionTest +import org.jetbrains.kotlin.idea.actions.AbstractGotoTestOrCodeActionTest +import org.jetbrains.kotlin.idea.caches.resolve.* +import org.jetbrains.kotlin.idea.codeInsight.* +import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractCodeInsightActionTest +import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest +import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateTestSupportMethodActionTest +import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateToStringActionTest +import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveLeftRightTest +import org.jetbrains.kotlin.idea.codeInsight.moveUpDown.AbstractMoveStatementTest +import org.jetbrains.kotlin.idea.codeInsight.postfix.AbstractPostfixTemplateProviderTest +import org.jetbrains.kotlin.idea.codeInsight.surroundWith.AbstractSurroundWithTest +import org.jetbrains.kotlin.idea.codeInsight.unwrap.AbstractUnwrapRemoveTest +import org.jetbrains.kotlin.idea.completion.test.* +import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractBasicCompletionHandlerTest +import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractCompletionCharFilterTest +import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractKeywordCompletionHandlerTest +import org.jetbrains.kotlin.idea.completion.test.handlers.AbstractSmartCompletionHandlerTest +import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractBasicCompletionWeigherTest +import org.jetbrains.kotlin.idea.completion.test.weighers.AbstractSmartCompletionWeigherTest +import org.jetbrains.kotlin.idea.configuration.AbstractGradleConfigureProjectByChangingFileTest +import org.jetbrains.kotlin.idea.conversion.copy.AbstractJavaToKotlinCopyPasteConversionTest +import org.jetbrains.kotlin.idea.conversion.copy.AbstractLiteralKotlinToKotlinCopyPasteTest +import org.jetbrains.kotlin.idea.conversion.copy.AbstractLiteralTextToKotlinCopyPasteTest +import org.jetbrains.kotlin.idea.conversion.copy.AbstractTextJavaToKotlinCopyPasteConversionTest +import org.jetbrains.kotlin.idea.coverage.AbstractKotlinCoverageOutputFilesTest +import org.jetbrains.kotlin.idea.debugger.evaluate.* +import org.jetbrains.kotlin.idea.debugger.test.sequence.exec.AbstractSequenceTraceTestCase +import org.jetbrains.kotlin.idea.debugger.test.* +import org.jetbrains.kotlin.idea.debugger.test.AbstractFileRankingTest +import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToDecompiledLibraryTest +import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToLibrarySourceTest +import org.jetbrains.kotlin.idea.decompiler.navigation.AbstractNavigateToLibrarySourceTestWithJS +import org.jetbrains.kotlin.idea.decompiler.stubBuilder.AbstractClsStubBuilderTest +import org.jetbrains.kotlin.idea.decompiler.stubBuilder.AbstractLoadJavaClsStubTest +import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractCommonDecompiledTextFromJsMetadataTest +import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractCommonDecompiledTextTest +import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractJsDecompiledTextFromJsMetadataTest +import org.jetbrains.kotlin.idea.decompiler.textBuilder.AbstractJvmDecompiledTextTest +import org.jetbrains.kotlin.idea.editor.AbstractMultiLineStringIndentTest +import org.jetbrains.kotlin.idea.editor.backspaceHandler.AbstractBackspaceHandlerTest +import org.jetbrains.kotlin.idea.editor.quickDoc.AbstractQuickDocProviderTest +import org.jetbrains.kotlin.idea.filters.AbstractKotlinExceptionFilterTest +import org.jetbrains.kotlin.idea.fir.AbstractFirMultiModuleResolveTest +import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest +import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyTest +import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyWithLibTest +import org.jetbrains.kotlin.idea.highlighter.* +import org.jetbrains.kotlin.idea.imports.AbstractJsOptimizeImportsTest +import org.jetbrains.kotlin.idea.imports.AbstractJvmOptimizeImportsTest +import org.jetbrains.kotlin.idea.inspections.AbstractLocalInspectionTest +import org.jetbrains.kotlin.idea.inspections.AbstractMultiFileLocalInspectionTest +import org.jetbrains.kotlin.idea.intentions.AbstractConcatenatedStringGeneratorTest +import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest +import org.jetbrains.kotlin.idea.intentions.AbstractIntentionTest2 +import org.jetbrains.kotlin.idea.intentions.AbstractMultiFileIntentionTest +import org.jetbrains.kotlin.idea.intentions.declarations.AbstractJoinLinesTest +import org.jetbrains.kotlin.idea.internal.AbstractBytecodeToolWindowTest +import org.jetbrains.kotlin.idea.kdoc.AbstractKDocHighlightingTest +import org.jetbrains.kotlin.idea.kdoc.AbstractKDocTypingTest +import org.jetbrains.kotlin.idea.navigation.* +import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest +import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest +import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiModuleTest +import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest +import org.jetbrains.kotlin.idea.refactoring.AbstractNameSuggestionProviderTest +import org.jetbrains.kotlin.idea.refactoring.copy.AbstractCopyTest +import org.jetbrains.kotlin.idea.refactoring.copy.AbstractMultiModuleCopyTest +import org.jetbrains.kotlin.idea.refactoring.inline.AbstractInlineTest +import org.jetbrains.kotlin.idea.refactoring.introduce.AbstractExtractionTest +import org.jetbrains.kotlin.idea.refactoring.move.AbstractMoveTest +import org.jetbrains.kotlin.idea.refactoring.move.AbstractMultiModuleMoveTest +import org.jetbrains.kotlin.idea.refactoring.pullUp.AbstractPullUpTest +import org.jetbrains.kotlin.idea.refactoring.pushDown.AbstractPushDownTest +import org.jetbrains.kotlin.idea.refactoring.rename.AbstractMultiModuleRenameTest +import org.jetbrains.kotlin.idea.refactoring.rename.AbstractRenameTest +import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractMultiModuleSafeDeleteTest +import org.jetbrains.kotlin.idea.refactoring.safeDelete.AbstractSafeDeleteTest +import org.jetbrains.kotlin.idea.repl.AbstractIdeReplCompletionTest +import org.jetbrains.kotlin.idea.resolve.* +import org.jetbrains.kotlin.idea.scratch.AbstractScratchLineMarkersTest +import org.jetbrains.kotlin.idea.scratch.AbstractScratchRunActionTest +import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationCompletionTest +import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationHighlightingTest +import org.jetbrains.kotlin.idea.script.AbstractScriptConfigurationNavigationTest +import org.jetbrains.kotlin.idea.script.AbstractScriptDefinitionsOrderTest +import org.jetbrains.kotlin.idea.slicer.AbstractSlicerLeafGroupingTest +import org.jetbrains.kotlin.idea.slicer.AbstractSlicerNullnessGroupingTest +import org.jetbrains.kotlin.idea.slicer.AbstractSlicerTreeTest +import org.jetbrains.kotlin.idea.structureView.AbstractKotlinFileStructureTest +import org.jetbrains.kotlin.idea.stubs.AbstractMultiFileHighlightingTest +import org.jetbrains.kotlin.idea.stubs.AbstractResolveByStubTest +import org.jetbrains.kotlin.idea.stubs.AbstractStubBuilderTest +import org.jetbrains.kotlin.incremental.* +import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterForWebDemoTest +import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterMultiFileTest +import org.jetbrains.kotlin.j2k.AbstractJavaToKotlinConverterSingleFileTest +//import org.jetbrains.kotlin.jps.build.* +//import org.jetbrains.kotlin.jps.incremental.AbstractJsProtoComparisonTest +//import org.jetbrains.kotlin.jps.incremental.AbstractJvmProtoComparisonTest +import org.jetbrains.kotlin.kapt.cli.test.AbstractArgumentParsingTest +import org.jetbrains.kotlin.kapt.cli.test.AbstractKaptToolIntegrationTest +import org.jetbrains.kotlin.kapt3.test.AbstractClassFileToSourceStubConverterTest +import org.jetbrains.kotlin.kapt3.test.AbstractKotlinKaptContextTest +import org.jetbrains.kotlin.nj2k.AbstractNewJavaToKotlinConverterMultiFileTest +import org.jetbrains.kotlin.nj2k.AbstractNewJavaToKotlinConverterSingleFileTest +import org.jetbrains.kotlin.nj2k.AbstractNewJavaToKotlinCopyPasteConversionTest +import org.jetbrains.kotlin.nj2k.AbstractTextNewJavaToKotlinCopyPasteConversionTest +import org.jetbrains.kotlin.nj2k.inference.common.AbstractCommonConstraintCollectorTest +import org.jetbrains.kotlin.nj2k.inference.mutability.AbstractMutabilityInferenceTest +import org.jetbrains.kotlin.nj2k.inference.nullability.AbstractNullabilityInferenceTest +import org.jetbrains.kotlin.noarg.AbstractBlackBoxCodegenTestForNoArg +import org.jetbrains.kotlin.noarg.AbstractBytecodeListingTestForNoArg +import org.jetbrains.kotlin.psi.patternMatching.AbstractPsiUnifierTest +import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverScriptTest +import org.jetbrains.kotlin.samWithReceiver.AbstractSamWithReceiverTest +import org.jetbrains.kotlin.search.AbstractAnnotatedMembersSearchTest +import org.jetbrains.kotlin.search.AbstractInheritorsSearchTest +import org.jetbrains.kotlin.shortenRefs.AbstractShortenRefsTest +import org.jetbrains.kotlin.test.TargetBackend +import org.jetbrains.kotlin.tools.projectWizard.cli.AbstractBuildFileGenerationTest +import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginBytecodeListingTest +import org.jetbrains.kotlinx.serialization.AbstractSerializationPluginDiagnosticTest +import org.jetbrains.kotlinx.serialization.AbstractSerializationIrBytecodeListingTest + +fun main(args: Array) { + System.setProperty("java.awt.headless", "true") + + testGroup("idea/jvm-debugger/jvm-debugger-test/test", "idea/jvm-debugger/jvm-debugger-test/testData") { + testClass { + model( + "stepping/stepIntoAndSmartStepInto", + pattern = KT_WITHOUT_DOTS_IN_NAME, + testMethod = "doStepIntoTest", + testClassName = "StepInto" + ) + model( + "stepping/stepIntoAndSmartStepInto", + pattern = KT_WITHOUT_DOTS_IN_NAME, + testMethod = "doSmartStepIntoTest", + testClassName = "SmartStepInto" + ) + model( + "stepping/stepInto", + pattern = KT_WITHOUT_DOTS_IN_NAME, + testMethod = "doStepIntoTest", + testClassName = "StepIntoOnly" + ) + model("stepping/stepOut", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOutTest") + model("stepping/stepOver", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOverTest") + model("stepping/stepOverForce", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepOverForceTest") + model("stepping/filters", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doStepIntoTest") + model("stepping/custom", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doCustomTest") + } + + testClass { + model("evaluation/singleBreakpoint", testMethod = "doSingleBreakpointTest") + model("evaluation/multipleBreakpoints", testMethod = "doMultipleBreakpointsTest") + } + + testClass { + model("selectExpression", recursive = false) + model("selectExpression/disallowMethodCalls", testMethod = "doTestWoMethodCalls") + } + + testClass { + model("positionManager", recursive = false, extension = "kt", testClassName = "SingleFile") + model("positionManager", recursive = false, extension = null, testClassName = "MultiFile") + } + + testClass { + model("smartStepInto") + } + + testClass { + model("breakpointApplicability") + } + + testClass { + model("fileRanking") + } + + testClass { + model("asyncStackTrace") + } + + testClass { + // TODO: implement mapping logic for terminal operations + model("sequence/streams/sequence", excludeDirs = listOf("terminal")) + } + } + + testGroup("idea/tests", "idea/testData") { + testClass { + model("resolve/additionalLazyResolve") + } + + testClass { + model("resolve/partialBodyResolve") + } + + testClass { + model("checker", recursive = false) + model("checker/regression") + model("checker/recovery") + model("checker/rendering") + model("checker/scripts", extension = "kts") + model("checker/duplicateJvmSignature") + model("checker/infos", testMethod = "doTestWithInfos") + model("checker/diagnosticsMessage") + } + + testClass { + model("checker", recursive = false) + model("checker/regression") + model("checker/recovery") + model("checker/rendering") + model("checker/duplicateJvmSignature") + model("checker/infos") + model("checker/diagnosticsMessage") + } + + testClass { + model("kotlinAndJavaChecker/javaAgainstKotlin") + model("kotlinAndJavaChecker/javaWithKotlin") + } + + testClass { + model("kotlinAndJavaChecker/javaAgainstKotlin") + } + + testClass { + model("unifier") + } + + testClass { + model("checker/codeFragments", extension = "kt", recursive = false) + model("checker/codeFragments/imports", testMethod = "doTestWithImport", extension = "kt") + } + + testClass { + model("quickfix.special/codeFragmentAutoImport", extension = "kt", recursive = false) + } + + testClass { + model("checker/js") + } + + testClass { + model("quickfix", pattern = "^([\\w\\-_]+)\\.kt$", filenameStartsLowerCase = true) + } + + testClass { + model("navigation/gotoSuper", extension = "test", recursive = false) + } + + testClass { + model("navigation/gotoTypeDeclaration", extension = "test") + } + + testClass { + model("navigation/gotoDeclaration", extension = "test") + } + + testClass { + model( + "parameterInfo", + pattern = "^([\\w\\-_]+)\\.kt$", recursive = true, + excludeDirs = listOf("withLib1/sharedLib", "withLib2/sharedLib", "withLib3/sharedLib") + ) + } + + testClass { + model("navigation/gotoClass", testMethod = "doClassTest") + model("navigation/gotoSymbol", testMethod = "doSymbolTest") + } + + testClass(annotations = listOf(muteExtraSuffix(".libsrc"))) { + model("decompiler/navigation/usercode") + } + + testClass(annotations = listOf(muteExtraSuffix(".libsrcjs"))) { + model("decompiler/navigation/usercode", testClassName ="UsercodeWithJSModule") + } + + testClass { + model("decompiler/navigation/usercode") + } + + testClass { + model("navigation/implementations", recursive = false) + } + + testClass { + model("navigation/gotoTestOrCode", pattern = "^(.+)\\.main\\..+\$") + } + + testClass { + model("search/inheritance") + } + + testClass { + model("search/annotations") + } + + testClass { + model("quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") + } + + testClass { + model("typealiasExpansionIndex") + } + + testClass { + model("highlighter") + } + + testClass { + model("dslHighlighter") + } + + testClass { + model("usageHighlighter") + } + + testClass { + model("folding/noCollapse") + model("folding/checkCollapse", testMethod = "doSettingsFoldingTest") + } + + testClass { + model("codeInsight/surroundWith/if", testMethod = "doTestWithIfSurrounder") + model("codeInsight/surroundWith/ifElse", testMethod = "doTestWithIfElseSurrounder") + model("codeInsight/surroundWith/ifElseExpression", testMethod = "doTestWithIfElseExpressionSurrounder") + model("codeInsight/surroundWith/ifElseExpressionBraces", testMethod = "doTestWithIfElseExpressionBracesSurrounder") + model("codeInsight/surroundWith/not", testMethod = "doTestWithNotSurrounder") + model("codeInsight/surroundWith/parentheses", testMethod = "doTestWithParenthesesSurrounder") + model("codeInsight/surroundWith/stringTemplate", testMethod = "doTestWithStringTemplateSurrounder") + model("codeInsight/surroundWith/when", testMethod = "doTestWithWhenSurrounder") + model("codeInsight/surroundWith/tryCatch", testMethod = "doTestWithTryCatchSurrounder") + model("codeInsight/surroundWith/tryCatchExpression", testMethod = "doTestWithTryCatchExpressionSurrounder") + model("codeInsight/surroundWith/tryCatchFinally", testMethod = "doTestWithTryCatchFinallySurrounder") + model("codeInsight/surroundWith/tryCatchFinallyExpression", testMethod = "doTestWithTryCatchFinallyExpressionSurrounder") + model("codeInsight/surroundWith/tryFinally", testMethod = "doTestWithTryFinallySurrounder") + model("codeInsight/surroundWith/functionLiteral", testMethod = "doTestWithFunctionLiteralSurrounder") + model("codeInsight/surroundWith/withIfExpression", testMethod = "doTestWithSurroundWithIfExpression") + model("codeInsight/surroundWith/withIfElseExpression", testMethod = "doTestWithSurroundWithIfElseExpression") + } + + testClass { + model("joinLines") + } + + testClass { + model("codeInsight/breadcrumbs") + } + + testClass { + model("intentions", pattern = "^([\\w\\-_]+)\\.(kt|kts)$") + } + + testClass { + model("intentions/loopToCallChain", pattern = "^([\\w\\-_]+)\\.kt$") + } + + testClass { + model("concatenatedStringGenerator", pattern = "^([\\w\\-_]+)\\.kt$") + } + + testClass { + model("intentions", pattern = "^(inspections\\.test)$", singleClass = true) + model("inspections", pattern = "^(inspections\\.test)$", singleClass = true) + model("inspectionsLocal", pattern = "^(inspections\\.test)$", singleClass = true) + } + + testClass { + model("inspectionsLocal", pattern = "^([\\w\\-_]+)\\.(kt|kts)$") + } + + testClass { + model("hierarchy/class/type", extension = null, recursive = false, testMethod = "doTypeClassHierarchyTest") + model("hierarchy/class/super", extension = null, recursive = false, testMethod = "doSuperClassHierarchyTest") + model("hierarchy/class/sub", extension = null, recursive = false, testMethod = "doSubClassHierarchyTest") + model("hierarchy/calls/callers", extension = null, recursive = false, testMethod = "doCallerHierarchyTest") + model("hierarchy/calls/callersJava", extension = null, recursive = false, testMethod = "doCallerJavaHierarchyTest") + model("hierarchy/calls/callees", extension = null, recursive = false, testMethod = "doCalleeHierarchyTest") + model("hierarchy/overrides", extension = null, recursive = false, testMethod = "doOverrideHierarchyTest") + } + + testClass { + model("hierarchy/withLib", extension = null, recursive = false) + } + + testClass { + model("codeInsight/moveUpDown/classBodyDeclarations", pattern = KT_OR_KTS, testMethod = "doTestClassBodyDeclaration") + model("codeInsight/moveUpDown/closingBraces", testMethod = "doTestExpression") + model("codeInsight/moveUpDown/expressions", pattern = KT_OR_KTS, testMethod = "doTestExpression") + model("codeInsight/moveUpDown/parametersAndArguments", testMethod = "doTestExpression") + } + + testClass { + model("codeInsight/moveLeftRight") + } + + testClass { + model("refactoring/inline", pattern = "^(\\w+)\\.kt$") + } + + testClass { + model("codeInsight/unwrapAndRemove/removeExpression", testMethod = "doTestExpressionRemover") + model("codeInsight/unwrapAndRemove/unwrapThen", testMethod = "doTestThenUnwrapper") + model("codeInsight/unwrapAndRemove/unwrapElse", testMethod = "doTestElseUnwrapper") + model("codeInsight/unwrapAndRemove/removeElse", testMethod = "doTestElseRemover") + model("codeInsight/unwrapAndRemove/unwrapLoop", testMethod = "doTestLoopUnwrapper") + model("codeInsight/unwrapAndRemove/unwrapTry", testMethod = "doTestTryUnwrapper") + model("codeInsight/unwrapAndRemove/unwrapCatch", testMethod = "doTestCatchUnwrapper") + model("codeInsight/unwrapAndRemove/removeCatch", testMethod = "doTestCatchRemover") + model("codeInsight/unwrapAndRemove/unwrapFinally", testMethod = "doTestFinallyUnwrapper") + model("codeInsight/unwrapAndRemove/removeFinally", testMethod = "doTestFinallyRemover") + model("codeInsight/unwrapAndRemove/unwrapLambda", testMethod = "doTestLambdaUnwrapper") + model("codeInsight/unwrapAndRemove/unwrapFunctionParameter", testMethod = "doTestFunctionParameterUnwrapper") + } + + testClass { + model("codeInsight/expressionType") + } + + testClass { + model("editor/backspaceHandler") + } + + testClass { + model("editor/enterHandler/multilineString") + } + + testClass { + model("editor/quickDoc", pattern = """^([^_]+)\.(kt|java)$""") + } + + testClass { + model("refactoring/safeDelete/deleteClass/kotlinClass", testMethod = "doClassTest") + model("refactoring/safeDelete/deleteClass/kotlinClassWithJava", testMethod = "doClassTestWithJava") + model("refactoring/safeDelete/deleteClass/javaClassWithKotlin", extension = "java", testMethod = "doJavaClassTest") + model("refactoring/safeDelete/deleteObject/kotlinObject", testMethod = "doObjectTest") + model("refactoring/safeDelete/deleteFunction/kotlinFunction", testMethod = "doFunctionTest") + model("refactoring/safeDelete/deleteFunction/kotlinFunctionWithJava", testMethod = "doFunctionTestWithJava") + model("refactoring/safeDelete/deleteFunction/javaFunctionWithKotlin", testMethod = "doJavaMethodTest") + model("refactoring/safeDelete/deleteProperty/kotlinProperty", testMethod = "doPropertyTest") + model("refactoring/safeDelete/deleteProperty/kotlinPropertyWithJava", testMethod = "doPropertyTestWithJava") + model("refactoring/safeDelete/deleteProperty/javaPropertyWithKotlin", testMethod = "doJavaPropertyTest") + model("refactoring/safeDelete/deleteTypeAlias/kotlinTypeAlias", testMethod = "doTypeAliasTest") + model("refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameter", testMethod = "doTypeParameterTest") + model("refactoring/safeDelete/deleteTypeParameter/kotlinTypeParameterWithJava", testMethod = "doTypeParameterTestWithJava") + model("refactoring/safeDelete/deleteValueParameter/kotlinValueParameter", testMethod = "doValueParameterTest") + model("refactoring/safeDelete/deleteValueParameter/kotlinValueParameterWithJava", testMethod = "doValueParameterTestWithJava") + } + + testClass { + model("resolve/references", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("resolve/references", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("resolve/referenceInJava/binaryAndSource", extension = "java") + model("resolve/referenceInJava/sourceOnly", extension = "java") + } + + testClass { + model("resolve/referenceInJava/binaryAndSource", extension = "java") + } + + testClass { + model("resolve/referenceWithLib", recursive = false) + } + + testClass { + model("resolve/referenceInLib", recursive = false) + } + + testClass { + model("resolve/referenceToJavaWithWrongFileStructure", recursive = false) + } + + testClass { + model("findUsages/kotlin", pattern = """^(.+)\.0\.(kt|kts)$""") + model("findUsages/java", pattern = """^(.+)\.0\.java$""") + model("findUsages/propertyFiles", pattern = """^(.+)\.0\.properties$""") + } + + testClass { + model("findUsages/libraryUsages", pattern = """^(.+)\.0\.kt$""") + } + + testClass { + model("refactoring/move", extension = "test", singleClass = true) + } + + testClass { + model("refactoring/copy", extension = "test", singleClass = true) + } + + testClass { + model("refactoring/moveMultiModule", extension = "test", singleClass = true) + } + + testClass { + model("refactoring/copyMultiModule", extension = "test", singleClass = true) + } + + testClass { + model("refactoring/safeDeleteMultiModule", extension = "test", singleClass = true) + } + + testClass { + model("multiFileIntentions", extension = "test", singleClass = true, filenameStartsLowerCase = true) + } + + testClass { + model("multiFileLocalInspections", extension = "test", singleClass = true, filenameStartsLowerCase = true) + } + + testClass { + model("multiFileInspections", extension = "test", singleClass = true) + } + + testClass { + model("formatter", pattern = """^([^\.]+)\.after\.kt.*$""") + model("formatter", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", + testMethod = "doTestInverted", testClassName = "FormatterInverted") + } + + testClass { + model("indentationOnNewline", pattern = """^([^\.]+)\.after\.kt.*$""", testMethod = "doNewlineTest", + testClassName = "DirectSettings") + model("indentationOnNewline", pattern = """^([^\.]+)\.after\.inv\.kt.*$""", testMethod = "doNewlineTestWithInvert", + testClassName = "InvertedSettings") + } + + testClass { + model("diagnosticMessage", recursive = false) + } + + testClass { + model("diagnosticMessage/js", recursive = false, targetBackend = TargetBackend.JS) + } + + testClass { + model("refactoring/rename", extension = "test", singleClass = true) + } + + testClass { + model("refactoring/renameMultiModule", extension = "test", singleClass = true) + } + + testClass { + model("codeInsight/outOfBlock", pattern = KT_OR_KTS) + } + + testClass { + model("dataFlowValueRendering") + } + + testClass { + model("copyPaste/conversion", pattern = """^([^\.]+)\.java$""") + } + + testClass { + model("copyPaste/plainTextConversion", pattern = """^([^\.]+)\.txt$""") + } + + testClass { + model("copyPaste/plainTextLiteral", pattern = """^([^\.]+)\.txt$""") + } + + testClass { + model("copyPaste/literal", pattern = """^([^\.]+)\.kt$""") + } + + testClass { + model("copyPaste/imports", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTestCopy", testClassName = "Copy", recursive = false) + model("copyPaste/imports", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTestCut", testClassName = "Cut", recursive = false) + } + + testClass { + model("copyPaste/moveDeclarations", pattern = KT_WITHOUT_DOTS_IN_NAME, testMethod = "doTest") + } + + testClass { + model("copyright", pattern = KT_OR_KTS, testMethod = "doTest") + } + + testClass { + model("exitPoints") + } + + testClass { + model("codeInsight/lineMarker") + } + + testClass { + model("codeInsightInLibrary/lineMarker", testMethod = "doTestWithLibrary") + } + + testClass { + model("multiModuleLineMarker", extension = null, recursive = false) + } + + testClass { + model("shortenRefs", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + testClass { + model("addImport", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("smartSelection", testMethod = "doTestSmartSelection", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("structureView/fileStructure", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("expressionSelection", testMethod = "doTestExpressionSelection", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("decompiler/decompiledText", pattern = """^([^\.]+)$""") + } + + testClass { + model("decompiler/decompiledTextJvm", pattern = """^([^\.]+)$""") + } + + testClass { + model("decompiler/decompiledText", pattern = """^([^\.]+)$""", targetBackend = TargetBackend.JS) + } + + testClass { + model("decompiler/decompiledTextJs", pattern = """^([^\.]+)$""", targetBackend = TargetBackend.JS) + } + + testClass { + model("decompiler/stubBuilder", extension = null, recursive = false) + } + + testClass { + model("editor/optimizeImports/jvm", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) + model("editor/optimizeImports/common", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + testClass { + model("editor/optimizeImports/js", pattern = KT_WITHOUT_DOTS_IN_NAME) + model("editor/optimizeImports/common", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("debugger/exceptionFilter", pattern = """^([^\.]+)$""", recursive = false) + } + + testClass { + model("stubs", extension = "kt") + } + + testClass { + model("multiFileHighlighting", recursive = false) + } + + testClass { + model("multiModuleHighlighting/multiplatform/", recursive = false, extension = null) + } + + testClass { + model("multiModuleHighlighting/hierarchicalExpectActualMatching/", recursive = false, extension = null) + } + + testClass { + model("multiModuleQuickFix", extension = null, deep = 1) + } + + testClass { + model("navigation/implementations/multiModule", recursive = false, extension = null) + } + + testClass { + model("navigation/relatedSymbols/multiModule", recursive = false, extension = null) + } + + testClass { + model("navigation/gotoSuper/multiModule", recursive = false, extension = null) + } + + testClass { + model("refactoring/introduceVariable", pattern = KT_OR_KTS, testMethod = "doIntroduceVariableTest") + model("refactoring/extractFunction", pattern = KT_OR_KTS, testMethod = "doExtractFunctionTest") + model("refactoring/introduceProperty", pattern = KT_OR_KTS, testMethod = "doIntroducePropertyTest") + model("refactoring/introduceParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceSimpleParameterTest") + model("refactoring/introduceLambdaParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceLambdaParameterTest") + model("refactoring/introduceJavaParameter", extension = "java", testMethod = "doIntroduceJavaParameterTest") + model("refactoring/introduceTypeParameter", pattern = KT_OR_KTS, testMethod = "doIntroduceTypeParameterTest") + model("refactoring/introduceTypeAlias", pattern = KT_OR_KTS, testMethod = "doIntroduceTypeAliasTest") + model("refactoring/extractSuperclass", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME, testMethod = "doExtractSuperclassTest") + model("refactoring/extractInterface", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME, testMethod = "doExtractInterfaceTest") + } + + testClass { + model("refactoring/pullUp/k2k", extension = "kt", singleClass = true, testClassName = "K2K", testMethod = "doKotlinTest") + model("refactoring/pullUp/k2j", extension = "kt", singleClass = true, testClassName = "K2J", testMethod = "doKotlinTest") + model("refactoring/pullUp/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest") + } + + testClass { + model("refactoring/pushDown/k2k", extension = "kt", singleClass = true, testClassName = "K2K", testMethod = "doKotlinTest") + model("refactoring/pushDown/k2j", extension = "kt", singleClass = true, testClassName = "K2J", testMethod = "doKotlinTest") + model("refactoring/pushDown/j2k", extension = "java", singleClass = true, testClassName = "J2K", testMethod = "doJavaTest") + } + + testClass { + model("coverage/outputFiles") + } + + testClass { + model("internal/toolWindow", recursive = false, extension = null) + } + + testClass("org.jetbrains.kotlin.idea.kdoc.KdocResolveTestGenerated") { + model("kdoc/resolve") + } + + testClass { + model("kdoc/highlighting") + } + + testClass { + model("kdoc/typing") + } + + testClass { + model("codeInsight/generate/testFrameworkSupport") + } + + testClass { + model("codeInsight/generate/equalsWithHashCode") + } + + testClass { + model("codeInsight/generate/secondaryConstructors") + } + + testClass { + model("codeInsight/generate/toString") + } + + testClass { + model("repl/completion") + } + + testClass { + model("codeInsight/postfix") + } + + testClass { + model("script/definition/highlighting", extension = null, recursive = false) + model("script/definition/complex", extension = null, recursive = false, testMethod = "doComplexTest") + } + + testClass { + model("script/definition/navigation", extension = null, recursive = false) + } + + testClass { + model("script/definition/completion", extension = null, recursive = false) + } + + testClass { + model("script/definition/order", extension = null, recursive = false) + } + + testClass { + model("refactoring/nameSuggestionProvider") + } + + testClass { + model("slicer", singleClass = true) + } + + testClass { + model("slicer/inflow", singleClass = true) + } + + testClass { + model("slicer/inflow", singleClass = true) + } + } + + testGroup("idea/scripting-support/test", "idea/scripting-support/testData") { + testClass { + model("scratch", extension = "kts", testMethod = "doScratchCompilingTest", testClassName = "ScratchCompiling", recursive = false) + model("scratch", extension = "kts", testMethod = "doScratchReplTest", testClassName = "ScratchRepl", recursive = false) + model("scratch/multiFile", extension = null, testMethod = "doScratchMultiFileTest", testClassName = "ScratchMultiFile", recursive = false) + + model("worksheet", extension = "ws.kts", testMethod = "doWorksheetCompilingTest", testClassName = "WorksheetCompiling", recursive = false) + model("worksheet", extension = "ws.kts", testMethod = "doWorksheetReplTest", testClassName = "WorksheetRepl", recursive = false) + model("worksheet/multiFile", extension = null, testMethod = "doWorksheetMultiFileTest", testClassName = "WorksheetMultiFile", recursive = false) + + model("scratch/rightPanelOutput", extension = "kts", testMethod = "doRightPreviewPanelOutputTest", testClassName = "ScratchRightPanelOutput", recursive = false) + } + + testClass { + model("scratch/lineMarker", testMethod = "doScratchTest", pattern = KT_OR_KTS) + } + + testClass { + model("fir/multiModule", recursive = false, extension = null) + } + } + + /* + // Maven and Gradle are not relevant for AS branch + + testGroup("idea/idea-maven/test", "idea/idea-maven/testData") { + testClass { + model("configurator/jvm", extension = null, recursive = false, testMethod = "doTestWithMaven") + model("configurator/js", extension = null, recursive = false, testMethod = "doTestWithJSMaven") + } + + testClass { + model("maven-inspections", pattern = "^([\\w\\-]+).xml$", singleClass = true) + } + } + + testGroup("idea/idea-gradle/tests", "idea/testData") { + testClass { + model("configuration/gradle", extension = null, recursive = false, testMethod = "doTestGradle") + model("configuration/gsk", extension = null, recursive = false, testMethod = "doTestGradle") + } + } + + */ + + testGroup("idea/tests", "compiler/testData") { + testClass { + model("loadJava/compiledKotlin") + } + + testClass { + model("loadJava/compiledKotlin", testMethod = "doTestCompiledKotlin") + } + + testClass { + model("asJava/lightClasses", excludeDirs = listOf("delegation", "script"), pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("asJava/script/ide", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("asJava/lightClasses", excludeDirs = listOf("local", "compilationErrors", "ideRegression"), pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) + } + } + + testGroup("idea/idea-completion/tests", "idea/idea-completion/testData") { + testClass { + model("injava", extension = "java", recursive = false) + } + + testClass { + model("injava", extension = "java", recursive = false) + } + + testClass { + model("injava/stdlib", extension = "java", recursive = false) + } + + testClass { + model("weighers/basic", pattern = KT_OR_KTS_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("weighers/smart", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("basic/common") + model("basic/js") + } + + testClass { + model("basic/common") + model("basic/java") + } + + testClass { + model("smart") + } + + testClass { + model("keywords", recursive = false) + } + + testClass { + model("basic/withLib", recursive = false) + } + + testClass { + model("handlers/basic", pattern = KT_WITHOUT_DOTS_IN_NAME) + } + + testClass { + model("handlers/smart") + } + + testClass { + model("handlers/keywords") + } + + testClass { + model("handlers/charFilter") + } + + testClass { + model("basic/multifile", extension = null, recursive = false) + } + + testClass { + model("smartMultiFile", extension = null, recursive = false) + } + + testClass("KDocCompletionTestGenerated") { + model("kdoc") + } + + testClass { + model("basic/java8") + } + + testClass { + model("incrementalResolve") + } + + testClass { + model("multiPlatform", recursive = false, extension = null) + } + } + + testGroup( + "libraries/tools/new-project-wizard/new-project-wizard-cli/tests", + "libraries/tools/new-project-wizard/new-project-wizard-cli/testData" + ) { + testClass { + model("buildFileGeneration", recursive = false, extension = null) + } + } + + //TODO: move these tests into idea-completion module + testGroup("idea/tests", "idea/idea-completion/testData") { + testClass { + model("handlers/runtimeCast") + } + + testClass { + model("basic/codeFragments", extension = "kt") + } + } + + testGroup("j2k/tests", "j2k/testData") { + testClass { + model("fileOrElement", extension = "java") + } + } + testGroup("j2k/tests", "j2k/testData") { + testClass { + model("multiFile", extension = null, recursive = false) + } + } + testGroup("j2k/tests", "j2k/testData") { + testClass { + model("fileOrElement", extension = "java") + } + } + + testGroup("nj2k/tests", "nj2k/testData") { + testClass { + model("newJ2k", pattern = """^([^\.]+)\.java$""") + } + testClass { + model("inference/common") + } + testClass { + model("inference/nullability") + } + testClass { + model("inference/mutability") + } + testClass { + model("copyPaste", pattern = """^([^\.]+)\.java$""") + } + testClass { + model("copyPastePlainText", pattern = """^([^\.]+)\.txt$""") + } + testClass { + model("multiFile", extension = null, recursive = false) + } + } + +/* There is no jps in AS + .... +*/ + testGroup("compiler/incremental-compilation-impl/test", "jps-plugin/testData") { + testClass { + model("incremental/pureKotlin", extension = null, recursive = false) + model("incremental/classHierarchyAffected", extension = null, recursive = false) + model("incremental/inlineFunCallSite", extension = null, excludeParentDirs = true) + model("incremental/withJava", extension = null, excludeParentDirs = true) + model("incremental/incrementalJvmCompilerOnly", extension = null, excludeParentDirs = true) + } + + testClass { + model("incremental/pureKotlin", extension = null, recursive = false) + model("incremental/classHierarchyAffected", extension = null, recursive = false) + model("incremental/js", extension = null, excludeParentDirs = true) + } + + testClass { + model("incremental/js/friendsModuleDisabled", extension = null, recursive = false) + } + + testClass { + model("incremental/multiplatform/singleModule", extension = null, excludeParentDirs = true) + } + testClass { + model("incremental/multiplatform/singleModule", extension = null, excludeParentDirs = true) + } + } + + testGroup("plugins/android-extensions/android-extensions-compiler/test", "plugins/android-extensions/android-extensions-compiler/testData") { + testClass { + model("descriptors", recursive = false, extension = null) + } + + testClass { + model("codegen/android", recursive = false, extension = null, testMethod = "doCompileAgainstAndroidSdkTest") + model("codegen/android", recursive = false, extension = null, testMethod = "doFakeInvocationTest", testClassName = "Invoke") + } + + testClass { + model("codegen/bytecodeShape", recursive = false, extension = null) + } + + testClass { + model("parcel/codegen") + } + } + + testGroup("plugins/kapt3/kapt3-compiler/test", "plugins/kapt3/kapt3-compiler/testData") { + testClass { + model("converter") + } + + testClass { + model("kotlinRunner") + } + } + + testGroup("plugins/kapt3/kapt3-cli/test", "plugins/kapt3/kapt3-cli/testData") { + testClass { + model("argumentParsing", extension = "txt") + } + + testClass { + model("integration", recursive = false, extension = null) + } + } + + testGroup("plugins/allopen/allopen-cli/test", "plugins/allopen/allopen-cli/testData") { + testClass { + model("bytecodeListing", extension = "kt") + } + } + + testGroup("plugins/noarg/noarg-cli/test", "plugins/noarg/noarg-cli/testData") { + testClass { + model("bytecodeListing", extension = "kt") + } + + testClass { + model("box", targetBackend = TargetBackend.JVM) + } + } + + testGroup("plugins/sam-with-receiver/sam-with-receiver-cli/test", "plugins/sam-with-receiver/sam-with-receiver-cli/testData") { + testClass { + model("diagnostics") + } + testClass { + model("script", extension = "kts") + } + } + + testGroup( + "plugins/kotlin-serialization/kotlin-serialization-compiler/test", + "plugins/kotlin-serialization/kotlin-serialization-compiler/testData" + ) { + testClass { + model("diagnostics") + } + + testClass { + model("codegen") + } + + testClass { + model("codegen") + } + } +/* + testGroup("plugins/android-extensions/android-extensions-idea/tests", "plugins/android-extensions/android-extensions-idea/testData") { + testClass { + model("android/completion", recursive = false, extension = null) + } + + testClass { + model("android/goto", recursive = false, extension = null) + } + + testClass { + model("android/rename", recursive = false, extension = null) + } + + testClass { + model("android/renameLayout", recursive = false, extension = null) + } + + testClass { + model("android/findUsages", recursive = false, extension = null) + } + + testClass { + model("android/usageHighlighting", recursive = false, extension = null) + } + + testClass { + model("android/extraction", recursive = false, extension = null) + } + + testClass { + model("android/parcel/checker", excludeParentDirs = true) + } + + testClass { + model("android/parcel/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") + } + } + + testGroup("idea/idea-android/tests", "idea/testData") { + testClass { + model("configuration/android-gradle", pattern = """(\w+)_before\.gradle$""", testMethod = "doTestAndroidGradle") + model("configuration/android-gsk", pattern = """(\w+)_before\.gradle.kts$""", testMethod = "doTestAndroidGradle") + } + + testClass { + model("android/intention", pattern = "^([\\w\\-_]+)\\.kt$") + } + + testClass { + model("android/resourceIntention", extension = "test", singleClass = true) + } + + testClass { + model("android/quickfix", pattern = """^(\w+)\.((before\.Main\.\w+)|(test))$""", testMethod = "doTestWithExtraFile") + } + + testClass { + model("android/lint", excludeParentDirs = true) + } + + testClass { + model("android/lintQuickfix", pattern = "^([\\w\\-_]+)\\.kt$") + } + + testClass { + model("android/folding") + } + + testClass { + model("android/gutterIcon") + } + } +*/ +} diff --git a/gradle.properties.as40 b/gradle.properties.as40 new file mode 100644 index 00000000000..a14f118a680 --- /dev/null +++ b/gradle.properties.as40 @@ -0,0 +1,24 @@ +org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m -Dfile.encoding=UTF-8 + +cacheRedirectorEnabled=true + +kotlin.compiler.effectSystemEnabled=true +kotlin.compiler.newInferenceEnabled=true +#maven.repository.mirror=http://repository.jetbrains.com/remote-repos/ +#bootstrap.kotlin.repo=https://dl.bintray.com/kotlin/kotlin-dev +#bootstrap.kotlin.version=1.1.50-dev-1451 +#signingRequired=true + +intellijUltimateEnabled=false +intellijEnforceCommunitySdk=true + +## The following properties can be added to your local.properties file to customize the build: + +#jpsBuild=true +#cidrPluginsEnabled=true + +## Used for compare gradle and jps build + +#kotlin.build.postprocessing=false +#kotlin.build.java9=false +#kotlin.build.useBootstrapStdlib=true \ No newline at end of file diff --git a/gradle/versions.properties.as40 b/gradle/versions.properties.as40 new file mode 100644 index 00000000000..e0ed39b812c --- /dev/null +++ b/gradle/versions.properties.as40 @@ -0,0 +1,20 @@ +versions.intellijSdk=193.5233.102 +versions.androidBuildTools=r23.0.1 +versions.idea.NodeJS=181.3494.12 +versions.androidStudioRelease=4.0.0.7 +versions.androidStudioBuild=193.6085562 +versions.jar.asm-all=7.0.1 +versions.jar.guava=27.1-jre +versions.jar.groovy-all=2.4.17 +versions.jar.lombok-ast=0.2.3 +versions.jar.swingx-core=1.6.2-2 +versions.jar.kxml2=2.3.0 +versions.jar.streamex=0.6.8 +versions.jar.gson=2.8.5 +versions.jar.oro=2.0.8 +versions.jar.picocontainer=1.2 +versions.jar.serviceMessages=2019.1.4 +ignore.jar.snappy-in-java=true +versions.gradle-api=4.5.1 +ignore.jar.common=true +ignore.jar.lombok-ast=true \ No newline at end of file diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 new file mode 100644 index 00000000000..96372ee9bbe --- /dev/null +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/confidence/KotlinConfidenceTest.java.as40 @@ -0,0 +1,184 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.completion.test.confidence; + +import com.intellij.codeInsight.CodeInsightSettings; +import com.intellij.codeInsight.completion.*; +import com.intellij.codeInsight.lookup.LookupElement; +import com.intellij.codeInsight.lookup.LookupManager; +import com.intellij.codeInsight.lookup.impl.LookupImpl; +import com.intellij.lang.Language; +import com.intellij.lang.injection.InjectedLanguageManager; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.projectRoots.JavaSdk; +import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; +import com.intellij.psi.util.PsiUtilCore; +import com.intellij.util.ArrayUtil; +import com.intellij.util.ThreeState; +import org.apache.commons.lang.SystemUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.kotlin.idea.completion.test.CompletionTestUtilKt; +import org.jetbrains.kotlin.idea.test.TestUtilsKt; +import org.jetbrains.kotlin.test.InTextDirectivesUtils; +import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.List; + +@RunWith(JUnit3WithIdeaConfigurationRunner.class) +public class KotlinConfidenceTest extends LightCompletionTestCase { + private static final String TYPE_DIRECTIVE_PREFIX = "// TYPE:"; + private final ThreadLocal skipComplete = ThreadLocal.withInitial(() -> false); + + public void testCompleteOnDotOutOfRanges() { + doTest(); + } + + public void testImportAsConfidence() { + doTest(); + } + + public void testInBlockOfFunctionLiteral() { + doTest(); + } + + public void testInModifierList() { + doTest(); + } + + public void testNoAutoCompletionForRangeOperator() { + doTest(); + } + + public void testNoAutoPopupInString() { + doTest(); + } + + public void testAutoPopupInStringTemplate() { + doTest(); + } + + public void testAutoPopupInStringTemplateAfterDollar() { + doTest(); + } + + public void testNoAutoPopupInStringTemplateAfterSpace() { + doTest(); + } + + public void testNoAutoPopupInRawStringTemplateAfterNewLine() { + doTest(); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + TestUtilsKt.invalidateLibraryCache(getProject()); + } + + protected void doTest() { + boolean completeByChars = CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS; + + CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = true; + + try { + skipComplete.set(true); + try { + configureByFile(getBeforeFileName()); + } finally { + skipComplete.set(false); + } + + String text = getEditor().getDocument().getText(); + boolean noLookup = InTextDirectivesUtils.isDirectiveDefined(text, "// NO_LOOKUP"); + if (!noLookup) complete(); //This will cause NPE in case of absence of autopopup completion + + List expectedElements = InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// ELEMENT:"); + assertFalse("Can't both expect lookup elements and no lookup", !expectedElements.isEmpty() && noLookup); + + if (noLookup) { + assertTrue("Should skip autopopup completion", shouldSkipAutoPopup(getEditor(), getFile())); + return; + } + + String typeText = getTypeText(text); + if (!expectedElements.isEmpty()) { + assertContainsItems(ArrayUtil.toStringArray(expectedElements)); + return; + } + assertNotNull("You must type something, use // TYPE:", typeText); + type(typeText); + checkResultByFile(getAfterFileName()); + } + finally { + CodeInsightSettings.getInstance().SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = completeByChars; + } + } + + private static String getTypeText(String text) { + String[] directives = InTextDirectivesUtils.findArrayWithPrefixes(text, TYPE_DIRECTIVE_PREFIX); + if (directives.length == 0) return null; + assertEquals("One directive with \"" + TYPE_DIRECTIVE_PREFIX +"\" expected", 1, directives.length); + + return StringUtil.unquoteString(directives[0]); + } + + private String getBeforeFileName() { + return getTestName(false) + ".kt"; + } + + private String getAfterFileName() { + return getTestName(false) + ".kt.after"; + } + + @NotNull + @Override + protected String getTestDataPath() { + return new File(CompletionTestUtilKt.getCOMPLETION_TEST_DATA_BASE_PATH(), "/confidence/").getPath() + File.separator; + } + + @Override + protected Sdk getProjectJDK() { + return JavaSdk.getInstance().createJdk("JDK", SystemUtils.getJavaHome().getAbsolutePath()); + } + + @Override + protected void complete() { + if (skipComplete.get()) return; + new CodeCompletionHandlerBase(CompletionType.BASIC, false, true, true).invokeCompletion( + getProject(), getEditor(), 0, false); + + LookupImpl lookup = (LookupImpl) LookupManager.getActiveLookup(myEditor); + myItems = lookup == null ? null : lookup.getItems().toArray(LookupElement.EMPTY_ARRAY); + myPrefix = lookup == null ? null : lookup.itemPattern(lookup.getItems().get(0)); + } + + private static boolean shouldSkipAutoPopup(Editor editor, PsiFile psiFile) { + int offset = editor.getCaretModel().getOffset(); + int psiOffset = Math.max(0, offset - 1); + + PsiElement elementAt = InjectedLanguageManager.getInstance(psiFile.getProject()).findInjectedElementAt(psiFile, psiOffset); + if (elementAt == null) { + elementAt = psiFile.findElementAt(psiOffset); + } + if (elementAt == null) return true; + + Language language = PsiUtilCore.findLanguageFromElement(elementAt); + + for (CompletionConfidence confidence : CompletionConfidenceEP.forLanguage(language)) { + ThreeState result = confidence.shouldSkipAutopopup(elementAt, psiFile, offset); + if (result != ThreeState.UNSURE) { + return result == ThreeState.YES; + } + } + + return false; + } +} diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.as40 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.as40 new file mode 100644 index 00000000000..939c6c53fe5 --- /dev/null +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/IDESettingsFUSCollector.kt.as40 @@ -0,0 +1,3 @@ +class IDESettingsFUSCollector { + // Not whitelisted +} diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as40 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as40 new file mode 100644 index 00000000000..0e1adf9ff46 --- /dev/null +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/KotlinFUSLogger.kt.as40 @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2019 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.idea.statistics + +open class KotlinFUSLogger { + companion object { + fun log(group: FUSEventGroups, event: String) { + // Not whitelisted for AS + } + + fun log(group: FUSEventGroups, event: String, eventData: Map) { + // Not whitelisted for AS + } + } +} \ No newline at end of file diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as40 b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as40 new file mode 100644 index 00000000000..3fe75589e1c --- /dev/null +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/statistics/ProjectConfigurationCollector.kt.as40 @@ -0,0 +1,3 @@ +class ProjectConfigurationCollector { + // Not whitelisted +} \ No newline at end of file diff --git a/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt.as40 b/idea/idea-git/src/org/jetbrains/kotlin/git/KotlinExplicitMovementProvider.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelProvider.kt.as40 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelProvider.kt.as40 new file mode 100644 index 00000000000..8083e3fcdb3 --- /dev/null +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelProvider.kt.as40 @@ -0,0 +1,37 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.scripting.gradle.importing + +import org.gradle.tooling.BuildController +import org.gradle.tooling.model.idea.IdeaModule +import org.gradle.tooling.model.idea.IdeaProject +import org.gradle.tooling.model.kotlin.dsl.KotlinDslScriptsModel +import org.jetbrains.plugins.gradle.model.ProjectImportExtraModelProvider + +class KotlinDslScriptModelProvider : ProjectImportExtraModelProvider { + private val kotlinDslScriptModelClass: Class<*> = KotlinDslScriptsModel::class.java + + override fun populateBuildModels( + controller: BuildController, + project: IdeaProject, + consumer: ProjectImportExtraModelProvider.BuildModelConsumer + ) { + project.modules.forEach { module -> + if (module.gradleProject.parent == null) { + val model = controller.findModel(module.gradleProject, kotlinDslScriptModelClass) + if (model != null) { + consumer.consume(module, model, kotlinDslScriptModelClass) + } + } + } + } + + override fun populateProjectModels( + controller: BuildController, + module: IdeaModule?, + modelConsumer: ProjectImportExtraModelProvider.ProjectModelConsumer + ) = Unit +} \ No newline at end of file diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelResolver.kt.as40 b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelResolver.kt.as40 new file mode 100644 index 00000000000..627a569b35b --- /dev/null +++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/importing/KotlinDslScriptModelResolver.kt.as40 @@ -0,0 +1,44 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.scripting.gradle.importing + +import com.intellij.openapi.externalSystem.model.DataNode +import com.intellij.openapi.externalSystem.model.project.ProjectData +import org.gradle.tooling.model.GradleProject +import org.gradle.tooling.model.idea.IdeaProject +import org.gradle.tooling.model.kotlin.dsl.KotlinDslScriptsModel +import org.jetbrains.kotlin.idea.scripting.gradle.kotlinDslScriptsModelImportSupported +import org.jetbrains.plugins.gradle.model.Build + +class KotlinDslScriptModelResolver : KotlinDslScriptModelResolverCommon() { + override fun getExtraModelProvider() = KotlinDslScriptModelProvider() + override fun requiresTaskRunning() = true + + override fun populateProjectExtraModels(gradleProject: IdeaProject, ideProject: DataNode) { + super.populateProjectExtraModels(gradleProject, ideProject) + + if (kotlinDslScriptsModelImportSupported(resolverCtx.projectGradleVersion)) { + populateBuildModels(resolverCtx.models.mainBuild, ideProject) + + resolverCtx.models.includedBuilds.forEach { includedRoot -> + populateBuildModels(includedRoot, ideProject) + } + } + } + + private fun populateBuildModels( + root: Build, + ideProject: DataNode + ) { + root.projects.forEach { + if ((it as? GradleProject)?.parent == null) { + resolverCtx.models.getModel(it, KotlinDslScriptsModel::class.java)?.let { model -> + ideProject.KOTLIN_DSL_SCRIPT_MODELS.addAll(model.toListOfScriptModels()) + } + } + } + } +} \ No newline at end of file diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformWizardTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/GradleMultiplatformWizardTest.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/HierarchicalMultiplatformProjectImportingTest.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformProjectImportingTest.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as40 new file mode 100644 index 00000000000..6bbb8c73dc3 --- /dev/null +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/MultiplatformTestCompatibilityMatrix.kt.as40 @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.gradle + +fun KaptImportingTest.isAndroidStudio() = true diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/NewMultiplatformProjectImportingTest.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/gradle/PackagePrefixImportingTest.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 new file mode 100644 index 00000000000..42fdde3a79e --- /dev/null +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/AbstractModelBuilderTest.java.as40 @@ -0,0 +1,262 @@ +/* + * Copyright 2010-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.idea.codeInsight.gradle; + +import com.google.common.collect.Multimap; +import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.util.io.StreamUtil; +import com.intellij.testFramework.IdeaTestUtil; +import com.intellij.util.Function; +import com.intellij.util.containers.ContainerUtil; +import org.codehaus.groovy.runtime.typehandling.ShortTypeHandling; +import org.gradle.tooling.BuildActionExecuter; +import org.gradle.tooling.GradleConnector; +import org.gradle.tooling.ProjectConnection; +import org.gradle.tooling.internal.consumer.DefaultGradleConnector; +import org.gradle.tooling.model.DomainObjectSet; +import org.gradle.tooling.model.idea.IdeaModule; +import org.gradle.util.GradleVersion; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.plugins.gradle.model.ClassSetProjectImportExtraModelProvider; +import org.jetbrains.plugins.gradle.model.ExternalProject; +import org.jetbrains.plugins.gradle.model.ProjectImportAction; +import org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper; +import org.jetbrains.plugins.gradle.tooling.builder.ModelBuildScriptClasspathBuilderImpl; +import org.jetbrains.plugins.gradle.util.GradleConstants; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.TestName; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assume.assumeThat; + +// part of org.jetbrains.plugins.gradle.tooling.builder.AbstractModelBuilderTest +@RunWith(value = Parameterized.class) +public abstract class AbstractModelBuilderTest { + + public static final Object[][] SUPPORTED_GRADLE_VERSIONS = {{"4.9"}, {"5.6.4"}}; + + private static final Pattern TEST_METHOD_NAME_PATTERN = Pattern.compile("(.*)\\[(\\d*: with Gradle-.*)\\]"); + + private static File ourTempDir; + + @NotNull + private final String gradleVersion; + private File testDir; + private ProjectImportAction.AllModels allModels; + + @Rule public TestName name = new TestName(); + @Rule public VersionMatcherRule versionMatcherRule = new VersionMatcherRule(); + + public AbstractModelBuilderTest(@NotNull String gradleVersion) { + this.gradleVersion = gradleVersion; + } + + @Parameterized.Parameters(name = "{index}: with Gradle-{0}") + public static Collection data() { + return Arrays.asList(SUPPORTED_GRADLE_VERSIONS); + } + + + @Before + public void setUp() throws Exception { + assumeThat(gradleVersion, versionMatcherRule.getMatcher()); + + ensureTempDirCreated(); + + String methodName = name.getMethodName(); + Matcher m = TEST_METHOD_NAME_PATTERN.matcher(methodName); + if (m.matches()) { + methodName = m.group(1); + } + + testDir = new File(ourTempDir, methodName); + FileUtil.ensureExists(testDir); + + InputStream buildScriptStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.DEFAULT_SCRIPT_NAME); + try { + FileUtil.writeToFile( + new File(testDir, GradleConstants.DEFAULT_SCRIPT_NAME), + FileUtil.loadTextAndClose(buildScriptStream) + ); + } + finally { + StreamUtil.closeStream(buildScriptStream); + } + + InputStream settingsStream = getClass().getResourceAsStream("/" + methodName + "/" + GradleConstants.SETTINGS_FILE_NAME); + try { + if (settingsStream != null) { + FileUtil.writeToFile( + new File(testDir, GradleConstants.SETTINGS_FILE_NAME), + FileUtil.loadTextAndClose(settingsStream) + ); + } + } + finally { + StreamUtil.closeStream(settingsStream); + } + + GradleConnector connector = GradleConnector.newConnector(); + + URI distributionUri = new DistributionLocator().getDistributionFor(GradleVersion.version(gradleVersion)); + connector.useDistribution(distributionUri); + connector.forProjectDirectory(testDir); + int daemonMaxIdleTime = 10; + try { + daemonMaxIdleTime = Integer.parseInt(System.getProperty("gradleDaemonMaxIdleTime", "10")); + } + catch (NumberFormatException ignore) { + } + + ((DefaultGradleConnector) connector).daemonMaxIdleTime(daemonMaxIdleTime, TimeUnit.SECONDS); + ProjectConnection connection = connector.connect(); + + try { + ProjectImportAction projectImportAction = new ProjectImportAction(false); + projectImportAction.addProjectImportExtraModelProvider(new ClassSetProjectImportExtraModelProvider(getModels())); + BuildActionExecuter buildActionExecutor = connection.action(projectImportAction); + File initScript = GradleExecutionHelper.generateInitScript(false, getToolingExtensionClasses()); + assertNotNull(initScript); + String jdkHome = IdeaTestUtil.requireRealJdkHome(); + buildActionExecutor.setJavaHome(new File(jdkHome)); + buildActionExecutor.setJvmArguments("-Xmx128m", "-XX:MaxPermSize=64m"); + buildActionExecutor + .withArguments("--info", "--recompile-scripts", GradleConstants.INIT_SCRIPT_CMD_OPTION, initScript.getAbsolutePath()); + allModels = buildActionExecutor.run(); + assertNotNull(allModels); + } + finally { + connection.close(); + } + } + + @NotNull + private static Set getToolingExtensionClasses() { + Set classes = ContainerUtil.set( + ExternalProject.class, + // gradle-tooling-extension-api jar + ProjectImportAction.class, + // gradle-tooling-extension-impl jar + ModelBuildScriptClasspathBuilderImpl.class, + Multimap.class, + ShortTypeHandling.class + ); + + ContainerUtil.addAllNotNull(classes, doGetToolingExtensionClasses()); + return classes; + } + + @NotNull + private static Set doGetToolingExtensionClasses() { + return Collections.emptySet(); + } + + @After + public void tearDown() throws Exception { + if (testDir != null) { + FileUtil.delete(testDir); + } + } + + protected abstract Set getModels(); + + + private Map getModulesMap(final Class aClass) { + DomainObjectSet ideaModules = allModels.getIdeaProject().getModules(); + + final String filterKey = "to_filter"; + Map map = ContainerUtil.map2Map(ideaModules, new Function>() { + @Override + public Pair fun(IdeaModule module) { + T value = allModels.getExtraProject(module, aClass); + String key = value != null ? module.getGradleProject().getPath() : filterKey; + return Pair.create(key, value); + } + }); + + map.remove(filterKey); + return map; + } + + private static void ensureTempDirCreated() throws IOException { + if (ourTempDir != null) return; + + ourTempDir = new File(FileUtil.getTempDirectory(), "gradleTests"); + FileUtil.delete(ourTempDir); + FileUtil.ensureExists(ourTempDir); + } + + public static class DistributionLocator { + private static final String RELEASE_REPOSITORY_ENV = "GRADLE_RELEASE_REPOSITORY"; + private static final String SNAPSHOT_REPOSITORY_ENV = "GRADLE_SNAPSHOT_REPOSITORY"; + private static final String GRADLE_RELEASE_REPO = "https://services.gradle.org/distributions"; + private static final String GRADLE_SNAPSHOT_REPO = "https://services.gradle.org/distributions-snapshots"; + + @NotNull private final String myReleaseRepoUrl; + @NotNull private final String mySnapshotRepoUrl; + + public DistributionLocator() { + this(DistributionLocator.getRepoUrl(false), DistributionLocator.getRepoUrl(true)); + } + + public DistributionLocator(@NotNull String releaseRepoUrl, @NotNull String snapshotRepoUrl) { + myReleaseRepoUrl = releaseRepoUrl; + mySnapshotRepoUrl = snapshotRepoUrl; + } + + @NotNull + public URI getDistributionFor(@NotNull GradleVersion version) throws URISyntaxException { + return getDistribution(getDistributionRepository(version), version, "gradle", "bin"); + } + + @NotNull + private String getDistributionRepository(@NotNull GradleVersion version) { + return version.isSnapshot() ? mySnapshotRepoUrl : myReleaseRepoUrl; + } + + private static URI getDistribution( + @NotNull String repositoryUrl, + @NotNull GradleVersion version, + @NotNull String archiveName, + @NotNull String archiveClassifier + ) throws URISyntaxException { + return new URI(String.format("%s/%s-%s-%s.zip", repositoryUrl, archiveName, version.getVersion(), archiveClassifier)); + } + + @NotNull + public static String getRepoUrl(boolean isSnapshotUrl) { + String envRepoUrl = System.getenv(isSnapshotUrl ? SNAPSHOT_REPOSITORY_ENV : RELEASE_REPOSITORY_ENV); + if (envRepoUrl != null) return envRepoUrl; + + return isSnapshotUrl ? GRADLE_SNAPSHOT_REPO : GRADLE_RELEASE_REPO; + } + } +} diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleConfiguratorPlatformSpecificTest.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleFacetImportTest.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as40 b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as40 new file mode 100644 index 00000000000..bd96057db50 --- /dev/null +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTestCompatibilityMatrix.kt.as40 @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.codeInsight.gradle + +fun isGradleInspectionTestApplicable() = false \ No newline at end of file diff --git a/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as40 b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as40 new file mode 100644 index 00000000000..47feb237c39 --- /dev/null +++ b/idea/idea-new-project-wizard/src/org/jetbrains/kotlin/tools/projectWizard/wizard/service/MavenProjectImporter.kt.as40 @@ -0,0 +1,15 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.tools.projectWizard.wizard.service + +import com.intellij.openapi.project.Project +import java.nio.file.Path + +class MavenProjectImporter(private val project: Project) { + fun importProject(path: Path) { + // AS does not support Maven + } +} \ No newline at end of file diff --git a/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compatTestWrappers.kt.as40 b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compatTestWrappers.kt.as40 new file mode 100644 index 00000000000..e44198d0879 --- /dev/null +++ b/idea/idea-test-framework/test/org/jetbrains/kotlin/idea/test/compatTestWrappers.kt.as40 @@ -0,0 +1,39 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +@file:Suppress("unused", "IncompatibleAPI", "PropertyName") + +package org.jetbrains.kotlin.idea.test + +import com.intellij.openapi.actionSystem.DataContext +import com.intellij.openapi.editor.Document +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.module.Module +import com.intellij.openapi.project.Project +import com.intellij.psi.PsiFile +import com.intellij.testFramework.LightIdeaTestCase +import com.intellij.testFramework.LightPlatformCodeInsightTestCase +import com.intellij.testFramework.LightPlatformTestCase + +// BUNCH: as36, 191 +@Suppress("DEPRECATION") +@Deprecated("Use KotlinLightCodeInsightFixtureTestCase instead") +abstract class KotlinLightCodeInsightTestCase : com.intellij.testFramework.LightCodeInsightTestCase() { + protected inline val project_: Project get() = LightPlatformTestCase.getProject() + protected inline val module_: Module get() = LightPlatformTestCase.getModule() + protected inline val editor_: Editor get() = LightPlatformCodeInsightTestCase.getEditor() + protected inline val file_: PsiFile get() = LightPlatformCodeInsightTestCase.getFile() + protected inline val currentEditorDataContext_: DataContext get() = LightPlatformCodeInsightTestCase.getCurrentEditorDataContext() + + protected fun configureFromFileText_(fileName: String, fileText: String): Document { + return LightPlatformCodeInsightTestCase.configureFromFileText(fileName, fileText, false) + } +} + +// BUNCH: as36, 191 +abstract class KotlinLightIdeaTestCase : LightIdeaTestCase() { + protected inline val project_: Project get() = LightPlatformTestCase.getProject() + protected inline val module_: Module get() = LightPlatformTestCase.getModule() +} \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 new file mode 100644 index 00000000000..251877e099f --- /dev/null +++ b/idea/jvm-debugger/jvm-debugger-test/test/org/jetbrains/kotlin/idea/debugger/test/sequence/KotlinPsiChainBuilderTestCase.kt.as40 @@ -0,0 +1,74 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.debugger.test.sequence + +import com.intellij.debugger.streams.test.StreamChainBuilderTestCase +import com.intellij.debugger.streams.wrapper.StreamChain +import com.intellij.debugger.streams.wrapper.StreamChainBuilder +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.projectRoots.Sdk +import com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable +import com.intellij.testFramework.LightPlatformTestCase +import com.intellij.testFramework.PsiTestUtil +import junit.framework.TestCase +import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime +import org.jetbrains.kotlin.idea.caches.project.LibraryModificationTracker +import org.jetbrains.kotlin.idea.debugger.test.DEBUGGER_TESTDATA_PATH_BASE +import org.jetbrains.kotlin.idea.test.PluginTestCaseBase + +abstract class KotlinPsiChainBuilderTestCase(private val relativePath: String) : StreamChainBuilderTestCase() { + override fun getTestDataPath(): String = "$DEBUGGER_TESTDATA_PATH_BASE/sequence/psi/$relativeTestPath" + + override fun getFileExtension(): String = ".kt" + abstract val kotlinChainBuilder: StreamChainBuilder + override fun getChainBuilder(): StreamChainBuilder = kotlinChainBuilder + private val stdLibName = "kotlin-stdlib" + + protected abstract fun doTest() + + final override fun getRelativeTestPath(): String = relativePath + + override fun setUp() { + super.setUp() + ApplicationManager.getApplication().runWriteAction { + @Suppress("UnstableApiUsage") + if (ProjectLibraryTable.getInstance(LightPlatformTestCase.getProject()).getLibraryByName(stdLibName) == null) { + val stdLibPath = ForTestCompileRuntime.runtimeJarForTests() + PsiTestUtil.addLibrary( + testRootDisposable, + LightPlatformTestCase.getModule(), + stdLibName, + stdLibPath.parent, + stdLibPath.name + ) + } + } + LibraryModificationTracker.getInstance(LightPlatformTestCase.getProject()).incModificationCount() + } + + + override fun getProjectJDK(): Sdk { + return PluginTestCaseBase.mockJdk9() + } + + abstract class Positive(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) { + override fun doTest() { + val chains = buildChains() + checkChains(chains) + } + + private fun checkChains(chains: MutableList) { + TestCase.assertFalse(chains.isEmpty()) + } + } + + abstract class Negative(relativePath: String) : KotlinPsiChainBuilderTestCase(relativePath) { + override fun doTest() { + val elementAtCaret = configureAndGetElementAtCaret() + TestCase.assertFalse(chainBuilder.isChainExists(elementAtCaret)) + TestCase.assertTrue(chainBuilder.build(elementAtCaret).isEmpty()) + } + } +} diff --git a/idea/resources/META-INF/android-lint.xml.as40 b/idea/resources/META-INF/android-lint.xml.as40 new file mode 100644 index 00000000000..5a029687008 --- /dev/null +++ b/idea/resources/META-INF/android-lint.xml.as40 @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/idea/resources/META-INF/git4idea.xml.as40 b/idea/resources/META-INF/git4idea.xml.as40 new file mode 100644 index 00000000000..1bb24d148a3 --- /dev/null +++ b/idea/resources/META-INF/git4idea.xml.as40 @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/idea/resources/META-INF/plugin.xml.as40 b/idea/resources/META-INF/plugin.xml.as40 new file mode 100644 index 00000000000..bdb6cbd40a2 --- /dev/null +++ b/idea/resources/META-INF/plugin.xml.as40 @@ -0,0 +1,79 @@ + + org.jetbrains.kotlin + + Kotlin + +Getting Started in IntelliJ IDEA
+Getting Started in Android Studio
+Public Slack
+Issue tracker
+]]>
+ @snapshot@ + JetBrains + + + + com.intellij.modules.platform + com.intellij.modules.androidstudio + + JUnit + com.intellij.gradle + org.jetbrains.plugins.gradle + org.intellij.groovy + org.jetbrains.idea.maven + TestNG-J + com.intellij.copyright + Coverage + com.intellij.java-i18n + org.jetbrains.java.decompiler + Git4Idea + org.jetbrains.debugger.streams + + + + + com.intellij.modules.java + JavaScriptDebugger + com.intellij.copyright + org.intellij.intelliLang + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as40 new file mode 100644 index 00000000000..c1ae1f2d614 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/markers/dslStyleIcon.kt.as40 @@ -0,0 +1,15 @@ +/* + * Copyright 2010-2019 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.idea.highlighter.markers + +import com.intellij.icons.AllIcons +import javax.swing.Icon + +// BUNCH: as35 +// BUNCH: as34 +internal fun createDslStyleIcon(styleId: Int): Icon { + return AllIcons.Gutter.Colors +} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as40 new file mode 100644 index 00000000000..f6dcd38c87e --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/reporter/ITNReporterCompat.kt.as40 @@ -0,0 +1,33 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.reporter + +import com.intellij.diagnostic.ITNReporter +import com.intellij.openapi.diagnostic.IdeaLoggingEvent +import com.intellij.openapi.diagnostic.SubmittedReportInfo +import com.intellij.util.Consumer +import java.awt.Component + +abstract class ITNReporterCompat : ITNReporter() { + final override fun submit( + events: Array, + additionalInfo: String?, + parentComponent: Component?, + consumer: Consumer + ): Boolean { + return submitCompat(events, additionalInfo, parentComponent, consumer) + } + + open fun submitCompat( + events: Array, + additionalInfo: String?, + parentComponent: Component?, + consumer: Consumer + ): Boolean { + @Suppress("IncompatibleAPI") + return super.submit(events, additionalInfo, parentComponent, consumer) + } +} diff --git a/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as40 new file mode 100644 index 00000000000..dace666ba76 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/testResourceBundle.kt.as40 @@ -0,0 +1,38 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +@file:Suppress("DEPRECATION") + +package org.jetbrains.kotlin.idea + +import com.intellij.featureStatistics.FeatureStatisticsBundleProvider +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.extensions.Extensions + +private const val CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME = "com.jetbrains.cidr.lang.OCFeatureStatisticsBundleProvider" + +// Remove the function, when there's no dependency to cidr during running Kotlin tests. +fun registerAdditionalResourceBundleInTests() { + if (!ApplicationManager.getApplication().isUnitTestMode) { + return + } + + val isAlreadyRegistered = FeatureStatisticsBundleProvider.EP_NAME.extensions.any { provider -> + provider.javaClass.name == CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME + } + if (isAlreadyRegistered) { + return + } + + val cidrFSBundleProviderClass = try { + Class.forName(CIDR_FEATURE_STATISTICS_PROVIDER_FQNAME) + } catch (_: ClassNotFoundException) { + return + } + + val cidrFSBundleProvider = cidrFSBundleProviderClass.newInstance() as FeatureStatisticsBundleProvider + + Extensions.getRootArea().getExtensionPoint(FeatureStatisticsBundleProvider.EP_NAME).registerExtension(cidrFSBundleProvider) +} \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as40 new file mode 100644 index 00000000000..d12cce53050 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/update/GooglePluginUpdateVerifier.kt.as40 @@ -0,0 +1,152 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.update + +import com.intellij.ide.plugins.IdeaPluginDescriptor +import com.intellij.ide.plugins.PluginManagerCore +import com.intellij.ide.plugins.PluginNode +import com.intellij.openapi.diagnostic.Logger +import org.jetbrains.kotlin.idea.util.isDev +import org.jetbrains.kotlin.idea.util.isEap +import java.io.IOException +import java.net.URL +import java.util.* +import javax.xml.bind.JAXBContext +import javax.xml.bind.JAXBException +import javax.xml.bind.annotation.* + +class GooglePluginUpdateVerifier : PluginUpdateVerifier() { + override val verifierName: String + get() = "Android Studio" + + // Verifies if a plugin can be installed in Android Studio 3.2+. + // Currently used only by KotlinPluginUpdater. + override fun verify(pluginDescriptor: IdeaPluginDescriptor): PluginVerifyResult? { + if (pluginDescriptor.pluginId.idString != KOTLIN_PLUGIN_ID) { + return null + } + + val version = pluginDescriptor.version + if (isEap(version) || isDev(version)) { + return PluginVerifyResult.accept() + } + + try { + val url = URL(METADATA_FILE_URL) + val stream = url.openStream() + val context = JAXBContext.newInstance(PluginCompatibility::class.java) + val unmarshaller = context.createUnmarshaller() + val pluginCompatibility = unmarshaller.unmarshal(stream) as PluginCompatibility + + val release = getRelease(pluginCompatibility) + ?: return PluginVerifyResult.decline("No verified versions for this build.") + + return if (release.plugins().any { KOTLIN_PLUGIN_ID == it.id && version == it.version }) + PluginVerifyResult.accept() + else + PluginVerifyResult.decline("Version to be verified.") + } catch (e: Exception) { + LOG.info("Exception when verifying plugin ${pluginDescriptor.pluginId.idString} version $version", e) + return when (e) { + is IOException -> + PluginVerifyResult.decline("unable to connect to compatibility verification repository") + is JAXBException -> PluginVerifyResult.decline("unable to parse compatibility verification metadata") + else -> PluginVerifyResult.decline("exception during verification ${e.message}") + } + } + } + + private fun getRelease(pluginCompatibility: PluginCompatibility): StudioRelease? { + for (studioRelease in pluginCompatibility.releases()) { + if (buildInRange(studioRelease.name, studioRelease.sinceBuild, studioRelease.untilBuild)) { + return studioRelease + } + } + return null + } + + private fun buildInRange(name: String?, sinceBuild: String?, untilBuild: String?): Boolean { + val descriptor = PluginNode() + descriptor.name = name + descriptor.sinceBuild = sinceBuild + descriptor.untilBuild = untilBuild + return PluginManagerCore.isCompatible(descriptor) + } + + companion object { + private const val KOTLIN_PLUGIN_ID = "org.jetbrains.kotlin" + private const val METADATA_FILE_URL = "https://dl.google.com/android/studio/plugins/compatibility.xml" + + private val LOG = Logger.getInstance(GooglePluginUpdateVerifier::class.java) + + private fun PluginCompatibility.releases() = studioRelease ?: emptyArray() + private fun StudioRelease.plugins() = ideaPlugin ?: emptyArray() + + @XmlRootElement(name = "plugin-compatibility") + @XmlAccessorType(XmlAccessType.FIELD) + class PluginCompatibility { + @XmlElement(name = "studio-release") + var studioRelease: Array? = null + + override fun toString(): String { + return "PluginCompatibility(studioRelease=${Arrays.toString(studioRelease)})" + } + } + + @XmlAccessorType(XmlAccessType.FIELD) + class StudioRelease { + @XmlAttribute(name = "until-build") + var untilBuild: String? = null + @XmlAttribute(name = "since-build") + var sinceBuild: String? = null + @XmlAttribute + var name: String? = null + @XmlAttribute + var channel: String? = null + + @XmlElement(name = "idea-plugin") + var ideaPlugin: Array? = null + + override fun toString(): String { + return "StudioRelease(" + + "untilBuild=$untilBuild, name=$name, ideaPlugin=${Arrays.toString(ideaPlugin)}, " + + "sinceBuild=$sinceBuild, channel=$channel" + + ")" + } + } + + @XmlAccessorType(XmlAccessType.FIELD) + class IdeaPlugin { + @XmlAttribute + var id: String? = null + @XmlAttribute + var sha256: String? = null + @XmlAttribute + var channel: String? = null + @XmlAttribute + var version: String? = null + + @XmlElement(name = "idea-version") + var ideaVersion: IdeaVersion? = null + + override fun toString(): String { + return "IdeaPlugin(id=$id, sha256=$sha256, ideaVersion=$ideaVersion, channel=$channel, version=$version)" + } + } + + @XmlAccessorType(XmlAccessType.FIELD) + class IdeaVersion { + @XmlAttribute(name = "until-build") + var untilBuild: String? = null + @XmlAttribute(name = "since-build") + var sinceBuild: String? = null + + override fun toString(): String { + return "IdeaVersion(untilBuild=$untilBuild, sinceBuild=$sinceBuild)" + } + } + } +} diff --git a/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as40 b/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as40 new file mode 100644 index 00000000000..8ee62b0a17c --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/update/verify.kt.as40 @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.update + +import com.intellij.ide.plugins.IdeaPluginDescriptor +import com.intellij.openapi.util.registry.Registry +import org.jetbrains.kotlin.idea.PluginUpdateStatus + +// Do an additional verification with PluginUpdateVerifier. Enabled only in AS 3.2+ +fun verify(updateStatus: PluginUpdateStatus.Update): PluginUpdateStatus { + @Suppress("InvalidBundleOrProperty") + val pluginVerifierEnabled = Registry.`is`("kotlin.plugin.update.verifier.enabled", true) + if (!pluginVerifierEnabled) { + return updateStatus + } + + val pluginDescriptor: IdeaPluginDescriptor = updateStatus.pluginDescriptor + val pluginVerifiers = PluginUpdateVerifier.EP_NAME.extensions + + for (pluginVerifier in pluginVerifiers) { + val verifyResult = pluginVerifier.verify(pluginDescriptor) ?: continue + if (!verifyResult.verified) { + return PluginUpdateStatus.Unverified( + pluginVerifier.verifierName, + verifyResult.declineMessage, + updateStatus + ) + } + } + + return updateStatus +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/moveUpDown/AbstractCodeMoverTest.kt.as40 b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/moveUpDown/AbstractCodeMoverTest.kt.as40 new file mode 100644 index 00000000000..21c296ff460 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/moveUpDown/AbstractCodeMoverTest.kt.as40 @@ -0,0 +1,130 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.codeInsight.moveUpDown + +import com.intellij.application.options.CodeStyle +import com.intellij.codeInsight.editorActions.moveLeftRight.MoveElementLeftAction +import com.intellij.codeInsight.editorActions.moveLeftRight.MoveElementRightAction +import com.intellij.codeInsight.editorActions.moveUpDown.MoveStatementDownAction +import com.intellij.codeInsight.editorActions.moveUpDown.MoveStatementUpAction +import com.intellij.codeInsight.editorActions.moveUpDown.StatementUpDownMover +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.application.runWriteAction +import com.intellij.openapi.editor.actionSystem.EditorAction +import com.intellij.openapi.extensions.Extensions +import com.intellij.openapi.util.io.FileUtil +import com.intellij.testFramework.LightPlatformCodeInsightTestCase +import junit.framework.ComparisonFailure +import junit.framework.TestCase +import org.jetbrains.kotlin.formatter.FormatSettingsUtil +import org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinDeclarationMover +import org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover +import org.jetbrains.kotlin.idea.core.script.isScriptChangesNotifierDisabled +import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightTestCase +import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.KotlinTestUtils +import java.io.File + +abstract class AbstractMoveStatementTest : AbstractCodeMoverTest() { + protected fun doTestClassBodyDeclaration(path: String) { + doTest(path, KotlinDeclarationMover::class.java) + } + + protected fun doTestExpression(path: String) { + doTest(path, KotlinExpressionMover::class.java) + } + + private fun doTest(path: String, defaultMoverClass: Class) { + doTest(path) { isApplicableExpected, direction -> + val movers = Extensions.getExtensions(StatementUpDownMover.STATEMENT_UP_DOWN_MOVER_EP) + val info = StatementUpDownMover.MoveInfo() + val actualMover = movers.firstOrNull { + it.checkAvailable(LightPlatformCodeInsightTestCase.getEditor(), LightPlatformCodeInsightTestCase.getFile(), info, direction == "down") + } ?: error("No mover found") + + assertEquals("Unmatched movers", defaultMoverClass.name, actualMover::class.java.name) + assertEquals("Invalid applicability", isApplicableExpected, info.toMove2 != null) + } + } +} + +abstract class AbstractMoveLeftRightTest : AbstractCodeMoverTest() { + protected fun doTest(path: String) { + doTest(path) { _, _ -> } + } +} + +@Suppress("DEPRECATION") +abstract class AbstractCodeMoverTest : KotlinLightCodeInsightTestCase() { + override fun setUp() { + super.setUp() + ApplicationManager.getApplication().isScriptChangesNotifierDisabled = true + } + + override fun tearDown() { + ApplicationManager.getApplication().isScriptChangesNotifierDisabled = false + super.tearDown() + } + + protected fun doTest(path: String, isApplicableChecker: (isApplicableExpected: Boolean, direction: String) -> Unit) { + configureByFile(path) + + val fileText = FileUtil.loadFile(File(path), true) + val direction = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// MOVE: ") + ?: error("No MOVE directive found") + + val action = when (direction) { + "up" -> MoveStatementUpAction() + "down" -> MoveStatementDownAction() + "left" -> MoveElementLeftAction() + "right" -> MoveElementRightAction() + else -> error("Unknown direction: $direction") + } + + val isApplicableString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// IS_APPLICABLE: ") + val isApplicableExpected = isApplicableString == null || isApplicableString == "true" + + isApplicableChecker(isApplicableExpected, direction) + + invokeAndCheck(fileText, path, action, isApplicableExpected) + } + + private fun invokeAndCheck(fileText: String, path: String, action: EditorAction, isApplicableExpected: Boolean) { + val editor = editor_ + val project = editor.project!! + + val codeStyleSettings = CodeStyle.getSettings(project) + val configurator = FormatSettingsUtil.createConfigurator(fileText, codeStyleSettings) + configurator.configureSettings() + + try { + val dataContext = currentEditorDataContext_ + + val before = editor.document.text + runWriteAction { action.actionPerformed(editor, dataContext) } + + val after = editor.document.text + val actionDoesNothing = after == before + + TestCase.assertEquals(isApplicableExpected, !actionDoesNothing) + + if (isApplicableExpected) { + val afterFilePath = path + ".after" + try { + checkResultByFile(afterFilePath) + } + catch (e: ComparisonFailure) { + KotlinTestUtils.assertEqualsToFile(File(afterFilePath), editor) + } + } + } + finally { + codeStyleSettings.clearCodeStyleSettings() + } + } + + override fun getTestDataPath() = "" +} diff --git a/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 b/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 new file mode 100644 index 00000000000..beda0e405d4 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/refactoring/InplaceRenameTest.kt.as40 @@ -0,0 +1,257 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.idea.refactoring + +import com.intellij.codeInsight.TargetElementUtil +import com.intellij.codeInsight.template.impl.TemplateManagerImpl +import com.intellij.openapi.actionSystem.CommonDataKeys +import com.intellij.openapi.actionSystem.impl.SimpleDataContext +import com.intellij.openapi.command.WriteCommandAction +import com.intellij.refactoring.BaseRefactoringProcessor +import com.intellij.refactoring.rename.inplace.VariableInplaceRenameHandler +import com.intellij.testFramework.LightPlatformCodeInsightTestCase +import com.intellij.testFramework.fixtures.CodeInsightTestUtil +import junit.framework.TestCase +import org.jetbrains.kotlin.idea.refactoring.rename.KotlinMemberInplaceRenameHandler +import org.jetbrains.kotlin.idea.refactoring.rename.KotlinVariableInplaceRenameHandler +import org.jetbrains.kotlin.idea.refactoring.rename.RenameKotlinImplicitLambdaParameter +import org.jetbrains.kotlin.idea.refactoring.rename.findElementForRename +import org.jetbrains.kotlin.idea.test.PluginTestCaseBase +import org.jetbrains.kotlin.psi.KtNameReferenceExpression +import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.JUnit3WithIdeaConfigurationRunner +import org.junit.runner.RunWith +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +@RunWith(JUnit3WithIdeaConfigurationRunner::class) +class InplaceRenameTest : LightPlatformCodeInsightTestCase() { + override fun isRunInWriteAction(): Boolean = false + override fun getTestDataPath(): String = PluginTestCaseBase.getTestDataPathBase() + "/refactoring/rename/inplace/" + + fun testLocalVal() { + doTestMemberInplaceRename("y") + } + + fun testForLoop() { + doTestInplaceRename("j") + } + + fun testTryCatch() { + doTestInplaceRename("e1") + } + + fun testFunctionLiteral() { + doTestInplaceRename("y") + } + + fun testFunctionLiteralIt() { + doTestImplicitLambdaParameter("y") + } + + fun testFunctionLiteralItEndCaret() { + doTestImplicitLambdaParameter("y") + } + + fun testFunctionLiteralParenthesis() { + doTestInplaceRename("y") + } + + fun testLocalFunction() { + doTestMemberInplaceRename("bar") + } + + fun testFunctionParameterNotInplace() { + doTestInplaceRename(null) + } + + fun testGlobalFunctionNotInplace() { + doTestInplaceRename(null) + } + + fun testTopLevelValNotInplace() { + doTestInplaceRename(null) + } + + fun testLabelFromFunction() { + doTestMemberInplaceRename("foo") + } + + fun testMultiDeclaration() { + doTestInplaceRename("foo") + } + + fun testLocalVarShadowingMemberProperty() { + doTestMemberInplaceRename("name1") + } + + fun testNoReformat() { + doTestMemberInplaceRename("subject2") + } + + fun testInvokeToFoo() { + doTestMemberInplaceRename("foo") + } + + fun testInvokeToGet() { + doTestMemberInplaceRename("get") + } + + fun testInvokeToGetWithQualifiedExpr() { + doTestMemberInplaceRename("get") + } + + fun testInvokeToGetWithSafeQualifiedExpr() { + doTestMemberInplaceRename("get") + } + + fun testInvokeToPlus() { + doTestMemberInplaceRename("plus") + } + + fun testGetToFoo() { + doTestMemberInplaceRename("foo") + } + + fun testGetToInvoke() { + doTestMemberInplaceRename("invoke") + } + + fun testGetToInvokeWithQualifiedExpr() { + doTestMemberInplaceRename("invoke") + } + + fun testGetToInvokeWithSafeQualifiedExpr() { + doTestMemberInplaceRename("invoke") + } + + fun testGetToPlus() { + doTestMemberInplaceRename("plus") + } + + fun testAddQuotes() { + doTestMemberInplaceRename("is") + } + + fun testAddThis() { + doTestMemberInplaceRename("foo") + } + + fun testExtensionAndNoReceiver() { + doTestMemberInplaceRename("b") + } + + fun testTwoExtensions() { + doTestMemberInplaceRename("example") + } + + fun testQuotedLocalVar() { + doTestMemberInplaceRename("x") + } + + fun testQuotedParameter() { + doTestMemberInplaceRename("x") + } + + fun testEraseCompanionName() { + doTestMemberInplaceRename("") + } + + fun testLocalVarRedeclaration() { + doTestMemberInplaceRename("localValB") + } + + fun testLocalFunRedeclaration() { + doTestMemberInplaceRename("localFunB") + } + + fun testLocalClassRedeclaration() { + doTestMemberInplaceRename("LocalClassB") + } + + fun testBacktickedWithAccessors() { + doTestMemberInplaceRename("`object`") + } + + fun testNoTextUsagesForLocalVar() { + doTestMemberInplaceRename("w") + } + + private fun doTestImplicitLambdaParameter(newName: String) { + configureByFile(getTestName(false) + ".kt") + + // This code is copy-pasted from CodeInsightTestUtil.doInlineRename() and slightly modified. + // Original method was not suitable because it expects renamed element to be reference to other or referrable + + val file = getFile()!! + val editor = getEditor()!! + val element = file.findElementForRename(editor.caretModel.offset)!! + assertNotNull(element) + + val dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.name, element, + getCurrentEditorDataContext()) + val handler = RenameKotlinImplicitLambdaParameter() + + assertTrue(handler.isRenaming(dataContext), "In-place rename not allowed for " + element) + + val project = editor.project!! + + TemplateManagerImpl.setTemplateTesting(project, testRootDisposable) + + object : WriteCommandAction.Simple(project) { + override fun run() { + handler.invoke(project, editor, file, dataContext) + } + }.execute() + + var state = TemplateManagerImpl.getTemplateState(editor) + assert(state != null) + val range = state!!.currentVariableRange + assert(range != null) + object : WriteCommandAction.Simple(project) { + override fun run() { + editor.document.replaceString(range!!.startOffset, range.endOffset, newName) + } + }.execute().throwException() + + state = TemplateManagerImpl.getTemplateState(editor) + assert(state != null) + state!!.gotoEnd(false) + + checkResultByFile(getTestName(false) + ".kt.after") + } + + private fun doTestMemberInplaceRename(newName: String?) { + doTestInplaceRename(newName, KotlinMemberInplaceRenameHandler()) + } + + private fun doTestInplaceRename(newName: String?, handler: VariableInplaceRenameHandler = KotlinVariableInplaceRenameHandler()) { + configureByFile(getTestName(false) + ".kt") + val element = TargetElementUtil.findTargetElement( + myEditor, + TargetElementUtil.ELEMENT_NAME_ACCEPTED or TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED + ) + + assertNotNull(element) + + val dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.name, element!!, + getCurrentEditorDataContext()) + + if (newName == null) { + assertFalse(handler.isRenaming(dataContext), "In-place rename is allowed for " + element) + } + else { + try { + assertTrue(handler.isRenaming(dataContext), "In-place rename not allowed for " + element) + CodeInsightTestUtil.doInlineRename(handler, newName, getEditor(), element) + checkResultByFile(getTestName(false) + ".kt.after") + } catch (e: BaseRefactoringProcessor.ConflictsInTestsException) { + val expectedMessage = InTextDirectivesUtils.findStringWithPrefixes(myFile.text, "// SHOULD_FAIL_WITH: ") + TestCase.assertEquals(expectedMessage, e.messages.joinToString()) + } + } + } +} diff --git a/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as40 b/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as40 new file mode 100644 index 00000000000..6546b2059d2 --- /dev/null +++ b/jps-plugin/src/org/jetbrains/kotlin/jps/build/ideaPlatform.kt.as40 @@ -0,0 +1,13 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.jps.build + +import org.jetbrains.jps.incremental.CompileContext +import org.jetbrains.jps.incremental.messages.CompilerMessage + +fun jpsReportInternalBuilderError(context: CompileContext, error: Throwable) { + KotlinBuilder.LOG.info(error) +} \ No newline at end of file diff --git a/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as40 b/plugins/allopen/allopen-ide/src/AllOpenMavenProjectImportHandler.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as40 b/plugins/annotation-based-compiler-plugins-ide-support/src/AbstractMavenImportHandler.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as40 b/plugins/kotlin-serialization/kotlin-serialization-ide/src/org/jetbrains/kotlinx/serialization/idea/KotlinSerializationMavenImportHandler.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as40 b/plugins/noarg/noarg-ide/src/NoArgMavenProjectImportHandler.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d diff --git a/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as40 b/plugins/sam-with-receiver/sam-with-receiver-ide/src/SamWithReceiverMavenProjectImportHandler.kt.as40 new file mode 100644 index 00000000000..e69de29bb2d