[MERGE] KT: build-1.5.20-dev-60 KT/N: b02fe76d7 OLD: 40959c756
This commit is contained in:
+1
-1
@@ -52,7 +52,6 @@ pill {
|
||||
excludedDirs(
|
||||
"out",
|
||||
"buildSrc/build",
|
||||
"buildSrc/prepare-deps/android-dx/build",
|
||||
"buildSrc/prepare-deps/intellij-sdk/build"
|
||||
)
|
||||
}
|
||||
@@ -332,6 +331,7 @@ extra["tasksWithWarnings"] = listOf(
|
||||
":compiler:fir:checkers:compileKotlin",
|
||||
":compiler:fir:java:compileKotlin",
|
||||
":kotlin-scripting-compiler:compileKotlin",
|
||||
":kotlin-scripting-compiler:compileTestKotlin",
|
||||
":plugins:uast-kotlin:compileKotlin",
|
||||
":plugins:uast-kotlin:compileTestKotlin",
|
||||
":plugins:uast-kotlin-idea:compileKotlin"
|
||||
|
||||
@@ -81,8 +81,6 @@ extra["intellijReleaseType"] = when {
|
||||
else -> "releases"
|
||||
}
|
||||
|
||||
extra["versions.androidDxSources"] = "5.0.0_r2"
|
||||
|
||||
extra["customDepsOrg"] = "kotlin.build"
|
||||
|
||||
repositories {
|
||||
|
||||
@@ -76,8 +76,6 @@ fun Project.jpsStandalone() = "kotlin.build:jps-standalone:${rootProject.extra["
|
||||
|
||||
fun Project.nodeJSPlugin() = "kotlin.build:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}"
|
||||
|
||||
fun Project.androidDxJar() = "org.jetbrains.kotlin:android-dx:${rootProject.extra["versions.androidBuildTools"]}"
|
||||
|
||||
fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
fun Project.kotlinxCollectionsImmutable() = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${rootProject.extra["versions.kotlinx-collections-immutable"]}"
|
||||
|
||||
@@ -65,7 +65,6 @@ dependencies {
|
||||
testRuntimeOnly(intellijPluginDep("java"))
|
||||
|
||||
testRuntime(project(":kotlin-reflect"))
|
||||
testRuntime(androidDxJar())
|
||||
testRuntime(toolsJar())
|
||||
|
||||
antLauncherJar(commonDep("org.apache.ant", "ant"))
|
||||
|
||||
+2
-13
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2010-2015 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.
|
||||
# Copyright 2010-2021 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.
|
||||
|
||||
export KOTLIN_TOOL=kotlin-annotation-processing-cli.jar
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
setlocal
|
||||
set _KOTLIN_COMPILER=org.jetbrains.kotlin.kapt.cli.KaptCli
|
||||
|
||||
+2
-13
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2010-2015 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.
|
||||
# Copyright 2010-2021 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.
|
||||
|
||||
export KOTLIN_RUNNER=1
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
# Copyright 2010-2021 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.
|
||||
|
||||
export KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.dce.K2JSDce
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
setlocal
|
||||
set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.dce.K2JSDce
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
setlocal
|
||||
set _KOTLIN_RUNNER=1
|
||||
|
||||
+27
-13
@@ -1,13 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Based on scalac from the Scala distribution
|
||||
# Copyright 2002-2011, LAMP/EPFL
|
||||
# Copyright 2011-2015, JetBrains
|
||||
#
|
||||
# This is free software; see the distribution for copying conditions.
|
||||
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
##############################################################################
|
||||
# Copyright 2010-2021 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.
|
||||
|
||||
cygwin=false;
|
||||
case "`uname`" in
|
||||
@@ -25,6 +21,17 @@ findKotlinHome() {
|
||||
(cd -P "$(dirname "$source")/.." && pwd)
|
||||
}
|
||||
|
||||
findJavaVersion() {
|
||||
# Note that this only loads the first component of the version, so "1.8.0_265" -> "1".
|
||||
# But it's fine because major version is 9 for JDK 9, and so on.
|
||||
regex='^.*version "([[:digit:]]+).*$'
|
||||
while read -r line; do
|
||||
if [[ "$line" =~ $regex ]]; then
|
||||
echo ${BASH_REMATCH[1]}
|
||||
fi
|
||||
done <<< $("${JAVACMD:=java}" -version 2>&1)
|
||||
}
|
||||
|
||||
KOTLIN_HOME="$(findKotlinHome)"
|
||||
|
||||
if $cygwin; then
|
||||
@@ -60,17 +67,24 @@ fi
|
||||
|
||||
declare -a kotlin_app
|
||||
|
||||
if [ -n "$KOTLIN_RUNNER" ];
|
||||
then
|
||||
java_version="$(findJavaVersion)"
|
||||
if [[ $java_version -ge 9 ]]; then
|
||||
# Workaround the illegal reflective access warning from ReflectionUtil to ResourceBundle.setParent, see IDEA-248785.
|
||||
java_args=("${java_args[@]}" "--add-opens" "java.base/java.util=ALL-UNNAMED")
|
||||
fi
|
||||
|
||||
if [ -n "$KOTLIN_RUNNER" ]; then
|
||||
java_args=("${java_args[@]}" "-Dkotlin.home=${KOTLIN_HOME}")
|
||||
kotlin_app=("${KOTLIN_HOME}/lib/kotlin-runner.jar" "org.jetbrains.kotlin.runner.Main")
|
||||
else
|
||||
[ -n "$KOTLIN_COMPILER" ] || KOTLIN_COMPILER=org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
java_args=("${java_args[@]}" "-noverify")
|
||||
|
||||
if [[ $java_version < 13 ]]; then
|
||||
java_args=("${java_args[@]}" "-noverify")
|
||||
fi
|
||||
|
||||
declare additional_classpath=""
|
||||
if [ -n "$KOTLIN_TOOL" ];
|
||||
then
|
||||
if [ -n "$KOTLIN_TOOL" ]; then
|
||||
additional_classpath=":${KOTLIN_HOME}/lib/${KOTLIN_TOOL}"
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2010-2015 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.
|
||||
# Copyright 2010-2021 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.
|
||||
|
||||
export KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.K2JSCompiler
|
||||
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
setlocal
|
||||
set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.K2JSCompiler
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2010-2015 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.
|
||||
# Copyright 2010-2021 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.
|
||||
|
||||
DIR="${BASH_SOURCE[0]%/*}"
|
||||
: ${DIR:="."}
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
@echo off
|
||||
|
||||
rem Copyright 2010-2015 JetBrains s.r.o.
|
||||
rem
|
||||
rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
rem you may not use this file except in compliance with the License.
|
||||
rem You may obtain a copy of the License at
|
||||
rem
|
||||
rem http://www.apache.org/licenses/LICENSE-2.0
|
||||
rem
|
||||
rem Unless required by applicable law or agreed to in writing, software
|
||||
rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
rem See the License for the specific language governing permissions and
|
||||
rem limitations under the License.
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
call %~dps0kotlinc.bat %*
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
@echo off
|
||||
rem based on scalac.bat from the Scala distribution
|
||||
rem ##########################################################################
|
||||
rem # Copyright 2002-2011, LAMP/EPFL
|
||||
rem # Copyright 2011-2015, JetBrains
|
||||
rem #
|
||||
rem # This is free software; see the distribution for copying conditions.
|
||||
rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
|
||||
rem # PARTICULAR PURPOSE.
|
||||
rem ##########################################################################
|
||||
|
||||
rem Based on scalac.bat from the Scala distribution
|
||||
rem Copyright 2002-2011, LAMP/EPFL
|
||||
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
|
||||
rem We adopt the following conventions:
|
||||
rem - System/user environment variables start with a letter
|
||||
@@ -19,11 +15,10 @@ call :set_home
|
||||
if "%_KOTLIN_COMPILER%"=="" set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
|
||||
if not "%JAVA_HOME%"=="" (
|
||||
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
|
||||
rem Prepend JAVA_HOME to local PATH to be able to simply execute "java" later in the script.
|
||||
set "PATH=%JAVA_HOME%\bin;%PATH%"
|
||||
)
|
||||
|
||||
if "%_JAVACMD%"=="" set _JAVACMD=java
|
||||
|
||||
rem We use the value of the JAVA_OPTS environment variable if defined
|
||||
if "%JAVA_OPTS%"=="" set JAVA_OPTS=-Xmx256M -Xms32M
|
||||
|
||||
@@ -45,18 +40,29 @@ shift
|
||||
goto loop
|
||||
:loopend
|
||||
|
||||
if "%_KOTLIN_RUNNER%"=="1" (
|
||||
"%_JAVACMD%" %JAVA_OPTS% "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
call :set_java_version
|
||||
if !_java_major_version! geq 9 (
|
||||
rem Workaround the illegal reflective access warning from ReflectionUtil to ResourceBundle.setParent, see IDEA-248785.
|
||||
set JAVA_OPTS=!JAVA_OPTS! "--add-opens" "java.base/java.util=ALL-UNNAMED"
|
||||
)
|
||||
|
||||
if "!_KOTLIN_RUNNER!"=="1" (
|
||||
java !JAVA_OPTS! "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^
|
||||
org.jetbrains.kotlin.runner.Main %KOTLIN_OPTS%
|
||||
) else (
|
||||
setlocal EnableDelayedExpansion
|
||||
SET _ADDITIONAL_CLASSPATH=
|
||||
set _ADDITIONAL_CLASSPATH=
|
||||
|
||||
if !_java_major_version! lss 13 (
|
||||
set JAVA_OPTS=!JAVA_OPTS! "-noverify"
|
||||
)
|
||||
|
||||
if not "%_KOTLIN_TOOL%"=="" (
|
||||
set _ADDITIONAL_CLASSPATH=;%_KOTLIN_HOME%\lib\%_KOTLIN_TOOL%
|
||||
)
|
||||
|
||||
"%_JAVACMD%" %JAVA_OPTS% -noverify -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^
|
||||
java !JAVA_OPTS! -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^
|
||||
org.jetbrains.kotlin.preloading.Preloader -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar!_ADDITIONAL_CLASSPATH!" ^
|
||||
%_KOTLIN_COMPILER% %KOTLIN_OPTS%
|
||||
)
|
||||
@@ -73,6 +79,29 @@ rem # subroutines
|
||||
set _KOTLIN_HOME=%_BIN_DIR%..
|
||||
goto :eof
|
||||
|
||||
rem Parses "java -version" output and stores the major version to _java_major_version.
|
||||
rem Note that this only loads the first component of the version, so "1.8.0_265" -> "1".
|
||||
rem But it's fine because major version is 9 for JDK 9, and so on.
|
||||
rem Needs to be executed in the EnableDelayedExpansion mode.
|
||||
:set_java_version
|
||||
set _version=
|
||||
rem Parse output and take the third token from the string containing " version ".
|
||||
rem It should be something like "1.8.0_275" or "15.0.1".
|
||||
for /f "tokens=3" %%i in ('java -version 2^>^&1 ^| findstr /i " version "') do (
|
||||
rem Split the string by "-" or "." and take the first token.
|
||||
for /f "delims=-. tokens=1" %%j in ("%%i") do (
|
||||
rem At this point, _version should be something like "1 or "15. Note the leading quote.
|
||||
set _version=%%j
|
||||
)
|
||||
)
|
||||
if "!_version!"=="" (
|
||||
rem If failed to parse the output, set the version to 1.
|
||||
set _java_major_version=1
|
||||
) else (
|
||||
rem Strip the leading quote.
|
||||
set _java_major_version=!_version:~1!
|
||||
)
|
||||
goto :eof
|
||||
|
||||
:end
|
||||
endlocal
|
||||
|
||||
|
||||
+6
@@ -374,10 +374,16 @@ object KotlinCompilerClient {
|
||||
// hide daemon window
|
||||
"-Djava.awt.headless=true",
|
||||
"-D$JAVA_RMI_SERVER_HOSTNAME=$serverHostname")
|
||||
val javaVersion = System.getProperty("java.specification.version")?.toIntOrNull()
|
||||
val javaIllegalAccessWorkaround =
|
||||
if (javaVersion != null && javaVersion >= 17)
|
||||
listOf("--illegal-access=permit")
|
||||
else emptyList()
|
||||
val args = listOf(
|
||||
javaExecutable.absolutePath, "-cp", compilerId.compilerClasspath.joinToString(File.pathSeparator)) +
|
||||
platformSpecificOptions +
|
||||
daemonJVMOptions.mappers.flatMap { it.toArgs("-") } +
|
||||
javaIllegalAccessWorkaround +
|
||||
COMPILER_DAEMON_CLASS_FQN +
|
||||
daemonOptions.mappers.flatMap { it.toArgs(COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX) } +
|
||||
compilerId.mappers.flatMap { it.toArgs(COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX) }
|
||||
|
||||
@@ -32,7 +32,6 @@ dependencies {
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
testRuntimeOnly(project(":kotlin-reflect"))
|
||||
testRuntimeOnly(project(":core:descriptors.runtime"))
|
||||
testRuntimeOnly(androidDxJar())
|
||||
testRuntimeOnly(project(":compiler:fir:fir2ir:jvm-backend"))
|
||||
|
||||
testImplementation(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
|
||||
@@ -11,6 +11,7 @@ val compileOnly by configurations
|
||||
runtimeOnly.extendsFrom(compileOnly)
|
||||
|
||||
dependencies {
|
||||
implementation(project(":generators"))
|
||||
implementation(project(":core:compiler.common"))
|
||||
implementation(project(":compiler:frontend.common"))
|
||||
implementation(project(":compiler:fir:cones"))
|
||||
|
||||
+7
-5
@@ -5,8 +5,9 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.tree.generator
|
||||
|
||||
import org.jetbrains.kotlin.fir.tree.generator.printer.printElements
|
||||
import org.jetbrains.kotlin.fir.tree.generator.printer.generateElements
|
||||
import org.jetbrains.kotlin.fir.tree.generator.util.*
|
||||
import org.jetbrains.kotlin.generators.util.GeneratorsFileUtil
|
||||
import java.io.File
|
||||
|
||||
|
||||
@@ -19,8 +20,9 @@ fun main(args: Array<String>) {
|
||||
ImplementationConfigurator.configureImplementations()
|
||||
configureInterfacesAndAbstractClasses(FirTreeBuilder)
|
||||
BuilderConfigurator.configureBuilders()
|
||||
removePreviousGeneratedFiles(generationPath)
|
||||
printElements(FirTreeBuilder, generationPath)
|
||||
// printFieldUsageTable(FirTreeBuilder)
|
||||
// printHierarchyGraph(FirTreeBuilder)
|
||||
val previouslyGeneratedFiles = collectPreviouslyGeneratedFiles(generationPath)
|
||||
val generatedFiles = generateElements(FirTreeBuilder, generationPath)
|
||||
generatedFiles.forEach { GeneratorsFileUtil.writeFileIfContentChanged(it.file, it.newText, logNotChanged = false) }
|
||||
removeExtraFilesFromPreviousGeneration(previouslyGeneratedFiles, generatedFiles.map { it.file })
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -9,11 +9,11 @@ import org.jetbrains.kotlin.fir.tree.generator.declarationAttributesType
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.*
|
||||
import java.io.File
|
||||
|
||||
fun Builder.generateCode(generationPath: File) {
|
||||
fun Builder.generateCode(generationPath: File): GeneratedFile {
|
||||
val dir = generationPath.resolve(packageName.replace(".", "/"))
|
||||
dir.mkdirs()
|
||||
val file = File(dir, "$type.kt")
|
||||
file.useSmartPrinter {
|
||||
val stringBuilder = StringBuilder()
|
||||
SmartPrinter(stringBuilder).apply {
|
||||
printCopyright()
|
||||
println("package $packageName")
|
||||
println()
|
||||
@@ -25,6 +25,7 @@ fun Builder.generateCode(generationPath: File) {
|
||||
printGeneratedMessage()
|
||||
printBuilder(this@generateCode)
|
||||
}
|
||||
return GeneratedFile(file, stringBuilder.toString())
|
||||
}
|
||||
|
||||
private fun SmartPrinter.printBuilder(builder: Builder) {
|
||||
|
||||
+4
-3
@@ -12,11 +12,11 @@ import org.jetbrains.kotlin.fir.tree.generator.util.get
|
||||
|
||||
import java.io.File
|
||||
|
||||
fun Element.generateCode(generationPath: File) {
|
||||
fun Element.generateCode(generationPath: File): GeneratedFile {
|
||||
val dir = generationPath.resolve(packageName.replace(".", "/"))
|
||||
dir.mkdirs()
|
||||
val file = File(dir, "$type.kt")
|
||||
file.useSmartPrinter {
|
||||
val stringBuilder = StringBuilder()
|
||||
SmartPrinter(stringBuilder).apply {
|
||||
printCopyright()
|
||||
println("package $packageName")
|
||||
println()
|
||||
@@ -28,6 +28,7 @@ fun Element.generateCode(generationPath: File) {
|
||||
printGeneratedMessage()
|
||||
printElement(this@generateCode)
|
||||
}
|
||||
return GeneratedFile(file, stringBuilder.toString())
|
||||
}
|
||||
|
||||
fun SmartPrinter.printElement(element: Element) {
|
||||
|
||||
+4
-3
@@ -10,11 +10,11 @@ import org.jetbrains.kotlin.fir.tree.generator.pureAbstractElementType
|
||||
|
||||
import java.io.File
|
||||
|
||||
fun Implementation.generateCode(generationPath: File) {
|
||||
fun Implementation.generateCode(generationPath: File): GeneratedFile {
|
||||
val dir = generationPath.resolve(packageName.replace(".", "/"))
|
||||
dir.mkdirs()
|
||||
val file = File(dir, "$type.kt")
|
||||
file.useSmartPrinter {
|
||||
val stringBuilder = StringBuilder()
|
||||
SmartPrinter(stringBuilder).apply {
|
||||
printCopyright()
|
||||
println("package $packageName")
|
||||
println()
|
||||
@@ -26,6 +26,7 @@ fun Implementation.generateCode(generationPath: File) {
|
||||
printGeneratedMessage()
|
||||
printImplementation(this@generateCode)
|
||||
}
|
||||
return GeneratedFile(file, stringBuilder.toString())
|
||||
}
|
||||
|
||||
fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
|
||||
+10
-8
@@ -19,15 +19,17 @@ val GENERATED_MESSAGE = """
|
||||
*/
|
||||
""".trimIndent()
|
||||
|
||||
fun printElements(builder: AbstractFirTreeBuilder, generationPath: File) {
|
||||
builder.elements.forEach { it.generateCode(generationPath) }
|
||||
builder.elements.flatMap { it.allImplementations }.forEach { it.generateCode(generationPath) }
|
||||
builder.elements.flatMap { it.allImplementations }.mapNotNull { it.builder }.forEach { it.generateCode(generationPath) }
|
||||
builder.intermediateBuilders.forEach { it.generateCode(generationPath) }
|
||||
fun generateElements(builder: AbstractFirTreeBuilder, generationPath: File): List<GeneratedFile> {
|
||||
val generatedFiles = mutableListOf<GeneratedFile>()
|
||||
builder.elements.mapTo(generatedFiles) { it.generateCode(generationPath) }
|
||||
builder.elements.flatMap { it.allImplementations }.mapTo(generatedFiles) { it.generateCode(generationPath) }
|
||||
builder.elements.flatMap { it.allImplementations }.mapNotNull { it.builder }.mapTo(generatedFiles) { it.generateCode(generationPath) }
|
||||
builder.intermediateBuilders.mapTo(generatedFiles) { it.generateCode(generationPath) }
|
||||
|
||||
printVisitor(builder.elements, generationPath)
|
||||
printVisitorVoid(builder.elements, generationPath)
|
||||
printTransformer(builder.elements, generationPath)
|
||||
generatedFiles += printVisitor(builder.elements, generationPath)
|
||||
generatedFiles += printVisitorVoid(builder.elements, generationPath)
|
||||
generatedFiles += printTransformer(builder.elements, generationPath)
|
||||
return generatedFiles
|
||||
}
|
||||
|
||||
fun SmartPrinter.printCopyright() {
|
||||
|
||||
+5
-3
@@ -11,10 +11,11 @@ import org.jetbrains.kotlin.fir.tree.generator.model.Element
|
||||
|
||||
import java.io.File
|
||||
|
||||
fun printTransformer(elements: List<Element>, generationPath: File) {
|
||||
fun printTransformer(elements: List<Element>, generationPath: File): GeneratedFile {
|
||||
val dir = File(generationPath, VISITOR_PACKAGE.replace(".", "/"))
|
||||
dir.mkdirs()
|
||||
File(dir, "FirTransformer.kt").useSmartPrinter {
|
||||
val file = File(dir, "FirTransformer.kt")
|
||||
val stringBuilder = StringBuilder()
|
||||
SmartPrinter(stringBuilder).apply {
|
||||
printCopyright()
|
||||
println("package $VISITOR_PACKAGE")
|
||||
println()
|
||||
@@ -62,4 +63,5 @@ fun printTransformer(elements: List<Element>, generationPath: File) {
|
||||
}
|
||||
println("}")
|
||||
}
|
||||
return GeneratedFile(file, stringBuilder.toString())
|
||||
}
|
||||
|
||||
+4
@@ -10,6 +10,10 @@ import org.jetbrains.kotlin.fir.tree.generator.context.AbstractFirTreeBuilder
|
||||
import org.jetbrains.kotlin.fir.tree.generator.firImplementationDetailType
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.*
|
||||
import org.jetbrains.kotlin.fir.tree.generator.pureAbstractElementType
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
import java.io.File
|
||||
|
||||
class GeneratedFile(val file: File, val newText: String)
|
||||
|
||||
enum class ImportKind(val postfix: String) {
|
||||
Element(""), Implementation(".impl"), Builder(".builder")
|
||||
|
||||
+10
-8
@@ -7,14 +7,13 @@ package org.jetbrains.kotlin.fir.tree.generator.printer
|
||||
|
||||
import org.jetbrains.kotlin.fir.tree.generator.context.AbstractFirTreeBuilder
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.Element
|
||||
|
||||
import java.io.File
|
||||
import java.io.PrintWriter
|
||||
|
||||
fun printVisitor(elements: List<Element>, generationPath: File) {
|
||||
fun printVisitor(elements: List<Element>, generationPath: File): GeneratedFile {
|
||||
val dir = File(generationPath, VISITOR_PACKAGE.replace(".", "/"))
|
||||
dir.mkdirs()
|
||||
File(dir, "FirVisitor.kt").useSmartPrinter {
|
||||
val file = File(dir, "FirVisitor.kt")
|
||||
val stringBuilder = StringBuilder()
|
||||
SmartPrinter(stringBuilder).apply {
|
||||
printCopyright()
|
||||
println("package $VISITOR_PACKAGE")
|
||||
println()
|
||||
@@ -37,13 +36,15 @@ fun printVisitor(elements: List<Element>, generationPath: File) {
|
||||
popIndent()
|
||||
println("}")
|
||||
}
|
||||
return GeneratedFile(file, stringBuilder.toString())
|
||||
}
|
||||
|
||||
|
||||
fun printVisitorVoid(elements: List<Element>, generationPath: File) {
|
||||
fun printVisitorVoid(elements: List<Element>, generationPath: File): GeneratedFile {
|
||||
val dir = File(generationPath, VISITOR_PACKAGE.replace(".", "/"))
|
||||
dir.mkdirs()
|
||||
File(dir, "FirVisitorVoid.kt").useSmartPrinter {
|
||||
val file = File(dir, "FirVisitorVoid.kt")
|
||||
val stringBuilder = StringBuilder()
|
||||
SmartPrinter(stringBuilder).apply {
|
||||
printCopyright()
|
||||
println("package $VISITOR_PACKAGE")
|
||||
println()
|
||||
@@ -83,4 +84,5 @@ fun printVisitorVoid(elements: List<Element>, generationPath: File) {
|
||||
}
|
||||
println("}")
|
||||
}
|
||||
return GeneratedFile(file, stringBuilder.toString())
|
||||
}
|
||||
|
||||
+18
-5
@@ -6,12 +6,25 @@
|
||||
package org.jetbrains.kotlin.fir.tree.generator.util
|
||||
|
||||
import org.jetbrains.kotlin.fir.tree.generator.printer.GENERATED_MESSAGE
|
||||
import org.jetbrains.kotlin.generators.util.GeneratorsFileUtil
|
||||
import java.io.File
|
||||
|
||||
fun removePreviousGeneratedFiles(generationPath: File) {
|
||||
generationPath.walkTopDown().forEach {
|
||||
if (it.isFile && it.readText().contains(GENERATED_MESSAGE)) {
|
||||
it.delete()
|
||||
fun collectPreviouslyGeneratedFiles(generationPath: File): List<File> {
|
||||
return generationPath.walkTopDown().filter {
|
||||
it.isFile && it.readText().contains(GENERATED_MESSAGE)
|
||||
}.toList()
|
||||
}
|
||||
|
||||
fun removeExtraFilesFromPreviousGeneration(previouslyGeneratedFiles: List<File>, generatedFiles: List<File>) {
|
||||
val generatedFilesPath = generatedFiles.mapTo(mutableSetOf()) { it.absolutePath }
|
||||
|
||||
for (file in previouslyGeneratedFiles) {
|
||||
if (file.absolutePath !in generatedFilesPath) {
|
||||
if (GeneratorsFileUtil.isTeamCityBuild) {
|
||||
GeneratorsFileUtil.assertTeamCityMode()
|
||||
}
|
||||
println("Deleted: ${file.absolutePath}")
|
||||
file.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-13
@@ -2,15 +2,12 @@
|
||||
// FILE: A.kt
|
||||
// VERSION: 1
|
||||
|
||||
open class X {
|
||||
val hasFoo = false
|
||||
}
|
||||
open class X
|
||||
|
||||
// FILE: B.kt
|
||||
// VERSION: 2
|
||||
|
||||
open class X {
|
||||
val hasFoo = false
|
||||
open fun foo(): String = "new member"
|
||||
}
|
||||
|
||||
@@ -33,15 +30,6 @@ fun qux(): String = Y().foo()
|
||||
// MODULE: mainLib(lib)
|
||||
// FILE: mainLib.kt
|
||||
|
||||
fun qux(): String {
|
||||
val y = Y()
|
||||
if (y.hasFoo()) {
|
||||
foo()
|
||||
} else {
|
||||
"no foo"
|
||||
}
|
||||
}
|
||||
|
||||
fun lib(): String = when {
|
||||
qux() != "new member" -> "fail 1"
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +FunctionTypesWithBigArity
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: J.java
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// SAM_CONVERSIONS: INDY
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
// no stream api on Android
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
import java.util.stream.Collectors
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// SAM_CONVERSIONS: INDY
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
// no stream api on Android
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
import java.util.stream.*
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -14,7 +14,6 @@ dependencies {
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
testRuntimeOnly(project(":kotlin-reflect"))
|
||||
testRuntimeOnly(project(":core:descriptors.runtime"))
|
||||
testRuntimeOnly(androidDxJar())
|
||||
|
||||
testImplementation(projectTests(":generators:test-generator"))
|
||||
|
||||
|
||||
-2
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.test.backend.handlers
|
||||
|
||||
import org.jetbrains.kotlin.codegen.D8Checker
|
||||
import org.jetbrains.kotlin.codegen.DxChecker
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_DEXING
|
||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.RUN_DEX_CHECKER
|
||||
@@ -21,7 +20,6 @@ class DxCheckerHandler(testServices: TestServices) : JvmBinaryArtifactHandler(te
|
||||
|
||||
override fun processModule(module: TestModule, info: BinaryArtifacts.Jvm) {
|
||||
if (RUN_DEX_CHECKER !in module.directives || IGNORE_DEXING in module.directives) return
|
||||
DxChecker.check(info.classFileFactory)
|
||||
D8Checker.check(info.classFileFactory)
|
||||
}
|
||||
|
||||
|
||||
+20
-6
@@ -11,6 +11,10 @@ import org.jetbrains.kotlin.test.services.assertions
|
||||
import java.io.File
|
||||
|
||||
abstract class FirIdenticalCheckerHelper(private val testServices: TestServices) {
|
||||
companion object {
|
||||
private val isTeamCityBuild: Boolean = System.getProperty("TEAMCITY_VERSION") != null
|
||||
}
|
||||
|
||||
abstract fun getClassicFileToCompare(testDataFile: File): File?
|
||||
abstract fun getFirFileToCompare(testDataFile: File): File?
|
||||
|
||||
@@ -35,21 +39,31 @@ abstract class FirIdenticalCheckerHelper(private val testServices: TestServices)
|
||||
}
|
||||
|
||||
fun addDirectiveToClassicFileAndAssert(testDataFile: File) {
|
||||
val classicFileContent = testDataFile.readText()
|
||||
testDataFile.writer().use {
|
||||
it.appendLine("// ${FirDiagnosticsDirectives.FIR_IDENTICAL.name}")
|
||||
it.append(classicFileContent)
|
||||
if (!isTeamCityBuild) {
|
||||
val classicFileContent = testDataFile.readText()
|
||||
testDataFile.writer().use {
|
||||
it.appendLine("// ${FirDiagnosticsDirectives.FIR_IDENTICAL.name}")
|
||||
it.append(classicFileContent)
|
||||
}
|
||||
}
|
||||
|
||||
val message = if (isTeamCityBuild) {
|
||||
"Please remove .fir.txt dump and add // FIR_IDENTICAL to test source"
|
||||
} else {
|
||||
"Deleted .fir.txt dump, added // FIR_IDENTICAL to test source"
|
||||
}
|
||||
testServices.assertions.fail {
|
||||
"""
|
||||
Dumps via FIR & via old FE are the same.
|
||||
Deleted .fir.txt dump, added // FIR_IDENTICAL to test source
|
||||
$message
|
||||
Please re-run the test now
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteFirFile(testDataFile: File) {
|
||||
getFirFileToCompare(testDataFile)?.takeIf { it.exists() }?.delete()
|
||||
if (!isTeamCityBuild) {
|
||||
getFirFileToCompare(testDataFile)?.takeIf { it.exists() }?.delete()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ dependencies {
|
||||
testCompile(project(":kotlin-scripting-compiler-impl"))
|
||||
testCompile(projectTests(":compiler:test-infrastructure-utils"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(androidDxJar()) { isTransitive = false }
|
||||
testCompile(commonDep("com.android.tools:r8"))
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
testCompileOnly(toolsJar())
|
||||
|
||||
@@ -315,8 +315,7 @@ public abstract class CodegenTestCase extends KotlinBaseTest<KotlinBaseTest.Test
|
||||
boolean ignoreDexing = myFiles.getPsiFiles().stream().anyMatch(
|
||||
it -> InTextDirectivesUtils.isDirectiveDefined(it.getText(), "IGNORE_DEXING")
|
||||
);
|
||||
if (verifyWithDex() && DxChecker.RUN_DX_CHECKER && !ignoreDexing) {
|
||||
DxChecker.check(classFileFactory);
|
||||
if (verifyWithDex() && D8Checker.RUN_D8_CHECKER && !ignoreDexing) {
|
||||
D8Checker.check(classFileFactory);
|
||||
}
|
||||
}
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.compatibility.binary
|
||||
|
||||
import org.jetbrains.kotlin.test.*
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import java.io.File
|
||||
|
||||
class TestFile(val module: TestModule, fileName: String, text: String, directives: Directives)
|
||||
: KotlinBaseTest.TestFile(fileName, text, directives) {
|
||||
init {
|
||||
module.files.add(this)
|
||||
}
|
||||
val version: Int? = directives["VERSION"]?.toInt()
|
||||
}
|
||||
|
||||
class TestModule(name: String, dependenciesSymbols: List<String>, friends: List<String>)
|
||||
: KotlinBaseTest.TestModule(name, dependenciesSymbols, friends) {
|
||||
|
||||
val files = mutableListOf<TestFile>()
|
||||
val hasVersions get() = files.any { it.version != null }
|
||||
fun versionFiles(version: Int) = files.filter { it.version == null || it.version == version }
|
||||
}
|
||||
|
||||
abstract class AbstractKlibBinaryCompatibilityTest : KotlinTestWithEnvironment() {
|
||||
|
||||
private val pathToRootOutputDir = System.getProperty("kotlin.js.test.root.out.dir") ?: error("'kotlin.js.test.root.out.dir' is not set")
|
||||
private val testGroupSuffix = "binaryCompatibility/"
|
||||
protected lateinit var workingDir: File
|
||||
|
||||
fun doTest(filePath: String) {
|
||||
workingDir = File(pathToRootOutputDir + "out/$testGroupSuffix" + filePath)
|
||||
workingDir.mkdirs()
|
||||
doTestWithIgnoringByFailFile(filePath)
|
||||
}
|
||||
|
||||
fun doTestWithIgnoringByFailFile(filePath: String) {
|
||||
val failFile = File("$filePath.fail")
|
||||
try {
|
||||
doTest(filePath, "OK")
|
||||
} catch (e: Throwable) {
|
||||
if (failFile.exists()) {
|
||||
KotlinTestUtils.assertEqualsToFile(failFile, e.message ?: "")
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun doTest(filePath: String, expectedResult: String) {
|
||||
val file = File(filePath)
|
||||
val fileContent = KtTestUtil.doLoadFile(file)
|
||||
|
||||
val inputFiles = TestFiles.createTestFiles(
|
||||
file.name,
|
||||
fileContent,
|
||||
object : TestFiles.TestFileFactory<TestModule, TestFile> {
|
||||
override fun createFile(module: TestModule?, fileName: String, text: String, directives: Directives) =
|
||||
module?.let {
|
||||
TestFile(module, fileName, text, directives)
|
||||
} ?: error("Expected a module for $fileName in $filePath")
|
||||
|
||||
override fun createModule(name: String, dependencies: List<String>, friends: List<String>) =
|
||||
TestModule(name, dependencies, friends)
|
||||
|
||||
},
|
||||
true,
|
||||
true
|
||||
)
|
||||
val modules = inputFiles
|
||||
.map { it.module }.distinct()
|
||||
.map { it.name to it }.toMap()
|
||||
|
||||
val orderedModules = DFS.topologicalOrder(modules.values) { module ->
|
||||
module.dependenciesSymbols.mapNotNull { modules[it] }
|
||||
}
|
||||
|
||||
val mainModuleName = DEFAULT_MODULE
|
||||
val mainModule = modules[mainModuleName] ?: error("No module with name \"$mainModuleName\"")
|
||||
|
||||
orderedModules.reversed().filterNot { it === mainModule }.forEach {
|
||||
produceKlib(it, 1)
|
||||
if (it.hasVersions) {
|
||||
produceKlib(it, 2)
|
||||
}
|
||||
}
|
||||
produceProgram(mainModule)
|
||||
|
||||
runProgram(mainModule, expectedResult)
|
||||
}
|
||||
|
||||
abstract fun produceKlib(module: TestModule, version: Int)
|
||||
abstract fun produceProgram(module: TestModule)
|
||||
abstract fun runProgram(module: TestModule, expectedResult: String)
|
||||
|
||||
companion object {
|
||||
val TEST_FUNCTION = "box"
|
||||
val DEFAULT_MODULE = "main"
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ dependencies {
|
||||
testCompile(project(":compiler:fir:entrypoint"))
|
||||
testCompile(projectTests(":compiler:test-infrastructure-utils"))
|
||||
testCompile(project(":kotlin-preloader"))
|
||||
testCompile(androidDxJar()) { isTransitive = false }
|
||||
testCompile(commonDep("com.android.tools:r8"))
|
||||
testCompileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import java.util.function.Consumer;
|
||||
|
||||
public class D8Checker {
|
||||
|
||||
public static final boolean RUN_D8_CHECKER = true;
|
||||
|
||||
private D8Checker() {
|
||||
}
|
||||
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.codegen;
|
||||
|
||||
import com.android.dx.cf.direct.DirectClassFile;
|
||||
import com.android.dx.cf.direct.StdAttributeFactory;
|
||||
import com.android.dx.command.dexer.Main;
|
||||
import com.android.dx.dex.cf.CfTranslator;
|
||||
import com.android.dx.dex.file.DexFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFile;
|
||||
import org.jetbrains.kotlin.test.KtAssert;
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class DxChecker {
|
||||
|
||||
public static final boolean RUN_DX_CHECKER = true;
|
||||
private static final Pattern STACK_TRACE_PATTERN = Pattern.compile("[\\s]+at .*");
|
||||
|
||||
private DxChecker() {
|
||||
}
|
||||
|
||||
public static void check(ClassFileFactory outputFiles) {
|
||||
Main.Arguments arguments = new Main.Arguments();
|
||||
String[] array = new String[1];
|
||||
array[0] = "testArgs";
|
||||
arguments.parse(array);
|
||||
|
||||
for (OutputFile file : ClassFileUtilsKt.getClassFiles(outputFiles)) {
|
||||
try {
|
||||
byte[] bytes = file.asByteArray();
|
||||
if (isJava6Class(bytes)) {
|
||||
checkFileWithDx(bytes, file.getRelativePath(), arguments);
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
KtAssert.fail(generateExceptionMessage(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isJava6Class(byte[] bytes) throws IOException {
|
||||
try (DataInputStream stream = new DataInputStream(new ByteArrayInputStream(bytes))) {
|
||||
int header = stream.readInt();
|
||||
if (0xCAFEBABE != header) {
|
||||
throw new IOException("Invalid header class header: " + header);
|
||||
}
|
||||
int minor = stream.readUnsignedShort();
|
||||
int major = stream.readUnsignedShort();
|
||||
return major == Opcodes.V1_6;
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkFileWithDx(byte[] bytes, @NotNull String relativePath) {
|
||||
Main.Arguments arguments = new Main.Arguments();
|
||||
String[] array = new String[1];
|
||||
array[0] = "testArgs";
|
||||
arguments.parse(array);
|
||||
checkFileWithDx(bytes, relativePath, arguments);
|
||||
}
|
||||
|
||||
private static void checkFileWithDx(byte[] bytes, @NotNull String relativePath, @NotNull Main.Arguments arguments) {
|
||||
DirectClassFile cf = new DirectClassFile(bytes, relativePath, true);
|
||||
cf.setAttributeFactory(StdAttributeFactory.THE_ONE);
|
||||
CfTranslator.translate(
|
||||
cf,
|
||||
bytes,
|
||||
arguments.cfOptions,
|
||||
arguments.dexOptions,
|
||||
new DexFile(arguments.dexOptions)
|
||||
);
|
||||
}
|
||||
|
||||
private static String generateExceptionMessage(Throwable e) {
|
||||
StringWriter writer = new StringWriter();
|
||||
try (PrintWriter printWriter = new PrintWriter(writer)) {
|
||||
e.printStackTrace(printWriter);
|
||||
String stackTrace = writer.toString();
|
||||
Matcher matcher = STACK_TRACE_PATTERN.matcher(stackTrace);
|
||||
return matcher.replaceAll("");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,8 @@ class LauncherScriptTest : TestCaseWithTmpdir() {
|
||||
expectedStdout: String = "",
|
||||
expectedStderr: String = "",
|
||||
expectedExitCode: Int = 0,
|
||||
workDirectory: File? = null
|
||||
workDirectory: File? = null,
|
||||
environment: Map<String, String> = emptyMap(),
|
||||
) {
|
||||
val executableFileName = if (SystemInfo.isWindows) "$executableName.bat" else executableName
|
||||
val launcherFile = File(PathUtil.kotlinPathsForDistDirectory.homePath, "bin/$executableFileName")
|
||||
@@ -43,9 +44,10 @@ class LauncherScriptTest : TestCaseWithTmpdir() {
|
||||
// So, use ProcessBuilder instead.
|
||||
val pb = ProcessBuilder(
|
||||
launcherFile.absolutePath,
|
||||
// In cmd, `=` is delimeter, so we need to surround parameter with quotes.
|
||||
// In cmd, `=` is delimiter, so we need to surround parameter with quotes.
|
||||
*quoteIfNeeded(args)
|
||||
)
|
||||
pb.environment().putAll(environment)
|
||||
pb.directory(workDirectory)
|
||||
val process = pb.start()
|
||||
val stdout =
|
||||
@@ -334,4 +336,17 @@ fun f() : Result<Int> = Result.success(42)
|
||||
)
|
||||
runProcess("kotlin", "-howtorun", "classfile", "test.HelloWorldKt", expectedStdout = "Hello!\n", workDirectory = tmpdir)
|
||||
}
|
||||
|
||||
fun testKotlincJdk15() {
|
||||
val jdk15 = mapOf("JAVA_HOME" to KtTestUtil.getJdk15Home().absolutePath)
|
||||
runProcess(
|
||||
"kotlinc", "$testDataDirectory/helloWorld.kt", "-d", tmpdir.path,
|
||||
environment = jdk15,
|
||||
)
|
||||
|
||||
runProcess(
|
||||
"kotlin", "-e", "listOf('O'.toString() + 'K')",
|
||||
expectedStdout = "[OK]\n", environment = jdk15,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ class TestStdlibWithDxTest {
|
||||
for (entry in generateSequence { zip.nextEntry }) {
|
||||
if (entry.name.endsWith(".class") && !entry.name.startsWith("META-INF/")) {
|
||||
val bytes = zip.readBytes()
|
||||
DxChecker.checkFileWithDx(bytes, entry.name)
|
||||
files.add(Pair(bytes, entry.name))
|
||||
}
|
||||
}
|
||||
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
import java.net.URI
|
||||
|
||||
plugins {
|
||||
base
|
||||
`maven-publish`
|
||||
id("com.jfrog.bintray") version "1.8.4"
|
||||
}
|
||||
|
||||
apply(from = "../../gradle/versions.gradle.kts")
|
||||
|
||||
val androidBuildToolsVersion = extra["versions.androidBuildTools"] as String
|
||||
val androidDxSourcesVersion = extra["versions.androidDxSources"] as String
|
||||
|
||||
group = "org.jetbrains.kotlin"
|
||||
version = androidBuildToolsVersion
|
||||
|
||||
repositories {
|
||||
ivy {
|
||||
url = URI("https://dl.google.com/android/repository")
|
||||
|
||||
patternLayout {
|
||||
artifact("[artifact]_[revision](-[classifier]).[ext]")
|
||||
}
|
||||
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ivy {
|
||||
url = URI("https://android.googlesource.com/platform/dalvik/+archive/android-$androidDxSourcesVersion")
|
||||
|
||||
patternLayout {
|
||||
artifact("[artifact].[ext]")
|
||||
}
|
||||
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val androidBuildTools by configurations.creating
|
||||
val androidDxSources by configurations.creating
|
||||
|
||||
val androidDxRevision = androidBuildToolsVersion
|
||||
|
||||
dependencies {
|
||||
androidBuildTools("google:build-tools:$androidBuildToolsVersion:linux@zip")
|
||||
androidDxSources("google:dx:0@tar.gz")
|
||||
}
|
||||
|
||||
val unzipDxJar by tasks.registering {
|
||||
val outputDir = File(buildDir, name)
|
||||
val outputFile = File(outputDir, "dx.jar")
|
||||
|
||||
dependsOn(androidBuildTools)
|
||||
inputs.files(androidBuildTools)
|
||||
outputs.files(outputFile)
|
||||
|
||||
doFirst {
|
||||
project.copy {
|
||||
from(zipTree(androidBuildTools.singleFile).files)
|
||||
include("**/dx.jar")
|
||||
into(outputDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val untarDxSources by tasks.registering {
|
||||
val dxSourcesTargetDir = File(buildDir, name)
|
||||
dependsOn(androidDxSources)
|
||||
inputs.files(androidDxSources)
|
||||
outputs.dir(dxSourcesTargetDir)
|
||||
doFirst {
|
||||
project.copy {
|
||||
from(tarTree(androidDxSources.singleFile))
|
||||
include("src/**")
|
||||
includeEmptyDirs = false
|
||||
into(dxSourcesTargetDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val prepareDxSourcesJar by tasks.registering(Jar::class) {
|
||||
dependsOn(untarDxSources)
|
||||
from(untarDxSources)
|
||||
|
||||
archiveClassifier.set("sources")
|
||||
}
|
||||
|
||||
val dxArtifact = artifacts.add("default", unzipDxJar.outputs.files.singleFile) {
|
||||
builtBy(unzipDxJar)
|
||||
}
|
||||
|
||||
artifacts.add("archives", dxArtifact)
|
||||
artifacts.add("archives", prepareDxSourcesJar)
|
||||
|
||||
apply(from="../publishing.gradle.kts")
|
||||
@@ -11,6 +11,8 @@ import java.io.IOException
|
||||
import kotlin.io.path.*
|
||||
|
||||
object GeneratorsFileUtil {
|
||||
val isTeamCityBuild: Boolean = System.getProperty("TEAMCITY_VERSION") != null
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
@@ -18,6 +20,7 @@ object GeneratorsFileUtil {
|
||||
fun writeFileIfContentChanged(file: File, newText: String, logNotChanged: Boolean = true) {
|
||||
val parentFile = file.parentFile
|
||||
if (!parentFile.exists()) {
|
||||
if (isTeamCityBuild) assertTeamCityMode()
|
||||
if (parentFile.mkdirs()) {
|
||||
println("Directory created: " + parentFile.absolutePath)
|
||||
} else {
|
||||
@@ -30,6 +33,7 @@ object GeneratorsFileUtil {
|
||||
}
|
||||
return
|
||||
}
|
||||
if (isTeamCityBuild) assertTeamCityMode()
|
||||
val useTempFile = !SystemInfo.isWindows
|
||||
val targetFile = file.toPath()
|
||||
val tempFile =
|
||||
@@ -43,6 +47,10 @@ object GeneratorsFileUtil {
|
||||
println()
|
||||
}
|
||||
|
||||
fun assertTeamCityMode(): Nothing {
|
||||
throw IllegalStateException("You should commit all newly generated files before pushing them to TeamCity")
|
||||
}
|
||||
|
||||
fun isFileContentChangedIgnoringLineSeparators(file: File, content: String): Boolean {
|
||||
val currentContent: String = try {
|
||||
StringUtil.convertLineSeparators(file.readText(Charsets.UTF_8))
|
||||
@@ -51,4 +59,4 @@ object GeneratorsFileUtil {
|
||||
}
|
||||
return StringUtil.convertLineSeparators(content) != currentContent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
versions.intellijSdk=202.7660.26
|
||||
versions.androidBuildTools=r23.0.1
|
||||
versions.idea.NodeJS=193.6494.7
|
||||
versions.jar.asm-all=8.0.1
|
||||
versions.jar.guava=29.0-jre
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
versions.intellijSdk=201.7223.91
|
||||
versions.androidBuildTools=r23.0.1
|
||||
versions.idea.NodeJS=193.6494.7
|
||||
versions.jar.asm-all=7.0.1
|
||||
versions.jar.guava=28.2-jre
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
versions.intellijSdk=203-SNAPSHOT
|
||||
versions.androidBuildTools=r23.0.1
|
||||
versions.idea.NodeJS=193.6494.7
|
||||
versions.jar.asm-all=8.0.1
|
||||
versions.jar.guava=29.0-jre
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
versions.intellijSdk=201.7223.91
|
||||
versions.androidBuildTools=r23.0.1
|
||||
versions.idea.NodeJS=193.6494.7
|
||||
versions.androidStudioRelease=4.1.0.18
|
||||
versions.androidStudioBuild=201.6823847
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
versions.intellijSdk=202.6397.94
|
||||
versions.androidBuildTools=r23.0.1
|
||||
versions.idea.NodeJS=193.6494.7
|
||||
versions.androidStudioRelease=4.2.0.16
|
||||
versions.androidStudioBuild=202.6939830
|
||||
|
||||
@@ -17,8 +17,6 @@ dependencies {
|
||||
compile(project(":idea:ide-common"))
|
||||
compile(project(":idea:idea-gradle"))
|
||||
|
||||
compile(androidDxJar())
|
||||
|
||||
compileOnly(project(":kotlin-android-extensions-runtime"))
|
||||
compileOnly(intellijDep())
|
||||
compileOnly(intellijPluginDep("android"))
|
||||
|
||||
@@ -8,7 +8,11 @@ package org.jetbrains.kotlin.generators.tests
|
||||
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.js.test.AbstractDceTest
|
||||
import org.jetbrains.kotlin.js.test.AbstractJsLineNumberTest
|
||||
import org.jetbrains.kotlin.js.test.es6.semantics.*
|
||||
import org.jetbrains.kotlin.js.test.compatibility.binary.AbstractJsKlibBinaryCompatibilityTest
|
||||
import org.jetbrains.kotlin.js.test.es6.semantics.AbstractIrBoxJsES6Test
|
||||
import org.jetbrains.kotlin.js.test.es6.semantics.AbstractIrJsCodegenBoxES6Test
|
||||
import org.jetbrains.kotlin.js.test.es6.semantics.AbstractIrJsCodegenInlineES6Test
|
||||
import org.jetbrains.kotlin.js.test.es6.semantics.AbstractIrJsTypeScriptExportES6Test
|
||||
import org.jetbrains.kotlin.js.test.ir.semantics.*
|
||||
import org.jetbrains.kotlin.js.test.semantics.*
|
||||
import org.jetbrains.kotlin.js.test.wasm.semantics.AbstractIrCodegenBoxWasmTest
|
||||
@@ -124,5 +128,11 @@ fun main(args: Array<String>) {
|
||||
model("codegen/box/arrays", targetBackend = TargetBackend.JS)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("js/js.tests/tests-gen", "compiler/testData/binaryCompatibility", testRunnerMethodName = "runTest0") {
|
||||
testClass<AbstractJsKlibBinaryCompatibilityTest> {
|
||||
model("klibEvolution", targetBackend = TargetBackend.JS_IR)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.js.test.compatibility.binary
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.js.K2JSCompiler
|
||||
import org.jetbrains.kotlin.compatibility.binary.*
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.js.test.V8JsTestChecker
|
||||
import org.jetbrains.kotlin.library.KLIB_FILE_EXTENSION
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractJsKlibBinaryCompatibilityTest : AbstractKlibBinaryCompatibilityTest() {
|
||||
|
||||
override fun createEnvironment() =
|
||||
KotlinCoreEnvironment.createForTests(testRootDisposable, CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES)
|
||||
|
||||
private fun TestModule.name(version: Int) = if (this.hasVersions) "version$version/${this.name}" else this.name
|
||||
|
||||
private fun List<TestModule>.toLibrariesArg(version: Int): String {
|
||||
val fileNames = this.map { it.name(version) }
|
||||
val allDependencies = fileNames.map { File(workingDir, it.klib).absolutePath } + STDLIB_DEPENDENCY
|
||||
return allDependencies.joinToString(File.pathSeparator)
|
||||
}
|
||||
|
||||
private fun TestModule.dependenciesToLibrariesArg(version: Int): String =
|
||||
this.dependencies.map { it as? TestModule ?: error("Unexpected dependency kind: $it") }.toLibrariesArg(version)
|
||||
|
||||
private val TestModule.jsPath get() = File(workingDir, "${this.name}.js").absolutePath
|
||||
|
||||
private fun createFiles(files: List<TestFile>): List<String> =
|
||||
files.map {
|
||||
val file = File(workingDir, it.name)
|
||||
file.writeText(it.content)
|
||||
file.absolutePath
|
||||
}
|
||||
|
||||
private fun runnerFunctionFile(): String {
|
||||
val file = File(workingDir, RUNNER_FUNCTION_FILE)
|
||||
file.writeText(runnerFileText)
|
||||
return file.absolutePath
|
||||
}
|
||||
|
||||
override fun produceKlib(module: TestModule, version: Int) {
|
||||
val args = K2JSCompilerArguments().apply {
|
||||
freeArgs = createFiles(module.versionFiles(version))
|
||||
libraries = module.dependenciesToLibrariesArg(version = version)
|
||||
outputFile = File(workingDir, "${module.name(version)}.$KLIB_FILE_EXTENSION").absolutePath
|
||||
irProduceKlibFile = true
|
||||
irOnly = true
|
||||
irModuleName = module.name
|
||||
repositries = "$workingDir${File.pathSeparator}$workingDir/version$version"
|
||||
}
|
||||
K2JSCompiler().exec(TestMessageCollector(), Services.EMPTY, args)
|
||||
}
|
||||
|
||||
override fun produceProgram(module: TestModule) {
|
||||
assert(!module.hasVersions)
|
||||
val args = K2JSCompilerArguments().apply {
|
||||
freeArgs = createFiles(module.files) + runnerFunctionFile()
|
||||
libraries = module.dependenciesToLibrariesArg(version = 2)
|
||||
outputFile = File(workingDir, module.name.js).absolutePath
|
||||
irProduceJs = true
|
||||
irOnly = true
|
||||
irModuleName = module.name
|
||||
repositries = "$workingDir${File.pathSeparator}$workingDir/version2"
|
||||
}
|
||||
K2JSCompiler().exec(TestMessageCollector(), Services.EMPTY, args)
|
||||
}
|
||||
|
||||
override fun runProgram(module: TestModule, expectedResult: String) {
|
||||
testChecker.check(listOf(module.jsPath), module.name, null, RUNNER_FUNCTION, expectedResult, false)
|
||||
}
|
||||
|
||||
// TODO: ask js folks what to use here.
|
||||
protected open val testChecker get() = V8JsTestChecker
|
||||
|
||||
companion object {
|
||||
private val String.klib: String get() = "$this.$KLIB_FILE_EXTENSION"
|
||||
private val String.js: String get() = "$this.js"
|
||||
|
||||
private val STDLIB_DEPENDENCY = System.getProperty("kotlin.js.full.stdlib.path")
|
||||
|
||||
// A @JsExport wrapper for box().
|
||||
// Otherwise box() is not available in js.
|
||||
private const val RUNNER_FUNCTION = "__js_exported_wrapper_function"
|
||||
private const val RUNNER_FUNCTION_FILE = "js_exported_wrapper_function.kt"
|
||||
private val runnerFileText = """
|
||||
@JsExport
|
||||
fun $RUNNER_FUNCTION() = $TEST_FUNCTION()
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractJsKlibBinaryCompatibilityErrorTest : AbstractJsKlibBinaryCompatibilityTest()
|
||||
|
||||
private class TestMessageCollector : MessageCollector {
|
||||
override fun clear() {}
|
||||
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
|
||||
if (severity.isError()) error(message)
|
||||
}
|
||||
override fun hasErrors(): Boolean = error("Unsupported operation")
|
||||
}
|
||||
+227
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.js.test.compatibility.binary;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/binaryCompatibility/klibEvolution")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class JsKlibBinaryCompatibilityTestGenerated extends AbstractJsKlibBinaryCompatibilityTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("addAbstractMemberBody.kt")
|
||||
public void testAddAbstractMemberBody() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addAbstractMemberBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addCompanionObject.kt")
|
||||
public void testAddCompanionObject() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addCompanionObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addDefaultImplementations.kt")
|
||||
public void testAddDefaultImplementations() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addDefaultImplementations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addEnumClassMember.kt")
|
||||
public void testAddEnumClassMember() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addEnumClassMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addLateinitToVar.kt")
|
||||
public void testAddLateinitToVar() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addLateinitToVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addOpenToClass.kt")
|
||||
public void testAddOpenToClass() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addOpenToClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addOpenToMember.kt")
|
||||
public void testAddOpenToMember() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addOpenToMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addOrRemoveConst.kt")
|
||||
public void testAddOrRemoveConst() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addOrRemoveConst.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addOrRemoveInitBlock.kt")
|
||||
public void testAddOrRemoveInitBlock() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addOrRemoveInitBlock.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addOverloads.kt")
|
||||
public void testAddOverloads() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addOverloads.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addParameterDefaulValue.kt")
|
||||
public void testAddParameterDefaulValue() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addParameterDefaulValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addProeprtyAccessor.kt")
|
||||
public void testAddProeprtyAccessor() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addProeprtyAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("addingSealedClassMember.kt")
|
||||
public void testAddingSealedClassMember() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/addingSealedClassMember.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInKlibEvolution() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/binaryCompatibility/klibEvolution"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("changeBaseClassOrder.kt")
|
||||
public void testChangeBaseClassOrder() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/changeBaseClassOrder.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changeCompanionToNestedObject.kt")
|
||||
public void testChangeCompanionToNestedObject() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/changeCompanionToNestedObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changeConstInitialization.kt")
|
||||
public void testChangeConstInitialization() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/changeConstInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changeNamesOfTypeParameters.kt")
|
||||
public void testChangeNamesOfTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/changeNamesOfTypeParameters.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changeObjectToCompanion.kt")
|
||||
public void testChangeObjectToCompanion() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/changeObjectToCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changeParameterDefaultValue.kt")
|
||||
public void testChangeParameterDefaultValue() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/changeParameterDefaultValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changePropertyFromValToVar.kt")
|
||||
public void testChangePropertyFromValToVar() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/changePropertyFromValToVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("changePropertyInitialization.kt")
|
||||
public void testChangePropertyInitialization() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/changePropertyInitialization.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("constructorParameterMarkValVar.kt")
|
||||
public void testConstructorParameterMarkValVar() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/constructorParameterMarkValVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deleteOverrideMember.kt")
|
||||
public void testDeleteOverrideMember() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/deleteOverrideMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("deletePrivateMembers.kt")
|
||||
public void testDeletePrivateMembers() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/deletePrivateMembers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineBodyChange.kt")
|
||||
public void testInlineBodyChange() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/inlineBodyChange.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunction.kt")
|
||||
public void testInlineFunction() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/inlineFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("makeFunctionInfixOrTailrec.kt")
|
||||
public void testMakeFunctionInfixOrTailrec() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/makeFunctionInfixOrTailrec.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("moreSpecificBaseClass.kt")
|
||||
public void testMoreSpecificBaseClass() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/moreSpecificBaseClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("moveMemberUpInHierarchy.kt")
|
||||
public void testMoveMemberUpInHierarchy() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/moveMemberUpInHierarchy.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("newFakeOverride.kt")
|
||||
public void testNewFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/newFakeOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("newOverrideMember.kt")
|
||||
public void testNewOverrideMember() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/newOverrideMember.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removeAbstractFromClass.kt")
|
||||
public void testRemoveAbstractFromClass() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/removeAbstractFromClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removeInfixOrTailrecFromFunction.kt")
|
||||
public void testRemoveInfixOrTailrecFromFunction() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/removeInfixOrTailrecFromFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removeLateinitFromVar.kt")
|
||||
public void testRemoveLateinitFromVar() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/removeLateinitFromVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("removePropertyAccessor.kt")
|
||||
public void testRemovePropertyAccessor() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/removePropertyAccessor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("renameArguments.kt")
|
||||
public void testRenameArguments() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/renameArguments.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("reorderClassConstructors.kt")
|
||||
public void testReorderClassConstructors() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/reorderClassConstructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("turnClassIntoDataClass.kt")
|
||||
public void testTurnClassIntoDataClass() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/turnClassIntoDataClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("widenSuperMemberVisibility.kt")
|
||||
public void testWidenSuperMemberVisibility() throws Exception {
|
||||
runTest("compiler/testData/binaryCompatibility/klibEvolution/widenSuperMemberVisibility.kt");
|
||||
}
|
||||
}
|
||||
@@ -18,12 +18,12 @@
|
||||
buildKotlinVersion=1.5.0-dev-2205
|
||||
buildKotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.0-dev-2205,branch:default:any,pinned:true/artifacts/content/maven
|
||||
remoteRoot=konan_tests
|
||||
kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.20-dev-7,branch:default:any,pinned:true/artifacts/content/maven
|
||||
kotlinVersion=1.5.20-dev-7
|
||||
kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.20-dev-7,branch:default:any,pinned:true/artifacts/content/maven
|
||||
kotlinStdlibVersion=1.5.20-dev-7
|
||||
kotlinStdlibTestsVersion=1.5.20-dev-7
|
||||
testKotlinCompilerVersion=1.5.20-dev-7
|
||||
kotlinCompilerRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.20-dev-60,branch:default:any,pinned:true/artifacts/content/maven
|
||||
kotlinVersion=1.5.20-dev-60
|
||||
kotlinStdlibRepo=https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:1.5.20-dev-60,branch:default:any,pinned:true/artifacts/content/maven
|
||||
kotlinStdlibVersion=1.5.20-dev-60
|
||||
kotlinStdlibTestsVersion=1.5.20-dev-60
|
||||
testKotlinCompilerVersion=1.5.20-dev-60
|
||||
konanVersion=1.5.0
|
||||
|
||||
# A version of Xcode required to build the Kotlin/Native compiler.
|
||||
|
||||
+2
-1
@@ -128,7 +128,8 @@ class BuildCacheRelocationIT : BaseGradleIT() {
|
||||
cacheableTaskNames = listOf(
|
||||
"kaptKotlin", "kaptGenerateStubsKotlin", "compileKotlin", "compileTestKotlin", "compileJava"
|
||||
),
|
||||
initProject = { File(projectDir, "build.gradle").appendText("\nkapt.useBuildCache = true") }
|
||||
initProject = { File(projectDir, "build.gradle").appendText("\nkapt.useBuildCache = true") },
|
||||
withAnotherGradleHome = true
|
||||
),
|
||||
TestCase("kotlin2JsDceProject",
|
||||
taskToExecute = arrayOf("assemble", "runDceKotlinJs"),
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ abstract class KaptWithoutKotlincTask @Inject constructor(private val workerExec
|
||||
@get:Input
|
||||
internal val kotlinAndroidPluginWrapperPluginDoesNotExist = project.plugins.none { it is KotlinAndroidPluginWrapper }
|
||||
|
||||
@get:Input
|
||||
@get:Classpath
|
||||
internal val kotlinStdlibClasspath = findKotlinStdlibClasspath(project)
|
||||
|
||||
@get:Internal
|
||||
|
||||
+10
-1
@@ -131,7 +131,16 @@ internal fun applyLanguageSettingsToKotlinOptions(
|
||||
}
|
||||
}
|
||||
|
||||
private val apiVersionValues = ApiVersion.run { listOf(KOTLIN_1_0, KOTLIN_1_1, KOTLIN_1_2, KOTLIN_1_3, KOTLIN_1_4) }
|
||||
private val apiVersionValues = ApiVersion.run {
|
||||
listOf(
|
||||
KOTLIN_1_0,
|
||||
KOTLIN_1_1,
|
||||
KOTLIN_1_2,
|
||||
KOTLIN_1_3,
|
||||
KOTLIN_1_4,
|
||||
KOTLIN_1_5
|
||||
)
|
||||
}
|
||||
|
||||
internal fun parseLanguageVersionSetting(versionString: String) = LanguageVersion.fromVersionString(versionString)
|
||||
internal fun parseApiVersionSettings(versionString: String) = apiVersionValues.find { it.versionString == versionString }
|
||||
|
||||
Reference in New Issue
Block a user