mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-26 15:51:48 +00:00
Compare commits
9 Commits
rr/ic/scri
...
native-syn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a236ca68ec | ||
|
|
6c6c91be70 | ||
|
|
d59004dc0d | ||
|
|
62ca6fb7d2 | ||
|
|
5eac21b73b | ||
|
|
d54c618466 | ||
|
|
f24e766ac8 | ||
|
|
c7043665f5 | ||
|
|
7a7424c6bb |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -12,7 +12,6 @@
|
||||
/android-studio/sdk
|
||||
out/
|
||||
/tmp
|
||||
kotlin-ide/
|
||||
workspace.xml
|
||||
*.versionsBackup
|
||||
/idea/testData/debugger/tinyApp/classes*
|
||||
@@ -33,8 +32,6 @@ build/
|
||||
.idea/modules
|
||||
.idea/runConfigurations/JPS_*.xml
|
||||
.idea/runConfigurations/PILL_*.xml
|
||||
.idea/runConfigurations/_FP_*.xml
|
||||
.idea/runConfigurations/_MT_*.xml
|
||||
.idea/libraries
|
||||
.idea/modules.xml
|
||||
.idea/gradle.xml
|
||||
@@ -57,8 +54,7 @@ build/
|
||||
.idea/artifacts/kotlin_test_js_ir_*
|
||||
.idea/artifacts/kotlin_stdlib_wasm_*
|
||||
.idea/jarRepositories.xml
|
||||
.idea/csv-plugin.xml
|
||||
.idea/libraries-with-intellij-classes.xml
|
||||
kotlin-ultimate/
|
||||
node_modules/
|
||||
.rpt2_cache/
|
||||
libraries/tools/kotlin-test-js-runner/lib/
|
||||
@@ -67,4 +63,4 @@ buildSrcTmp/
|
||||
distTmp/
|
||||
outTmp/
|
||||
/test.output
|
||||
/kotlin-native/dist
|
||||
/kotlin-native/dist
|
||||
23
.idea/codeStyles/Project.xml
generated
23
.idea/codeStyles/Project.xml
generated
@@ -63,6 +63,27 @@
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<option name="FIELD_ANNOTATION_WRAP" value="0" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
|
||||
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
|
||||
<option name="CALL_PARAMETERS_WRAP" value="1" />
|
||||
<option name="METHOD_PARAMETERS_WRAP" value="5" />
|
||||
<option name="BINARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="FOR_STATEMENT_WRAP" value="5" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="ASSIGNMENT_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="PROTO">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
@@ -80,4 +101,4 @@
|
||||
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
</component>
|
||||
|
||||
8
.idea/dictionaries/igor.xml
generated
8
.idea/dictionaries/igor.xml
generated
@@ -1,8 +0,0 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="igor">
|
||||
<words>
|
||||
<w>descr</w>
|
||||
<w>exprs</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
9
.idea/dictionaries/sebastiansellmair.xml
generated
9
.idea/dictionaries/sebastiansellmair.xml
generated
@@ -1,9 +0,0 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="sebastiansellmair">
|
||||
<words>
|
||||
<w>cinterops</w>
|
||||
<w>interops</w>
|
||||
<w>klibrary</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
4
.idea/runConfigurations/Generate_All_Tests.xml
generated
4
.idea/runConfigurations/Generate_All_Tests.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
|
||||
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
|
||||
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -11,7 +11,7 @@
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":compiler:fir:checkers:generateCheckersComponents" />
|
||||
<option value=":idea-frontend-fir:generateCode" />
|
||||
<option value=":idea:idea-frontend-fir:generateCode" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
@@ -21,4 +21,4 @@
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
21
.idea/runConfigurations/Generate_FIR_tree.xml
generated
21
.idea/runConfigurations/Generate_FIR_tree.xml
generated
@@ -1,21 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate FIR tree" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/compiler/fir/tree" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="generateTree" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
<GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
|
||||
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/kotlin-stdlib-gen" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
4
.idea/runConfigurations/IDEA.xml
generated
4
.idea/runConfigurations/IDEA.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
4
.idea/runConfigurations/IDEA_Ultimate.xml
generated
4
.idea/runConfigurations/IDEA_Ultimate.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
4
.idea/runConfigurations/IDEA__Not_Internal_.xml
generated
4
.idea/runConfigurations/IDEA__Not_Internal_.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -16,4 +16,4 @@
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
25
.idea/runConfigurations/Test__Commonizer.xml
generated
25
.idea/runConfigurations/Test__Commonizer.xml
generated
@@ -1,25 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: Commonizer" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="--tests "org.jetbrains.kotlin.gradle.CommonizerHierarchicalIT" --tests "org.jetbrains.kotlin.gradle.CommonizerIT" --tests "org.jetbrains.kotlin.commonizer.**"" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value=":native:kotlin-klib-commonizer-api:test" />
|
||||
<option value=":native:kotlin-klib-commonizer:test" />
|
||||
<option value=":kotlin-gradle-plugin-integration-tests:test" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
4
.idea/runConfigurations/Test__KMM.xml
generated
4
.idea/runConfigurations/Test__KMM.xml
generated
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
|
||||
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -17,4 +17,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
|
||||
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/binary-compatibility-validator" />
|
||||
@@ -18,4 +18,4 @@
|
||||
</ExternalSystemSettings>
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
|
||||
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -19,4 +19,4 @@
|
||||
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
12
.idea/vcs.xml
generated
12
.idea/vcs.xml
generated
@@ -8,18 +8,6 @@
|
||||
<inspection_tool class="SubjectLimit" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
<component name="GithubSharedProjectSettings">
|
||||
<option name="branchProtectionPatterns">
|
||||
<list>
|
||||
<option value="master" />
|
||||
<option value="1\.5\.0-M2" />
|
||||
<option value="1\.5\.0" />
|
||||
<option value="1\.5\.20" />
|
||||
<option value="1\.5\.20-M1-release" />
|
||||
<option value="1\.5\.20-RC-release" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="IssueNavigationConfiguration">
|
||||
<option name="links">
|
||||
<list>
|
||||
|
||||
3272
ChangeLog.md
3272
ChangeLog.md
File diff suppressed because it is too large
Load Diff
63
ReadMe.md
63
ReadMe.md
@@ -41,24 +41,20 @@ Support for multiplatform programming is one of Kotlin’s key benefits. It redu
|
||||
|
||||
## Build environment requirements
|
||||
|
||||
This repository is using [Gradle toolchains](https://docs.gradle.org/current/userguide/toolchains.html) feature
|
||||
to select and auto-provision required JDKs from [AdoptOpenJdk](https://adoptopenjdk.net) project.
|
||||
In order to build Kotlin distribution you need to have:
|
||||
|
||||
Unfortunately [AdoptOpenJdk](https://adoptopenjdk.net) project does not provide required JDK 1.6 and 1.7 images,
|
||||
so you could either download them manually and provide path to installation via `JDK_16` and `JDK_17` environment variables or
|
||||
use following SDK managers:
|
||||
- [Asdf-vm](https://asdf-vm.com/)
|
||||
- [Jabba](https://github.com/shyiko/jabba)
|
||||
- [SDKMAN!](https://sdkman.io/)
|
||||
- JDK 1.6, 1.7, 1.8 and 9
|
||||
- Setup environment variables as following:
|
||||
|
||||
Alternatively, it is still possible to only provide required JDKs via environment variables
|
||||
(see [gradle.properties](./gradle.properties#L5) for supported variable names). To ensure Gradle uses only JDKs
|
||||
from environmental variables - disable Gradle toolchain auto-detection by passing `-Porg.gradle.java.installations.auto-detect=false` option
|
||||
(or put it into `$GRADLE_USER_HOME/gradle.properties`).
|
||||
JAVA_HOME="path to JDK 1.8"
|
||||
JDK_16="path to JDK 1.6"
|
||||
JDK_17="path to JDK 1.7"
|
||||
JDK_18="path to JDK 1.8"
|
||||
JDK_9="path to JDK 9"
|
||||
|
||||
For local development, if you're not working on bytecode generation or the standard library, it's OK to avoid installing JDK 1.6 and JDK 1.7.
|
||||
Add `kotlin.build.isObsoleteJdkOverrideEnabled=true` to the `local.properties` file, so build will only use JDK 1.8+. Note, that in this
|
||||
case, build will have Gradle remote build cache misses for some tasks.
|
||||
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 1.8 and JDK 9 installed, and to point `JDK_16` and `JDK_17` environment variables to your JDK 1.8 installation.
|
||||
|
||||
You also can use [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties) to setup `JDK_*` variables.
|
||||
|
||||
Note: The JDK 6 for MacOS is not available on Oracle's site. You can install it by
|
||||
|
||||
@@ -110,8 +106,6 @@ To reproduce TeamCity build use `-Pteamcity=true` flag. Local builds don't run p
|
||||
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
|
||||
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
|
||||
|
||||
To build Kotlin/Native, see
|
||||
[kotlin-native/README.md](kotlin-native/README.md#building-from-source).
|
||||
|
||||
### Building for different versions of IntelliJ IDEA and Android Studio
|
||||
|
||||
@@ -151,27 +145,28 @@ From this root project there are Run/Debug Configurations for running `IDEA` or
|
||||
* Run the `IDEA` run configuration in the project
|
||||
* A child IntelliJ IDEA with the Kotlin plugin will then startup
|
||||
|
||||
### Dependency verification
|
||||
### Including into composite build
|
||||
|
||||
We have a [dependencies verification](https://docs.gradle.org/current/userguide/dependency_verification.html) feature enabled in the
|
||||
repository for all Gradle builds. Gradle will check hashes (md5 and sha256) of used dependencies and will fail builds with
|
||||
`Dependency verification failed` errors when local artifacts are absent or have different hashes listed in the
|
||||
[verification-metadata.xml](https://github.com/JetBrains/kotlin/blob/master/gradle/verification-metadata.xml) file.
|
||||
To include kotlin compiler into [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) you need to define `dependencySubstitution` for `kotlin-compiler` module in `settings.gradle.kts`
|
||||
|
||||
It's expected that `verification-metadata.xml` should only be updated with the commits that modify the build. There are some tips how
|
||||
to perform such updates:
|
||||
```Kotlin
|
||||
includeBuild("/path/to/kotlin") {
|
||||
dependencySubstitution {
|
||||
substitute(module("org.jetbrains.kotlin:kotlin-compiler"))
|
||||
.with(project(":include:kotlin-compiler"))
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Use auto-generation for getting an initial list of new hashes (verify updates relate to you changes).
|
||||
or in `settings.gradle`
|
||||
|
||||
`./gradlew -M sha256,md5 help`
|
||||
|
||||
*(any other task may be used instead of `help`)*
|
||||
|
||||
- Consider removing old versions from the file if you are updating dependencies.
|
||||
- Leave meaningful `origin` attribute (instead of `Generated by Gradle`) if you did some manual verification of the artifact.
|
||||
- Always do manual verification if several hashes are needed and a new `also-trust` tag has to be added.
|
||||
- If you’re adding a dependency with OS mentioning in an artifact name (`darwin`, `mac`, `osx`, `linux`, `windows`), remember to add
|
||||
counterparts for other platforms.
|
||||
```Groovy
|
||||
includeBuild('/path/to/kotlin') {
|
||||
dependencySubstitution {
|
||||
substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler')
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# License
|
||||
Kotlin is distributed under the terms of the Apache License (Version 2.0). See [license folder](license/README.md) for details.
|
||||
|
||||
@@ -1,11 +1,36 @@
|
||||
import kotlinx.benchmark.gradle.benchmark
|
||||
|
||||
val benchmarks_version = "0.3.1"
|
||||
val benchmarks_version = "0.2.0-dev-7"
|
||||
buildscript {
|
||||
val benchmarks_version = "0.2.0-dev-7"
|
||||
|
||||
repositories {
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
if (cacheRedirectorEnabled) {
|
||||
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
|
||||
} else {
|
||||
maven("https://dl.bintray.com/kotlin/kotlinx")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlinx:kotlinx.benchmark.gradle:$benchmarks_version")
|
||||
}
|
||||
}
|
||||
|
||||
apply(plugin = "kotlinx.benchmark")
|
||||
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.kotlinx.benchmark") version "0.3.1"
|
||||
}
|
||||
|
||||
repositories {
|
||||
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
|
||||
if (cacheRedirectorEnabled) {
|
||||
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
|
||||
} else {
|
||||
maven("https://dl.bintray.com/kotlin/kotlinx")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -17,7 +42,7 @@ dependencies {
|
||||
compile(jpsStandalone()) { includeJars("jps-model") }
|
||||
compile(intellijPluginDep("java"))
|
||||
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
|
||||
compile("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:$benchmarks_version")
|
||||
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -67,16 +92,18 @@ benchmark {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.matching { it is Zip && it.name == "mainBenchmarkJar" }.configureEach {
|
||||
this as Zip
|
||||
isZip64 = true
|
||||
archiveFileName.set("benchmarks.jar")
|
||||
}
|
||||
|
||||
val benchmarkTasks = listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark")
|
||||
tasks.matching { it is JavaExec && it.name in benchmarkTasks }.configureEach {
|
||||
this as JavaExec
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
tasks.named("classes") {
|
||||
doLast {
|
||||
tasks.named("mainBenchmarkJar", Zip::class.java) {
|
||||
isZip64 = true
|
||||
archiveName = "benchmarks.jar"
|
||||
}
|
||||
listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark").forEach {
|
||||
tasks.named(it, JavaExec::class.java) {
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<JavaExec>("runBenchmark") {
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.intellij.psi.PsiFileFactory
|
||||
import com.intellij.psi.impl.PsiFileFactoryImpl
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import com.intellij.testFramework.LightVirtualFile
|
||||
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
|
||||
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
|
||||
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
@@ -26,7 +25,7 @@ import org.jetbrains.kotlin.context.withProject
|
||||
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
|
||||
import org.jetbrains.kotlin.fir.createSessionForTests
|
||||
import org.jetbrains.kotlin.fir.createSession
|
||||
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
|
||||
import org.jetbrains.kotlin.fir.resolve.firProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
|
||||
@@ -148,11 +147,10 @@ abstract class AbstractSimpleFileBenchmark {
|
||||
bh.consume(result.shouldGenerateCode)
|
||||
}
|
||||
|
||||
@OptIn(ObsoleteTestInfrastructure::class)
|
||||
private fun analyzeGreenFileIr(bh: Blackhole) {
|
||||
val scope = GlobalSearchScope.filesScope(env.project, listOf(file.virtualFile))
|
||||
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
|
||||
val session = createSessionForTests(env, scope)
|
||||
val session = createSession(env, scope)
|
||||
val firProvider = session.firProvider as FirProviderImpl
|
||||
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ dependencies {
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(protobufFull())
|
||||
testCompile(kotlinStdlib())
|
||||
Platform[193].orLower {
|
||||
testCompileOnly(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
|
||||
}
|
||||
testRuntime(project(":kotlin-reflect"))
|
||||
}
|
||||
|
||||
|
||||
@@ -26,17 +26,15 @@ open class GeneratedFile(
|
||||
val outputFile: File
|
||||
) {
|
||||
val sourceFiles = sourceFiles.sortedBy { it.path }
|
||||
|
||||
override fun toString(): String = "${this::class.java.simpleName}: $outputFile"
|
||||
}
|
||||
|
||||
class GeneratedJvmClass(
|
||||
sourceFiles: Collection<File>,
|
||||
outputFile: File
|
||||
class GeneratedJvmClass (
|
||||
sourceFiles: Collection<File>,
|
||||
outputFile: File
|
||||
) : GeneratedFile(sourceFiles, outputFile) {
|
||||
val outputClass = LocalFileKotlinClass.create(outputFile).sure {
|
||||
"Couldn't load KotlinClass from $outputFile; it may happen because class doesn't have valid Kotlin annotations"
|
||||
}
|
||||
}
|
||||
|
||||
fun File.isModuleMappingFile() = extension == ModuleMapping.MAPPING_FILE_EXT && parentFile.name == "META-INF"
|
||||
fun File.isModuleMappingFile() = extension == ModuleMapping.MAPPING_FILE_EXT && parentFile.name == "META-INF"
|
||||
|
||||
@@ -17,7 +17,6 @@ enum class BuildAttributeKind : Serializable {
|
||||
|
||||
enum class BuildAttribute(val kind: BuildAttributeKind) : Serializable {
|
||||
NO_BUILD_HISTORY(BuildAttributeKind.REBUILD_REASON),
|
||||
NO_ABI_SNAPSHOT(BuildAttributeKind.REBUILD_REASON),
|
||||
CACHE_CORRUPTION(BuildAttributeKind.REBUILD_REASON),
|
||||
UNKNOWN_CHANGES_IN_GRADLE_INPUTS(BuildAttributeKind.REBUILD_REASON),
|
||||
JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED(BuildAttributeKind.REBUILD_REASON),
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.io.Serializable
|
||||
|
||||
@Suppress("Reformat")
|
||||
enum class BuildTime(val parent: BuildTime? = null) : Serializable {
|
||||
GRADLE_TASK_ACTION,
|
||||
GRADLE_TASK,
|
||||
CLEAR_OUTPUT(GRADLE_TASK),
|
||||
BACKUP_OUTPUT(GRADLE_TASK),
|
||||
@@ -21,10 +20,6 @@ enum class BuildTime(val parent: BuildTime? = null) : Serializable {
|
||||
NON_INCREMENTAL_COMPILATION_OUT_OF_PROCESS(RUN_COMPILER),
|
||||
NON_INCREMENTAL_COMPILATION_DAEMON(RUN_COMPILER),
|
||||
INCREMENTAL_COMPILATION(RUN_COMPILER),
|
||||
STORE_BUILD_INFO(INCREMENTAL_COMPILATION),
|
||||
JAR_SNAPSHOT(INCREMENTAL_COMPILATION),
|
||||
SET_UP_ABI_SNAPSHOTS(JAR_SNAPSHOT),
|
||||
IC_ANALYZE_JAR_FILES(JAR_SNAPSHOT),
|
||||
IC_CALCULATE_INITIAL_DIRTY_SET(INCREMENTAL_COMPILATION),
|
||||
IC_ANALYZE_CHANGES_IN_DEPENDENCIES(IC_CALCULATE_INITIAL_DIRTY_SET),
|
||||
IC_FIND_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
|
||||
|
||||
@@ -30,28 +30,6 @@ class ChangesCollector {
|
||||
private val changedMembers = hashMapOf<FqName, MutableSet<String>>()
|
||||
private val areSubclassesAffected = hashMapOf<FqName, Boolean>()
|
||||
|
||||
//TODO for test only: ProtoData or ProtoBuf
|
||||
private val storage = hashMapOf<FqName, ProtoData>()
|
||||
private val removed = ArrayList<FqName>()
|
||||
|
||||
//TODO change to immutable map
|
||||
fun protoDataChanges(): Map<FqName, ProtoData> = storage
|
||||
fun protoDataRemoved(): List<FqName> = removed
|
||||
|
||||
companion object {
|
||||
fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>) =
|
||||
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
|
||||
|
||||
fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {
|
||||
return proto.getNonPrivateNames(
|
||||
nameResolver,
|
||||
ProtoBuf.Class::getConstructorList,
|
||||
ProtoBuf.Class::getFunctionList,
|
||||
ProtoBuf.Class::getPropertyList
|
||||
) + proto.enumEntryList.map { nameResolver.getString(it.name) }
|
||||
}
|
||||
}
|
||||
|
||||
fun changes(): List<ChangeInfo> {
|
||||
val changes = arrayListOf<ChangeInfo>()
|
||||
|
||||
@@ -79,7 +57,7 @@ class ChangesCollector {
|
||||
}
|
||||
|
||||
private fun <T, R> MutableMap<T, MutableSet<R>>.getSet(key: T) =
|
||||
getOrPut(key) { HashSet() }
|
||||
getOrPut(key) { HashSet() }
|
||||
|
||||
private fun collectChangedMember(scope: FqName, name: String) {
|
||||
changedMembers.getSet(scope).add(name)
|
||||
@@ -101,35 +79,11 @@ class ChangesCollector {
|
||||
}
|
||||
}
|
||||
|
||||
fun collectProtoChanges(oldData: ProtoData?, newData: ProtoData?, collectAllMembersForNewClass: Boolean = false, packageProtoKey: String? = null) {
|
||||
fun collectProtoChanges(oldData: ProtoData?, newData: ProtoData?, collectAllMembersForNewClass: Boolean = false) {
|
||||
if (oldData == null && newData == null) {
|
||||
throw IllegalStateException("Old and new value are null")
|
||||
}
|
||||
|
||||
if (newData != null) {
|
||||
when (newData) {
|
||||
is ClassProtoData -> {
|
||||
val fqName = newData.nameResolver.getClassId(newData.proto.fqName).asSingleFqName()
|
||||
storage[fqName] = newData
|
||||
}
|
||||
is PackagePartProtoData -> {
|
||||
//TODO fqName is not unique. It's package and can be present in both java and kotlin
|
||||
val fqName = newData.packageFqName
|
||||
storage[packageProtoKey?.let { FqName(it) } ?: fqName] = newData
|
||||
}
|
||||
}
|
||||
} else {
|
||||
when (oldData) {
|
||||
is ClassProtoData -> {
|
||||
removed.add(oldData.nameResolver.getClassId(oldData.proto.fqName).asSingleFqName())
|
||||
}
|
||||
is PackagePartProtoData -> {
|
||||
//TODO fqName is not unique. It's package and can be present in both java and kotlin
|
||||
removed.add(packageProtoKey?.let { FqName(it) } ?: oldData.packageFqName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (oldData == null) {
|
||||
newData!!.collectAll(isRemoved = false, isAdded = true, collectAllMembersForNewClass = collectAllMembersForNewClass)
|
||||
return
|
||||
@@ -171,8 +125,8 @@ class ChangesCollector {
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>) =
|
||||
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
|
||||
private fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>): Set<String> =
|
||||
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
|
||||
|
||||
//TODO remember all sealed parent classes
|
||||
private fun ProtoData.collectAll(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) =
|
||||
@@ -183,15 +137,16 @@ class ChangesCollector {
|
||||
|
||||
private fun PackagePartProtoData.collectAllFromPackage(isRemoved: Boolean) {
|
||||
val memberNames =
|
||||
proto.getNonPrivateNames(
|
||||
nameResolver,
|
||||
ProtoBuf.Package::getFunctionList,
|
||||
ProtoBuf.Package::getPropertyList
|
||||
)
|
||||
proto.getNonPrivateNames(
|
||||
nameResolver,
|
||||
ProtoBuf.Package::getFunctionList,
|
||||
ProtoBuf.Package::getPropertyList
|
||||
)
|
||||
|
||||
if (isRemoved) {
|
||||
collectRemovedMembers(packageFqName, memberNames)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
collectChangedMembers(packageFqName, memberNames)
|
||||
}
|
||||
}
|
||||
@@ -206,7 +161,8 @@ class ChangesCollector {
|
||||
val collectMember = if (isRemoved) this@ChangesCollector::collectRemovedMember else this@ChangesCollector::collectChangedMember
|
||||
collectMember(classFqName.parent(), classFqName.shortName().asString())
|
||||
memberNames.forEach { collectMember(classFqName, it) }
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (!isRemoved && collectAllMembersForNewClass) {
|
||||
val memberNames = getNonPrivateMemberNames()
|
||||
memberNames.forEach { this@ChangesCollector.collectChangedMember(classFqName, it) }
|
||||
@@ -233,6 +189,15 @@ class ChangesCollector {
|
||||
addChangedParents(fqName, changedParentsFqNames)
|
||||
}
|
||||
|
||||
private fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {
|
||||
return proto.getNonPrivateNames(
|
||||
nameResolver,
|
||||
ProtoBuf.Class::getConstructorList,
|
||||
ProtoBuf.Class::getFunctionList,
|
||||
ProtoBuf.Class::getPropertyList
|
||||
) + proto.enumEntryList.map { nameResolver.getString(it.name) }
|
||||
}
|
||||
|
||||
fun collectMemberIfValueWasChanged(scope: FqName, name: String, oldValue: Any?, newValue: Any?) {
|
||||
if (oldValue == null && newValue == null) {
|
||||
throw IllegalStateException("Old and new value are null for $scope#$name")
|
||||
@@ -240,7 +205,8 @@ class ChangesCollector {
|
||||
|
||||
if (oldValue != null && newValue == null) {
|
||||
collectRemovedMember(scope, name)
|
||||
} else if (oldValue != newValue) {
|
||||
}
|
||||
else if (oldValue != newValue) {
|
||||
collectChangedMember(scope, name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.incremental
|
||||
|
||||
import com.intellij.util.io.DataExternalizer
|
||||
import org.jetbrains.kotlin.build.GeneratedFile
|
||||
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumerImpl
|
||||
import org.jetbrains.kotlin.incremental.js.IrTranslationResultValue
|
||||
import org.jetbrains.kotlin.incremental.js.TranslationResultValue
|
||||
@@ -49,7 +48,6 @@ open class IncrementalJsCache(
|
||||
private const val INLINE_FUNCTIONS = "inline-functions"
|
||||
private const val HEADER_FILE_NAME = "header.meta"
|
||||
private const val PACKAGE_META_FILE = "packages-meta"
|
||||
private const val SOURCE_TO_JS_OUTPUT = "source-to-js-output"
|
||||
|
||||
fun hasHeaderFile(cachesDir: File) = File(cachesDir, HEADER_FILE_NAME).exists()
|
||||
}
|
||||
@@ -62,7 +60,6 @@ open class IncrementalJsCache(
|
||||
private val irTranslationResults = registerMap(IrTranslationResultMap(IR_TRANSLATION_RESULT_MAP.storageFile, pathConverter))
|
||||
private val inlineFunctions = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile, pathConverter))
|
||||
private val packageMetadata = registerMap(PackageMetadataMap(PACKAGE_META_FILE.storageFile))
|
||||
private val sourceToJsOutputsMap = registerMap(SourceToJsOutputMap(SOURCE_TO_JS_OUTPUT.storageFile, pathConverter))
|
||||
|
||||
private val dirtySources = hashSetOf<File>()
|
||||
|
||||
@@ -78,7 +75,6 @@ open class IncrementalJsCache(
|
||||
|
||||
override fun markDirty(removedAndCompiledSources: Collection<File>) {
|
||||
removedAndCompiledSources.forEach { sourceFile ->
|
||||
sourceToJsOutputsMap.remove(sourceFile)
|
||||
// The common prefix of all FQN parents has to be the file package
|
||||
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minByOrNull { it.length }?.let {
|
||||
packageMetadata.remove(it)
|
||||
@@ -99,10 +95,6 @@ open class IncrementalJsCache(
|
||||
}
|
||||
}
|
||||
|
||||
fun getOutputsBySource(sourceFile: File): Collection<File> {
|
||||
return sourceToJsOutputsMap.get(sourceFile)
|
||||
}
|
||||
|
||||
fun compareAndUpdate(incrementalResults: IncrementalResultsConsumerImpl, changesCollector: ChangesCollector) {
|
||||
val translatedFiles = incrementalResults.packageParts
|
||||
|
||||
@@ -137,8 +129,8 @@ open class IncrementalJsCache(
|
||||
}
|
||||
|
||||
for ((srcFile, irData) in incrementalResults.irFileData) {
|
||||
val (fileData, types, signatures, strings, declarations, bodies, fqn, debugInfos) = irData
|
||||
irTranslationResults.put(srcFile, fileData, types, signatures, strings, declarations, bodies, fqn, debugInfos)
|
||||
val (fileData, types, signatures, strings, declarations, bodies, fqn) = irData
|
||||
irTranslationResults.put(srcFile, fileData, types, signatures, strings, declarations, bodies, fqn)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,17 +175,6 @@ open class IncrementalJsCache(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateSourceToOutputMap(
|
||||
generatedFiles: Iterable<GeneratedFile>,
|
||||
) {
|
||||
for (generatedFile in generatedFiles) {
|
||||
for (source in generatedFile.sourceFiles) {
|
||||
if (dirtySources.contains(source))
|
||||
sourceToJsOutputsMap.add(source, generatedFile.outputFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private object TranslationResultValueExternalizer : DataExternalizer<TranslationResultValue> {
|
||||
@@ -234,20 +215,17 @@ private class TranslationResultMap(
|
||||
override fun dumpValue(value: TranslationResultValue): String =
|
||||
"Metadata: ${value.metadata.md5()}, Binary AST: ${value.binaryAst.md5()}, InlineData: ${value.inlineData.md5()}"
|
||||
|
||||
@Synchronized
|
||||
fun put(sourceFile: File, newMetadata: ByteArray, newBinaryAst: ByteArray, newInlineData: ByteArray) {
|
||||
storage[pathConverter.toPath(sourceFile)] =
|
||||
TranslationResultValue(metadata = newMetadata, binaryAst = newBinaryAst, inlineData = newInlineData)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
operator fun get(sourceFile: File): TranslationResultValue? =
|
||||
storage[pathConverter.toPath(sourceFile)]
|
||||
|
||||
fun keys(): Collection<File> =
|
||||
storage.keys.map { pathConverter.toFile(it) }
|
||||
|
||||
@Synchronized
|
||||
fun remove(sourceFile: File, changesCollector: ChangesCollector) {
|
||||
val path = pathConverter.toPath(sourceFile)
|
||||
val protoBytes = storage[path]!!.metadata
|
||||
@@ -269,7 +247,6 @@ private object IrTranslationResultValueExternalizer : DataExternalizer<IrTransla
|
||||
output.writeArray(value.declarations)
|
||||
output.writeArray(value.bodies)
|
||||
output.writeArray(value.fqn)
|
||||
value.debugInfo?.let { output.writeArray(it) }
|
||||
}
|
||||
|
||||
private fun DataOutput.writeArray(array: ByteArray) {
|
||||
@@ -284,17 +261,6 @@ private object IrTranslationResultValueExternalizer : DataExternalizer<IrTransla
|
||||
return filedata
|
||||
}
|
||||
|
||||
private fun DataInput.readArrayOrNull(): ByteArray? {
|
||||
try {
|
||||
val dataSize = readInt()
|
||||
val filedata = ByteArray(dataSize)
|
||||
readFully(filedata)
|
||||
return filedata
|
||||
} catch (e: Throwable) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
override fun read(input: DataInput): IrTranslationResultValue {
|
||||
val fileData = input.readArray()
|
||||
val types = input.readArray()
|
||||
@@ -303,9 +269,8 @@ private object IrTranslationResultValueExternalizer : DataExternalizer<IrTransla
|
||||
val declarations = input.readArray()
|
||||
val bodies = input.readArray()
|
||||
val fqn = input.readArray()
|
||||
val debugInfos = input.readArrayOrNull()
|
||||
|
||||
return IrTranslationResultValue(fileData, types, signatures, strings, declarations, bodies, fqn, debugInfos)
|
||||
return IrTranslationResultValue(fileData, types, signatures, strings, declarations, bodies, fqn)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,11 +295,10 @@ private class IrTranslationResultMap(
|
||||
newStrings: ByteArray,
|
||||
newDeclarations: ByteArray,
|
||||
newBodies: ByteArray,
|
||||
fqn: ByteArray,
|
||||
debugInfos: ByteArray?
|
||||
fqn: ByteArray
|
||||
) {
|
||||
storage[pathConverter.toPath(sourceFile)] =
|
||||
IrTranslationResultValue(newFiledata, newTypes, newSignatures, newStrings, newDeclarations, newBodies, fqn, debugInfos)
|
||||
IrTranslationResultValue(newFiledata, newTypes, newSignatures, newStrings, newDeclarations, newBodies, fqn)
|
||||
}
|
||||
|
||||
operator fun get(sourceFile: File): IrTranslationResultValue? =
|
||||
@@ -395,7 +359,6 @@ private class InlineFunctionsMap(
|
||||
storageFile: File,
|
||||
private val pathConverter: FileToPathConverter
|
||||
) : BasicStringMap<Map<String, Long>>(storageFile, StringToLongMapExternalizer) {
|
||||
@Synchronized
|
||||
fun process(srcFile: File, newMap: Map<String, Long>, changesCollector: ChangesCollector) {
|
||||
val key = pathConverter.toPath(srcFile)
|
||||
val oldMap = storage[key] ?: emptyMap()
|
||||
@@ -413,7 +376,6 @@ private class InlineFunctionsMap(
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun remove(sourceFile: File) {
|
||||
storage.remove(pathConverter.toPath(sourceFile))
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.ModuleMapping
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.org.objectweb.asm.*
|
||||
@@ -185,7 +184,7 @@ open class IncrementalJvmCache(
|
||||
sourceToClassesMap.add(source, jvmClassName)
|
||||
val (proto, nameResolver) = serializedJavaClass.toProtoData()
|
||||
addToClassStorage(proto, nameResolver, source)
|
||||
// collector.addJavaProto(ClassProtoData(proto, nameResolver))
|
||||
|
||||
dirtyOutputClassesMap.notDirty(jvmClassName)
|
||||
}
|
||||
|
||||
@@ -308,7 +307,7 @@ open class IncrementalJvmCache(
|
||||
storage[key] = newData
|
||||
|
||||
val packageFqName = kotlinClass.className.packageFqName
|
||||
changesCollector.collectProtoChanges(oldData?.toProtoData(packageFqName), newData.toProtoData(packageFqName), packageProtoKey = key)
|
||||
changesCollector.collectProtoChanges(oldData?.toProtoData(packageFqName), newData.toProtoData(packageFqName))
|
||||
}
|
||||
|
||||
operator fun contains(className: JvmClassName): Boolean =
|
||||
@@ -400,9 +399,7 @@ open class IncrementalJvmCache(
|
||||
}
|
||||
|
||||
for (const in oldMap.keys + newMap.keys) {
|
||||
//Constant can be declared via companion object or via const field declaration
|
||||
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(companion = true), const, oldMap[const], newMap[const])
|
||||
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(companion = false), const, oldMap[const], newMap[const])
|
||||
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(), const, oldMap[const], newMap[const])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,12 +599,11 @@ sealed class ChangeInfo(val fqName: FqName) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun LocalFileKotlinClass.scopeFqName(companion: Boolean = false) = when (classHeader.kind) {
|
||||
KotlinClassHeader.Kind.CLASS -> {
|
||||
className.fqNameForClassNameWithoutDollars.let { if (companion) it.child(DEFAULT_NAME_FOR_COMPANION_OBJECT) else it }
|
||||
private fun LocalFileKotlinClass.scopeFqName() =
|
||||
when (classHeader.kind) {
|
||||
KotlinClassHeader.Kind.CLASS -> className.fqNameForClassNameWithoutDollars
|
||||
else -> className.packageFqName
|
||||
}
|
||||
else -> className.packageFqName
|
||||
}
|
||||
|
||||
fun ByteArray.md5(): Long {
|
||||
val d = MessageDigest.getInstance("MD5").digest(this)!!
|
||||
|
||||
@@ -12,8 +12,7 @@ data class IncrementalModuleEntry(
|
||||
private val projectPath: String,
|
||||
val name: String,
|
||||
val buildDir: File,
|
||||
val buildHistoryFile: File,
|
||||
val abiSnapshot: File
|
||||
val buildHistoryFile: File
|
||||
) : Serializable {
|
||||
companion object {
|
||||
private const val serialVersionUID = 0L
|
||||
@@ -27,9 +26,7 @@ class IncrementalModuleInfo(
|
||||
val nameToModules: Map<String, Set<IncrementalModuleEntry>>,
|
||||
val jarToClassListFile: Map<File, File>,
|
||||
// only for js and mpp
|
||||
val jarToModule: Map<File, IncrementalModuleEntry>,
|
||||
//for JVM only
|
||||
val jarToAbiSnapshot: Map<File, File>
|
||||
val jarToModule: Map<File, IncrementalModuleEntry>
|
||||
) : Serializable {
|
||||
companion object {
|
||||
private const val serialVersionUID = 1L
|
||||
|
||||
@@ -41,7 +41,7 @@ open class LookupStorage(
|
||||
private val countersFile = "counters".storageFile
|
||||
private val idToFile = registerMap(IdToFileMap("id-to-file".storageFile, pathConverter))
|
||||
private val fileToId = registerMap(FileToIdMap("file-to-id".storageFile, pathConverter))
|
||||
val lookupMap = registerMap(LookupMap("lookups".storageFile))
|
||||
private val lookupMap = registerMap(LookupMap("lookups".storageFile))
|
||||
|
||||
@Volatile
|
||||
private var size: Int = 0
|
||||
|
||||
@@ -182,21 +182,6 @@ open class ProtoCompareGenerated(
|
||||
|
||||
if (!checkEqualsClassSealedSubclassFqName(old, new)) return false
|
||||
|
||||
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) return false
|
||||
if (old.hasInlineClassUnderlyingPropertyName()) {
|
||||
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) return false
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) return false
|
||||
if (old.hasInlineClassUnderlyingType()) {
|
||||
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) return false
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) return false
|
||||
if (old.hasInlineClassUnderlyingTypeId()) {
|
||||
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) return false
|
||||
}
|
||||
|
||||
if (!checkEqualsClassVersionRequirement(old, new)) return false
|
||||
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
|
||||
@@ -281,9 +266,6 @@ open class ProtoCompareGenerated(
|
||||
TYPE_ALIAS_LIST,
|
||||
ENUM_ENTRY_LIST,
|
||||
SEALED_SUBCLASS_FQ_NAME_LIST,
|
||||
INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
|
||||
INLINE_CLASS_UNDERLYING_TYPE,
|
||||
INLINE_CLASS_UNDERLYING_TYPE_ID,
|
||||
VERSION_REQUIREMENT_LIST,
|
||||
VERSION_REQUIREMENT_TABLE,
|
||||
JVM_EXT_CLASS_MODULE_NAME,
|
||||
@@ -332,21 +314,6 @@ open class ProtoCompareGenerated(
|
||||
|
||||
if (!checkEqualsClassSealedSubclassFqName(old, new)) result.add(ProtoBufClassKind.SEALED_SUBCLASS_FQ_NAME_LIST)
|
||||
|
||||
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
|
||||
if (old.hasInlineClassUnderlyingPropertyName()) {
|
||||
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
|
||||
if (old.hasInlineClassUnderlyingType()) {
|
||||
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
|
||||
}
|
||||
|
||||
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
|
||||
if (old.hasInlineClassUnderlyingTypeId()) {
|
||||
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
|
||||
}
|
||||
|
||||
if (!checkEqualsClassVersionRequirement(old, new)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_LIST)
|
||||
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
|
||||
@@ -1761,18 +1728,6 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
|
||||
hashCode = 31 * hashCode + fqNameIndexes(getSealedSubclassFqName(i))
|
||||
}
|
||||
|
||||
if (hasInlineClassUnderlyingPropertyName()) {
|
||||
hashCode = 31 * hashCode + stringIndexes(inlineClassUnderlyingPropertyName)
|
||||
}
|
||||
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
hashCode = 31 * hashCode + inlineClassUnderlyingType.hashCode(stringIndexes, fqNameIndexes, typeById)
|
||||
}
|
||||
|
||||
if (hasInlineClassUnderlyingTypeId()) {
|
||||
hashCode = 31 * hashCode + typeById(inlineClassUnderlyingTypeId).hashCode(stringIndexes, fqNameIndexes, typeById)
|
||||
}
|
||||
|
||||
for(i in 0..versionRequirementCount - 1) {
|
||||
hashCode = 31 * hashCode + getVersionRequirement(i)
|
||||
}
|
||||
|
||||
@@ -255,23 +255,22 @@ fun withSubtypes(
|
||||
typeFqName: FqName,
|
||||
caches: Iterable<IncrementalCacheCommon>
|
||||
): Set<FqName> {
|
||||
val typesToProccess = LinkedHashSet(listOf(typeFqName))
|
||||
val proccessedTypes = hashSetOf<FqName>()
|
||||
val types = LinkedHashSet(listOf(typeFqName))
|
||||
val subtypes = hashSetOf<FqName>()
|
||||
|
||||
|
||||
while (typesToProccess.isNotEmpty()) {
|
||||
val iterator = typesToProccess.iterator()
|
||||
while (types.isNotEmpty()) {
|
||||
val iterator = types.iterator()
|
||||
val unprocessedType = iterator.next()
|
||||
iterator.remove()
|
||||
|
||||
caches.asSequence()
|
||||
.flatMap { it.getSubtypesOf(unprocessedType) }
|
||||
.filter { it !in proccessedTypes }
|
||||
.forEach { typesToProccess.add(it) }
|
||||
.filter { it !in subtypes }
|
||||
.forEach { types.add(it) }
|
||||
|
||||
proccessedTypes.add(unprocessedType)
|
||||
subtypes.add(unprocessedType)
|
||||
}
|
||||
|
||||
return proccessedTypes
|
||||
return subtypes
|
||||
}
|
||||
|
||||
|
||||
@@ -290,11 +290,6 @@ class DifferenceCalculatorForClass(
|
||||
isClassAffected = true
|
||||
areSubclassesAffected = true
|
||||
}
|
||||
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
|
||||
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE,
|
||||
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID -> {
|
||||
isClassAffected = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,16 +47,10 @@ abstract class BasicMap<K : Comparable<K>, V>(
|
||||
storage.flush(memoryCachesOnly)
|
||||
}
|
||||
|
||||
// avoid unsynchronized close
|
||||
fun close() {
|
||||
storage.close()
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
fun closeForTest() {
|
||||
close()
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
fun dump(): String {
|
||||
return with(StringBuilder()) {
|
||||
|
||||
@@ -34,6 +34,7 @@ class CachingLazyStorage<K, V>(
|
||||
) : LazyStorage<K, V> {
|
||||
private var storage: PersistentHashMap<K, V>? = null
|
||||
|
||||
@Synchronized
|
||||
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
|
||||
if (storage != null) return storage
|
||||
|
||||
@@ -45,36 +46,32 @@ class CachingLazyStorage<K, V>(
|
||||
return null
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
|
||||
if (storage == null) {
|
||||
storage = createMap()
|
||||
}
|
||||
|
||||
return storage!!
|
||||
}
|
||||
|
||||
override val keys: Collection<K>
|
||||
@Synchronized
|
||||
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
|
||||
|
||||
@Synchronized
|
||||
override operator fun contains(key: K): Boolean =
|
||||
getStorageIfExists()?.containsMapping(key) ?: false
|
||||
|
||||
@Synchronized
|
||||
override operator fun get(key: K): V? =
|
||||
getStorageIfExists()?.get(key)
|
||||
|
||||
@Synchronized
|
||||
override operator fun set(key: K, value: V) {
|
||||
getStorageOrCreateNew().put(key, value)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun remove(key: K) {
|
||||
getStorageIfExists()?.remove(key)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun append(key: K, value: V) {
|
||||
getStorageOrCreateNew().appendData(key, { valueExternalizer.save(it, value) })
|
||||
}
|
||||
@@ -106,11 +103,7 @@ class CachingLazyStorage<K, V>(
|
||||
|
||||
@Synchronized
|
||||
override fun close() {
|
||||
try {
|
||||
storage?.close()
|
||||
} finally {
|
||||
storage = null
|
||||
}
|
||||
storage?.close()
|
||||
}
|
||||
|
||||
private fun createMap(): PersistentHashMap<K, V> = PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
|
||||
|
||||
@@ -28,7 +28,6 @@ internal open class ClassOneToManyMap(storageFile: File) : BasicStringMap<Collec
|
||||
storage.append(key.asString(), listOf(value.asString()))
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
operator fun get(key: FqName): Collection<FqName> =
|
||||
storage[key.asString()]?.map(::FqName) ?: setOf()
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.incremental.storage
|
||||
|
||||
import java.io.File
|
||||
|
||||
class LookupMap(storage: File) : BasicMap<LookupSymbolKey, Collection<Int>>(storage, LookupSymbolKeyDescriptor, IntCollectionExternalizer) {
|
||||
internal class LookupMap(storage: File) : BasicMap<LookupSymbolKey, Collection<Int>>(storage, LookupSymbolKeyDescriptor, IntCollectionExternalizer) {
|
||||
override fun dumpKey(key: LookupSymbolKey): String = key.toString()
|
||||
|
||||
override fun dumpValue(value: Collection<Int>): String = value.toString()
|
||||
|
||||
@@ -31,6 +31,7 @@ class NonCachingLazyStorage<K, V>(
|
||||
) : LazyStorage<K, V> {
|
||||
private var storage: PersistentHashMap<K, V>? = null
|
||||
|
||||
@Synchronized
|
||||
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
|
||||
if (storage != null) return storage
|
||||
|
||||
@@ -42,6 +43,7 @@ class NonCachingLazyStorage<K, V>(
|
||||
return null
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
|
||||
if (storage == null) {
|
||||
storage = createMap()
|
||||
@@ -51,28 +53,22 @@ class NonCachingLazyStorage<K, V>(
|
||||
}
|
||||
|
||||
override val keys: Collection<K>
|
||||
@Synchronized
|
||||
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
|
||||
|
||||
@Synchronized
|
||||
override operator fun contains(key: K): Boolean =
|
||||
getStorageIfExists()?.containsMapping(key) ?: false
|
||||
|
||||
@Synchronized
|
||||
override operator fun get(key: K): V? =
|
||||
getStorageIfExists()?.get(key)
|
||||
|
||||
@Synchronized
|
||||
override operator fun set(key: K, value: V) {
|
||||
getStorageOrCreateNew().put(key, value)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun remove(key: K) {
|
||||
getStorageIfExists()?.remove(key)
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
override fun append(key: K, value: V) {
|
||||
getStorageOrCreateNew().appendData(key) { dataOutput -> valueExternalizer.save(dataOutput, value) }
|
||||
}
|
||||
@@ -104,11 +100,7 @@ class NonCachingLazyStorage<K, V>(
|
||||
|
||||
@Synchronized
|
||||
override fun close() {
|
||||
try {
|
||||
storage?.close()
|
||||
} finally {
|
||||
storage = null
|
||||
}
|
||||
storage?.close()
|
||||
}
|
||||
|
||||
private fun createMap(): PersistentHashMap<K, V> =
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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.incremental.storage
|
||||
|
||||
import org.jetbrains.kotlin.incremental.dumpCollection
|
||||
import java.io.File
|
||||
|
||||
class SourceToJsOutputMap(storageFile: File, private val pathConverter: FileToPathConverter) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
|
||||
override fun dumpValue(value: Collection<String>): String = value.dumpCollection()
|
||||
|
||||
@Synchronized
|
||||
fun add(key: File, value: File) {
|
||||
storage.append(pathConverter.toPath(key), listOf(pathConverter.toPath(value)))
|
||||
}
|
||||
|
||||
operator fun get(sourceFile: File): Collection<File> =
|
||||
storage[pathConverter.toPath(sourceFile)]?.map { pathConverter.toFile(it) } ?: setOf()
|
||||
|
||||
|
||||
@Synchronized
|
||||
operator fun set(key: File, values: Collection<File>) {
|
||||
if (values.isEmpty()) {
|
||||
remove(key)
|
||||
return
|
||||
}
|
||||
|
||||
storage[pathConverter.toPath(key)] = values.map { pathConverter.toPath(it) }
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun remove(key: File) {
|
||||
storage.remove(pathConverter.toPath(key))
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun removeValues(key: File, removed: Set<File>) {
|
||||
val notRemoved = this[key].filter { it !in removed }
|
||||
this[key] = notRemoved
|
||||
}
|
||||
}
|
||||
@@ -21,49 +21,23 @@ import com.intellij.util.io.DataExternalizer
|
||||
import com.intellij.util.io.EnumeratorStringDescriptor
|
||||
import com.intellij.util.io.IOUtil
|
||||
import com.intellij.util.io.KeyDescriptor
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.toBooleanLenient
|
||||
import java.io.DataInput
|
||||
import java.io.DataInputStream
|
||||
import java.io.DataOutput
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Storage versioning:
|
||||
* 0 - only name and value hashes are saved
|
||||
* 1 - name and scope are saved
|
||||
*/
|
||||
object LookupSymbolKeyDescriptor : KeyDescriptor<LookupSymbolKey> {
|
||||
override fun read(input: DataInput): LookupSymbolKey {
|
||||
val version = input.readByte()
|
||||
return when (version.toInt()) {
|
||||
0 -> {
|
||||
val name = input.readUTF()
|
||||
val scope = input.readUTF()
|
||||
LookupSymbolKey(name.hashCode(), scope.hashCode(), name, scope)
|
||||
}
|
||||
1 -> {
|
||||
val first = input.readInt()
|
||||
val second = input.readInt()
|
||||
LookupSymbolKey(first, second, "", "")
|
||||
}
|
||||
else -> throw RuntimeException("Unknown version of LookupSymbolKeyDescriptor=${version}")
|
||||
}
|
||||
val first = input.readInt()
|
||||
val second = input.readInt()
|
||||
|
||||
return LookupSymbolKey(first, second)
|
||||
}
|
||||
|
||||
private val storeFullFqName = CompilerSystemProperties.COMPILE_INCREMENTAL_WITH_CLASSPATH_SHAPSHOTS.value.toBooleanLenient() ?: false
|
||||
|
||||
override fun save(output: DataOutput, value: LookupSymbolKey) {
|
||||
if (storeFullFqName) {
|
||||
output.writeByte(0)
|
||||
output.writeUTF(value.name)
|
||||
output.writeUTF(value.scope)
|
||||
} else {
|
||||
output.writeByte(1)
|
||||
output.writeInt(value.nameHash)
|
||||
output.writeInt(value.scopeHash)
|
||||
}
|
||||
output.writeInt(value.nameHash)
|
||||
output.writeInt(value.scopeHash)
|
||||
}
|
||||
|
||||
override fun getHashCode(value: LookupSymbolKey): Int = value.hashCode()
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.incremental.storage
|
||||
|
||||
data class LookupSymbolKey(val nameHash: Int, val scopeHash: Int, val name:String, val scope:String) : Comparable<LookupSymbolKey> {
|
||||
constructor(name: String, scope: String) : this(name.hashCode(), scope.hashCode(), name, scope)
|
||||
data class LookupSymbolKey(val nameHash: Int, val scopeHash: Int) : Comparable<LookupSymbolKey> {
|
||||
constructor(name: String, scope: String) : this(name.hashCode(), scope.hashCode())
|
||||
|
||||
override fun compareTo(other: LookupSymbolKey): Int {
|
||||
val nameCmp = nameHash.compareTo(other.nameHash)
|
||||
@@ -26,26 +26,6 @@ data class LookupSymbolKey(val nameHash: Int, val scopeHash: Int, val name:Strin
|
||||
|
||||
return scopeHash.compareTo(other.scopeHash)
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = nameHash
|
||||
result = 31 * result + scopeHash
|
||||
return result
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as LookupSymbolKey
|
||||
|
||||
if (nameHash != other.nameHash) return false
|
||||
if (scopeHash != other.scopeHash) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
data class ProtoMapValue(val isPackageFacade: Boolean, val bytes: ByteArray, val strings: Array<String>)
|
||||
|
||||
@@ -23,8 +23,7 @@ data class BuildLogFinder(
|
||||
private val isGradleEnabled: Boolean = false,
|
||||
private val isJsEnabled: Boolean = false,
|
||||
private val isScopeExpansionEnabled: Boolean = false,
|
||||
private val isKlibEnabled: Boolean = false,
|
||||
private val isFirEnabled: Boolean = false
|
||||
private val isKlibEnabled: Boolean = false
|
||||
) {
|
||||
companion object {
|
||||
private const val JS_LOG = "js-build.log"
|
||||
@@ -33,8 +32,6 @@ data class BuildLogFinder(
|
||||
private const val GRADLE_LOG = "gradle-build.log"
|
||||
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
|
||||
const val JS_JPS_LOG = "js-jps-build.log"
|
||||
private const val FIR_LOG = "fir-build.log"
|
||||
private const val GRADLE_FIR_LOG = "gradle-fir-build.log"
|
||||
private const val SIMPLE_LOG = "build.log"
|
||||
|
||||
fun isJpsLogFile(file: File): Boolean =
|
||||
@@ -48,8 +45,6 @@ data class BuildLogFinder(
|
||||
isScopeExpansionEnabled && SCOPE_EXPANDING_LOG in files -> SCOPE_EXPANDING_LOG
|
||||
isKlibEnabled && KLIB_LOG in files -> KLIB_LOG
|
||||
isJsEnabled && JS_LOG in files -> JS_LOG
|
||||
isGradleEnabled && isFirEnabled && GRADLE_FIR_LOG in files -> GRADLE_FIR_LOG
|
||||
isFirEnabled && FIR_LOG in files -> FIR_LOG
|
||||
isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG
|
||||
isJsEnabled && JS_JPS_LOG in files -> JS_JPS_LOG
|
||||
isDataContainerBuildLogEnabled && DATA_CONTAINER_LOG in files -> DATA_CONTAINER_LOG
|
||||
|
||||
@@ -10,21 +10,17 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.packageFqName);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classFile);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classKdoc);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classUniqId);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorKdoc);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorUniqId);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionFile);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionKdoc);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionUniqId);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyGetterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertySetterAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.compileTimeValue);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyFile);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyKdoc);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyUniqId);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.enumEntryAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.enumEntryOrdinal);
|
||||
@@ -3167,17 +3163,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
null);
|
||||
public static final int CLASS_KDOC_FIELD_NUMBER = 176;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
|
||||
java.lang.String> classKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.String.class,
|
||||
null);
|
||||
public static final int CLASS_UNIQ_ID_FIELD_NUMBER = 171;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
|
||||
@@ -3200,17 +3185,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
|
||||
public static final int CONSTRUCTOR_KDOC_FIELD_NUMBER = 173;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
|
||||
java.lang.String> constructorKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.String.class,
|
||||
null);
|
||||
public static final int CONSTRUCTOR_UNIQ_ID_FIELD_NUMBER = 172;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
|
||||
@@ -3244,17 +3218,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
null);
|
||||
public static final int FUNCTION_KDOC_FIELD_NUMBER = 174;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
|
||||
java.lang.String> functionKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.String.class,
|
||||
null);
|
||||
public static final int FUNCTION_UNIQ_ID_FIELD_NUMBER = 173;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
|
||||
@@ -3321,17 +3284,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
null);
|
||||
public static final int PROPERTY_KDOC_FIELD_NUMBER = 180;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
|
||||
java.lang.String> propertyKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.String.class,
|
||||
null);
|
||||
public static final int PROPERTY_UNIQ_ID_FIELD_NUMBER = 179;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
|
||||
@@ -3528,79 +3480,72 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
".metadata.Class\030\252\001 \003(\0132).org.jetbrains.k" +
|
||||
"otlin.metadata.Annotation:?\n\nclass_file\022",
|
||||
"$.org.jetbrains.kotlin.metadata.Class\030\257\001" +
|
||||
" \001(\005B\004\200\265\030\001:?\n\nclass_kdoc\022$.org.jetbrains" +
|
||||
".kotlin.metadata.Class\030\260\001 \001(\tB\004\200\265\030\001:u\n\rc" +
|
||||
"lass_uniq_id\022$.org.jetbrains.kotlin.meta" +
|
||||
"data.Class\030\253\001 \001(\01327.org.jetbrains.kotlin" +
|
||||
".library.metadata.DescriptorUniqId:v\n\026co" +
|
||||
"nstructor_annotation\022*.org.jetbrains.kot" +
|
||||
"lin.metadata.Constructor\030\252\001 \003(\0132).org.je" +
|
||||
"tbrains.kotlin.metadata.Annotation:K\n\020co" +
|
||||
"nstructor_kdoc\022*.org.jetbrains.kotlin.me",
|
||||
"tadata.Constructor\030\255\001 \001(\tB\004\200\265\030\001:\201\001\n\023cons" +
|
||||
"tructor_uniq_id\022*.org.jetbrains.kotlin.m" +
|
||||
"etadata.Constructor\030\254\001 \001(\01327.org.jetbrai" +
|
||||
"ns.kotlin.library.metadata.DescriptorUni" +
|
||||
"qId:p\n\023function_annotation\022\'.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Function\030\252\001 \003(\0132).org" +
|
||||
".jetbrains.kotlin.metadata.Annotation:E\n" +
|
||||
"\rfunction_file\022\'.org.jetbrains.kotlin.me" +
|
||||
"tadata.Function\030\254\001 \001(\005B\004\200\265\030\001:E\n\rfunction" +
|
||||
"_kdoc\022\'.org.jetbrains.kotlin.metadata.Fu",
|
||||
"nction\030\256\001 \001(\tB\004\200\265\030\001:{\n\020function_uniq_id\022" +
|
||||
"\'.org.jetbrains.kotlin.metadata.Function" +
|
||||
"\030\255\001 \001(\01327.org.jetbrains.kotlin.library.m" +
|
||||
"etadata.DescriptorUniqId:p\n\023property_ann" +
|
||||
"otation\022\'.org.jetbrains.kotlin.metadata." +
|
||||
"Property\030\252\001 \003(\0132).org.jetbrains.kotlin.m" +
|
||||
"etadata.Annotation:w\n\032property_getter_an" +
|
||||
"notation\022\'.org.jetbrains.kotlin.metadata" +
|
||||
".Property\030\261\001 \003(\0132).org.jetbrains.kotlin." +
|
||||
"metadata.Annotation:w\n\032property_setter_a",
|
||||
"nnotation\022\'.org.jetbrains.kotlin.metadat" +
|
||||
"a.Property\030\262\001 \003(\0132).org.jetbrains.kotlin" +
|
||||
".metadata.Annotation:~\n\022compile_time_val" +
|
||||
"ue\022\'.org.jetbrains.kotlin.metadata.Prope" +
|
||||
"rty\030\255\001 \001(\01328.org.jetbrains.kotlin.metada" +
|
||||
"ta.Annotation.Argument.Value:E\n\rproperty" +
|
||||
"_file\022\'.org.jetbrains.kotlin.metadata.Pr" +
|
||||
"operty\030\260\001 \001(\005B\004\200\265\030\001:E\n\rproperty_kdoc\022\'.o" +
|
||||
"rg.jetbrains.kotlin.metadata.Property\030\264\001" +
|
||||
" \001(\tB\004\200\265\030\001:{\n\020property_uniq_id\022\'.org.jet",
|
||||
"brains.kotlin.metadata.Property\030\263\001 \001(\01327" +
|
||||
".org.jetbrains.kotlin.library.metadata.D" +
|
||||
"escriptorUniqId:s\n\025enum_entry_annotation" +
|
||||
"\022(.org.jetbrains.kotlin.metadata.EnumEnt" +
|
||||
"ry\030\252\001 \003(\0132).org.jetbrains.kotlin.metadat" +
|
||||
"a.Annotation:E\n\022enum_entry_ordinal\022(.org" +
|
||||
".jetbrains.kotlin.metadata.EnumEntry\030\253\001 " +
|
||||
"\001(\005:~\n\022enum_entry_uniq_id\022(.org.jetbrain" +
|
||||
"s.kotlin.metadata.EnumEntry\030\254\001 \001(\01327.org" +
|
||||
".jetbrains.kotlin.library.metadata.Descr",
|
||||
"iptorUniqId:w\n\024parameter_annotation\022-.or" +
|
||||
"g.jetbrains.kotlin.metadata.ValueParamet" +
|
||||
"er\030\252\001 \003(\0132).org.jetbrains.kotlin.metadat" +
|
||||
"a.Annotation:h\n\017type_annotation\022#.org.je" +
|
||||
"tbrains.kotlin.metadata.Type\030\252\001 \003(\0132).or" +
|
||||
"g.jetbrains.kotlin.metadata.Annotation:{" +
|
||||
"\n\031type_parameter_annotation\022,.org.jetbra" +
|
||||
"ins.kotlin.metadata.TypeParameter\030\252\001 \003(\013" +
|
||||
"2).org.jetbrains.kotlin.metadata.Annotat" +
|
||||
"ion:\202\001\n\022type_param_uniq_id\022,.org.jetbrai",
|
||||
"ns.kotlin.metadata.TypeParameter\030\253\001 \001(\0132" +
|
||||
"7.org.jetbrains.kotlin.library.metadata." +
|
||||
"DescriptorUniqId:U\n\026package_fragment_fil" +
|
||||
"es\022..org.jetbrains.kotlin.metadata.Packa" +
|
||||
"geFragment\030\252\001 \003(\005B\004\200\265\030\001:A\n\010is_empty\022..or" +
|
||||
"g.jetbrains.kotlin.metadata.PackageFragm" +
|
||||
"ent\030\254\001 \001(\010:@\n\007fq_name\022..org.jetbrains.ko" +
|
||||
"tlin.metadata.PackageFragment\030\255\001 \001(\t:G\n\n" +
|
||||
"class_name\022..org.jetbrains.kotlin.metada" +
|
||||
"ta.PackageFragment\030\256\001 \003(\005B\002\020\001:~\n\022type_al",
|
||||
"ias_uniq_id\022(.org.jetbrains.kotlin.metad" +
|
||||
"ata.TypeAlias\030\203\001 \001(\01327.org.jetbrains.kot" +
|
||||
"lin.library.metadata.DescriptorUniqIdB\033B" +
|
||||
"\031DebugKlibMetadataProtoBuf"
|
||||
" \001(\005B\004\200\265\030\001:u\n\rclass_uniq_id\022$.org.jetbra" +
|
||||
"ins.kotlin.metadata.Class\030\253\001 \001(\01327.org.j" +
|
||||
"etbrains.kotlin.library.metadata.Descrip" +
|
||||
"torUniqId:v\n\026constructor_annotation\022*.or" +
|
||||
"g.jetbrains.kotlin.metadata.Constructor\030" +
|
||||
"\252\001 \003(\0132).org.jetbrains.kotlin.metadata.A" +
|
||||
"nnotation:\201\001\n\023constructor_uniq_id\022*.org." +
|
||||
"jetbrains.kotlin.metadata.Constructor\030\254\001" +
|
||||
" \001(\01327.org.jetbrains.kotlin.library.meta",
|
||||
"data.DescriptorUniqId:p\n\023function_annota" +
|
||||
"tion\022\'.org.jetbrains.kotlin.metadata.Fun" +
|
||||
"ction\030\252\001 \003(\0132).org.jetbrains.kotlin.meta" +
|
||||
"data.Annotation:E\n\rfunction_file\022\'.org.j" +
|
||||
"etbrains.kotlin.metadata.Function\030\254\001 \001(\005" +
|
||||
"B\004\200\265\030\001:{\n\020function_uniq_id\022\'.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Function\030\255\001 \001(\01327.org" +
|
||||
".jetbrains.kotlin.library.metadata.Descr" +
|
||||
"iptorUniqId:p\n\023property_annotation\022\'.org" +
|
||||
".jetbrains.kotlin.metadata.Property\030\252\001 \003",
|
||||
"(\0132).org.jetbrains.kotlin.metadata.Annot" +
|
||||
"ation:w\n\032property_getter_annotation\022\'.or" +
|
||||
"g.jetbrains.kotlin.metadata.Property\030\261\001 " +
|
||||
"\003(\0132).org.jetbrains.kotlin.metadata.Anno" +
|
||||
"tation:w\n\032property_setter_annotation\022\'.o" +
|
||||
"rg.jetbrains.kotlin.metadata.Property\030\262\001" +
|
||||
" \003(\0132).org.jetbrains.kotlin.metadata.Ann" +
|
||||
"otation:~\n\022compile_time_value\022\'.org.jetb" +
|
||||
"rains.kotlin.metadata.Property\030\255\001 \001(\01328." +
|
||||
"org.jetbrains.kotlin.metadata.Annotation",
|
||||
".Argument.Value:E\n\rproperty_file\022\'.org.j" +
|
||||
"etbrains.kotlin.metadata.Property\030\260\001 \001(\005" +
|
||||
"B\004\200\265\030\001:{\n\020property_uniq_id\022\'.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Property\030\263\001 \001(\01327.org" +
|
||||
".jetbrains.kotlin.library.metadata.Descr" +
|
||||
"iptorUniqId:s\n\025enum_entry_annotation\022(.o" +
|
||||
"rg.jetbrains.kotlin.metadata.EnumEntry\030\252" +
|
||||
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
|
||||
"notation:E\n\022enum_entry_ordinal\022(.org.jet" +
|
||||
"brains.kotlin.metadata.EnumEntry\030\253\001 \001(\005:",
|
||||
"~\n\022enum_entry_uniq_id\022(.org.jetbrains.ko" +
|
||||
"tlin.metadata.EnumEntry\030\254\001 \001(\01327.org.jet" +
|
||||
"brains.kotlin.library.metadata.Descripto" +
|
||||
"rUniqId:w\n\024parameter_annotation\022-.org.je" +
|
||||
"tbrains.kotlin.metadata.ValueParameter\030\252" +
|
||||
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
|
||||
"notation:h\n\017type_annotation\022#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\030\252\001 \003(\0132).org.je" +
|
||||
"tbrains.kotlin.metadata.Annotation:{\n\031ty" +
|
||||
"pe_parameter_annotation\022,.org.jetbrains.",
|
||||
"kotlin.metadata.TypeParameter\030\252\001 \003(\0132).o" +
|
||||
"rg.jetbrains.kotlin.metadata.Annotation:" +
|
||||
"\202\001\n\022type_param_uniq_id\022,.org.jetbrains.k" +
|
||||
"otlin.metadata.TypeParameter\030\253\001 \001(\01327.or" +
|
||||
"g.jetbrains.kotlin.library.metadata.Desc" +
|
||||
"riptorUniqId:U\n\026package_fragment_files\022." +
|
||||
".org.jetbrains.kotlin.metadata.PackageFr" +
|
||||
"agment\030\252\001 \003(\005B\004\200\265\030\001:A\n\010is_empty\022..org.je" +
|
||||
"tbrains.kotlin.metadata.PackageFragment\030" +
|
||||
"\254\001 \001(\010:@\n\007fq_name\022..org.jetbrains.kotlin",
|
||||
".metadata.PackageFragment\030\255\001 \001(\t:G\n\nclas" +
|
||||
"s_name\022..org.jetbrains.kotlin.metadata.P" +
|
||||
"ackageFragment\030\256\001 \003(\005B\002\020\001:~\n\022type_alias_" +
|
||||
"uniq_id\022(.org.jetbrains.kotlin.metadata." +
|
||||
"TypeAlias\030\203\001 \001(\01327.org.jetbrains.kotlin." +
|
||||
"library.metadata.DescriptorUniqIdB\033B\031Deb" +
|
||||
"ugKlibMetadataProtoBuf"
|
||||
};
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
@@ -3637,34 +3582,30 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
packageFqName.internalInit(descriptor.getExtensions().get(0));
|
||||
classAnnotation.internalInit(descriptor.getExtensions().get(1));
|
||||
classFile.internalInit(descriptor.getExtensions().get(2));
|
||||
classKdoc.internalInit(descriptor.getExtensions().get(3));
|
||||
classUniqId.internalInit(descriptor.getExtensions().get(4));
|
||||
constructorAnnotation.internalInit(descriptor.getExtensions().get(5));
|
||||
constructorKdoc.internalInit(descriptor.getExtensions().get(6));
|
||||
constructorUniqId.internalInit(descriptor.getExtensions().get(7));
|
||||
functionAnnotation.internalInit(descriptor.getExtensions().get(8));
|
||||
functionFile.internalInit(descriptor.getExtensions().get(9));
|
||||
functionKdoc.internalInit(descriptor.getExtensions().get(10));
|
||||
functionUniqId.internalInit(descriptor.getExtensions().get(11));
|
||||
propertyAnnotation.internalInit(descriptor.getExtensions().get(12));
|
||||
propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(13));
|
||||
propertySetterAnnotation.internalInit(descriptor.getExtensions().get(14));
|
||||
compileTimeValue.internalInit(descriptor.getExtensions().get(15));
|
||||
propertyFile.internalInit(descriptor.getExtensions().get(16));
|
||||
propertyKdoc.internalInit(descriptor.getExtensions().get(17));
|
||||
propertyUniqId.internalInit(descriptor.getExtensions().get(18));
|
||||
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(19));
|
||||
enumEntryOrdinal.internalInit(descriptor.getExtensions().get(20));
|
||||
enumEntryUniqId.internalInit(descriptor.getExtensions().get(21));
|
||||
parameterAnnotation.internalInit(descriptor.getExtensions().get(22));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(23));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(24));
|
||||
typeParamUniqId.internalInit(descriptor.getExtensions().get(25));
|
||||
packageFragmentFiles.internalInit(descriptor.getExtensions().get(26));
|
||||
isEmpty.internalInit(descriptor.getExtensions().get(27));
|
||||
fqName.internalInit(descriptor.getExtensions().get(28));
|
||||
className.internalInit(descriptor.getExtensions().get(29));
|
||||
typeAliasUniqId.internalInit(descriptor.getExtensions().get(30));
|
||||
classUniqId.internalInit(descriptor.getExtensions().get(3));
|
||||
constructorAnnotation.internalInit(descriptor.getExtensions().get(4));
|
||||
constructorUniqId.internalInit(descriptor.getExtensions().get(5));
|
||||
functionAnnotation.internalInit(descriptor.getExtensions().get(6));
|
||||
functionFile.internalInit(descriptor.getExtensions().get(7));
|
||||
functionUniqId.internalInit(descriptor.getExtensions().get(8));
|
||||
propertyAnnotation.internalInit(descriptor.getExtensions().get(9));
|
||||
propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(10));
|
||||
propertySetterAnnotation.internalInit(descriptor.getExtensions().get(11));
|
||||
compileTimeValue.internalInit(descriptor.getExtensions().get(12));
|
||||
propertyFile.internalInit(descriptor.getExtensions().get(13));
|
||||
propertyUniqId.internalInit(descriptor.getExtensions().get(14));
|
||||
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(15));
|
||||
enumEntryOrdinal.internalInit(descriptor.getExtensions().get(16));
|
||||
enumEntryUniqId.internalInit(descriptor.getExtensions().get(17));
|
||||
parameterAnnotation.internalInit(descriptor.getExtensions().get(18));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(19));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(20));
|
||||
typeParamUniqId.internalInit(descriptor.getExtensions().get(21));
|
||||
packageFragmentFiles.internalInit(descriptor.getExtensions().get(22));
|
||||
isEmpty.internalInit(descriptor.getExtensions().get(23));
|
||||
fqName.internalInit(descriptor.getExtensions().get(24));
|
||||
className.internalInit(descriptor.getExtensions().get(25));
|
||||
typeAliasUniqId.internalInit(descriptor.getExtensions().get(26));
|
||||
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry =
|
||||
org.jetbrains.kotlin.protobuf.ExtensionRegistry.newInstance();
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipMessageInComparison);
|
||||
@@ -3672,10 +3613,6 @@ public final class DebugKlibMetadataProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
|
||||
.internalUpdateFileDescriptor(descriptor, registry);
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
|
||||
|
||||
@@ -10347,37 +10347,6 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
int getSealedSubclassFqName(int index);
|
||||
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
boolean hasInlineClassUnderlyingPropertyName();
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
int getInlineClassUnderlyingPropertyName();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
boolean hasInlineClassUnderlyingType();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder();
|
||||
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
boolean hasInlineClassUnderlyingTypeId();
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
int getInlineClassUnderlyingTypeId();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
@@ -10616,32 +10585,9 @@ public final class DebugProtoBuf {
|
||||
input.popLimit(limit);
|
||||
break;
|
||||
}
|
||||
case 136: {
|
||||
bitField0_ |= 0x00000008;
|
||||
inlineClassUnderlyingPropertyName_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 146: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
subBuilder = inlineClassUnderlyingType_.toBuilder();
|
||||
}
|
||||
inlineClassUnderlyingType_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(inlineClassUnderlyingType_);
|
||||
inlineClassUnderlyingType_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
}
|
||||
case 152: {
|
||||
bitField0_ |= 0x00000020;
|
||||
inlineClassUnderlyingTypeId_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 242: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
subBuilder = typeTable_.toBuilder();
|
||||
}
|
||||
typeTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.PARSER, extensionRegistry);
|
||||
@@ -10649,13 +10595,13 @@ public final class DebugProtoBuf {
|
||||
subBuilder.mergeFrom(typeTable_);
|
||||
typeTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000040;
|
||||
bitField0_ |= 0x00000008;
|
||||
break;
|
||||
}
|
||||
case 248: {
|
||||
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00020000;
|
||||
mutable_bitField0_ |= 0x00004000;
|
||||
}
|
||||
versionRequirement_.add(input.readInt32());
|
||||
break;
|
||||
@@ -10663,9 +10609,9 @@ public final class DebugProtoBuf {
|
||||
case 250: {
|
||||
int length = input.readRawVarint32();
|
||||
int limit = input.pushLimit(length);
|
||||
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000) && input.getBytesUntilLimit() > 0) {
|
||||
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000) && input.getBytesUntilLimit() > 0) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
|
||||
mutable_bitField0_ |= 0x00020000;
|
||||
mutable_bitField0_ |= 0x00004000;
|
||||
}
|
||||
while (input.getBytesUntilLimit() > 0) {
|
||||
versionRequirement_.add(input.readInt32());
|
||||
@@ -10675,7 +10621,7 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
case 258: {
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
subBuilder = versionRequirementTable_.toBuilder();
|
||||
}
|
||||
versionRequirementTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.PARSER, extensionRegistry);
|
||||
@@ -10683,7 +10629,7 @@ public final class DebugProtoBuf {
|
||||
subBuilder.mergeFrom(versionRequirementTable_);
|
||||
versionRequirementTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000080;
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -10724,7 +10670,7 @@ public final class DebugProtoBuf {
|
||||
if (((mutable_bitField0_ & 0x00001000) == 0x00001000)) {
|
||||
sealedSubclassFqName_ = java.util.Collections.unmodifiableList(sealedSubclassFqName_);
|
||||
}
|
||||
if (((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
|
||||
}
|
||||
this.unknownFields = unknownFields.build();
|
||||
@@ -11279,64 +11225,13 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
private int sealedSubclassFqNameMemoizedSerializedSize = -1;
|
||||
|
||||
public static final int INLINE_CLASS_UNDERLYING_PROPERTY_NAME_FIELD_NUMBER = 17;
|
||||
private int inlineClassUnderlyingPropertyName_;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingPropertyName() {
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingPropertyName() {
|
||||
return inlineClassUnderlyingPropertyName_;
|
||||
}
|
||||
|
||||
public static final int INLINE_CLASS_UNDERLYING_TYPE_FIELD_NUMBER = 18;
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingType() {
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
|
||||
return inlineClassUnderlyingType_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
|
||||
return inlineClassUnderlyingType_;
|
||||
}
|
||||
|
||||
public static final int INLINE_CLASS_UNDERLYING_TYPE_ID_FIELD_NUMBER = 19;
|
||||
private int inlineClassUnderlyingTypeId_;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingTypeId() {
|
||||
return ((bitField0_ & 0x00000020) == 0x00000020);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingTypeId() {
|
||||
return inlineClassUnderlyingTypeId_;
|
||||
}
|
||||
|
||||
public static final int TYPE_TABLE_FIELD_NUMBER = 30;
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public boolean hasTypeTable() {
|
||||
return ((bitField0_ & 0x00000040) == 0x00000040);
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
@@ -11391,7 +11286,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public boolean hasVersionRequirementTable() {
|
||||
return ((bitField0_ & 0x00000080) == 0x00000080);
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
@@ -11420,9 +11315,6 @@ public final class DebugProtoBuf {
|
||||
typeAlias_ = java.util.Collections.emptyList();
|
||||
enumEntry_ = java.util.Collections.emptyList();
|
||||
sealedSubclassFqName_ = java.util.Collections.emptyList();
|
||||
inlineClassUnderlyingPropertyName_ = 0;
|
||||
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
inlineClassUnderlyingTypeId_ = 0;
|
||||
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
|
||||
@@ -11479,12 +11371,6 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
if (!getInlineClassUnderlyingType().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTypeTable()) {
|
||||
if (!getTypeTable().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
@@ -11557,21 +11443,12 @@ public final class DebugProtoBuf {
|
||||
output.writeInt32NoTag(sealedSubclassFqName_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
output.writeInt32(17, inlineClassUnderlyingPropertyName_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
output.writeMessage(18, inlineClassUnderlyingType_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
output.writeInt32(19, inlineClassUnderlyingTypeId_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
output.writeMessage(30, typeTable_);
|
||||
}
|
||||
for (int i = 0; i < versionRequirement_.size(); i++) {
|
||||
output.writeInt32(31, versionRequirement_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
output.writeMessage(32, versionRequirementTable_);
|
||||
}
|
||||
extensionWriter.writeUntil(19000, output);
|
||||
@@ -11667,18 +11544,6 @@ public final class DebugProtoBuf {
|
||||
sealedSubclassFqNameMemoizedSerializedSize = dataSize;
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32Size(17, inlineClassUnderlyingPropertyName_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(18, inlineClassUnderlyingType_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32Size(19, inlineClassUnderlyingTypeId_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000040) == 0x00000040)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(30, typeTable_);
|
||||
}
|
||||
@@ -11691,7 +11556,7 @@ public final class DebugProtoBuf {
|
||||
size += dataSize;
|
||||
size += 2 * getVersionRequirementList().size();
|
||||
}
|
||||
if (((bitField0_ & 0x00000080) == 0x00000080)) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(32, versionRequirementTable_);
|
||||
}
|
||||
@@ -11813,7 +11678,6 @@ public final class DebugProtoBuf {
|
||||
getPropertyFieldBuilder();
|
||||
getTypeAliasFieldBuilder();
|
||||
getEnumEntryFieldBuilder();
|
||||
getInlineClassUnderlyingTypeFieldBuilder();
|
||||
getTypeTableFieldBuilder();
|
||||
getVersionRequirementTableFieldBuilder();
|
||||
}
|
||||
@@ -11878,30 +11742,20 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
sealedSubclassFqName_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00001000);
|
||||
inlineClassUnderlyingPropertyName_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
inlineClassUnderlyingTypeId_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
if (typeTableBuilder_ == null) {
|
||||
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
|
||||
} else {
|
||||
typeTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00010000);
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
|
||||
} else {
|
||||
versionRequirementTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00040000);
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -12023,34 +11877,18 @@ public final class DebugProtoBuf {
|
||||
if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
|
||||
to_bitField0_ |= 0x00000008;
|
||||
}
|
||||
result.inlineClassUnderlyingPropertyName_ = inlineClassUnderlyingPropertyName_;
|
||||
if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
}
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
result.inlineClassUnderlyingType_ = inlineClassUnderlyingType_;
|
||||
} else {
|
||||
result.inlineClassUnderlyingType_ = inlineClassUnderlyingTypeBuilder_.build();
|
||||
}
|
||||
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
|
||||
to_bitField0_ |= 0x00000020;
|
||||
}
|
||||
result.inlineClassUnderlyingTypeId_ = inlineClassUnderlyingTypeId_;
|
||||
if (((from_bitField0_ & 0x00010000) == 0x00010000)) {
|
||||
to_bitField0_ |= 0x00000040;
|
||||
}
|
||||
if (typeTableBuilder_ == null) {
|
||||
result.typeTable_ = typeTable_;
|
||||
} else {
|
||||
result.typeTable_ = typeTableBuilder_.build();
|
||||
}
|
||||
if (((bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (((bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
}
|
||||
result.versionRequirement_ = versionRequirement_;
|
||||
if (((from_bitField0_ & 0x00040000) == 0x00040000)) {
|
||||
to_bitField0_ |= 0x00000080;
|
||||
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
}
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
result.versionRequirementTable_ = versionRequirementTable_;
|
||||
@@ -12294,22 +12132,13 @@ public final class DebugProtoBuf {
|
||||
}
|
||||
onChanged();
|
||||
}
|
||||
if (other.hasInlineClassUnderlyingPropertyName()) {
|
||||
setInlineClassUnderlyingPropertyName(other.getInlineClassUnderlyingPropertyName());
|
||||
}
|
||||
if (other.hasInlineClassUnderlyingType()) {
|
||||
mergeInlineClassUnderlyingType(other.getInlineClassUnderlyingType());
|
||||
}
|
||||
if (other.hasInlineClassUnderlyingTypeId()) {
|
||||
setInlineClassUnderlyingTypeId(other.getInlineClassUnderlyingTypeId());
|
||||
}
|
||||
if (other.hasTypeTable()) {
|
||||
mergeTypeTable(other.getTypeTable());
|
||||
}
|
||||
if (!other.versionRequirement_.isEmpty()) {
|
||||
if (versionRequirement_.isEmpty()) {
|
||||
versionRequirement_ = other.versionRequirement_;
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
} else {
|
||||
ensureVersionRequirementIsMutable();
|
||||
versionRequirement_.addAll(other.versionRequirement_);
|
||||
@@ -12371,12 +12200,6 @@ public final class DebugProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasInlineClassUnderlyingType()) {
|
||||
if (!getInlineClassUnderlyingType().isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTypeTable()) {
|
||||
if (!getTypeTable().isInitialized()) {
|
||||
|
||||
@@ -14435,186 +14258,6 @@ public final class DebugProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
private int inlineClassUnderlyingPropertyName_ ;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingPropertyName() {
|
||||
return ((bitField0_ & 0x00002000) == 0x00002000);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingPropertyName() {
|
||||
return inlineClassUnderlyingPropertyName_;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingPropertyName(int value) {
|
||||
bitField0_ |= 0x00002000;
|
||||
inlineClassUnderlyingPropertyName_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
|
||||
*/
|
||||
public Builder clearInlineClassUnderlyingPropertyName() {
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
inlineClassUnderlyingPropertyName_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder> inlineClassUnderlyingTypeBuilder_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingType() {
|
||||
return ((bitField0_ & 0x00004000) == 0x00004000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
return inlineClassUnderlyingType_;
|
||||
} else {
|
||||
return inlineClassUnderlyingTypeBuilder_.getMessage();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
inlineClassUnderlyingType_ = value;
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingType(
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder builderForValue) {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingType_ = builderForValue.build();
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder mergeInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00004000) == 0x00004000) &&
|
||||
inlineClassUnderlyingType_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance()) {
|
||||
inlineClassUnderlyingType_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.newBuilder(inlineClassUnderlyingType_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
inlineClassUnderlyingType_ = value;
|
||||
}
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00004000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public Builder clearInlineClassUnderlyingType() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
|
||||
onChanged();
|
||||
} else {
|
||||
inlineClassUnderlyingTypeBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder getInlineClassUnderlyingTypeBuilder() {
|
||||
bitField0_ |= 0x00004000;
|
||||
onChanged();
|
||||
return getInlineClassUnderlyingTypeFieldBuilder().getBuilder();
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ != null) {
|
||||
return inlineClassUnderlyingTypeBuilder_.getMessageOrBuilder();
|
||||
} else {
|
||||
return inlineClassUnderlyingType_;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
|
||||
*/
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>
|
||||
getInlineClassUnderlyingTypeFieldBuilder() {
|
||||
if (inlineClassUnderlyingTypeBuilder_ == null) {
|
||||
inlineClassUnderlyingTypeBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>(
|
||||
getInlineClassUnderlyingType(),
|
||||
getParentForChildren(),
|
||||
isClean());
|
||||
inlineClassUnderlyingType_ = null;
|
||||
}
|
||||
return inlineClassUnderlyingTypeBuilder_;
|
||||
}
|
||||
|
||||
private int inlineClassUnderlyingTypeId_ ;
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public boolean hasInlineClassUnderlyingTypeId() {
|
||||
return ((bitField0_ & 0x00008000) == 0x00008000);
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public int getInlineClassUnderlyingTypeId() {
|
||||
return inlineClassUnderlyingTypeId_;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public Builder setInlineClassUnderlyingTypeId(int value) {
|
||||
bitField0_ |= 0x00008000;
|
||||
inlineClassUnderlyingTypeId_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
|
||||
*/
|
||||
public Builder clearInlineClassUnderlyingTypeId() {
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
inlineClassUnderlyingTypeId_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTableOrBuilder> typeTableBuilder_;
|
||||
@@ -14622,7 +14265,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public boolean hasTypeTable() {
|
||||
return ((bitField0_ & 0x00010000) == 0x00010000);
|
||||
return ((bitField0_ & 0x00002000) == 0x00002000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
@@ -14647,7 +14290,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14661,7 +14304,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14669,7 +14312,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder mergeTypeTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable value) {
|
||||
if (typeTableBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00010000) == 0x00010000) &&
|
||||
if (((bitField0_ & 0x00002000) == 0x00002000) &&
|
||||
typeTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance()) {
|
||||
typeTable_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.newBuilder(typeTable_).mergeFrom(value).buildPartial();
|
||||
@@ -14680,7 +14323,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14693,14 +14336,14 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
typeTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00010000);
|
||||
bitField0_ = (bitField0_ & ~0x00002000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder getTypeTableBuilder() {
|
||||
bitField0_ |= 0x00010000;
|
||||
bitField0_ |= 0x00002000;
|
||||
onChanged();
|
||||
return getTypeTableFieldBuilder().getBuilder();
|
||||
}
|
||||
@@ -14733,9 +14376,9 @@ public final class DebugProtoBuf {
|
||||
|
||||
private java.util.List<java.lang.Integer> versionRequirement_ = java.util.Collections.emptyList();
|
||||
private void ensureVersionRequirementIsMutable() {
|
||||
if (!((bitField0_ & 0x00020000) == 0x00020000)) {
|
||||
if (!((bitField0_ & 0x00004000) == 0x00004000)) {
|
||||
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>(versionRequirement_);
|
||||
bitField0_ |= 0x00020000;
|
||||
bitField0_ |= 0x00004000;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -14820,7 +14463,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder clearVersionRequirement() {
|
||||
versionRequirement_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00020000);
|
||||
bitField0_ = (bitField0_ & ~0x00004000);
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
@@ -14832,7 +14475,7 @@ public final class DebugProtoBuf {
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public boolean hasVersionRequirementTable() {
|
||||
return ((bitField0_ & 0x00040000) == 0x00040000);
|
||||
return ((bitField0_ & 0x00008000) == 0x00008000);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
@@ -14857,7 +14500,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14871,7 +14514,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14879,7 +14522,7 @@ public final class DebugProtoBuf {
|
||||
*/
|
||||
public Builder mergeVersionRequirementTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable value) {
|
||||
if (versionRequirementTableBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00040000) == 0x00040000) &&
|
||||
if (((bitField0_ & 0x00008000) == 0x00008000) &&
|
||||
versionRequirementTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance()) {
|
||||
versionRequirementTable_ =
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.newBuilder(versionRequirementTable_).mergeFrom(value).buildPartial();
|
||||
@@ -14890,7 +14533,7 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
@@ -14903,14 +14546,14 @@ public final class DebugProtoBuf {
|
||||
} else {
|
||||
versionRequirementTableBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00040000);
|
||||
bitField0_ = (bitField0_ & ~0x00008000);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder getVersionRequirementTableBuilder() {
|
||||
bitField0_ |= 0x00040000;
|
||||
bitField0_ |= 0x00008000;
|
||||
onChanged();
|
||||
return getVersionRequirementTableFieldBuilder().getBuilder();
|
||||
}
|
||||
@@ -34739,7 +34382,7 @@ public final class DebugProtoBuf {
|
||||
"Variance:\003INV\0228\n\013upper_bound\030\005 \003(\0132#.org" +
|
||||
".jetbrains.kotlin.metadata.Type\022\036\n\016upper" +
|
||||
"_bound_id\030\006 \003(\005B\006\020\001\240\265\030\001\"$\n\010Variance\022\006\n\002I" +
|
||||
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\327\010\n\005Class\022\020" +
|
||||
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\250\007\n\005Class\022\020" +
|
||||
"\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq_name\030\003 \002(\005B\004\220\265\030\001\022",
|
||||
"#\n\025companion_object_name\030\004 \001(\005B\004\210\265\030\001\022D\n\016" +
|
||||
"type_parameter\030\005 \003(\0132,.org.jetbrains.kot" +
|
||||
@@ -34755,127 +34398,122 @@ public final class DebugProtoBuf {
|
||||
"brains.kotlin.metadata.TypeAlias\022<\n\nenum" +
|
||||
"_entry\030\r \003(\0132(.org.jetbrains.kotlin.meta" +
|
||||
"data.EnumEntry\022\'\n\027sealed_subclass_fq_nam" +
|
||||
"e\030\020 \003(\005B\006\020\001\220\265\030\001\0223\n%inline_class_underlyi" +
|
||||
"ng_property_name\030\021 \001(\005B\004\210\265\030\001\022I\n\034inline_c" +
|
||||
"lass_underlying_type\030\022 \001(\0132#.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Type\022-\n\037inline_class_" +
|
||||
"underlying_type_id\030\023 \001(\005B\004\240\265\030\001\022<\n\ntype_t" +
|
||||
"able\030\036 \001(\0132(.org.jetbrains.kotlin.metada",
|
||||
"ta.TypeTable\022\033\n\023version_requirement\030\037 \003(" +
|
||||
"\005\022Y\n\031version_requirement_table\030 \001(\01326.o" +
|
||||
"rg.jetbrains.kotlin.metadata.VersionRequ" +
|
||||
"irementTable\"x\n\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTER" +
|
||||
"FACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024" +
|
||||
"\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMP" +
|
||||
"ANION_OBJECT\020\006*\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010fu" +
|
||||
"nction\030\003 \003(\0132\'.org.jetbrains.kotlin.meta" +
|
||||
"data.Function\0229\n\010property\030\004 \003(\0132\'.org.je" +
|
||||
"tbrains.kotlin.metadata.Property\022<\n\ntype",
|
||||
"_alias\030\005 \003(\0132(.org.jetbrains.kotlin.meta" +
|
||||
"data.TypeAlias\022<\n\ntype_table\030\036 \001(\0132(.org" +
|
||||
".jetbrains.kotlin.metadata.TypeTable\022Y\n\031" +
|
||||
"version_requirement_table\030 \001(\01326.org.je" +
|
||||
"tbrains.kotlin.metadata.VersionRequireme" +
|
||||
"ntTable*\005\010d\020\310\001\"`\n\tTypeTable\0221\n\004type\030\001 \003(" +
|
||||
"\0132#.org.jetbrains.kotlin.metadata.Type\022\032" +
|
||||
"\n\016first_nullable\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Con" +
|
||||
"structor\022\020\n\005flags\030\001 \001(\005:\0016\022F\n\017value_para" +
|
||||
"meter\030\002 \003(\0132-.org.jetbrains.kotlin.metad",
|
||||
"ata.ValueParameter\022\033\n\023version_requiremen" +
|
||||
"t\030\037 \003(\005*\006\010d\020\270\224\001\"\246\004\n\010Function\022\020\n\005flags\030\t " +
|
||||
"\001(\005:\0016\022\024\n\told_flags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002" +
|
||||
"(\005B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetb" +
|
||||
"rains.kotlin.metadata.Type\022\034\n\016return_typ" +
|
||||
"e_id\030\007 \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\013" +
|
||||
"2,.org.jetbrains.kotlin.metadata.TypePar" +
|
||||
"ameter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetb" +
|
||||
"rains.kotlin.metadata.Type\022\036\n\020receiver_t" +
|
||||
"ype_id\030\010 \001(\005B\004\240\265\030\001\022F\n\017value_parameter\030\006 ",
|
||||
"\003(\0132-.org.jetbrains.kotlin.metadata.Valu" +
|
||||
"eParameter\022<\n\ntype_table\030\036 \001(\0132(.org.jet" +
|
||||
"brains.kotlin.metadata.TypeTable\022\033\n\023vers" +
|
||||
"ion_requirement\030\037 \003(\005\0229\n\010contract\030 \001(\0132" +
|
||||
"\'.org.jetbrains.kotlin.metadata.Contract" +
|
||||
"*\006\010d\020\270\224\001\"\345\003\n\010Property\022\022\n\005flags\030\013 \001(\005:\00351" +
|
||||
"8\022\027\n\told_flags\030\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005" +
|
||||
"B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\022\034\n\016return_type_" +
|
||||
"id\030\t \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\0132,",
|
||||
".org.jetbrains.kotlin.metadata.TypeParam" +
|
||||
"eter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\022\036\n\020receiver_typ" +
|
||||
"e_id\030\n \001(\005B\004\240\265\030\001\022M\n\026setter_value_paramet" +
|
||||
"er\030\006 \001(\0132-.org.jetbrains.kotlin.metadata" +
|
||||
".ValueParameter\022\024\n\014getter_flags\030\007 \001(\005\022\024\n" +
|
||||
"\014setter_flags\030\010 \001(\005\022\033\n\023version_requireme" +
|
||||
"nt\030\037 \003(\005*\006\010d\020\270\224\001\"\357\001\n\016ValueParameter\022\020\n\005f" +
|
||||
"lags\030\001 \001(\005:\0010\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004typ" +
|
||||
"e\030\003 \001(\0132#.org.jetbrains.kotlin.metadata.",
|
||||
"Type\022\025\n\007type_id\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_el" +
|
||||
"ement_type\030\004 \001(\0132#.org.jetbrains.kotlin." +
|
||||
"metadata.Type\022$\n\026vararg_element_type_id\030" +
|
||||
"\006 \001(\005B\004\240\265\030\001*\005\010d\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flag" +
|
||||
"s\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_p" +
|
||||
"arameter\030\003 \003(\0132,.org.jetbrains.kotlin.me" +
|
||||
"tadata.TypeParameter\022<\n\017underlying_type\030" +
|
||||
"\004 \001(\0132#.org.jetbrains.kotlin.metadata.Ty" +
|
||||
"pe\022 \n\022underlying_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\r" +
|
||||
"expanded_type\030\006 \001(\0132#.org.jetbrains.kotl",
|
||||
"in.metadata.Type\022\036\n\020expanded_type_id\030\007 \001" +
|
||||
"(\005B\004\240\265\030\001\022=\n\nannotation\030\010 \003(\0132).org.jetbr" +
|
||||
"ains.kotlin.metadata.Annotation\022\033\n\023versi" +
|
||||
"on_requirement\030\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry" +
|
||||
"\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionR" +
|
||||
"equirement\022\017\n\007version\030\001 \001(\005\022\024\n\014version_f" +
|
||||
"ull\030\002 \001(\005\022M\n\005level\030\003 \001(\01627.org.jetbrains" +
|
||||
".kotlin.metadata.VersionRequirement.Leve" +
|
||||
"l:\005ERROR\022\022\n\nerror_code\030\004 \001(\005\022\025\n\007message\030" +
|
||||
"\005 \001(\005B\004\230\265\030\001\022e\n\014version_kind\030\006 \001(\0162=.org.",
|
||||
"jetbrains.kotlin.metadata.VersionRequire" +
|
||||
"ment.VersionKind:\020LANGUAGE_VERSION\"+\n\005Le" +
|
||||
"vel\022\013\n\007WARNING\020\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"" +
|
||||
"J\n\013VersionKind\022\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020" +
|
||||
"COMPILER_VERSION\020\001\022\017\n\013API_VERSION\020\002\"a\n\027V" +
|
||||
"ersionRequirementTable\022F\n\013requirement\030\001 " +
|
||||
"\003(\01321.org.jetbrains.kotlin.metadata.Vers" +
|
||||
"ionRequirement\"\217\002\n\017PackageFragment\022;\n\007st" +
|
||||
"rings\030\001 \001(\0132*.org.jetbrains.kotlin.metad" +
|
||||
"ata.StringTable\022J\n\017qualified_names\030\002 \001(\013",
|
||||
"21.org.jetbrains.kotlin.metadata.Qualifi" +
|
||||
"edNameTable\0227\n\007package\030\003 \001(\0132&.org.jetbr" +
|
||||
"ains.kotlin.metadata.Package\0223\n\005class\030\004 " +
|
||||
"\003(\0132$.org.jetbrains.kotlin.metadata.Clas" +
|
||||
"s*\005\010d\020\310\001\"A\n\010Contract\0225\n\006effect\030\001 \003(\0132%.o" +
|
||||
"rg.jetbrains.kotlin.metadata.Effect\"\306\003\n\006" +
|
||||
"Effect\022E\n\013effect_type\030\001 \001(\01620.org.jetbra" +
|
||||
"ins.kotlin.metadata.Effect.EffectType\022N\n" +
|
||||
"\033effect_constructor_argument\030\002 \003(\0132).org" +
|
||||
".jetbrains.kotlin.metadata.Expression\022S\n",
|
||||
" conclusion_of_conditional_effect\030\003 \001(\0132" +
|
||||
").org.jetbrains.kotlin.metadata.Expressi" +
|
||||
"on\022B\n\004kind\030\004 \001(\01624.org.jetbrains.kotlin." +
|
||||
"metadata.Effect.InvocationKind\"C\n\nEffect" +
|
||||
"Type\022\024\n\020RETURNS_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n" +
|
||||
"\020RETURNS_NOT_NULL\020\002\"G\n\016InvocationKind\022\020\n" +
|
||||
"\014AT_MOST_ONCE\020\000\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_" +
|
||||
"LEAST_ONCE\020\002\"\245\003\n\nExpression\022\020\n\005flags\030\001 \001" +
|
||||
"(\005:\0010\022!\n\031value_parameter_reference\030\002 \001(\005" +
|
||||
"\022O\n\016constant_value\030\003 \001(\01627.org.jetbrains",
|
||||
".kotlin.metadata.Expression.ConstantValu" +
|
||||
"e\022=\n\020is_instance_type\030\004 \001(\0132#.org.jetbra" +
|
||||
"ins.kotlin.metadata.Type\022!\n\023is_instance_" +
|
||||
"type_id\030\005 \001(\005B\004\240\265\030\001\022?\n\014and_argument\030\006 \003(" +
|
||||
"\0132).org.jetbrains.kotlin.metadata.Expres" +
|
||||
"sion\022>\n\013or_argument\030\007 \003(\0132).org.jetbrain" +
|
||||
"s.kotlin.metadata.Expression\".\n\rConstant" +
|
||||
"Value\022\010\n\004TRUE\020\000\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010" +
|
||||
"Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRAC" +
|
||||
"T\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERNA",
|
||||
"L\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLI" +
|
||||
"C\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nM" +
|
||||
"emberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERR" +
|
||||
"IDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B\017" +
|
||||
"B\rDebugProtoBuf"
|
||||
"e\030\020 \003(\005B\006\020\001\220\265\030\001\022<\n\ntype_table\030\036 \001(\0132(.or" +
|
||||
"g.jetbrains.kotlin.metadata.TypeTable\022\033\n" +
|
||||
"\023version_requirement\030\037 \003(\005\022Y\n\031version_re" +
|
||||
"quirement_table\030 \001(\01326.org.jetbrains.ko" +
|
||||
"tlin.metadata.VersionRequirementTable\"x\n" +
|
||||
"\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_",
|
||||
"CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024\n\020ANNOTATION_CL" +
|
||||
"ASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMPANION_OBJECT\020\006*" +
|
||||
"\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010function\030\003 \003(\0132\'." +
|
||||
"org.jetbrains.kotlin.metadata.Function\0229" +
|
||||
"\n\010property\030\004 \003(\0132\'.org.jetbrains.kotlin." +
|
||||
"metadata.Property\022<\n\ntype_alias\030\005 \003(\0132(." +
|
||||
"org.jetbrains.kotlin.metadata.TypeAlias\022" +
|
||||
"<\n\ntype_table\030\036 \001(\0132(.org.jetbrains.kotl" +
|
||||
"in.metadata.TypeTable\022Y\n\031version_require" +
|
||||
"ment_table\030 \001(\01326.org.jetbrains.kotlin.",
|
||||
"metadata.VersionRequirementTable*\005\010d\020\310\001\"" +
|
||||
"`\n\tTypeTable\0221\n\004type\030\001 \003(\0132#.org.jetbrai" +
|
||||
"ns.kotlin.metadata.Type\022\032\n\016first_nullabl" +
|
||||
"e\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Constructor\022\020\n\005fla" +
|
||||
"gs\030\001 \001(\005:\0016\022F\n\017value_parameter\030\002 \003(\0132-.o" +
|
||||
"rg.jetbrains.kotlin.metadata.ValueParame" +
|
||||
"ter\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224\001" +
|
||||
"\"\246\004\n\010Function\022\020\n\005flags\030\t \001(\005:\0016\022\024\n\told_f" +
|
||||
"lags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013ret" +
|
||||
"urn_type\030\003 \001(\0132#.org.jetbrains.kotlin.me",
|
||||
"tadata.Type\022\034\n\016return_type_id\030\007 \001(\005B\004\240\265\030" +
|
||||
"\001\022D\n\016type_parameter\030\004 \003(\0132,.org.jetbrain" +
|
||||
"s.kotlin.metadata.TypeParameter\022:\n\rrecei" +
|
||||
"ver_type\030\005 \001(\0132#.org.jetbrains.kotlin.me" +
|
||||
"tadata.Type\022\036\n\020receiver_type_id\030\010 \001(\005B\004\240" +
|
||||
"\265\030\001\022F\n\017value_parameter\030\006 \003(\0132-.org.jetbr" +
|
||||
"ains.kotlin.metadata.ValueParameter\022<\n\nt" +
|
||||
"ype_table\030\036 \001(\0132(.org.jetbrains.kotlin.m" +
|
||||
"etadata.TypeTable\022\033\n\023version_requirement" +
|
||||
"\030\037 \003(\005\0229\n\010contract\030 \001(\0132\'.org.jetbrains",
|
||||
".kotlin.metadata.Contract*\006\010d\020\270\224\001\"\345\003\n\010Pr" +
|
||||
"operty\022\022\n\005flags\030\013 \001(\005:\003518\022\027\n\told_flags\030" +
|
||||
"\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013retur" +
|
||||
"n_type\030\003 \001(\0132#.org.jetbrains.kotlin.meta" +
|
||||
"data.Type\022\034\n\016return_type_id\030\t \001(\005B\004\240\265\030\001\022" +
|
||||
"D\n\016type_parameter\030\004 \003(\0132,.org.jetbrains." +
|
||||
"kotlin.metadata.TypeParameter\022:\n\rreceive" +
|
||||
"r_type\030\005 \001(\0132#.org.jetbrains.kotlin.meta" +
|
||||
"data.Type\022\036\n\020receiver_type_id\030\n \001(\005B\004\240\265\030" +
|
||||
"\001\022M\n\026setter_value_parameter\030\006 \001(\0132-.org.",
|
||||
"jetbrains.kotlin.metadata.ValueParameter" +
|
||||
"\022\024\n\014getter_flags\030\007 \001(\005\022\024\n\014setter_flags\030\010" +
|
||||
" \001(\005\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224" +
|
||||
"\001\"\357\001\n\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022" +
|
||||
"\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004type\030\003 \001(\0132#.org.j" +
|
||||
"etbrains.kotlin.metadata.Type\022\025\n\007type_id" +
|
||||
"\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_element_type\030\004 \001(" +
|
||||
"\0132#.org.jetbrains.kotlin.metadata.Type\022$" +
|
||||
"\n\026vararg_element_type_id\030\006 \001(\005B\004\240\265\030\001*\005\010d" +
|
||||
"\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flags\030\001 \001(\005:\0016\022\022\n\004n",
|
||||
"ame\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_parameter\030\003 \003(\0132" +
|
||||
",.org.jetbrains.kotlin.metadata.TypePara" +
|
||||
"meter\022<\n\017underlying_type\030\004 \001(\0132#.org.jet" +
|
||||
"brains.kotlin.metadata.Type\022 \n\022underlyin" +
|
||||
"g_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\rexpanded_type\030\006" +
|
||||
" \001(\0132#.org.jetbrains.kotlin.metadata.Typ" +
|
||||
"e\022\036\n\020expanded_type_id\030\007 \001(\005B\004\240\265\030\001\022=\n\nann" +
|
||||
"otation\030\010 \003(\0132).org.jetbrains.kotlin.met" +
|
||||
"adata.Annotation\022\033\n\023version_requirement\030" +
|
||||
"\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry\022\022\n\004name\030\001 \001(\005B",
|
||||
"\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionRequirement\022\017\n\007v" +
|
||||
"ersion\030\001 \001(\005\022\024\n\014version_full\030\002 \001(\005\022M\n\005le" +
|
||||
"vel\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
|
||||
"a.VersionRequirement.Level:\005ERROR\022\022\n\nerr" +
|
||||
"or_code\030\004 \001(\005\022\025\n\007message\030\005 \001(\005B\004\230\265\030\001\022e\n\014" +
|
||||
"version_kind\030\006 \001(\0162=.org.jetbrains.kotli" +
|
||||
"n.metadata.VersionRequirement.VersionKin" +
|
||||
"d:\020LANGUAGE_VERSION\"+\n\005Level\022\013\n\007WARNING\020" +
|
||||
"\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"J\n\013VersionKind\022" +
|
||||
"\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020COMPILER_VERSIO",
|
||||
"N\020\001\022\017\n\013API_VERSION\020\002\"a\n\027VersionRequireme" +
|
||||
"ntTable\022F\n\013requirement\030\001 \003(\01321.org.jetbr" +
|
||||
"ains.kotlin.metadata.VersionRequirement\"" +
|
||||
"\217\002\n\017PackageFragment\022;\n\007strings\030\001 \001(\0132*.o" +
|
||||
"rg.jetbrains.kotlin.metadata.StringTable" +
|
||||
"\022J\n\017qualified_names\030\002 \001(\01321.org.jetbrain" +
|
||||
"s.kotlin.metadata.QualifiedNameTable\0227\n\007" +
|
||||
"package\030\003 \001(\0132&.org.jetbrains.kotlin.met" +
|
||||
"adata.Package\0223\n\005class\030\004 \003(\0132$.org.jetbr" +
|
||||
"ains.kotlin.metadata.Class*\005\010d\020\310\001\"A\n\010Con",
|
||||
"tract\0225\n\006effect\030\001 \003(\0132%.org.jetbrains.ko" +
|
||||
"tlin.metadata.Effect\"\306\003\n\006Effect\022E\n\013effec" +
|
||||
"t_type\030\001 \001(\01620.org.jetbrains.kotlin.meta" +
|
||||
"data.Effect.EffectType\022N\n\033effect_constru" +
|
||||
"ctor_argument\030\002 \003(\0132).org.jetbrains.kotl" +
|
||||
"in.metadata.Expression\022S\n conclusion_of_" +
|
||||
"conditional_effect\030\003 \001(\0132).org.jetbrains" +
|
||||
".kotlin.metadata.Expression\022B\n\004kind\030\004 \001(" +
|
||||
"\01624.org.jetbrains.kotlin.metadata.Effect" +
|
||||
".InvocationKind\"C\n\nEffectType\022\024\n\020RETURNS",
|
||||
"_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n\020RETURNS_NOT_NU" +
|
||||
"LL\020\002\"G\n\016InvocationKind\022\020\n\014AT_MOST_ONCE\020\000" +
|
||||
"\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_LEAST_ONCE\020\002\"\245\003" +
|
||||
"\n\nExpression\022\020\n\005flags\030\001 \001(\005:\0010\022!\n\031value_" +
|
||||
"parameter_reference\030\002 \001(\005\022O\n\016constant_va" +
|
||||
"lue\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
|
||||
"a.Expression.ConstantValue\022=\n\020is_instanc" +
|
||||
"e_type\030\004 \001(\0132#.org.jetbrains.kotlin.meta" +
|
||||
"data.Type\022!\n\023is_instance_type_id\030\005 \001(\005B\004" +
|
||||
"\240\265\030\001\022?\n\014and_argument\030\006 \003(\0132).org.jetbrai",
|
||||
"ns.kotlin.metadata.Expression\022>\n\013or_argu" +
|
||||
"ment\030\007 \003(\0132).org.jetbrains.kotlin.metada" +
|
||||
"ta.Expression\".\n\rConstantValue\022\010\n\004TRUE\020\000" +
|
||||
"\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010Modality\022\t\n\005FIN" +
|
||||
"AL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002\022\n\n\006SEALED\020\003" +
|
||||
"*b\n\nVisibility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020" +
|
||||
"\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVATE_" +
|
||||
"TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nMemberKind\022\017\n\013DE" +
|
||||
"CLARATION\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022\016\n\nDELEGA" +
|
||||
"TION\020\002\022\017\n\013SYNTHESIZED\020\003B\017B\rDebugProtoBuf"
|
||||
};
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
@@ -34949,7 +34587,7 @@ public final class DebugProtoBuf {
|
||||
internal_static_org_jetbrains_kotlin_metadata_Class_fieldAccessorTable = new
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_org_jetbrains_kotlin_metadata_Class_descriptor,
|
||||
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "InlineClassUnderlyingPropertyName", "InlineClassUnderlyingType", "InlineClassUnderlyingTypeId", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
|
||||
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
|
||||
internal_static_org_jetbrains_kotlin_metadata_Package_descriptor =
|
||||
getDescriptor().getMessageTypes().get(6);
|
||||
internal_static_org_jetbrains_kotlin_metadata_Package_fieldAccessorTable = new
|
||||
@@ -35058,8 +34696,6 @@ public final class DebugProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipMessageInComparison);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
|
||||
|
||||
394
build.gradle.kts
394
build.gradle.kts
@@ -1,6 +1,7 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.crypto.checksum.Checksum
|
||||
import org.gradle.plugins.ide.idea.model.IdeaModel
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import proguard.gradle.ProGuardTask
|
||||
|
||||
buildscript {
|
||||
@@ -13,11 +14,8 @@ buildscript {
|
||||
|
||||
if (cacheRedirectorEnabled) {
|
||||
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
|
||||
maven("https://cache-redirector.jetbrains.com/repo.maven.apache.org/maven2")
|
||||
|
||||
} else {
|
||||
maven("https://plugins.gradle.org/m2")
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +27,18 @@ buildscript {
|
||||
dependencies {
|
||||
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
|
||||
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.31")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
|
||||
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
|
||||
classpath(kotlin("serialization", bootstrapKotlinVersion))
|
||||
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
|
||||
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.17.2")
|
||||
}
|
||||
}
|
||||
|
||||
if (kotlinBuildProperties.buildScanServer != null) {
|
||||
apply(from = "gradle/buildScanUserData.gradle")
|
||||
}
|
||||
|
||||
plugins {
|
||||
base
|
||||
idea
|
||||
@@ -55,6 +58,13 @@ pill {
|
||||
|
||||
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
|
||||
|
||||
val configuredJdks: List<JdkId> =
|
||||
getConfiguredJdks().also {
|
||||
it.forEach { jdkId ->
|
||||
logger.info("Using ${jdkId.majorVersion} home: ${jdkId.homeDir}")
|
||||
}
|
||||
}
|
||||
|
||||
val defaultSnapshotVersion: String by extra
|
||||
val buildNumber by extra(findProperty("build.number")?.toString() ?: defaultSnapshotVersion)
|
||||
val kotlinVersion by extra(
|
||||
@@ -80,8 +90,10 @@ val distKotlinHomeDir by extra("$distDir/kotlinc")
|
||||
val distLibDir = "$distKotlinHomeDir/lib"
|
||||
val commonLocalDataDir = "$rootDir/local"
|
||||
val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox"
|
||||
val ideaUltimateSandboxDir = "$commonLocalDataDir/ideaUltimateSandbox"
|
||||
val artifactsDir = "$distDir/artifacts"
|
||||
val ideaPluginDir = "$artifactsDir/ideaPlugin/Kotlin"
|
||||
val ideaUltimatePluginDir = "$artifactsDir/ideaUltimatePlugin/Kotlin"
|
||||
|
||||
extra["ktorExcludesForDaemon"] = listOf(
|
||||
"org.jetbrains.kotlin" to "kotlin-reflect",
|
||||
@@ -99,13 +111,46 @@ extra["distLibDir"] = project.file(distLibDir)
|
||||
extra["libsDir"] = project.file(distLibDir)
|
||||
extra["commonLocalDataDir"] = project.file(commonLocalDataDir)
|
||||
extra["ideaSandboxDir"] = project.file(ideaSandboxDir)
|
||||
extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir)
|
||||
extra["ideaPluginDir"] = project.file(ideaPluginDir)
|
||||
extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir)
|
||||
extra["isSonatypeRelease"] = false
|
||||
val kotlinNativeVersionObject = project.kotlinNativeVersionValue()
|
||||
subprojects {
|
||||
extra["kotlinNativeVersion"] = kotlinNativeVersionObject
|
||||
}
|
||||
|
||||
// Work-around necessary to avoid setting null javaHome. Will be removed after support of lazy task configuration
|
||||
val jdkNotFoundConst = "JDK NOT FOUND"
|
||||
|
||||
if (isTeamcityBuild) {
|
||||
extra["JDK_16"] = jdkPath("1.6")
|
||||
extra["JDK_17"] = jdkPath("1.7")
|
||||
} else {
|
||||
extra["JDK_16"] = jdkPath("1.6", "1.8")
|
||||
extra["JDK_17"] = jdkPath("1.7", "1.8")
|
||||
}
|
||||
extra["JDK_18"] = jdkPath("1.8")
|
||||
extra["JDK_9"] = jdkPath("9")
|
||||
extra["JDK_10"] = jdkPath("10")
|
||||
extra["JDK_11"] = jdkPath("11")
|
||||
extra["JDK_15"] = jdkPath("15")
|
||||
|
||||
// allow opening the project without setting up all env variables (see KT-26413)
|
||||
if (!kotlinBuildProperties.isInIdeaSync) {
|
||||
checkJDK()
|
||||
}
|
||||
|
||||
fun checkJDK() {
|
||||
val missingEnvVars = JdkMajorVersion.values()
|
||||
.filter { it.isMandatory() && extra[it.name] == jdkNotFoundConst }
|
||||
.mapTo(ArrayList()) { it.name }
|
||||
|
||||
if (missingEnvVars.isNotEmpty()) {
|
||||
throw GradleException("Required environment variables are missing: ${missingEnvVars.joinToString()}")
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.apply {
|
||||
from(rootProject.file("gradle/versions.gradle.kts"))
|
||||
from(rootProject.file("gradle/report.gradle.kts"))
|
||||
@@ -114,7 +159,6 @@ rootProject.apply {
|
||||
from(rootProject.file("gradle/checkArtifacts.gradle.kts"))
|
||||
from(rootProject.file("gradle/checkCacheability.gradle.kts"))
|
||||
from(rootProject.file("gradle/retryPublishing.gradle.kts"))
|
||||
from(rootProject.file("gradle/modularizedTestConfigurations.gradle.kts"))
|
||||
}
|
||||
|
||||
IdeVersionConfigurator.setCurrentIde(project)
|
||||
@@ -128,9 +172,8 @@ extra["versions.junit"] = "4.12"
|
||||
extra["versions.javaslang"] = "2.0.6"
|
||||
extra["versions.ant"] = "1.10.7"
|
||||
extra["versions.android"] = "2.3.1"
|
||||
extra["versions.kotlinx-coroutines-core"] = "1.5.0"
|
||||
extra["versions.kotlinx-coroutines-core-jvm"] = "1.5.0"
|
||||
extra["versions.kotlinx-coroutines-jdk8"] = "1.5.0"
|
||||
extra["versions.kotlinx-coroutines-core"] = "1.3.8"
|
||||
extra["versions.kotlinx-coroutines-jdk8"] = "1.3.8"
|
||||
extra["versions.json"] = "20160807"
|
||||
extra["versions.native-platform"] = "0.14"
|
||||
extra["versions.robolectric"] = "4.0"
|
||||
@@ -139,7 +182,7 @@ extra["versions.jflex"] = "1.7.0"
|
||||
extra["versions.markdown"] = "0.1.25"
|
||||
extra["versions.trove4j"] = "1.0.20181211"
|
||||
extra["versions.completion-ranking-kotlin"] = "0.1.3"
|
||||
extra["versions.r8"] = "2.2.64"
|
||||
extra["versions.r8"] = "2.0.88"
|
||||
val immutablesVersion = "0.3.1"
|
||||
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
|
||||
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
@@ -148,9 +191,10 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
extra["versions.ktor-network"] = "1.0.1"
|
||||
|
||||
if (!project.hasProperty("versions.kotlin-native")) {
|
||||
extra["versions.kotlin-native"] = "1.6.0-dev-248"
|
||||
extra["versions.kotlin-native"] = "1.5-dev-17775"
|
||||
}
|
||||
|
||||
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
|
||||
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
|
||||
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
|
||||
val useJvmIrBackend by extra(project.kotlinBuildProperties.useIR)
|
||||
@@ -162,11 +206,15 @@ extra["intellijSeparateSdks"] = intellijSeparateSdks
|
||||
|
||||
extra["IntellijCoreDependencies"] =
|
||||
listOf(
|
||||
"asm-all-8.0.1",
|
||||
when {
|
||||
Platform[202].orHigher() -> "asm-all-8.0.1"
|
||||
else -> "asm-all-7.0.1"
|
||||
},
|
||||
"guava",
|
||||
"jdom",
|
||||
"jna",
|
||||
"log4j",
|
||||
if (Platform[201].orHigher()) null else "picocontainer",
|
||||
"snappy-in-java",
|
||||
"streamex",
|
||||
"trove4j"
|
||||
@@ -214,7 +262,6 @@ extra["compilerModules"] = arrayOf(
|
||||
":compiler:incremental-compilation-impl",
|
||||
":compiler:compiler.version",
|
||||
":js:js.ast",
|
||||
":js:js.sourcemap",
|
||||
":js:js.serializer",
|
||||
":js:js.parser",
|
||||
":js:js.config",
|
||||
@@ -250,7 +297,6 @@ extra["compilerModules"] = arrayOf(
|
||||
":compiler:fir:java",
|
||||
":compiler:fir:jvm",
|
||||
":compiler:fir:checkers",
|
||||
":compiler:fir:checkers:checkers.jvm",
|
||||
":compiler:fir:entrypoint",
|
||||
":compiler:fir:analysis-tests",
|
||||
":compiler:fir:analysis-tests:legacy-fir-tests",
|
||||
@@ -270,6 +316,7 @@ extra["compilerModulesForJps"] = listOf(
|
||||
":core:compiler.common.jvm",
|
||||
":core:descriptors",
|
||||
":core:descriptors.jvm",
|
||||
":idea:idea-jps-common",
|
||||
":kotlin-preloader",
|
||||
":compiler:util",
|
||||
":compiler:config",
|
||||
@@ -279,54 +326,13 @@ extra["compilerModulesForJps"] = listOf(
|
||||
":compiler:compiler.version"
|
||||
)
|
||||
|
||||
extra["compilerArtifactsForIde"] = listOf(
|
||||
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide",
|
||||
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide",
|
||||
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide",
|
||||
":prepare:ide-plugin-dependencies:js-ir-runtime-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kotlin-compiler-cli-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide",
|
||||
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide",
|
||||
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide",
|
||||
":prepare:ide-plugin-dependencies:compiler-components-for-jps",
|
||||
":prepare:ide-plugin-dependencies:parcelize-compiler-plugin-for-ide",
|
||||
":prepare:ide-plugin-dependencies:lombok-compiler-plugin-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kotlin-compiler-tests-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kotlin-compiler-testdata-for-ide",
|
||||
":prepare:ide-plugin-dependencies:kotlin-stdlib-minimal-for-test-for-ide",
|
||||
":prepare:ide-plugin-dependencies:low-level-api-fir-for-ide",
|
||||
":prepare:ide-plugin-dependencies:high-level-api-for-ide",
|
||||
":prepare:ide-plugin-dependencies:high-level-api-fir-for-ide",
|
||||
":prepare:ide-plugin-dependencies:high-level-api-fir-tests-for-ide",
|
||||
":kotlin-script-runtime",
|
||||
":kotlin-script-util",
|
||||
":kotlin-scripting-common",
|
||||
":kotlin-scripting-jvm",
|
||||
":kotlin-scripting-compiler",
|
||||
":kotlin-scripting-compiler-impl",
|
||||
":kotlin-android-extensions-runtime",
|
||||
":kotlin-stdlib-common",
|
||||
":kotlin-stdlib",
|
||||
":kotlin-stdlib-jdk7",
|
||||
":kotlin-stdlib-jdk8",
|
||||
":kotlin-reflect",
|
||||
":kotlin-main-kts"
|
||||
)
|
||||
|
||||
// TODO: fix remaining warnings and remove this property.
|
||||
extra["tasksWithWarnings"] = listOf(
|
||||
":kotlin-stdlib:compileTestKotlin",
|
||||
":kotlin-stdlib-jdk7:compileTestKotlin",
|
||||
":kotlin-stdlib-jdk8:compileTestKotlin",
|
||||
":plugins:uast-kotlin-base:compileKotlin",
|
||||
":plugins:uast-kotlin-base:compileTestKotlin",
|
||||
":plugins:uast-kotlin:compileKotlin",
|
||||
":plugins:uast-kotlin:compileTestKotlin",
|
||||
":plugins:uast-kotlin-fir:compileKotlin",
|
||||
":plugins:uast-kotlin-fir:compileTestKotlin"
|
||||
":plugins:uast-kotlin:compileTestKotlin"
|
||||
)
|
||||
|
||||
val tasksWithWarnings: List<String> by extra
|
||||
@@ -348,12 +354,6 @@ val coreLibProjects = listOfNotNull(
|
||||
":kotlin-reflect"
|
||||
)
|
||||
|
||||
val projectsWithDisabledFirBootstrap = coreLibProjects + listOf(
|
||||
":kotlin-gradle-plugin",
|
||||
":kotlinx-metadata",
|
||||
":kotlinx-metadata-jvm"
|
||||
)
|
||||
|
||||
val gradlePluginProjects = listOf(
|
||||
":kotlin-gradle-plugin",
|
||||
":kotlin-gradle-plugin-api",
|
||||
@@ -361,8 +361,7 @@ val gradlePluginProjects = listOf(
|
||||
":kotlin-annotation-processing-gradle",
|
||||
":kotlin-noarg",
|
||||
":kotlin-sam-with-receiver",
|
||||
":kotlin-parcelize-compiler",
|
||||
":kotlin-lombok"
|
||||
":kotlin-parcelize-compiler"
|
||||
)
|
||||
|
||||
apply {
|
||||
@@ -371,7 +370,7 @@ apply {
|
||||
}
|
||||
|
||||
apply {
|
||||
if (extra["isDeployStagingRepoGenerationRequired"] as? Boolean == true) {
|
||||
if (extra["isSonatypeRelease"] as? Boolean == true) {
|
||||
logger.info("Applying configuration for sonatype release")
|
||||
from("libraries/prepareSonatypeStaging.gradle")
|
||||
}
|
||||
@@ -385,32 +384,11 @@ fun Task.listConfigurationContents(configName: String) {
|
||||
}
|
||||
}
|
||||
|
||||
val defaultJvmTarget = "1.8"
|
||||
val defaultJavaHome = jdkPath(if (Platform[203].orHigher()) "11" else defaultJvmTarget)
|
||||
val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures)
|
||||
|
||||
allprojects {
|
||||
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
|
||||
|
||||
repositories {
|
||||
kotlinBuildLocalRepo(project)
|
||||
mirrorRepo?.let(::maven)
|
||||
|
||||
internalBootstrapRepo?.let(::maven)
|
||||
bootstrapKotlinRepo?.let(::maven)
|
||||
maven(protobufRepo)
|
||||
|
||||
maven(intellijRepo)
|
||||
|
||||
mavenCentral()
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
maven("https://dl.google.com/dl/android/maven2")
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
|
||||
jcenter()
|
||||
}
|
||||
|
||||
if (path.startsWith(":kotlin-ide.")) {
|
||||
return@allprojects
|
||||
}
|
||||
|
||||
configurations.maybeCreate("embedded").apply {
|
||||
isCanBeConsumed = false
|
||||
@@ -430,17 +408,32 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
jvmTarget = defaultJvmTarget
|
||||
javaHome = defaultJavaHome
|
||||
|
||||
// There are problems with common build dir:
|
||||
// - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location
|
||||
// - idea seems unable to exclude common buildDir from indexing
|
||||
// therefore it is disabled by default
|
||||
// buildDir = File(commonBuildDir, project.name)
|
||||
|
||||
project.configureJvmDefaultToolchain()
|
||||
plugins.withId("java-base") {
|
||||
project.configureShadowJarSubstitutionInCompileClasspath()
|
||||
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
|
||||
|
||||
repositories {
|
||||
kotlinBuildLocalRepo(project)
|
||||
mirrorRepo?.let(::maven)
|
||||
jcenter()
|
||||
maven(protobufRepo)
|
||||
maven(intellijRepo)
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies")
|
||||
maven("https://dl.google.com/dl/android/maven2")
|
||||
bootstrapKotlinRepo?.let(::maven)
|
||||
internalBootstrapRepo?.let(::maven)
|
||||
}
|
||||
|
||||
configureJvmProject(javaHome!!, jvmTarget!!)
|
||||
|
||||
val commonCompilerArgs = listOfNotNull(
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-Xread-deserialized-contracts",
|
||||
@@ -470,7 +463,7 @@ allprojects {
|
||||
useIR = true
|
||||
}
|
||||
|
||||
if (useJvmFir && this@allprojects.path !in projectsWithDisabledFirBootstrap) {
|
||||
if (useJvmFir) {
|
||||
freeCompilerArgs += "-Xuse-fir"
|
||||
freeCompilerArgs += "-Xabi-stability=stable"
|
||||
}
|
||||
@@ -513,16 +506,12 @@ allprojects {
|
||||
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
|
||||
}
|
||||
|
||||
if (isConfigurationCacheDisabled) {
|
||||
// Custom input normolization isn't supported by configuration cache at the moment
|
||||
// See https://github.com/gradle/gradle/issues/13706
|
||||
normalization {
|
||||
runtimeClasspath {
|
||||
ignore("META-INF/MANIFEST.MF")
|
||||
ignore("META-INF/compiler.version")
|
||||
ignore("META-INF/plugin.xml")
|
||||
ignore("kotlin/KotlinVersionCurrentValue.class")
|
||||
}
|
||||
normalization {
|
||||
runtimeClasspath {
|
||||
ignore("META-INF/MANIFEST.MF")
|
||||
ignore("META-INF/compiler.version")
|
||||
ignore("META-INF/plugin.xml")
|
||||
ignore("kotlin/KotlinVersionCurrentValue.class")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,9 +526,12 @@ allprojects {
|
||||
register("checkBuild")
|
||||
}
|
||||
|
||||
apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts")
|
||||
|
||||
afterEvaluate {
|
||||
if (javaHome != defaultJavaHome || jvmTarget != defaultJvmTarget) {
|
||||
logger.info("configuring project $name to compile to the target jvm version $jvmTarget using jdk: $javaHome")
|
||||
configureJvmProject(javaHome!!, jvmTarget!!)
|
||||
} // else we will actually fail during the first task execution. We could not fail before configuration is done due to impact on import in IDE
|
||||
|
||||
fun File.toProjectRootRelativePathOrSelf() = (relativeToOrNull(rootDir)?.takeUnless { it.startsWith("..") } ?: this).path
|
||||
|
||||
fun FileCollection.printClassPath(role: String) =
|
||||
@@ -568,10 +560,27 @@ allprojects {
|
||||
?.exclude("org.jetbrains.kotlin", "kotlin-scripting-compiler-embeddable")
|
||||
}
|
||||
|
||||
apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts")
|
||||
apply(from = "$rootDir/gradle/testRetry.gradle.kts")
|
||||
}
|
||||
}
|
||||
|
||||
gradle.buildFinished {
|
||||
val taskGraph = gradle?.taskGraph
|
||||
if (taskGraph != null) {
|
||||
taskGraph.allTasks
|
||||
.filterIsInstance<SourceTask>()
|
||||
.filter { it.didWork }
|
||||
.forEach {
|
||||
it.source.visit {
|
||||
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
|
||||
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady {
|
||||
fun Boolean.toOnOff(): String = if (this) "on" else "off"
|
||||
val profile = if (isTeamcityBuild) "CI" else "Local"
|
||||
@@ -612,12 +621,17 @@ val ideaPlugin by task<Task> {
|
||||
}
|
||||
|
||||
tasks {
|
||||
named<Delete>("clean") {
|
||||
delete += setOf("$buildDir/repo", distDir)
|
||||
named("clean") {
|
||||
doLast {
|
||||
delete("$buildDir/repo")
|
||||
delete(distDir)
|
||||
}
|
||||
}
|
||||
|
||||
register<Delete>("cleanupArtifacts") {
|
||||
delete = setOf(artifactsDir)
|
||||
register("cleanupArtifacts") {
|
||||
doLast {
|
||||
delete(artifactsDir)
|
||||
}
|
||||
}
|
||||
|
||||
listOf("clean", "assemble", "install").forEach { taskName ->
|
||||
@@ -716,12 +730,10 @@ tasks {
|
||||
register("scriptingTest") {
|
||||
dependsOn("dist")
|
||||
dependsOn(":kotlin-script-util:test")
|
||||
dependsOn(":kotlin-scripting-compiler:test")
|
||||
dependsOn(":kotlin-scripting-compiler:testWithIr")
|
||||
dependsOn(":kotlin-scripting-compiler-embeddable:test")
|
||||
dependsOn(":kotlin-scripting-common:test")
|
||||
dependsOn(":kotlin-scripting-jvm:test")
|
||||
dependsOn(":kotlin-scripting-jvm-host-test:test")
|
||||
dependsOn(":kotlin-scripting-jvm-host-test:testWithIr")
|
||||
dependsOn(":kotlin-scripting-dependencies:test")
|
||||
dependsOn(":kotlin-scripting-dependencies-maven:test")
|
||||
dependsOn(":kotlin-scripting-jsr223-test:test")
|
||||
@@ -729,15 +741,8 @@ tasks {
|
||||
// dependsOn(":kotlin-scripting-jvm-host-test:embeddableTest")
|
||||
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
|
||||
dependsOn(":kotlin-main-kts-test:test")
|
||||
dependsOn(":kotlin-main-kts-test:testWithIr")
|
||||
|
||||
if (kotlinBuildProperties.getOrNull("attachedIntellijVersion") == null &&
|
||||
!kotlinBuildProperties.getBoolean("disableKotlinPluginModules", false)
|
||||
) {
|
||||
dependsOn(":kotlin-scripting-ide-services-test:test")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
|
||||
}
|
||||
|
||||
dependsOn(":kotlin-scripting-ide-services-test:test")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
|
||||
dependsOn(":kotlin-scripting-js-test:test")
|
||||
}
|
||||
|
||||
@@ -761,9 +766,6 @@ tasks {
|
||||
dependsOn("jvmCompilerIntegrationTest")
|
||||
|
||||
dependsOn(":plugins:parcelize:parcelize-compiler:test")
|
||||
|
||||
dependsOn(":kotlin-util-io:test")
|
||||
dependsOn(":kotlin-util-klib:test")
|
||||
}
|
||||
|
||||
register("toolsTest") {
|
||||
@@ -781,7 +783,6 @@ tasks {
|
||||
|
||||
register("distTest") {
|
||||
dependsOn("compilerTest")
|
||||
dependsOn("frontendApiTests")
|
||||
dependsOn("toolsTest")
|
||||
dependsOn("gradlePluginTest")
|
||||
dependsOn("examplesTest")
|
||||
@@ -805,6 +806,7 @@ tasks {
|
||||
dependsOn("dist")
|
||||
dependsOn(
|
||||
":idea:idea-maven:test",
|
||||
":j2k:test",
|
||||
":nj2k:test",
|
||||
":idea:jvm-debugger:jvm-debugger-core:test",
|
||||
":idea:jvm-debugger:jvm-debugger-evaluation:test",
|
||||
@@ -843,22 +845,12 @@ tasks {
|
||||
dependsOn("dist")
|
||||
dependsOn(
|
||||
":idea:idea-fir:test",
|
||||
":idea:idea-frontend-fir:fir-low-level-api-ide-impl:test",
|
||||
":plugins:uast-kotlin-fir:test",
|
||||
":idea:idea-fir-fe10-binding:test"
|
||||
":idea:idea-frontend-api:test",
|
||||
":idea:idea-frontend-fir:test",
|
||||
":idea:idea-frontend-fir:idea-fir-low-level-api:test"
|
||||
)
|
||||
}
|
||||
|
||||
register("frontendApiTests") {
|
||||
dependsOn("dist")
|
||||
dependsOn(
|
||||
":idea-frontend-api:test",
|
||||
":idea-frontend-fir:test",
|
||||
":idea-frontend-fir:idea-fir-low-level-api:test"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
register("android-ide-tests") {
|
||||
dependsOn("dist")
|
||||
@@ -900,11 +892,18 @@ tasks {
|
||||
if (Ide.IJ()) {
|
||||
dependsOn(
|
||||
":libraries:tools:new-project-wizard:test",
|
||||
":libraries:tools:new-project-wizard:new-project-wizard-cli:test"
|
||||
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
|
||||
":idea:idea-new-project-wizard:test" // Temporary here. Remove after enabling builds for ideaIntegrationsTests
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
register("ideaIntegrationsTests") {
|
||||
if (Ide.IJ()) {
|
||||
dependsOn(":idea:idea-new-project-wizard:test")
|
||||
}
|
||||
}
|
||||
|
||||
register("kaptIdeTest") {
|
||||
dependsOn(":kotlin-annotation-processing:test")
|
||||
dependsOn(":kotlin-annotation-processing-base:test")
|
||||
@@ -918,6 +917,22 @@ tasks {
|
||||
)
|
||||
}
|
||||
|
||||
register("kmmTest", AggregateTest::class) {
|
||||
dependsOn(
|
||||
":idea:idea-gradle:test",
|
||||
":idea:test",
|
||||
":compiler:test",
|
||||
":compiler:container:test",
|
||||
":js:js.tests:test"
|
||||
)
|
||||
|
||||
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
|
||||
if (Ide.AS40.orHigher())
|
||||
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
|
||||
|
||||
testPatternFile = file("tests/mpp/kmm-patterns.csv")
|
||||
}
|
||||
|
||||
register("test") {
|
||||
doLast {
|
||||
throw GradleException("Don't use directly, use aggregate tasks *-check instead")
|
||||
@@ -944,13 +959,32 @@ tasks {
|
||||
|
||||
register("publishIdeArtifacts") {
|
||||
idePluginDependency {
|
||||
dependsOn((rootProject.extra["compilerArtifactsForIde"] as List<String>).map { "$it:publish" })
|
||||
}
|
||||
}
|
||||
|
||||
register("installIdeArtifacts") {
|
||||
idePluginDependency {
|
||||
dependsOn((rootProject.extra["compilerArtifactsForIde"] as List<String>).map { "$it:install" })
|
||||
dependsOn(
|
||||
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide:publish",
|
||||
":prepare:ide-plugin-dependencies:compiler-components-for-jps:publish",
|
||||
":prepare:ide-plugin-dependencies:parcelize-compiler-plugin-for-ide:publish",
|
||||
":kotlin-script-runtime:publish",
|
||||
":kotlin-script-util:publish",
|
||||
":kotlin-scripting-common:publish",
|
||||
":kotlin-scripting-jvm:publish",
|
||||
":kotlin-scripting-compiler:publish",
|
||||
":kotlin-scripting-compiler-impl:publish",
|
||||
":kotlin-android-extensions-runtime:publish",
|
||||
":kotlin-stdlib-common:publish",
|
||||
":kotlin-stdlib:publish",
|
||||
":kotlin-stdlib-jdk7:publish",
|
||||
":kotlin-stdlib-jdk8:publish",
|
||||
":kotlin-reflect:publish",
|
||||
":kotlin-main-kts:publish"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1002,7 +1036,8 @@ val zipTestData by task<Zip> {
|
||||
val zipPlugin by task<Zip> {
|
||||
val src = when (project.findProperty("pluginArtifactDir") as String?) {
|
||||
"Kotlin" -> ideaPluginDir
|
||||
null -> ideaPluginDir
|
||||
"KotlinUltimate" -> ideaUltimatePluginDir
|
||||
null -> if (project.hasProperty("ultimate")) ideaUltimatePluginDir else ideaPluginDir
|
||||
else -> error("Unsupported plugin artifact dir")
|
||||
}
|
||||
val destPath = project.findProperty("pluginZipPath") as String?
|
||||
@@ -1059,6 +1094,66 @@ configure<IdeaModel> {
|
||||
}
|
||||
}
|
||||
|
||||
fun jdkPathOrNull(version: String): String? {
|
||||
val jdkName = "JDK_${version.replace(".", "")}"
|
||||
val jdkMajorVersion = JdkMajorVersion.valueOf(jdkName)
|
||||
return configuredJdks.find { it.majorVersion == jdkMajorVersion }?.homeDir?.canonicalPath
|
||||
}
|
||||
|
||||
fun jdkPath(version: String, vararg replacementVersions: String): String {
|
||||
return jdkPathOrNull(version) ?: run {
|
||||
replacementVersions.asSequence().map { jdkPathOrNull(it) }.find { it != null }
|
||||
} ?: jdkNotFoundConst
|
||||
}
|
||||
|
||||
fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
|
||||
val currentJavaHome = File(System.getProperty("java.home")!!).canonicalPath
|
||||
val shouldFork = !currentJavaHome.startsWith(File(javaHome).canonicalPath)
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
if (name != "compileJava9Java") {
|
||||
sourceCompatibility = javaVersion
|
||||
targetCompatibility = javaVersion
|
||||
options.isFork = shouldFork
|
||||
options.forkOptions.javaHome = file(javaHome)
|
||||
options.compilerArgs.add("-proc:none")
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.jdkHome = javaHome
|
||||
kotlinOptions.jvmTarget = javaVersion
|
||||
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
executable = File(javaHome, "bin/java").canonicalPath
|
||||
}
|
||||
|
||||
plugins.withId("java-base") {
|
||||
configureShadowJarSubstitutionInCompileClasspath()
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.configureShadowJarSubstitutionInCompileClasspath() {
|
||||
val substitutionMap = mapOf(":kotlin-reflect" to ":kotlin-reflect-api")
|
||||
|
||||
fun configureSubstitution(substitution: DependencySubstitution) {
|
||||
val requestedProject = (substitution.requested as? ProjectComponentSelector)?.projectPath ?: return
|
||||
val replacementProject = substitutionMap[requestedProject] ?: return
|
||||
substitution.useTarget(project(replacementProject), "Non-default shadow jars should not be used in compile classpath")
|
||||
}
|
||||
|
||||
sourceSets.all {
|
||||
for (configName in listOf(compileOnlyConfigurationName, compileClasspathConfigurationName)) {
|
||||
configurations.getByName(configName).resolutionStrategy.dependencySubstitution {
|
||||
all(::configureSubstitution)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("findShadowJarsInClasspath") {
|
||||
doLast {
|
||||
fun Collection<File>.printSorted(indent: String = " ") {
|
||||
@@ -1114,8 +1209,7 @@ val Jar.outputFile: File
|
||||
val Project.sourceSetsOrNull: SourceSetContainer?
|
||||
get() = convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets
|
||||
|
||||
val disableVerificationTasks = providers.systemProperty("disable.verification.tasks")
|
||||
.forUseAtConfigurationTime().orNull?.toBoolean() ?: false
|
||||
val disableVerificationTasks = System.getProperty("disable.verification.tasks") == "true"
|
||||
if (disableVerificationTasks) {
|
||||
gradle.taskGraph.whenReady {
|
||||
allTasks.forEach {
|
||||
@@ -1126,9 +1220,3 @@ if (disableVerificationTasks) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin::class) {
|
||||
extensions.configure(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension::class.java) {
|
||||
nodeVersion = "16.2.0"
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,10 @@ buildscript {
|
||||
|
||||
repositories {
|
||||
if (cacheRedirectorEnabled) {
|
||||
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
|
||||
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
} else {
|
||||
jcenter()
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
}
|
||||
|
||||
@@ -22,7 +24,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.31")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
|
||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
|
||||
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
|
||||
}
|
||||
@@ -69,6 +71,7 @@ rootProject.apply {
|
||||
}
|
||||
|
||||
val isTeamcityBuild = kotlinBuildProperties.isTeamcityBuild
|
||||
val intellijUltimateEnabled by extra(kotlinBuildProperties.intellijUltimateEnabled)
|
||||
val intellijSeparateSdks by extra(project.getBooleanProperty("intellijSeparateSdks") ?: false)
|
||||
|
||||
extra["intellijReleaseType"] = when {
|
||||
@@ -81,9 +84,10 @@ extra["versions.androidDxSources"] = "5.0.0_r2"
|
||||
extra["customDepsOrg"] = "kotlin.build"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
jcenter()
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
|
||||
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
|
||||
maven("https://kotlin.bintray.com/kotlinx")
|
||||
gradlePluginPortal()
|
||||
|
||||
extra["bootstrapKotlinRepo"]?.let {
|
||||
@@ -143,8 +147,8 @@ java {
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib", embeddedKotlinVersion))
|
||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
|
||||
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.31")
|
||||
implementation("com.gradle.publish:plugin-publish-plugin:0.14.0")
|
||||
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
|
||||
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
|
||||
|
||||
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
|
||||
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
|
||||
@@ -157,8 +161,8 @@ dependencies {
|
||||
|
||||
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")
|
||||
|
||||
implementation("org.gradle:test-retry-gradle-plugin:1.2.0")
|
||||
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:2.1")
|
||||
implementation("org.gradle:test-retry-gradle-plugin:1.1.9")
|
||||
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
|
||||
|
||||
compileOnly(gradleApi())
|
||||
|
||||
@@ -195,7 +199,6 @@ java {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.allWarningsAsErrors = true
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-Xskip-runtime-version-check",
|
||||
@@ -259,4 +262,4 @@ gradlePlugin {
|
||||
implementationClass = "org.jetbrains.kotlin.NativeInteropPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,28 +15,30 @@ plugins {
|
||||
base
|
||||
}
|
||||
|
||||
val intellijUltimateEnabled: Boolean by rootProject.extra
|
||||
val intellijReleaseType: String by rootProject.extra
|
||||
val intellijVersion = rootProject.extra["versions.intellijSdk"] as String
|
||||
val intellijVersionForIde = rootProject.intellijSdkVersionForIde()
|
||||
val asmVersion = rootProject.findProperty("versions.jar.asm-all") as String?
|
||||
val androidStudioRelease = rootProject.findProperty("versions.androidStudioRelease") as String?
|
||||
val androidStudioBuild = rootProject.findProperty("versions.androidStudioBuild") as String?
|
||||
val intellijSeparateSdks: Boolean by rootProject.extra
|
||||
val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks
|
||||
val installIntellijUltimate = intellijUltimateEnabled && androidStudioRelease == null
|
||||
|
||||
fun checkIntellijVersion(intellijVersion: String) {
|
||||
val intellijVersionDelimiterIndex = intellijVersion.indexOfAny(charArrayOf('.', '-'))
|
||||
if (intellijVersionDelimiterIndex == -1) {
|
||||
error("Invalid IDEA version $intellijVersion")
|
||||
}
|
||||
val intellijVersionDelimiterIndex = intellijVersion.indexOfAny(charArrayOf('.', '-'))
|
||||
if (intellijVersionDelimiterIndex == -1) {
|
||||
error("Invalid IDEA version $intellijVersion")
|
||||
}
|
||||
checkIntellijVersion(intellijVersion)
|
||||
intellijVersionForIde?.let { checkIntellijVersion(it) }
|
||||
|
||||
val platformBaseVersion = intellijVersion.substring(0, intellijVersionDelimiterIndex)
|
||||
|
||||
logger.info("intellijUltimateEnabled: $intellijUltimateEnabled")
|
||||
logger.info("intellijVersion: $intellijVersion")
|
||||
logger.info("intellijVersionForIde: $intellijVersionForIde")
|
||||
logger.info("androidStudioRelease: $androidStudioRelease")
|
||||
logger.info("androidStudioBuild: $androidStudioBuild")
|
||||
logger.info("intellijSeparateSdks: $intellijSeparateSdks")
|
||||
logger.info("installIntellijCommunity: $installIntellijCommunity")
|
||||
logger.info("installIntellijUltimate: $installIntellijUltimate")
|
||||
|
||||
val androidStudioOs by lazy {
|
||||
when {
|
||||
@@ -63,22 +65,36 @@ repositories {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
|
||||
ivy {
|
||||
url = URI("https://dl.bintray.com/kotlin/as/")
|
||||
|
||||
patternLayout {
|
||||
artifact("[artifact]-[revision]-$androidStudioOs.[ext]")
|
||||
}
|
||||
|
||||
credentials {
|
||||
username = System.getenv("AS_BINTRAY_USER_NAME") ?: findProperty("bintray.user") as String?
|
||||
password = System.getenv("AS_BINTRAY_API_KEY") ?: findProperty("bintray.apikey") as String?
|
||||
}
|
||||
|
||||
metadataSources {
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
maven("https://www.jetbrains.com/intellij-repository/$intellijReleaseType")
|
||||
maven("https://plugins.jetbrains.com/maven")
|
||||
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
|
||||
maven("https://jetbrains.bintray.com/intellij-third-party-dependencies/")
|
||||
}
|
||||
|
||||
val intellij by configurations.creating
|
||||
val intellijForIde by configurations.creating
|
||||
val intellijUltimate by configurations.creating
|
||||
val androidStudio by configurations.creating
|
||||
val sources by configurations.creating
|
||||
val sourcesForIde by configurations.creating
|
||||
val jpsStandalone by configurations.creating
|
||||
val jpsStandaloneForIde by configurations.creating
|
||||
val intellijCore by configurations.creating
|
||||
val intellijCoreForIde by configurations.creating
|
||||
val nodeJSPlugin by configurations.creating
|
||||
|
||||
/**
|
||||
@@ -94,6 +110,7 @@ val dependenciesDir = (findProperty("kotlin.build.dependencies.dir") as String?)
|
||||
val customDepsRepoDir = dependenciesDir.resolve("repo")
|
||||
|
||||
val customDepsOrg: String by rootProject.extra
|
||||
val customDepsRevision = intellijVersion
|
||||
val repoDir = File(customDepsRepoDir, customDepsOrg)
|
||||
|
||||
dependencies {
|
||||
@@ -105,8 +122,12 @@ dependencies {
|
||||
|
||||
androidStudio("google:android-studio-ide:$androidStudioBuild@$extension")
|
||||
} else {
|
||||
intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion")
|
||||
intellijVersionForIde?.let { intellijForIde("com.jetbrains.intellij.idea:ideaIC:$it") }
|
||||
if (installIntellijCommunity) {
|
||||
intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion")
|
||||
}
|
||||
if (installIntellijUltimate) {
|
||||
intellijUltimate("com.jetbrains.intellij.idea:ideaIU:$intellijVersion")
|
||||
}
|
||||
}
|
||||
|
||||
if (asmVersion != null) {
|
||||
@@ -114,104 +135,102 @@ dependencies {
|
||||
}
|
||||
|
||||
sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar")
|
||||
intellijVersionForIde?.let { sourcesForIde("com.jetbrains.intellij.idea:ideaIC:$it:sources@jar") }
|
||||
jpsStandalone("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion")
|
||||
intellijVersionForIde?.let { jpsStandaloneForIde("com.jetbrains.intellij.idea:jps-standalone:$it") }
|
||||
intellijCore("com.jetbrains.intellij.idea:intellij-core:$intellijVersion")
|
||||
intellijVersionForIde?.let { intellijCoreForIde("com.jetbrains.intellij.idea:intellij-core:$it") }
|
||||
if (intellijUltimateEnabled) {
|
||||
nodeJSPlugin("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip")
|
||||
}
|
||||
}
|
||||
|
||||
fun prepareDeps(
|
||||
intellij: Configuration,
|
||||
intellijCore: Configuration,
|
||||
sources: Configuration,
|
||||
jpsStandalone: Configuration,
|
||||
intellijVersion: String
|
||||
) {
|
||||
val makeIntellijCore = buildIvyRepositoryTask(intellijCore, customDepsOrg, customDepsRepoDir)
|
||||
val makeIntellijCore = buildIvyRepositoryTask(intellijCore, customDepsOrg, customDepsRepoDir)
|
||||
|
||||
val makeIntellijAnnotations = tasks.register("makeIntellijAnnotations${intellij.name.capitalize()}", Copy::class) {
|
||||
dependsOn(makeIntellijCore)
|
||||
val makeIntellijAnnotations by tasks.registering(Copy::class) {
|
||||
dependsOn(makeIntellijCore)
|
||||
|
||||
val intellijCoreRepo = CleanableStore[repoDir.resolve("intellij-core").absolutePath][intellijVersion].use()
|
||||
from(intellijCoreRepo.resolve("artifacts/annotations.jar"))
|
||||
val intellijCoreRepo = CleanableStore[repoDir.resolve("intellij-core").absolutePath][intellijVersion].use()
|
||||
from(intellijCoreRepo.resolve("artifacts/annotations.jar"))
|
||||
|
||||
val annotationsStore = CleanableStore[repoDir.resolve(intellijRuntimeAnnotations).absolutePath]
|
||||
val targetDir = annotationsStore[intellijVersion].use()
|
||||
into(targetDir)
|
||||
val annotationsStore = CleanableStore[repoDir.resolve(intellijRuntimeAnnotations).absolutePath]
|
||||
val targetDir = annotationsStore[intellijVersion].use()
|
||||
into(targetDir)
|
||||
|
||||
val ivyFile = File(targetDir, "$intellijRuntimeAnnotations.ivy.xml")
|
||||
outputs.files(ivyFile)
|
||||
val ivyFile = File(targetDir, "$intellijRuntimeAnnotations.ivy.xml")
|
||||
outputs.files(ivyFile)
|
||||
|
||||
doFirst {
|
||||
annotationsStore.cleanStore()
|
||||
}
|
||||
|
||||
doLast {
|
||||
writeIvyXml(
|
||||
customDepsOrg,
|
||||
intellijRuntimeAnnotations,
|
||||
intellijVersion,
|
||||
intellijRuntimeAnnotations,
|
||||
targetDir,
|
||||
targetDir,
|
||||
targetDir,
|
||||
allowAnnotations = true
|
||||
)
|
||||
}
|
||||
doFirst {
|
||||
annotationsStore.cleanStore()
|
||||
}
|
||||
|
||||
val mergeSources = tasks.create("mergeSources${intellij.name.capitalize()}", Jar::class.java) {
|
||||
dependsOn(sources)
|
||||
isPreserveFileTimestamps = false
|
||||
isReproducibleFileOrder = true
|
||||
isZip64 = true
|
||||
if (!kotlinBuildProperties.isTeamcityBuild) {
|
||||
from(provider { sources.map(::zipTree) })
|
||||
}
|
||||
destinationDirectory.set(File(repoDir, sources.name))
|
||||
archiveBaseName.set("intellij")
|
||||
archiveClassifier.set("sources")
|
||||
archiveVersion.set(intellijVersion)
|
||||
}
|
||||
|
||||
val sourcesFile = mergeSources.outputs.files.singleFile
|
||||
|
||||
val makeIde = if (androidStudioBuild != null) {
|
||||
buildIvyRepositoryTask(
|
||||
androidStudio,
|
||||
doLast {
|
||||
writeIvyXml(
|
||||
customDepsOrg,
|
||||
customDepsRepoDir,
|
||||
if (androidStudioOs == "mac")
|
||||
::skipContentsDirectory
|
||||
else
|
||||
::skipToplevelDirectory
|
||||
)
|
||||
} else {
|
||||
val task = buildIvyRepositoryTask(intellij, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||
|
||||
task.configure {
|
||||
dependsOn(mergeSources)
|
||||
}
|
||||
|
||||
task
|
||||
}
|
||||
|
||||
val buildJpsStandalone = buildIvyRepositoryTask(jpsStandalone, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||
|
||||
tasks.named("build") {
|
||||
dependsOn(
|
||||
makeIntellijCore,
|
||||
makeIde,
|
||||
buildJpsStandalone,
|
||||
makeIntellijAnnotations
|
||||
intellijRuntimeAnnotations,
|
||||
intellijVersion,
|
||||
intellijRuntimeAnnotations,
|
||||
targetDir,
|
||||
targetDir,
|
||||
targetDir,
|
||||
allowAnnotations = true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
prepareDeps(intellij, intellijCore, sources, jpsStandalone, intellijVersion)
|
||||
if (intellijVersionForIde != null) {
|
||||
prepareDeps(intellijForIde, intellijCoreForIde, sourcesForIde, jpsStandaloneForIde, intellijVersionForIde)
|
||||
val mergeSources by tasks.creating(Jar::class.java) {
|
||||
dependsOn(sources)
|
||||
isPreserveFileTimestamps = false
|
||||
isReproducibleFileOrder = true
|
||||
isZip64 = true
|
||||
if (!kotlinBuildProperties.isTeamcityBuild) {
|
||||
from(provider { sources.map(::zipTree) })
|
||||
}
|
||||
destinationDirectory.set(File(repoDir, sources.name))
|
||||
archiveBaseName.set("intellij")
|
||||
archiveClassifier.set("sources")
|
||||
archiveVersion.set(intellijVersion)
|
||||
}
|
||||
|
||||
val sourcesFile = mergeSources.outputs.files.singleFile
|
||||
|
||||
val makeIde = if (androidStudioBuild != null) {
|
||||
buildIvyRepositoryTask(
|
||||
androidStudio,
|
||||
customDepsOrg,
|
||||
customDepsRepoDir,
|
||||
if (androidStudioOs == "mac")
|
||||
::skipContentsDirectory
|
||||
else
|
||||
::skipToplevelDirectory
|
||||
)
|
||||
} else {
|
||||
val task = if (installIntellijUltimate) {
|
||||
buildIvyRepositoryTask(intellijUltimate, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||
} else {
|
||||
buildIvyRepositoryTask(intellij, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||
}
|
||||
|
||||
task.configure {
|
||||
dependsOn(mergeSources)
|
||||
}
|
||||
|
||||
task
|
||||
}
|
||||
|
||||
val buildJpsStandalone = buildIvyRepositoryTask(jpsStandalone, customDepsOrg, customDepsRepoDir, null, sourcesFile)
|
||||
|
||||
tasks.named("build") {
|
||||
dependsOn(
|
||||
makeIntellijCore,
|
||||
makeIde,
|
||||
buildJpsStandalone,
|
||||
makeIntellijAnnotations
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
if (installIntellijUltimate) {
|
||||
val buildNodeJsPlugin =
|
||||
buildIvyRepositoryTask(nodeJSPlugin, customDepsOrg, customDepsRepoDir, ::skipToplevelDirectory, sourcesFile)
|
||||
tasks.named("build") { dependsOn(buildNodeJsPlugin) }
|
||||
}
|
||||
|
||||
tasks.named<Delete>("clean") {
|
||||
@@ -398,11 +417,6 @@ fun skipToplevelDirectory(path: String) = path.substringAfter('/')
|
||||
|
||||
fun skipContentsDirectory(path: String) = path.substringAfter("Contents/")
|
||||
|
||||
fun Project.intellijSdkVersionForIde(): String? {
|
||||
val majorVersion = kotlinBuildProperties.getOrNull("attachedIntellijVersion") as? String ?: return null
|
||||
return rootProject.findProperty("versions.intellijSdk.forIde.$majorVersion") as? String
|
||||
}
|
||||
|
||||
class XMLWriter(private val outputStreamWriter: OutputStreamWriter) : Closeable {
|
||||
|
||||
private val xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStreamWriter)
|
||||
|
||||
@@ -18,11 +18,55 @@ buildscript {
|
||||
} else {
|
||||
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.30")
|
||||
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.25")
|
||||
}
|
||||
}
|
||||
|
||||
include "prepare-deps"
|
||||
def buildProperties = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
|
||||
def projectVersions = file("../gradle/versions.properties").text
|
||||
|
||||
include "prepare-deps"
|
||||
|
||||
def target_AppCode_Clion = buildProperties.includeCidrPlugins && !projectVersions.contains("versions.androidStudioRelease")
|
||||
def target_AndroidStudio = buildProperties.includeCidrPlugins && projectVersions.contains("versions.androidStudioRelease")
|
||||
def target_IdeaUltimate = buildProperties.includeUltimate
|
||||
|
||||
if (target_AppCode_Clion) {
|
||||
logger.info("Including modules for AC and CL in buildSrc/settings.gradle")
|
||||
|
||||
include ":prepare-deps:kotlin-native-platform-deps"
|
||||
include ":prepare-deps:native-debug-plugin"
|
||||
|
||||
project(":prepare-deps:kotlin-native-platform-deps").projectDir =
|
||||
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/kotlin-native-platform-deps")
|
||||
project(":prepare-deps:native-debug-plugin").projectDir =
|
||||
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/native-debug-plugin")
|
||||
} else if (target_AndroidStudio) {
|
||||
logger.info("Including modules for AS (mobile plugin) in buildSrc/settings.gradle")
|
||||
|
||||
include ":prepare-deps:appcode-binaries"
|
||||
include ":prepare-deps:lldb-framework"
|
||||
include ":prepare-deps:lldb-frontend"
|
||||
|
||||
project(":prepare-deps:appcode-binaries").projectDir =
|
||||
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/appcode-binaries")
|
||||
project(":prepare-deps:lldb-framework").projectDir =
|
||||
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/lldb-framework")
|
||||
project(":prepare-deps:lldb-frontend").projectDir =
|
||||
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/lldb-frontend")
|
||||
} else if (target_IdeaUltimate) {
|
||||
logger.info("Including modules for IU in buildSrc/settings.gradle")
|
||||
|
||||
include ":prepare-deps:lldb-frontend"
|
||||
include ":prepare-deps:native-debug-plugin"
|
||||
|
||||
project(":prepare-deps:lldb-frontend").projectDir =
|
||||
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/lldb-frontend")
|
||||
project(":prepare-deps:native-debug-plugin").projectDir =
|
||||
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/native-debug-plugin")
|
||||
|
||||
} else {
|
||||
logger.info("Not including extra modules in buildSrc/settings.gradle")
|
||||
}
|
||||
|
||||
@@ -20,7 +20,3 @@ val KotlinBuildProperties.jarCompression: Boolean get() = getBoolean("kotlin.bui
|
||||
val KotlinBuildProperties.ignoreTestFailures: Boolean get() = getBoolean("ignoreTestFailures", isTeamcityBuild)
|
||||
|
||||
val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", false)
|
||||
|
||||
val KotlinBuildProperties.isObsoleteJdkOverrideEnabled: Boolean
|
||||
get() = !isTeamcityBuild &&
|
||||
getBoolean("kotlin.build.isObsoleteJdkOverrideEnabled", false)
|
||||
|
||||
@@ -4,36 +4,32 @@
|
||||
*/
|
||||
|
||||
import groovy.lang.Closure
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.jvm.toolchain.JavaLauncher
|
||||
import org.gradle.kotlin.dsl.property
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
import org.gradle.internal.jvm.inspection.JvmVersionDetector
|
||||
import proguard.ClassSpecification
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@CacheableTask
|
||||
open class CacheableProguardTask : proguard.gradle.ProGuardTask() {
|
||||
open class CacheableProguardTask @Inject constructor(
|
||||
private val jvmVersionDetector: JvmVersionDetector
|
||||
) : proguard.gradle.ProGuardTask() {
|
||||
|
||||
@get:Internal
|
||||
val javaLauncher: Property<JavaLauncher> = project.objects.property()
|
||||
|
||||
@get:Internal
|
||||
val jdkHomePath: Provider<File> = javaLauncher.map { it.metadata.installationPath.asFile }
|
||||
@Internal
|
||||
var jdkHome: File? = null
|
||||
|
||||
@get:Optional
|
||||
@get:Input
|
||||
internal val jdkMajorVersion: Provider<JavaVersion> = javaLauncher.map {
|
||||
JavaVersion.toVersion(it.metadata.languageVersion.toString())
|
||||
}
|
||||
internal val jdkMajorVersion: String?
|
||||
get() = jdkHome?.let { jvmVersionDetector.getJavaVersion(Jvm.forHome(jdkHome)) }?.majorVersion
|
||||
|
||||
@CompileClasspath
|
||||
override fun getLibraryJarFileCollection(): FileCollection = super.getLibraryJarFileCollection()
|
||||
.filter { libraryFile ->
|
||||
jdkHomePath.orNull?.let { !libraryFile.absoluteFile.startsWith(it.absoluteFile) } ?: true
|
||||
}
|
||||
override fun getLibraryJarFileCollection(): FileCollection = super.getLibraryJarFileCollection().filter { libraryFile ->
|
||||
jdkHome?.let { !libraryFile.absoluteFile.startsWith(it.absoluteFile) } ?: true
|
||||
}
|
||||
|
||||
@InputFiles
|
||||
@PathSensitive(PathSensitivity.RELATIVE)
|
||||
|
||||
@@ -81,12 +81,3 @@ fun Task.singleOutputFile(): File = when (this) {
|
||||
is ProGuardTask -> project.file(outJarFiles.single()!!)
|
||||
else -> outputs.files.singleFile
|
||||
}
|
||||
|
||||
val Project.isConfigurationCacheDisabled
|
||||
get() = (gradle.startParameter as? org.gradle.api.internal.StartParameterInternal)?.isConfigurationCache != true
|
||||
|
||||
val Project.isIdeaActive
|
||||
get() = providers.systemProperty("idea.active").forUseAtConfigurationTime().isPresent
|
||||
|
||||
val Project.intellijCommunityDir: File
|
||||
get() = rootDir.resolve("kotlin-ide/intellij/community").takeIf { it.isDirectory } ?: rootDir.resolve("kotlin-ide/intellij")
|
||||
@@ -26,7 +26,7 @@ fun CompatibilityPredicate.or(other: CompatibilityPredicate): CompatibilityPredi
|
||||
}
|
||||
|
||||
enum class Platform : CompatibilityPredicate {
|
||||
P202, P203;
|
||||
P183, P191, P192, P193, P201, P202, P203;
|
||||
|
||||
val version: Int = name.drop(1).toInt()
|
||||
|
||||
@@ -43,9 +43,17 @@ enum class Platform : CompatibilityPredicate {
|
||||
}
|
||||
|
||||
enum class Ide(val platform: Platform) : CompatibilityPredicate {
|
||||
IJ191(Platform.P191),
|
||||
IJ192(Platform.P192),
|
||||
IJ193(Platform.P193),
|
||||
IJ201(Platform.P201),
|
||||
IJ202(Platform.P202),
|
||||
IJ203(Platform.P203),
|
||||
|
||||
AS35(Platform.P183),
|
||||
AS36(Platform.P192),
|
||||
AS40(Platform.P193),
|
||||
AS41(Platform.P201),
|
||||
AS42(Platform.P202);
|
||||
|
||||
val kind = Kind.values().first { it.shortName == name.take(2) }
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.kotlin.dsl.provideDelegate
|
||||
import org.gradle.kotlin.dsl.withGroovyBuilder
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class InstrumentJava(@Transient val javaInstrumentator: Configuration, @Transient val sourceSet: SourceSet) : Action<Task> {
|
||||
private val instrumentatorClasspath: String by lazy {
|
||||
javaInstrumentator.asPath
|
||||
}
|
||||
|
||||
private val srcDirs: FileCollection by lazy {
|
||||
sourceSet.allJava.sourceDirectories
|
||||
}
|
||||
|
||||
override fun execute(task: Task) {
|
||||
require(task is JavaCompile) { "$task is not of type JavaCompile!" }
|
||||
task.doLast {
|
||||
task.ant.withGroovyBuilder {
|
||||
"taskdef"(
|
||||
"name" to "instrumentIdeaExtensions",
|
||||
"classpath" to instrumentatorClasspath,
|
||||
"loaderref" to "java2.loader",
|
||||
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
|
||||
)
|
||||
}
|
||||
|
||||
val javaSourceDirectories = srcDirs.filter { it.exists() }
|
||||
|
||||
task.ant.withGroovyBuilder {
|
||||
javaSourceDirectories.forEach { directory ->
|
||||
"instrumentIdeaExtensions"(
|
||||
"srcdir" to directory,
|
||||
"destdir" to task.destinationDir,
|
||||
"classpath" to task.classpath.asPath,
|
||||
"includeantruntime" to false,
|
||||
"instrumentNotNull" to true
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
@file:JvmName("JvmToolchain")
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.jvm.toolchain.*
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
enum class JdkMajorVersion(
|
||||
val majorVersion: Int,
|
||||
val targetName: String = majorVersion.toString(),
|
||||
val overrideMajorVersion: Int? = null,
|
||||
private val mandatory: Boolean = true
|
||||
) {
|
||||
JDK_1_6(6, targetName = "1.6", overrideMajorVersion = 8),
|
||||
JDK_1_7(7, targetName = "1.7", overrideMajorVersion = 8),
|
||||
JDK_1_8(8, targetName = "1.8"),
|
||||
JDK_9(9),
|
||||
JDK_10(10, mandatory = false),
|
||||
JDK_11(11, mandatory = false),
|
||||
JDK_15(15, mandatory = false),
|
||||
JDK_16(16, mandatory = false);
|
||||
|
||||
fun isMandatory(): Boolean = mandatory
|
||||
|
||||
companion object {
|
||||
fun fromMajorVersion(majorVersion: Int) = values().first { it.majorVersion == majorVersion }
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.configureJvmDefaultToolchain() {
|
||||
configureJvmToolchain(JdkMajorVersion.JDK_1_8)
|
||||
}
|
||||
|
||||
fun Project.shouldOverrideObsoleteJdk(
|
||||
jdkVersion: JdkMajorVersion
|
||||
): Boolean = kotlinBuildProperties.isObsoleteJdkOverrideEnabled &&
|
||||
jdkVersion.overrideMajorVersion != null
|
||||
|
||||
fun Project.configureJvmToolchain(
|
||||
jdkVersion: JdkMajorVersion
|
||||
) {
|
||||
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||
val kotlinExtension = extensions.getByType<KotlinTopLevelExtension>()
|
||||
|
||||
if (shouldOverrideObsoleteJdk(jdkVersion)) {
|
||||
kotlinExtension.jvmToolchain {
|
||||
(this as JavaToolchainSpec).languageVersion
|
||||
.set(JavaLanguageVersion.of(jdkVersion.overrideMajorVersion!!))
|
||||
}
|
||||
updateJvmTarget(jdkVersion.targetName)
|
||||
} else {
|
||||
kotlinExtension.jvmToolchain {
|
||||
(this as JavaToolchainSpec).languageVersion
|
||||
.set(JavaLanguageVersion.of(jdkVersion.majorVersion))
|
||||
}
|
||||
}
|
||||
|
||||
tasks
|
||||
.matching { it.name != "compileJava9Java" && it is JavaCompile }
|
||||
.configureEach {
|
||||
with(this as JavaCompile) {
|
||||
options.compilerArgs.add("-proc:none")
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.configureJavaOnlyToolchain(
|
||||
jdkVersion: JdkMajorVersion
|
||||
) {
|
||||
plugins.withId("java-base") {
|
||||
val javaExtension = extensions.getByType<JavaPluginExtension>()
|
||||
if (shouldOverrideObsoleteJdk(jdkVersion)) {
|
||||
javaExtension.toolchain {
|
||||
languageVersion.set(
|
||||
JavaLanguageVersion.of(jdkVersion.overrideMajorVersion!!)
|
||||
)
|
||||
}
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
targetCompatibility = jdkVersion.targetName
|
||||
sourceCompatibility = jdkVersion.targetName
|
||||
}
|
||||
} else {
|
||||
javaExtension.toolchain {
|
||||
languageVersion.set(
|
||||
JavaLanguageVersion.of(jdkVersion.majorVersion)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun KotlinCompile.configureTaskToolchain(
|
||||
jdkVersion: JdkMajorVersion
|
||||
) {
|
||||
if (project.shouldOverrideObsoleteJdk(jdkVersion)) {
|
||||
kotlinJavaToolchain.toolchain.use(
|
||||
project.getToolchainLauncherFor(
|
||||
JdkMajorVersion.fromMajorVersion(
|
||||
jdkVersion.overrideMajorVersion!!
|
||||
)
|
||||
)
|
||||
)
|
||||
kotlinOptions {
|
||||
jvmTarget = jdkVersion.targetName
|
||||
}
|
||||
} else {
|
||||
kotlinJavaToolchain.toolchain.use(
|
||||
project.getToolchainLauncherFor(jdkVersion)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun JavaCompile.configureTaskToolchain(
|
||||
jdkVersion: JdkMajorVersion
|
||||
) {
|
||||
if (project.shouldOverrideObsoleteJdk(jdkVersion)) {
|
||||
javaCompiler.set(
|
||||
project.getToolchainCompilerFor(
|
||||
JdkMajorVersion.fromMajorVersion(
|
||||
jdkVersion.overrideMajorVersion!!
|
||||
)
|
||||
)
|
||||
)
|
||||
targetCompatibility = jdkVersion.targetName
|
||||
sourceCompatibility = jdkVersion.targetName
|
||||
} else {
|
||||
javaCompiler.set(project.getToolchainCompilerFor(jdkVersion))
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.updateJvmTarget(
|
||||
jvmTarget: String
|
||||
) {
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.jvmTarget = jvmTarget
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
sourceCompatibility = jvmTarget
|
||||
targetCompatibility = jvmTarget
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.getToolchainCompilerFor(
|
||||
jdkVersion: JdkMajorVersion
|
||||
): Provider<JavaCompiler> {
|
||||
val service = project.extensions.getByType<JavaToolchainService>()
|
||||
return service.compilerFor {
|
||||
this.languageVersion.set(JavaLanguageVersion.of(jdkVersion.majorVersion))
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.getToolchainLauncherFor(
|
||||
jdkVersion: JdkMajorVersion
|
||||
): Provider<JavaLauncher> {
|
||||
val service = project.extensions.getByType<JavaToolchainService>()
|
||||
return service.launcherFor {
|
||||
this.languageVersion.set(JavaLanguageVersion.of(jdkVersion.majorVersion))
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@file:JvmName("LibrariesCommon")
|
||||
|
||||
import org.gradle.api.JavaVersion
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.provideDelegate
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
import org.gradle.process.CommandLineArgumentProvider
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
@JvmOverloads
|
||||
fun Project.configureJava9Compilation(
|
||||
moduleName: String,
|
||||
moduleOutputs: Collection<FileCollection> = setOf(sourceSets["main"].output)
|
||||
) {
|
||||
configurations["java9CompileClasspath"].extendsFrom(configurations["compileClasspath"])
|
||||
|
||||
tasks.named("compileJava9Java", JavaCompile::class.java) {
|
||||
dependsOn(moduleOutputs)
|
||||
|
||||
javaCompiler.set(getToolchainCompilerFor(JdkMajorVersion.JDK_9))
|
||||
targetCompatibility = JavaVersion.VERSION_1_9.toString()
|
||||
sourceCompatibility = JavaVersion.VERSION_1_9.toString()
|
||||
|
||||
// module-info.java should be in java9 source set by convention
|
||||
val java9SourceSet = sourceSets["java9"].java
|
||||
destinationDir = file("${java9SourceSet.outputDir}/META-INF/versions/9")
|
||||
options.sourcepath = files(java9SourceSet.srcDirs)
|
||||
val compileClasspath = configurations["java9CompileClasspath"]
|
||||
val moduleFiles = objects.fileCollection().from(moduleOutputs)
|
||||
val modulePath = compileClasspath.filter { it !in moduleFiles.files }
|
||||
classpath = objects.fileCollection().from()
|
||||
options.compilerArgumentProviders.add(
|
||||
Java9AdditionalArgumentsProvider(
|
||||
moduleName,
|
||||
moduleFiles,
|
||||
modulePath
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private class Java9AdditionalArgumentsProvider(
|
||||
private val moduleName: String,
|
||||
private val moduleFiles: FileCollection,
|
||||
private val modulePath: FileCollection
|
||||
) : CommandLineArgumentProvider {
|
||||
override fun asArguments(): Iterable<String> = listOf(
|
||||
"--module-path", modulePath.asPath,
|
||||
"--patch-module", "$moduleName=${moduleFiles.asPath}",
|
||||
"-Xlint:-requires-transitive-automatic" // suppress automatic module transitive dependencies in kotlin.test
|
||||
)
|
||||
}
|
||||
|
||||
fun Project.disableDeprecatedJvmTargetWarning() {
|
||||
if (!kotlinBuildProperties.disableWerror) {
|
||||
val tasksWithWarnings: List<String> by rootProject.extra
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
if (!tasksWithWarnings.contains(path)) {
|
||||
kotlinOptions {
|
||||
allWarningsAsErrors = true
|
||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
||||
|
||||
import com.gradle.publish.PublishTask
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.artifacts.ConfigurablePublishArtifact
|
||||
@@ -22,12 +22,13 @@ import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.publish.tasks.GenerateModuleMetadata
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.api.tasks.Upload
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer
|
||||
import plugins.KotlinBuildPublishingPlugin
|
||||
import plugins.mainPublicationName
|
||||
|
||||
|
||||
private const val MAGIC_DO_NOT_CHANGE_TEST_JAR_TASK_NAME = "testJar"
|
||||
@@ -62,6 +63,8 @@ fun Project.removeArtifacts(configuration: Configuration, task: Task) {
|
||||
|
||||
fun Project.noDefaultJar() {
|
||||
tasks.named("jar").configure {
|
||||
enabled = false
|
||||
actions = emptyList()
|
||||
configurations.forEach { cfg ->
|
||||
removeArtifacts(cfg, this)
|
||||
}
|
||||
@@ -110,8 +113,6 @@ fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {})
|
||||
addVariantsFromConfiguration(runtimeJar) { }
|
||||
}
|
||||
|
||||
(components.findByName("java") as AdhocComponentWithVariants?)?.addVariantsFromConfiguration(runtimeJar) { }
|
||||
|
||||
return task
|
||||
}
|
||||
|
||||
@@ -225,20 +226,24 @@ fun Project.publish(moduleMetadata: Boolean = false, configure: MavenPublication
|
||||
|
||||
val publication = extensions.findByType<PublishingExtension>()
|
||||
?.publications
|
||||
?.findByName(mainPublicationName) as MavenPublication
|
||||
?.findByName(KotlinBuildPublishingPlugin.PUBLICATION_NAME) as MavenPublication
|
||||
publication.configure()
|
||||
}
|
||||
|
||||
fun Project.publishGradlePlugin() {
|
||||
mainPublicationName = "pluginMaven"
|
||||
publish()
|
||||
fun Project.publishWithLegacyMavenPlugin(body: Upload.() -> Unit = {}): Upload {
|
||||
apply<plugins.PublishedKotlinModule>()
|
||||
|
||||
if (artifactsRemovedDiagnosticFlag) {
|
||||
error("`publish()` should be called before removing artifacts typically done in `noDefaultJar()` or `runtimeJar()` call")
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks.withType<PublishTask> {
|
||||
// Makes plugin publication task reuse poms and metadata from publication named "pluginMaven"
|
||||
useAutomatedPublishing()
|
||||
useGradleModuleMetadataIfAvailable()
|
||||
}
|
||||
if (configurations.findByName("classes-dirs") != null)
|
||||
throw GradleException("classesDirsArtifact() is incompatible with publish(), see sources comments for details")
|
||||
}
|
||||
|
||||
return (tasks.getByName("uploadArchives") as Upload).apply {
|
||||
body()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,41 +254,6 @@ fun Project.idePluginDependency(block: () -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.publishJarsForIde(projects: List<String>, libraryDependencies: List<String> = emptyList()) {
|
||||
idePluginDependency {
|
||||
publishProjectJars(projects, libraryDependencies)
|
||||
}
|
||||
configurations.all {
|
||||
// Don't allow `ideaIC` from compiler to leak into Kotlin plugin modules. Compiler and
|
||||
// plugin may depend on different versions of IDEA and it will lead to version conflict
|
||||
exclude(module = ideModuleName())
|
||||
}
|
||||
dependencies {
|
||||
projects.forEach {
|
||||
jpsLikeJarDependency(project(it), JpsDepScope.COMPILE, { isTransitive = false }, exported = true)
|
||||
}
|
||||
libraryDependencies.forEach {
|
||||
jpsLikeJarDependency(it, JpsDepScope.COMPILE, exported = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.publishTestJarsForIde(projectNames: List<String>) {
|
||||
idePluginDependency {
|
||||
publishTestJar(projectNames)
|
||||
}
|
||||
configurations.all {
|
||||
// Don't allow `ideaIC` from compiler to leak into Kotlin plugin modules. Compiler and
|
||||
// plugin may depend on different versions of IDEA and it will lead to version conflict
|
||||
exclude(module = ideModuleName())
|
||||
}
|
||||
dependencies {
|
||||
for (projectName in projectNames) {
|
||||
jpsLikeJarDependency(projectTests(projectName), JpsDepScope.COMPILE, exported = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.publishProjectJars(projects: List<String>, libraryDependencies: List<String> = emptyList()) {
|
||||
apply<JavaPlugin>()
|
||||
|
||||
@@ -322,15 +292,13 @@ fun Project.publishProjectJars(projects: List<String>, libraryDependencies: List
|
||||
javadocJar()
|
||||
}
|
||||
|
||||
fun Project.publishTestJar(projects: List<String>) {
|
||||
fun Project.publishTestJar(projectName: String) {
|
||||
apply<JavaPlugin>()
|
||||
|
||||
val fatJarContents by configurations.creating
|
||||
|
||||
dependencies {
|
||||
for (projectName in projects) {
|
||||
fatJarContents(project(projectName, configuration = "tests-jar")) { isTransitive = false }
|
||||
}
|
||||
fatJarContents(project(projectName, configuration = "tests-jar")) { isTransitive = false }
|
||||
}
|
||||
|
||||
publish()
|
||||
@@ -347,7 +315,7 @@ fun Project.publishTestJar(projects: List<String>) {
|
||||
|
||||
sourcesJar {
|
||||
from {
|
||||
projects.map { project(it).testSourceSet.allSource }
|
||||
project(projectName).testSourceSet.allSource
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,37 +8,48 @@ package tasks
|
||||
import groovy.util.Node
|
||||
import groovy.util.XmlParser
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
abstract class WriteCopyrightToFile : DefaultTask() {
|
||||
|
||||
|
||||
|
||||
open class WriteCopyrightToFile : DefaultTask() {
|
||||
|
||||
@InputFile
|
||||
val path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
|
||||
var path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
|
||||
|
||||
@get:OutputFile
|
||||
abstract val outputFile: RegularFileProperty
|
||||
@OutputFile
|
||||
var outputFile: File? = null
|
||||
|
||||
@get:Input
|
||||
val commented: Property<Boolean> = project.objects.property(Boolean::class.java).convention(true)
|
||||
@Input
|
||||
var commented: Boolean = true
|
||||
|
||||
@TaskAction
|
||||
fun write() {
|
||||
val file = outputFile.asFile.get()
|
||||
file.writeText(if (commented.get()) readCopyrightCommented() else readCopyright())
|
||||
if (commented) {
|
||||
outputFile!!.writeText(project.readCopyrightCommented())
|
||||
} else {
|
||||
outputFile!!.writeText(project.readCopyright())
|
||||
}
|
||||
}
|
||||
|
||||
private fun readCopyright(): String {
|
||||
assert(path.exists()) {
|
||||
"File $path with copyright not found"
|
||||
|
||||
fun Project.readCopyright(): String {
|
||||
val file = rootDir.resolve(".idea/copyright/apache.xml")
|
||||
|
||||
assert(file.exists()) {
|
||||
"File $file with copyright not found"
|
||||
}
|
||||
|
||||
|
||||
val xmlParser = XmlParser()
|
||||
val node = xmlParser.parse(path)
|
||||
val node = xmlParser.parse(file)
|
||||
assert(node.attribute("name") == "CopyrightManager") {
|
||||
"Format changed occasionally?"
|
||||
}
|
||||
@@ -48,7 +59,7 @@ abstract class WriteCopyrightToFile : DefaultTask() {
|
||||
return noticeNode.attribute("value").toString().replace("$today.year", GregorianCalendar()[Calendar.YEAR].toString())
|
||||
}
|
||||
|
||||
private fun readCopyrightCommented(): String {
|
||||
fun Project.readCopyrightCommented(): String {
|
||||
return "/*\n" + readCopyright().prependIndent(" * ") + "\n */"
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,13 @@
|
||||
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.*
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.artifacts.ExternalModuleDependency
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
|
||||
import org.gradle.kotlin.dsl.closureOf
|
||||
import org.gradle.kotlin.dsl.exclude
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import org.gradle.kotlin.dsl.project
|
||||
import java.io.File
|
||||
@@ -36,7 +34,7 @@ val Project.internalBootstrapRepo: String? get() =
|
||||
when {
|
||||
bootstrapKotlinRepo?.startsWith("https://buildserver.labs.intellij.net") == true ->
|
||||
bootstrapKotlinRepo!!.replace("artifacts/content/maven", "artifacts/content/internal/repo")
|
||||
else -> "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Aggregate),number:$bootstrapKotlinVersion," +
|
||||
else -> "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:$bootstrapKotlinVersion," +
|
||||
"branch:default:any/artifacts/content/internal/repo/"
|
||||
}
|
||||
|
||||
@@ -91,6 +89,12 @@ fun Project.preloadedDeps(
|
||||
return files(*matchingFiles.map { it.canonicalPath }.toTypedArray())
|
||||
}
|
||||
|
||||
fun Project.ideaUltimatePreloadedDeps(vararg artifactBaseNames: String, subdir: String? = null): ConfigurableFileCollection {
|
||||
val ultimateDepsDir = fileFrom(rootDir, "ultimate", "dependencies")
|
||||
return if (ultimateDepsDir.isDirectory) preloadedDeps(*artifactBaseNames, baseDir = ultimateDepsDir, subdir = subdir)
|
||||
else files()
|
||||
}
|
||||
|
||||
fun Project.kotlinDep(artifactBaseName: String, version: String, classifier: String? = null): String =
|
||||
listOfNotNull("org.jetbrains.kotlin:kotlin-$artifactBaseName:$version", classifier).joinToString(":")
|
||||
|
||||
@@ -111,100 +115,10 @@ fun DependencyHandler.projectTests(name: String): ProjectDependency = project(na
|
||||
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
|
||||
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
|
||||
|
||||
enum class JpsDepScope {
|
||||
COMPILE, TEST, RUNTIME, PROVIDED
|
||||
}
|
||||
|
||||
fun DependencyHandler.add(configurationName: String, dependencyNotation: Any, configure: (ModuleDependency.() -> Unit)?) {
|
||||
// Avoid `dependencyNotation` to `ModuleDependency` class cast exception if possible
|
||||
if (configure != null) {
|
||||
add(configurationName, dependencyNotation, closureOf(configure))
|
||||
} else {
|
||||
add(configurationName, dependencyNotation)
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.disableDependencyVerification() {
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
disableDependencyVerification()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun DependencyHandler.jpsLikeJarDependency(
|
||||
dependencyNotation: Any,
|
||||
scope: JpsDepScope,
|
||||
dependencyConfiguration: (ModuleDependency.() -> Unit)? = null,
|
||||
exported: Boolean = false
|
||||
) {
|
||||
when (scope) {
|
||||
JpsDepScope.COMPILE -> {
|
||||
if (exported) {
|
||||
add("api", dependencyNotation, dependencyConfiguration)
|
||||
add("testCompile", dependencyNotation, dependencyConfiguration)
|
||||
} else {
|
||||
add("implementation", dependencyNotation, dependencyConfiguration)
|
||||
}
|
||||
}
|
||||
JpsDepScope.TEST -> {
|
||||
if (exported) {
|
||||
add("testCompile", dependencyNotation, dependencyConfiguration)
|
||||
} else {
|
||||
add("testImplementation", dependencyNotation, dependencyConfiguration)
|
||||
}
|
||||
}
|
||||
JpsDepScope.RUNTIME -> {
|
||||
add("testRuntimeOnly", dependencyNotation, dependencyConfiguration)
|
||||
}
|
||||
JpsDepScope.PROVIDED -> {
|
||||
if (exported) {
|
||||
add("compileOnlyApi", dependencyNotation, dependencyConfiguration)
|
||||
add("testCompile", dependencyNotation, dependencyConfiguration)
|
||||
} else {
|
||||
add("compileOnly", dependencyNotation, dependencyConfiguration)
|
||||
add("testImplementation", dependencyNotation, dependencyConfiguration)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun DependencyHandler.jpsLikeModuleDependency(moduleName: String, scope: JpsDepScope, exported: Boolean = false) {
|
||||
jpsLikeJarDependency(project(moduleName), scope, exported = exported)
|
||||
when (scope) {
|
||||
JpsDepScope.COMPILE -> {
|
||||
if (exported) {
|
||||
add("testCompile", projectTests(moduleName))
|
||||
} else {
|
||||
add("testImplementation", projectTests(moduleName))
|
||||
}
|
||||
}
|
||||
JpsDepScope.TEST -> {
|
||||
if (exported) {
|
||||
add("testCompile", projectTests(moduleName))
|
||||
} else {
|
||||
add("testImplementation", projectTests(moduleName))
|
||||
}
|
||||
}
|
||||
JpsDepScope.RUNTIME -> {
|
||||
add("runtimeOnly", projectTests(moduleName))
|
||||
}
|
||||
JpsDepScope.PROVIDED -> {
|
||||
if (exported) {
|
||||
add("testCompile", projectTests(moduleName))
|
||||
} else {
|
||||
add("testImplementation", projectTests(moduleName))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Project.testApiJUnit5(
|
||||
vintageEngine: Boolean = false,
|
||||
runner: Boolean = false,
|
||||
suiteApi: Boolean = false,
|
||||
jupiterParams: Boolean = false
|
||||
suiteApi: Boolean = false
|
||||
) {
|
||||
with(dependencies) {
|
||||
val platformVersion = commonVer("org.junit", "junit-bom")
|
||||
@@ -213,11 +127,6 @@ fun Project.testApiJUnit5(
|
||||
if (vintageEngine) {
|
||||
testApi("org.junit.vintage:junit-vintage-engine:$platformVersion")
|
||||
}
|
||||
|
||||
if (jupiterParams) {
|
||||
testApi("org.junit.jupiter:junit-jupiter-params:$platformVersion")
|
||||
}
|
||||
|
||||
val componentsVersion = commonVer("org.junit.platform", "")
|
||||
|
||||
val components = mutableListOf(
|
||||
@@ -289,16 +198,14 @@ fun Project.firstFromJavaHomeThatExists(vararg paths: String, jdkHome: File = Fi
|
||||
|
||||
fun Project.toolsJarApi(): Any =
|
||||
if (kotlinBuildProperties.isInJpsBuildIdeaSync)
|
||||
toolsJar()
|
||||
files(toolsJarFile() ?: error("tools.jar is not found!"))
|
||||
else
|
||||
dependencies.project(":dependencies:tools-jar-api")
|
||||
|
||||
fun Project.toolsJar(): FileCollection = files(
|
||||
getToolchainLauncherFor(JdkMajorVersion.JDK_1_8)
|
||||
.map {
|
||||
Jvm.forHome(it.metadata.installationPath.asFile).toolsJar ?: throw GradleException("tools.jar not found!")
|
||||
}
|
||||
)
|
||||
fun Project.toolsJar(): FileCollection = files(toolsJarFile() ?: error("tools.jar is not found!"))
|
||||
|
||||
fun Project.toolsJarFile(jdkHome: File = File(this.property("JDK_18") as String)): File? =
|
||||
firstFromJavaHomeThatExists("lib/tools.jar", jdkHome = jdkHome)
|
||||
|
||||
val compilerManifestClassPath
|
||||
get() = "annotations-13.0.jar kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar trove4j.jar"
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.DependencySubstitution
|
||||
import org.gradle.api.artifacts.component.ProjectComponentSelector
|
||||
import org.gradle.api.file.DuplicatesStrategy
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
@@ -82,24 +80,6 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.configureShadowJarSubstitutionInCompileClasspath() {
|
||||
val substitutionMap = mapOf(":kotlin-reflect" to ":kotlin-reflect-api")
|
||||
|
||||
fun configureSubstitution(substitution: DependencySubstitution) {
|
||||
val requestedProject = (substitution.requested as? ProjectComponentSelector)?.projectPath ?: return
|
||||
val replacementProject = substitutionMap[requestedProject] ?: return
|
||||
substitution.useTarget(project(replacementProject), "Non-default shadow jars should not be used in compile classpath")
|
||||
}
|
||||
|
||||
sourceSets.all {
|
||||
for (configName in listOf(compileOnlyConfigurationName, compileClasspathConfigurationName)) {
|
||||
configurations.getByName(configName).resolutionStrategy.dependencySubstitution {
|
||||
all(::configureSubstitution)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.embeddableCompiler(taskName: String = "embeddable", body: ShadowJar.() -> Unit = {}): TaskProvider<out ShadowJar> =
|
||||
compilerShadowJar(taskName) {
|
||||
configureEmbeddableCompilerRelocation()
|
||||
@@ -113,6 +93,7 @@ fun Project.compilerDummyForDependenciesRewriting(
|
||||
exclude(packagesToExcludeFromDummy)
|
||||
body()
|
||||
}
|
||||
|
||||
const val COMPILER_DUMMY_JAR_CONFIGURATION_NAME = "compilerDummyJar"
|
||||
|
||||
fun Project.compilerDummyJar(task: TaskProvider<out Jar>, body: Jar.() -> Unit = {}) {
|
||||
@@ -147,6 +128,7 @@ fun Project.rewriteDepsToShadedJar(
|
||||
archiveClassifier.set("original")
|
||||
}
|
||||
|
||||
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
|
||||
|
||||
shadowJarTask.configure {
|
||||
dependsOn(originalJarTask)
|
||||
@@ -154,8 +136,7 @@ fun Project.rewriteDepsToShadedJar(
|
||||
|
||||
// When Gradle traverses the inputs, reject the shaded compiler JAR,
|
||||
// which leads to the content of that JAR being excluded as well:
|
||||
val compilerDummyJarFile = project.provider { configurations.getByName("compilerDummyJar").singleFile }
|
||||
exclude { it.file == compilerDummyJarFile.get() }
|
||||
exclude { it.file == compilerDummyJarFile }
|
||||
|
||||
archiveClassifier.set("original")
|
||||
body()
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishGradlePlugin()
|
||||
standardPublicJars()
|
||||
|
||||
extensions.extraProperties["kotlin.stdlib.default.dependency"] = "false"
|
||||
|
||||
dependencies {
|
||||
compileOnly(kotlinStdlib())
|
||||
compileOnly(gradleApi())
|
||||
}
|
||||
|
||||
// These dependencies will be provided by Gradle and we should prevent version conflict
|
||||
fun Configuration.excludeGradleCommonDependencies() {
|
||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
|
||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
|
||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
|
||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
|
||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
|
||||
exclude(group = "org.jetbrains.kotlin", module = "kotlin-script-runtime")
|
||||
}
|
||||
configurations {
|
||||
"implementation" {
|
||||
excludeGradleCommonDependencies()
|
||||
}
|
||||
"api" {
|
||||
excludeGradleCommonDependencies()
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.languageVersion = "1.3"
|
||||
kotlinOptions.apiVersion = "1.3"
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
"-Xskip-prerelease-check",
|
||||
"-Xskip-runtime-version-check",
|
||||
"-Xsuppress-version-warnings"
|
||||
)
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
callGroovy("manifestAttributes", manifest, project)
|
||||
}
|
||||
@@ -21,18 +21,15 @@ import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.internal.ConventionTask
|
||||
import org.gradle.api.plugins.ExtensionAware
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.api.tasks.compile.AbstractCompile
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
||||
fun Project.configureFormInstrumentation() {
|
||||
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.configureEach {
|
||||
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
|
||||
// When we change the output classes directory, Gradle will automatically configure
|
||||
// the test compile tasks to use the instrumented classes. Normally this is fine,
|
||||
// however, it causes problems for Kotlin projects:
|
||||
@@ -45,36 +42,31 @@ fun Project.configureFormInstrumentation() {
|
||||
|
||||
// This fails when we change the classes dir. The easiest fix is to prepend the
|
||||
// classes from the "friendly directory" to the compile classpath.
|
||||
if (!tasks.names.contains("compileTestKotlin")) return@configureEach
|
||||
val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile?
|
||||
testCompile?.doFirst {
|
||||
val originalClassesDirs = files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy"))
|
||||
|
||||
tasks.named<AbstractCompile>("compileTestKotlin") {
|
||||
val objects = project.objects
|
||||
val classesDirs = project.mainSourceSet.output.classesDirs
|
||||
val classesDirsCopy = project.provider { (mainSourceSet as ExtensionAware).extra.get("classesDirsCopy") }
|
||||
doFirst {
|
||||
val originalClassesDirs = objects.fileCollection().from(classesDirsCopy)
|
||||
testCompile.classpath = (testCompile.classpath
|
||||
- mainSourceSet.output.classesDirs
|
||||
+ originalClassesDirs)
|
||||
|
||||
classpath = (classpath
|
||||
- classesDirs
|
||||
+ originalClassesDirs)
|
||||
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
|
||||
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
|
||||
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
|
||||
// -Xfriend-paths compiler argument as well.
|
||||
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
|
||||
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
|
||||
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
|
||||
|
||||
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
|
||||
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
|
||||
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
|
||||
// -Xfriend-paths compiler argument as well.
|
||||
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
|
||||
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
|
||||
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
|
||||
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
|
||||
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
|
||||
|
||||
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
|
||||
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
|
||||
|
||||
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
|
||||
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
|
||||
}
|
||||
addFreeCompilerArgs(this as AbstractCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
|
||||
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
|
||||
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
|
||||
}
|
||||
addFreeCompilerArgs(testCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
|
||||
@@ -84,7 +76,7 @@ fun Project.configureFormInstrumentation() {
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
sourceSets.forEach { sourceSetParam ->
|
||||
sourceSets.all { sourceSetParam ->
|
||||
// This copy will ignore filters, but they are unlikely to be used.
|
||||
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
|
||||
|
||||
@@ -96,82 +88,66 @@ fun Project.configureFormInstrumentation() {
|
||||
(sourceSetParam.output.classesDirs as ConfigurableFileCollection).setFrom(instrumentedClassesDir)
|
||||
val instrumentTask =
|
||||
project.tasks.register(sourceSetParam.getTaskName("instrument", "classes"), IntelliJInstrumentCodeTask::class.java) {
|
||||
dependsOn(sourceSetParam.classesTaskName)
|
||||
compileClasspath.from(sourceSetParam.compileClasspath)
|
||||
sourceDirs.from(project.files({ sourceSetParam.allSource.srcDirs.filter { !sourceSetParam.resources.contains(it) && it.exists() } }))
|
||||
instrumentationClasspathConfiguration = instrumentationClasspathCfg
|
||||
originalClassesDirs.from(classesDirsCopy)
|
||||
output.set(instrumentedClassesDir)
|
||||
dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty }
|
||||
sourceSet = sourceSetParam
|
||||
instrumentationClasspath = instrumentationClasspathCfg
|
||||
originalClassesDirs = classesDirsCopy
|
||||
output = instrumentedClassesDir
|
||||
outputs.dir(instrumentedClassesDir)
|
||||
}
|
||||
|
||||
// Ensure that our task is invoked when the source set is built
|
||||
sourceSetParam.compiledBy(instrumentTask)
|
||||
@Suppress("UNUSED_EXPRESSION")
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CacheableTask
|
||||
abstract class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
open class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
companion object {
|
||||
private const val FILTER_ANNOTATION_REGEXP_CLASS = "com.intellij.ant.ClassFilterAnnotationRegexp"
|
||||
private const val LOADER_REF = "java2.loader"
|
||||
}
|
||||
|
||||
@Transient
|
||||
@Internal
|
||||
lateinit var instrumentationClasspathConfiguration: Configuration
|
||||
@Classpath
|
||||
var instrumentationClasspath: Configuration? = null
|
||||
|
||||
@get:Classpath
|
||||
val instrumentationClasspath: String by lazy {
|
||||
instrumentationClasspathConfiguration.asPath
|
||||
}
|
||||
|
||||
@get:InputFiles
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
@get:SkipWhenEmpty
|
||||
abstract val originalClassesDirs: ConfigurableFileCollection
|
||||
@InputFiles
|
||||
@PathSensitive(PathSensitivity.RELATIVE)
|
||||
var originalClassesDirs: FileCollection? = null
|
||||
|
||||
@get:Input
|
||||
var instrumentNotNull: Boolean = false
|
||||
|
||||
@get:InputFiles
|
||||
@get:Classpath
|
||||
abstract val compileClasspath: ConfigurableFileCollection
|
||||
|
||||
// Instrumentation needs to have access to sources of forms for inclusion
|
||||
private val depSourceDirectorySets by lazy {
|
||||
project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
|
||||
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
|
||||
}
|
||||
@Internal
|
||||
var sourceSet: SourceSet? = null
|
||||
|
||||
@get:InputFiles
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
abstract val sourceDirs: ConfigurableFileCollection
|
||||
val sourceDirs: FileCollection
|
||||
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
|
||||
|
||||
@get:OutputDirectory
|
||||
abstract val output: RegularFileProperty
|
||||
|
||||
@get:Inject
|
||||
abstract val fs: FileSystemOperations
|
||||
lateinit var output: File
|
||||
|
||||
@TaskAction
|
||||
fun instrumentClasses() {
|
||||
logger.info(
|
||||
"input files are: ${
|
||||
originalClassesDirs.joinToString(
|
||||
"; ",
|
||||
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })
|
||||
}"
|
||||
"input files are: ${originalClassesDirs?.joinToString(
|
||||
"; ",
|
||||
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })}"
|
||||
)
|
||||
output.asFile.get().deleteRecursively()
|
||||
output.deleteRecursively()
|
||||
copyOriginalClasses()
|
||||
|
||||
val classpath = instrumentationClasspath
|
||||
val classpath = instrumentationClasspath!!
|
||||
|
||||
ant.withGroovyBuilder {
|
||||
"taskdef"(
|
||||
"name" to "instrumentIdeaExtensions",
|
||||
"classpath" to classpath,
|
||||
"classpath" to classpath.asPath,
|
||||
"loaderref" to LOADER_REF,
|
||||
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
|
||||
)
|
||||
@@ -179,14 +155,14 @@ abstract class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
|
||||
logger.info("Compiling forms and instrumenting code with nullability preconditions")
|
||||
if (instrumentNotNull) {
|
||||
prepareNotNullInstrumenting(classpath)
|
||||
prepareNotNullInstrumenting(classpath.asPath)
|
||||
}
|
||||
|
||||
instrumentCode(sourceDirs, instrumentNotNull)
|
||||
}
|
||||
|
||||
private fun copyOriginalClasses() {
|
||||
fs.copy {
|
||||
project.copy {
|
||||
from(originalClassesDirs)
|
||||
into(output)
|
||||
}
|
||||
@@ -205,10 +181,12 @@ abstract class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
|
||||
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
|
||||
val headlessOldValue = System.setProperty("java.awt.headless", "true")
|
||||
val output = output.get().asFile
|
||||
|
||||
// Instrumentation needs to have access to sources of forms for inclusion
|
||||
val depSourceDirectorySets = project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
|
||||
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
|
||||
val instrumentationClasspath =
|
||||
depSourceDirectorySets.fold(compileClasspath as FileCollection) { acc, v -> acc + v }.asPath.also {
|
||||
depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
|
||||
logger.info("Using following dependency source dirs: $it")
|
||||
}
|
||||
|
||||
|
||||
193
buildSrc/src/main/kotlin/jdksFinder.kt
Normal file
193
buildSrc/src/main/kotlin/jdksFinder.kt
Normal file
@@ -0,0 +1,193 @@
|
||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
||||
|
||||
import net.rubygrapefruit.platform.Native
|
||||
import net.rubygrapefruit.platform.WindowsRegistry
|
||||
import org.gradle.api.GradleException
|
||||
import org.gradle.api.Project
|
||||
import java.nio.file.Paths
|
||||
import java.io.File
|
||||
import net.rubygrapefruit.platform.WindowsRegistry.Key.HKEY_LOCAL_MACHINE
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
enum class JdkMajorVersion(private val mandatory: Boolean = true) {
|
||||
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10(false), JDK_11(false), /*15.0*/JDK_15(false);
|
||||
|
||||
fun isMandatory(): Boolean = mandatory
|
||||
}
|
||||
|
||||
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"), JdkMajorVersion.JDK_15 to listOf("JDK_15_0"))
|
||||
|
||||
data class JdkId(val explicit: Boolean, val majorVersion: JdkMajorVersion, var version: String, var homeDir: File)
|
||||
|
||||
fun Project.getConfiguredJdks(): List<JdkId> {
|
||||
val res = arrayListOf<JdkId>()
|
||||
for (jdkMajorVersion in JdkMajorVersion.values()) {
|
||||
val explicitJdkEnvVal = findProperty(jdkMajorVersion.name)?.toString()
|
||||
?: System.getenv(jdkMajorVersion.name)
|
||||
?: jdkAlternativeVarNames[jdkMajorVersion]?.mapNotNull { System.getenv(it) }?.firstOrNull()
|
||||
?: continue
|
||||
val explicitJdk = Paths.get(explicitJdkEnvVal).toRealPath().toFile()
|
||||
if (!explicitJdk.isDirectory) {
|
||||
throw GradleException("Invalid environment value $jdkMajorVersion: $explicitJdkEnvVal, expecting JDK home path")
|
||||
}
|
||||
res.add(JdkId(true, jdkMajorVersion, "X", explicitJdk))
|
||||
}
|
||||
if (res.size < JdkMajorVersion.values().size) {
|
||||
res.discoverJdks(this)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// see JEP 223
|
||||
private val javaMajorVersionRegex = Regex("""(?:1\.)?(\d+).*""")
|
||||
private val javaVersionRegex = Regex("""(?:1\.)?(\d+)(\.\d+)?([+-_]\w+){0,3}""")
|
||||
|
||||
fun MutableCollection<JdkId>.addIfBetter(project: Project, version: String, id: String, homeDir: File): Boolean {
|
||||
val matchString = javaMajorVersionRegex.matchEntire(version)?.groupValues?.get(1)
|
||||
val majorJdkVersion = when (matchString) {
|
||||
"6" -> JdkMajorVersion.JDK_16
|
||||
"7" -> JdkMajorVersion.JDK_17
|
||||
"8" -> JdkMajorVersion.JDK_18
|
||||
"9" -> JdkMajorVersion.JDK_9
|
||||
else -> {
|
||||
project.logger.info("Cannot recognize version string '$version' (found version '$matchString')")
|
||||
return false
|
||||
}
|
||||
}
|
||||
val prev = find { it.majorVersion == majorJdkVersion }
|
||||
if (prev == null) {
|
||||
add(JdkId(false, majorJdkVersion, version, homeDir))
|
||||
return true
|
||||
}
|
||||
if (prev.explicit) return false
|
||||
val versionsComparisonRes = compareVersions(prev.version, version)
|
||||
if (versionsComparisonRes < 0 || (versionsComparisonRes == 0 && id.contains("64"))) { // prefer 64-bit
|
||||
prev.version = version
|
||||
prev.homeDir = homeDir
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun compareVersions(left: String, right: String): Int {
|
||||
if (left == right) return 0
|
||||
fun MatchResult.extractNumVer(): List<Int> =
|
||||
groups.drop(2).map {
|
||||
it?.value?.filter { it in '0'..'9' }?.toIntOrNull() ?: 0
|
||||
}
|
||||
val lmi = (javaVersionRegex.matchEntire(left)?.extractNumVer() ?: emptyList()).iterator()
|
||||
val rmi = (javaVersionRegex.matchEntire(right)?.extractNumVer() ?: emptyList()).iterator()
|
||||
while (lmi.hasNext() && rmi.hasNext()) {
|
||||
val l = lmi.next()
|
||||
val r = rmi.next()
|
||||
when {
|
||||
l < r -> return -1
|
||||
l > r -> return 1
|
||||
}
|
||||
}
|
||||
return when {
|
||||
rmi.hasNext() -> -1
|
||||
lmi.hasNext() -> 1
|
||||
else -> 0
|
||||
}
|
||||
}
|
||||
|
||||
fun MutableCollection<JdkId>.discoverJdks(project: Project) {
|
||||
val os = OperatingSystem.current()
|
||||
when {
|
||||
os.isWindows -> discoverJdksOnWindows(project)
|
||||
os.isMacOsX -> discoverJdksOnMacOS(project)
|
||||
else -> discoverJdksOnUnix(project)
|
||||
}
|
||||
}
|
||||
|
||||
private val macOsJavaHomeOutRegexes =
|
||||
listOf(
|
||||
Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
|
||||
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""),
|
||||
Regex("""\s+(\S+)\s+\((.*?)\)\s+"[^"]*"\s+-\s+"[^"]*"\s(.+)"""),
|
||||
Regex("""\s+(\S+)\s+\((.+)\)\s+".+"\s+-\s+".+"\s+(.+)"""))
|
||||
|
||||
fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) {
|
||||
val procBuilder = ProcessBuilder("/usr/libexec/java_home", "-V").redirectErrorStream(true)
|
||||
val process = procBuilder.start()
|
||||
val retCode = process.waitFor()
|
||||
if (retCode != 0) throw GradleException("Unable to run 'java_home', return code $retCode")
|
||||
process.inputStream.bufferedReader().forEachLine { line ->
|
||||
for (rex in macOsJavaHomeOutRegexes) {
|
||||
val matchResult = rex.matchEntire(line)
|
||||
if (matchResult != null) {
|
||||
addIfBetter(project, matchResult.groupValues[1], matchResult.groupValues[0], File(matchResult.groupValues[3]))
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val unixConventionalJdkLocations = listOf(
|
||||
"/usr/lib/jvm", // *deb, Arch
|
||||
"/opt", // *rpm, Gentoo, HP/UX
|
||||
"/usr/lib", // Slackware 32
|
||||
"/usr/lib64", // Slackware 64
|
||||
"/usr/local", // OpenBSD, FreeBSD
|
||||
"/usr/pkg/java", // NetBSD
|
||||
"/usr/jdk/instances") // Solaris
|
||||
|
||||
private val unixConventionalJdkDirRex = Regex("jdk|jre|java|zulu")
|
||||
|
||||
fun MutableCollection<JdkId>.discoverJdksOnUnix(project: Project) {
|
||||
for (loc in unixConventionalJdkLocations) {
|
||||
val installedJdks = File(loc).listFiles { dir ->
|
||||
dir.isDirectory &&
|
||||
unixConventionalJdkDirRex.containsMatchIn(dir.name) &&
|
||||
fileFrom(dir, "bin", "java").isFile
|
||||
} ?: continue
|
||||
for (dir in installedJdks) {
|
||||
val versionMatch = javaVersionRegex.find(dir.name)
|
||||
if (versionMatch == null) {
|
||||
project.logger.info("Unable to extract version from possible JDK dir: $dir")
|
||||
}
|
||||
else {
|
||||
addIfBetter(project, versionMatch.value, dir.name, dir)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val windowsConventionalJdkRegistryPaths = listOf(
|
||||
"SOFTWARE\\JavaSoft\\Java Development Kit",
|
||||
"SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit",
|
||||
"SOFTWARE\\JavaSoft\\JDK",
|
||||
"SOFTWARE\\Wow6432Node\\JavaSoft\\JDK")
|
||||
|
||||
fun MutableCollection<JdkId>.discoverJdksOnWindows(project: Project) {
|
||||
val registry = Native.get(WindowsRegistry::class.java)
|
||||
for (regPath in windowsConventionalJdkRegistryPaths) {
|
||||
val jdkKeys = try {
|
||||
registry.getSubkeys(HKEY_LOCAL_MACHINE, regPath)
|
||||
} catch (e: RuntimeException) {
|
||||
// ignore missing nodes
|
||||
continue
|
||||
}
|
||||
for (jdkKey in jdkKeys) {
|
||||
try {
|
||||
val javaHome = registry.getStringValue(HKEY_LOCAL_MACHINE, regPath + "\\" + jdkKey, "JavaHome")
|
||||
val versionMatch = javaVersionRegex.find(jdkKey)
|
||||
if (versionMatch == null) {
|
||||
project.logger.info("Unable to extract version from possible JDK location: $javaHome ($jdkKey)")
|
||||
}
|
||||
else {
|
||||
javaHome.takeIf { it.isNotEmpty() }
|
||||
?.let { File(it) }
|
||||
?.takeIf { it.isDirectory && fileFrom(it, "bin", "java.exe").isFile }
|
||||
?.let {
|
||||
addIfBetter(project, versionMatch.value, jdkKey, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e: RuntimeException) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,26 +35,16 @@ private fun Project.kotlinBuildLocalDependenciesDir(): File =
|
||||
|
||||
private fun Project.kotlinBuildLocalRepoDir(): File = kotlinBuildLocalDependenciesDir().resolve("repo")
|
||||
|
||||
fun Project.ideModuleName() = when (IdeVersionConfigurator.currentIde.kind) {
|
||||
private fun Project.ideModuleName() = when (IdeVersionConfigurator.currentIde.kind) {
|
||||
Ide.Kind.AndroidStudio -> "android-studio-ide"
|
||||
Ide.Kind.IntelliJ -> "ideaIC"
|
||||
}
|
||||
|
||||
private fun Project.ideModuleVersion(forIde: Boolean) = when (IdeVersionConfigurator.currentIde.kind) {
|
||||
Ide.Kind.AndroidStudio -> rootProject.findProperty("versions.androidStudioBuild")
|
||||
Ide.Kind.IntelliJ -> {
|
||||
if (forIde) {
|
||||
intellijSdkVersionForIde()
|
||||
?: error("Please specify 'attachedIntellijVersion' in your local.properties")
|
||||
} else {
|
||||
rootProject.findProperty("versions.intellijSdk")
|
||||
}
|
||||
if (kotlinBuildProperties.intellijUltimateEnabled) "ideaIU" else "ideaIC"
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.intellijSdkVersionForIde(): String? {
|
||||
val majorVersion = kotlinBuildProperties.getOrNull("attachedIntellijVersion") as? String ?: return null
|
||||
return rootProject.findProperty("versions.intellijSdk.forIde.$majorVersion") as? String
|
||||
private fun Project.ideModuleVersion() = when (IdeVersionConfigurator.currentIde.kind) {
|
||||
Ide.Kind.AndroidStudio -> rootProject.findProperty("versions.androidStudioBuild")
|
||||
Ide.Kind.IntelliJ -> rootProject.findProperty("versions.intellijSdk")
|
||||
}
|
||||
|
||||
fun RepositoryHandler.kotlinBuildLocalRepo(project: Project): IvyArtifactRepository = ivy {
|
||||
@@ -68,7 +58,6 @@ fun RepositoryHandler.kotlinBuildLocalRepo(project: Project): IvyArtifactReposit
|
||||
|
||||
artifact("[organisation]/[module]/[revision]/artifacts/lib/[artifact](-[classifier]).[ext]")
|
||||
artifact("[organisation]/[module]/[revision]/artifacts/[artifact](-[classifier]).[ext]")
|
||||
artifact("[organisation]/intellij-core/[revision]/artifacts/[artifact](-[classifier]).[ext]")
|
||||
artifact("[organisation]/${project.ideModuleName()}/[revision]/artifacts/plugins/[module]/lib/[artifact](-[classifier]).[ext]") // bundled plugins
|
||||
artifact("[organisation]/sources/[artifact]-[revision](-[classifier]).[ext]")
|
||||
artifact("[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]")
|
||||
@@ -79,9 +68,7 @@ fun RepositoryHandler.kotlinBuildLocalRepo(project: Project): IvyArtifactReposit
|
||||
}
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun Project.intellijDep(module: String? = null, forIde: Boolean = false) =
|
||||
"kotlin.build:${module ?: ideModuleName()}:${ideModuleVersion(forIde)}"
|
||||
fun Project.intellijDep(module: String? = null) = "kotlin.build:${module ?: ideModuleName()}:${ideModuleVersion()}"
|
||||
|
||||
fun Project.intellijCoreDep() = "kotlin.build:intellij-core:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
@@ -106,7 +93,11 @@ fun Project.kotlinxCollectionsImmutable() = "org.jetbrains.kotlinx:kotlinx-colle
|
||||
*/
|
||||
fun Project.intellijRuntimeAnnotations() = "kotlin.build:intellij-runtime-annotations:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
fun Project.intellijPluginDep(plugin: String, forIde: Boolean = false) = intellijDep(plugin, forIde)
|
||||
fun Project.intellijPluginDep(plugin: String) = intellijDep(plugin)
|
||||
|
||||
fun Project.intellijUltimateDep() = intellijDep("ideaIU")
|
||||
|
||||
fun Project.intellijUltimatePluginDep(plugin: String) = intellijDep(plugin)
|
||||
|
||||
fun ModuleDependency.includeJars(vararg names: String, rootProject: Project? = null) {
|
||||
names.forEach {
|
||||
@@ -134,7 +125,7 @@ object IntellijRootUtils {
|
||||
fun getIntellijRootDir(project: Project): File = with(project.rootProject) {
|
||||
return File(
|
||||
getRepositoryRootDir(this),
|
||||
"${ideModuleName()}/${ideModuleVersion(forIde = false)}/artifacts"
|
||||
"${ideModuleName()}/${ideModuleVersion()}/artifacts"
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -146,8 +137,19 @@ fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFi
|
||||
rootProject = project.rootProject
|
||||
)
|
||||
|
||||
fun Project.isIntellijCommunityAvailable() =
|
||||
!(rootProject.extra["intellijUltimateEnabled"] as Boolean) || rootProject.extra["intellijSeparateSdks"] as Boolean
|
||||
|
||||
fun Project.isIntellijUltimateSdkAvailable() = (rootProject.extra["intellijUltimateEnabled"] as Boolean)
|
||||
|
||||
fun Project.intellijRootDir() = IntellijRootUtils.getIntellijRootDir(project)
|
||||
|
||||
fun Project.intellijUltimateRootDir() =
|
||||
if (isIntellijUltimateSdkAvailable())
|
||||
File(kotlinBuildLocalRepoDir(), "kotlin.build/ideaIU/${rootProject.extra["versions.intellijSdk"]}/artifacts")
|
||||
else
|
||||
throw GradleException("intellij ultimate SDK is not available")
|
||||
|
||||
fun DependencyHandlerScope.excludeInAndroidStudio(rootProject: Project, block: DependencyHandlerScope.() -> Unit) {
|
||||
if (!rootProject.extra.has("versions.androidStudioRelease")) {
|
||||
block()
|
||||
@@ -181,7 +183,9 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
|
||||
"-Dplugin.path=${ideaPluginDir.absolutePath}"
|
||||
)
|
||||
|
||||
jvmArgs("-Didea.platform.prefix=Idea")
|
||||
if (Platform[201].orHigher() && !isIntellijUltimateSdkAvailable()) {
|
||||
jvmArgs("-Didea.platform.prefix=Idea")
|
||||
}
|
||||
|
||||
if (rootProject.findProperty("versions.androidStudioRelease") != null) {
|
||||
jvmArgs("-Didea.platform.prefix=AndroidStudio")
|
||||
|
||||
@@ -10,16 +10,31 @@ import java.io.File
|
||||
import org.gradle.api.Project
|
||||
|
||||
open class PillExtension {
|
||||
/*
|
||||
* Here's how you can specify a custom variant:
|
||||
* `./gradlew pill -Dpill.variant=<NAME>`
|
||||
*/
|
||||
enum class Variant {
|
||||
BASE, // Includes compiler and IDE (default)
|
||||
FULL, // Includes compiler, IDE and Gradle plugin
|
||||
// Default variant (./gradlew pill)
|
||||
BASE() {
|
||||
override val includes = setOf(BASE)
|
||||
},
|
||||
|
||||
// Full variant (./gradlew pill -Dpill.variant=full)
|
||||
FULL() {
|
||||
override val includes = setOf(BASE, FULL)
|
||||
},
|
||||
|
||||
// Do not import the project to JPS model, but set some options for it
|
||||
NONE() {
|
||||
override val includes = emptySet<Variant>()
|
||||
},
|
||||
|
||||
// 'BASE' if the "jps-compatible" plugin is applied, 'NONE' otherwise
|
||||
DEFAULT() {
|
||||
override val includes = emptySet<Variant>()
|
||||
};
|
||||
|
||||
abstract val includes: Set<Variant>
|
||||
}
|
||||
|
||||
open var variant: Variant? = null
|
||||
open var variant: Variant = Variant.DEFAULT
|
||||
|
||||
open var excludedDirs: List<File> = emptyList()
|
||||
|
||||
@@ -30,7 +45,7 @@ open class PillExtension {
|
||||
|
||||
@Suppress("unused")
|
||||
fun serialize() = mapOf<String, Any?>(
|
||||
"variant" to variant?.name,
|
||||
"variant" to variant.name,
|
||||
"excludedDirs" to excludedDirs
|
||||
)
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import plugins.KotlinBuildPublishingPlugin
|
||||
import plugins.configureRepository
|
||||
import plugins.mainPublicationName
|
||||
import java.util.*
|
||||
|
||||
internal const val PLUGIN_MARKER_SUFFIX = ".gradle.plugin"
|
||||
@@ -27,7 +26,7 @@ fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
|
||||
|
||||
val pluginDevelopment = extensions.getByType<PluginBundleExtension>()
|
||||
val publishingExtension = extensions.getByType<PublishingExtension>()
|
||||
val mainPublication = publishingExtension.publications[mainPublicationName] as MavenPublication
|
||||
val mainPublication = publishingExtension.publications[KotlinBuildPublishingPlugin.PUBLICATION_NAME] as MavenPublication
|
||||
|
||||
pluginDevelopment.plugins.forEach { declaration ->
|
||||
val markerPublication = createMavenMarkerPublication(declaration, mainPublication, publishingExtension.publications)
|
||||
@@ -65,9 +64,6 @@ private fun createMavenMarkerPublication(
|
||||
): MavenPublication {
|
||||
return publications.create<MavenPublication>(declaration.name.toString() + "PluginMarkerMaven") {
|
||||
val pluginId: String = declaration.id
|
||||
val cGroupId = coordinates.groupId
|
||||
val cArtifactId = coordinates.artifactId
|
||||
val cVersion = coordinates.version
|
||||
artifactId = pluginId + PLUGIN_MARKER_SUFFIX
|
||||
groupId = pluginId
|
||||
pom.withXml {
|
||||
@@ -76,11 +72,11 @@ private fun createMavenMarkerPublication(
|
||||
val dependencies = root.appendChild(document.createElement("dependencies"))
|
||||
val dependency = dependencies.appendChild(document.createElement("dependency"))
|
||||
val groupId = dependency.appendChild(document.createElement("groupId"))
|
||||
groupId.textContent = cGroupId
|
||||
groupId.textContent = coordinates.groupId
|
||||
val artifactId = dependency.appendChild(document.createElement("artifactId"))
|
||||
artifactId.textContent = cArtifactId
|
||||
artifactId.textContent = coordinates.artifactId
|
||||
val version = dependency.appendChild(document.createElement("version"))
|
||||
version.textContent = cVersion
|
||||
version.textContent = coordinates.version
|
||||
}
|
||||
|
||||
pom.name.set(declaration.displayName)
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
import com.jakewharton.dex.*
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.ListProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import java.io.File
|
||||
|
||||
@CacheableTask
|
||||
abstract class DexMethodCount : DefaultTask() {
|
||||
open class DexMethodCount : DefaultTask() {
|
||||
|
||||
data class Counts(
|
||||
val total: Int,
|
||||
@@ -27,18 +24,16 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
@Classpath
|
||||
lateinit var jarFile: File
|
||||
|
||||
@get:Optional
|
||||
@get:Input
|
||||
abstract val ownPackages: ListProperty<String>
|
||||
@Optional
|
||||
@Input
|
||||
var ownPackages: List<String>? = null
|
||||
|
||||
@Internal
|
||||
var artifactName: String? = null
|
||||
|
||||
private val projectName = project.name
|
||||
|
||||
@get:Input
|
||||
val artifactOrArchiveName: String
|
||||
get() = artifactName ?: projectName
|
||||
get() = artifactName ?: project.name
|
||||
|
||||
fun from(jar: Jar) {
|
||||
jarFile = jar.archiveFile.get().asFile
|
||||
@@ -50,9 +45,8 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
lateinit var counts: Counts
|
||||
|
||||
@get:OutputFile
|
||||
val detailOutputFile: File by lazy {
|
||||
project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
|
||||
}
|
||||
val detailOutputFile: File
|
||||
get() = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
|
||||
|
||||
@TaskAction
|
||||
fun invoke() {
|
||||
@@ -65,9 +59,9 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
val byPackage = this.groupingBy { it.`package` }.eachCount()
|
||||
val byClass = this.groupingBy { it.declaringType }.eachCount()
|
||||
|
||||
val ownPackages = ownPackages.map { list -> list.map { "$it." } }
|
||||
val byOwnPackages = if (ownPackages.isPresent) {
|
||||
this.partition { method -> ownPackages.get().any { method.declaringType.startsWith(it) } }.let {
|
||||
val ownPackages = ownPackages?.map { "$it." }
|
||||
val byOwnPackages = if (ownPackages != null) {
|
||||
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) } }.let {
|
||||
it.first.size to it.second.size
|
||||
}
|
||||
} else (null to null)
|
||||
@@ -84,7 +78,7 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
private fun outputDetails(counts: Counts) {
|
||||
detailOutputFile.printWriter().use { writer ->
|
||||
writer.println("${counts.total.padRight()}\tTotal methods")
|
||||
ownPackages.orNull?.let { packages ->
|
||||
ownPackages?.let { packages ->
|
||||
writer.println("${counts.totalOwnPackages?.padRight()}\tTotal methods from packages ${packages.joinToString { "$it.*" }}")
|
||||
writer.println("${counts.totalOtherPackages?.padRight()}\tTotal methods from other packages")
|
||||
}
|
||||
@@ -102,24 +96,23 @@ abstract class DexMethodCount : DefaultTask() {
|
||||
}
|
||||
}
|
||||
|
||||
abstract class DexMethodCountStats : DefaultTask() {
|
||||
open class DexMethodCountStats : DefaultTask() {
|
||||
|
||||
@Internal
|
||||
lateinit var from: TaskProvider<DexMethodCount>
|
||||
|
||||
@get:InputFile
|
||||
internal abstract val inputFile: RegularFileProperty
|
||||
|
||||
@get:Input
|
||||
internal abstract val artifactOrArchiveName: Property<String>
|
||||
|
||||
@get:Input
|
||||
@get:Optional
|
||||
internal abstract val ownPackages: ListProperty<String>
|
||||
internal val inputFile
|
||||
get() = from.get().detailOutputFile
|
||||
|
||||
@TaskAction
|
||||
private fun printStats() {
|
||||
val artifactOrArchiveName = artifactOrArchiveName.get()
|
||||
inputFile.get().asFile.reader().useLines { lines ->
|
||||
val artifactOrArchiveName = from.get().artifactOrArchiveName
|
||||
inputFile.reader().useLines { lines ->
|
||||
fun String.getStatValue() = substringBefore("\t").trim()
|
||||
|
||||
val statsLineCount = if (!ownPackages.isPresent) 1 else 3
|
||||
val ownPackages = from.get().ownPackages
|
||||
val statsLineCount = if (ownPackages == null) 1 else 3
|
||||
val stats = lines.take(statsLineCount).map { it.getStatValue() }.toList()
|
||||
|
||||
val total = stats[0]
|
||||
@@ -129,7 +122,7 @@ abstract class DexMethodCountStats : DefaultTask() {
|
||||
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='$total']")
|
||||
}
|
||||
|
||||
ownPackages.map { packages ->
|
||||
ownPackages?.let { packages ->
|
||||
val totalOwnPackages = stats[1]
|
||||
val totalOtherPackages = stats[2]
|
||||
|
||||
@@ -148,9 +141,7 @@ abstract class DexMethodCountStats : DefaultTask() {
|
||||
fun Project.printStats(dexMethodCount: TaskProvider<DexMethodCount>) {
|
||||
val dexMethodCountStats = tasks.register("dexMethodCountStats", DexMethodCountStats::class.java) {
|
||||
dependsOn(dexMethodCount)
|
||||
inputFile.set(dexMethodCount.flatMap { objects.fileProperty().apply { set(it.detailOutputFile) } })
|
||||
artifactOrArchiveName.set(dexMethodCount.map { it.artifactOrArchiveName })
|
||||
ownPackages.set(dexMethodCount.flatMap { it.ownPackages })
|
||||
from = dexMethodCount
|
||||
}
|
||||
|
||||
dexMethodCount.configure {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
package plugins
|
||||
|
||||
import PublishToMavenLocalSerializable
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.attributes.Usage
|
||||
@@ -14,10 +13,10 @@ import org.gradle.api.plugins.JavaBasePlugin
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
|
||||
import org.gradle.api.publish.maven.tasks.PublishToMavenLocal
|
||||
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.plugins.signing.Sign
|
||||
import org.gradle.plugins.signing.SigningExtension
|
||||
import org.gradle.plugins.signing.SigningPlugin
|
||||
import java.util.*
|
||||
@@ -28,6 +27,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
|
||||
) : Plugin<Project> {
|
||||
override fun apply(target: Project): Unit = with(target) {
|
||||
apply<MavenPublishPlugin>()
|
||||
apply<SigningPlugin>()
|
||||
|
||||
val publishedRuntime = configurations.maybeCreate(RUNTIME_CONFIGURATION).apply {
|
||||
isCanBeConsumed = false
|
||||
@@ -68,7 +68,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
|
||||
|
||||
configure<PublishingExtension> {
|
||||
publications {
|
||||
create<MavenPublication>(project.mainPublicationName) {
|
||||
create<MavenPublication>(PUBLICATION_NAME) {
|
||||
from(kotlinLibraryComponent)
|
||||
|
||||
configureKotlinPomAttributes(project)
|
||||
@@ -79,26 +79,16 @@ class KotlinBuildPublishingPlugin @Inject constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val DEFAULT_MAIN_PUBLICATION_NAME = "Main"
|
||||
const val MAIN_PUBLICATION_NAME_PROPERTY = "MainPublicationName"
|
||||
const val PUBLICATION_NAME = "Main"
|
||||
const val REPOSITORY_NAME = "Maven"
|
||||
const val ADHOC_COMPONENT_NAME = "kotlinLibrary"
|
||||
|
||||
const val COMPILE_CONFIGURATION = "publishedCompile"
|
||||
const val RUNTIME_CONFIGURATION = "publishedRuntime"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var Project.mainPublicationName: String
|
||||
get() {
|
||||
return if (project.extra.has(KotlinBuildPublishingPlugin.MAIN_PUBLICATION_NAME_PROPERTY))
|
||||
project.extra.get(KotlinBuildPublishingPlugin.MAIN_PUBLICATION_NAME_PROPERTY) as String
|
||||
else KotlinBuildPublishingPlugin.DEFAULT_MAIN_PUBLICATION_NAME
|
||||
}
|
||||
set(value) {
|
||||
project.extra.set(KotlinBuildPublishingPlugin.MAIN_PUBLICATION_NAME_PROPERTY, value)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
private fun humanReadableName(name: String) =
|
||||
name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
|
||||
@@ -142,49 +132,31 @@ fun Project.configureDefaultPublishing() {
|
||||
}
|
||||
}
|
||||
|
||||
val signingRequired = project.providers.gradleProperty("signingRequired").forUseAtConfigurationTime().orNull?.toBoolean()
|
||||
?: project.providers.gradleProperty("isSonatypeRelease").forUseAtConfigurationTime().orNull?.toBoolean() ?: false
|
||||
|
||||
if (signingRequired) {
|
||||
apply<SigningPlugin>()
|
||||
configureSigning()
|
||||
}
|
||||
configureSigning()
|
||||
|
||||
tasks.register("install") {
|
||||
dependsOn(tasks.named("publishToMavenLocal"))
|
||||
}
|
||||
|
||||
// workaround for Gradle configuration cache
|
||||
// TODO: remove it when https://github.com/gradle/gradle/pull/16945 merged into used in build Gradle version
|
||||
tasks.withType(PublishToMavenLocal::class.java) {
|
||||
val originalTask = this
|
||||
val serializablePublishTask =
|
||||
tasks.register(originalTask.name + "Serializable", PublishToMavenLocalSerializable::class.java) {
|
||||
publication = originalTask.publication
|
||||
}
|
||||
originalTask.onlyIf { false }
|
||||
originalTask.dependsOn(serializablePublishTask)
|
||||
}
|
||||
|
||||
tasks.withType<PublishToMavenRepository>()
|
||||
.matching { it.name.endsWith("PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository") }
|
||||
.all { configureRepository() }
|
||||
}
|
||||
|
||||
private fun Project.configureSigning() {
|
||||
configure<SigningExtension> {
|
||||
sign(extensions.getByType<PublishingExtension>().publications) // all publications
|
||||
val signingRequired = provider {
|
||||
project.findProperty("signingRequired")?.toString()?.toBoolean()
|
||||
?: project.property("isSonatypeRelease") as Boolean
|
||||
}
|
||||
|
||||
val signKeyId = project.findProperty("signKeyId") as? String
|
||||
if (!signKeyId.isNullOrBlank()) {
|
||||
val signKeyPrivate = project.findProperty("signKeyPrivate") as? String
|
||||
?: error("Parameter `signKeyPrivate` not found")
|
||||
val signKeyPassphrase = project.findProperty("signKeyPassphrase") as? String
|
||||
?: error("Parameter `signKeyPassphrase` not found")
|
||||
useInMemoryPgpKeys(signKeyId, signKeyPrivate, signKeyPassphrase)
|
||||
} else {
|
||||
useGpgCmd()
|
||||
}
|
||||
configure<SigningExtension> {
|
||||
setRequired(signingRequired)
|
||||
sign(extensions.getByType<PublishingExtension>().publications) // all publications
|
||||
useGpgCmd()
|
||||
}
|
||||
|
||||
tasks.withType<Sign>().configureEach {
|
||||
setOnlyIf { signingRequired.get() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,4 +181,4 @@ private fun PublishToMavenRepository.configureRepository() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
173
buildSrc/src/main/kotlin/plugins/PublishedKotlinModule.kt
Normal file
173
buildSrc/src/main/kotlin/plugins/PublishedKotlinModule.kt
Normal file
@@ -0,0 +1,173 @@
|
||||
@file:Suppress("DEPRECATION")
|
||||
package plugins
|
||||
|
||||
import org.codehaus.groovy.runtime.InvokerHelper
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.artifacts.maven.Conf2ScopeMappingContainer
|
||||
import org.gradle.api.artifacts.maven.MavenDeployment
|
||||
import org.gradle.api.artifacts.maven.MavenResolver
|
||||
import org.gradle.api.plugins.MavenPluginConvention
|
||||
import org.gradle.api.plugins.MavenRepositoryHandlerConvention
|
||||
import org.gradle.api.publication.maven.internal.deployer.MavenRemoteRepository
|
||||
import org.gradle.api.tasks.Upload
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.plugins.signing.Sign
|
||||
import org.gradle.plugins.signing.SigningExtension
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
/**
|
||||
* Configures a Kotlin module for publication.
|
||||
*/
|
||||
open class PublishedKotlinModule : Plugin<Project> {
|
||||
|
||||
private fun String.toBooleanOrNull() = listOf(true, false).firstOrNull { it.toString().equals(this, ignoreCase = true) }
|
||||
|
||||
override fun apply(project: Project) {
|
||||
|
||||
project.run {
|
||||
|
||||
plugins.apply("maven")
|
||||
|
||||
configurations.maybeCreate("publishedRuntime").apply {
|
||||
the<MavenPluginConvention>()
|
||||
.conf2ScopeMappings
|
||||
.addMapping(0, this, Conf2ScopeMappingContainer.RUNTIME)
|
||||
}
|
||||
|
||||
configurations.maybeCreate("publishedCompile").apply {
|
||||
the<MavenPluginConvention>()
|
||||
.conf2ScopeMappings
|
||||
.addMapping(0, this, Conf2ScopeMappingContainer.COMPILE)
|
||||
}
|
||||
|
||||
if (!project.hasProperty("prebuiltJar")) {
|
||||
plugins.apply("signing")
|
||||
|
||||
val signingRequired = project.findProperty("signingRequired")?.toString()?.toBooleanOrNull()
|
||||
?: project.property("isSonatypeRelease") as Boolean
|
||||
|
||||
configure<SigningExtension> {
|
||||
isRequired = signingRequired
|
||||
sign(configurations["archives"])
|
||||
useGpgCmd()
|
||||
}
|
||||
|
||||
tasks.named<Sign>("signArchives").configure {
|
||||
enabled = signingRequired
|
||||
}
|
||||
}
|
||||
|
||||
fun MavenResolver.configurePom() {
|
||||
pom.project {
|
||||
withGroovyBuilder {
|
||||
"licenses" {
|
||||
"license" {
|
||||
"name"("The Apache Software License, Version 2.0")
|
||||
"url"("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||
"distribution"("repo")
|
||||
}
|
||||
}
|
||||
"name"("${project.group}:${project.name}")
|
||||
"packaging"("jar")
|
||||
// optionally artifactId can be defined here
|
||||
"description"(project.description)
|
||||
"url"("https://kotlinlang.org/")
|
||||
"licenses" {
|
||||
"license" {
|
||||
"name"("The Apache License, Version 2.0")
|
||||
"url"("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
||||
}
|
||||
}
|
||||
"scm" {
|
||||
"url"("https://github.com/JetBrains/kotlin")
|
||||
"connection"("scm:git:https://github.com/JetBrains/kotlin.git")
|
||||
"developerConnection"("scm:git:https://github.com/JetBrains/kotlin.git")
|
||||
}
|
||||
"developers" {
|
||||
"developer" {
|
||||
"name"("Kotlin Team")
|
||||
setProperty("organization", "JetBrains")
|
||||
"organizationUrl"("https://www.jetbrains.com")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pom.whenConfigured {
|
||||
dependencies.removeIf {
|
||||
InvokerHelper.getMetaClass(it).getProperty(it, "scope") == "test"
|
||||
}
|
||||
|
||||
dependencies
|
||||
.find {
|
||||
InvokerHelper.getMetaClass(it).getProperty(it, "groupId") == "org.jetbrains.kotlin"
|
||||
&& InvokerHelper.getMetaClass(it).getProperty(it, "artifactId") == "kotlin-stdlib"
|
||||
}
|
||||
?.also {
|
||||
InvokerHelper.getMetaClass(it).setProperty(it, "exclusions", emptyList<Any>())
|
||||
logger.warn("WARNING! Removed exclusions from kotlin-stdlib dependency of ${this.artifactId} artifact's maven metadata, check kotlin-stdlib dependency of ${project.path} project")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Upload>("uploadArchives").configure {
|
||||
|
||||
val preparePublication = project.rootProject.tasks.named("preparePublication").get()
|
||||
|
||||
dependsOn(preparePublication)
|
||||
|
||||
val username: String? by preparePublication.extra
|
||||
val password: String? by preparePublication.extra
|
||||
val repoUrl: String by preparePublication.extra
|
||||
|
||||
var repository by Delegates.notNull<MavenRemoteRepository>()
|
||||
|
||||
repositories {
|
||||
withConvention(MavenRepositoryHandlerConvention::class) {
|
||||
|
||||
mavenDeployer {
|
||||
withGroovyBuilder {
|
||||
"beforeDeployment" {
|
||||
val signing = project.the<SigningExtension>()
|
||||
if (signing.isRequired)
|
||||
signing.signPom(delegate as MavenDeployment)
|
||||
}
|
||||
|
||||
"repository"("url" to repoUrl)!!.also { repository = it as MavenRemoteRepository }.withGroovyBuilder {
|
||||
if (username != null && password != null) {
|
||||
"authentication"("userName" to username, "password" to password)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurePom()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doFirst {
|
||||
repository.url = repoUrl
|
||||
}
|
||||
}
|
||||
|
||||
val install = if (tasks.names.contains("install")) tasks.getByName("install") as Upload
|
||||
else tasks.create("install", Upload::class.java)
|
||||
install.apply {
|
||||
configuration = project.configurations.getByName(Dependency.ARCHIVES_CONFIGURATION)
|
||||
description = "Installs the 'archives' artifacts into the local Maven repository."
|
||||
repositories {
|
||||
withConvention(MavenRepositoryHandlerConvention::class) {
|
||||
mavenInstaller {
|
||||
configurePom()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("publish") {
|
||||
dependsOn(tasks.named("uploadArchives"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,25 +7,13 @@
|
||||
// usages in build scripts are not tracked properly
|
||||
@file:Suppress("unused")
|
||||
|
||||
import org.gradle.api.InvalidUserDataException
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter
|
||||
import org.gradle.api.publish.internal.PublishOperation
|
||||
import org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal
|
||||
import org.gradle.api.publish.maven.internal.publisher.MavenNormalizedPublication
|
||||
import org.gradle.api.publish.maven.internal.publisher.MavenPublisher
|
||||
import org.gradle.api.publish.maven.internal.publisher.ValidatingMavenPublisher
|
||||
import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.internal.serialization.Cached
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import org.gradle.kotlin.dsl.project
|
||||
import org.gradle.kotlin.dsl.support.serviceOf
|
||||
import java.io.File
|
||||
import java.lang.Character.isLowerCase
|
||||
import java.lang.Character.isUpperCase
|
||||
@@ -37,7 +25,6 @@ val kotlinGradlePluginAndItsRequired = arrayOf(
|
||||
":kotlin-noarg",
|
||||
":kotlin-sam-with-receiver",
|
||||
":kotlin-android-extensions",
|
||||
":kotlin-android-extensions-runtime",
|
||||
":kotlin-parcelize-compiler",
|
||||
":kotlin-build-common",
|
||||
":kotlin-compiler-embeddable",
|
||||
@@ -47,18 +34,15 @@ val kotlinGradlePluginAndItsRequired = arrayOf(
|
||||
":kotlin-compiler-runner",
|
||||
":kotlin-daemon-embeddable",
|
||||
":kotlin-daemon-client",
|
||||
":kotlin-project-model",
|
||||
":kotlin-gradle-plugin-api",
|
||||
":kotlin-gradle-plugin",
|
||||
":kotlin-gradle-plugin-model",
|
||||
":kotlin-tooling-metadata",
|
||||
":kotlin-reflect",
|
||||
":kotlin-annotation-processing-gradle",
|
||||
":kotlin-test",
|
||||
":kotlin-gradle-subplugin-example",
|
||||
":kotlin-stdlib-common",
|
||||
":kotlin-stdlib",
|
||||
":kotlin-stdlib-jdk7",
|
||||
":kotlin-stdlib-jdk8",
|
||||
":kotlin-stdlib-js",
|
||||
":examples:annotation-processor-example",
|
||||
@@ -67,11 +51,9 @@ val kotlinGradlePluginAndItsRequired = arrayOf(
|
||||
":kotlin-scripting-jvm",
|
||||
":kotlin-scripting-compiler-embeddable",
|
||||
":kotlin-scripting-compiler-impl-embeddable",
|
||||
":kotlin-serialization",
|
||||
":kotlin-test-js-runner",
|
||||
":native:kotlin-klib-commonizer-embeddable",
|
||||
":native:kotlin-klib-commonizer-api",
|
||||
":native:kotlin-native-utils"
|
||||
":native:kotlin-klib-commonizer-api"
|
||||
)
|
||||
|
||||
fun Task.dependsOnKotlinGradlePluginInstall() {
|
||||
@@ -98,139 +80,129 @@ fun Project.projectTest(
|
||||
shortenTempRootName: Boolean = false,
|
||||
jUnit5Enabled: Boolean = false,
|
||||
body: Test.() -> Unit = {}
|
||||
): TaskProvider<Test> {
|
||||
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
|
||||
.forUseAtConfigurationTime().orNull?.toBoolean() != true
|
||||
if (shouldInstrument) {
|
||||
evaluationDependsOn(":test-instrumenter")
|
||||
}
|
||||
return getOrCreateTask<Test>(taskName) {
|
||||
doFirst {
|
||||
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
|
||||
val patterns = filter.includePatterns + commandLineIncludePatterns
|
||||
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
|
||||
patterns.forEach { pattern ->
|
||||
var isClassPattern = false
|
||||
val maybeMethodName = pattern.substringAfterLast('.')
|
||||
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
|
||||
pattern.substringBeforeLast('.')
|
||||
): TaskProvider<Test> = getOrCreateTask(taskName) {
|
||||
doFirst {
|
||||
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
|
||||
val patterns = filter.includePatterns + commandLineIncludePatterns
|
||||
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
|
||||
patterns.forEach { pattern ->
|
||||
var isClassPattern = false
|
||||
val maybeMethodName = pattern.substringAfterLast('.')
|
||||
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
|
||||
pattern.substringBeforeLast('.')
|
||||
} else {
|
||||
isClassPattern = true
|
||||
pattern
|
||||
}
|
||||
|
||||
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
|
||||
return@forEach
|
||||
}
|
||||
|
||||
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
|
||||
val classFileName = "$classFileNameWithoutExtension.class"
|
||||
|
||||
if (isClassPattern) {
|
||||
val innerClassPattern = "$pattern$*"
|
||||
if (pattern in commandLineIncludePatterns) {
|
||||
commandLineIncludePatterns.add(innerClassPattern)
|
||||
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
|
||||
} else {
|
||||
isClassPattern = true
|
||||
pattern
|
||||
filter.includePatterns.add(innerClassPattern)
|
||||
}
|
||||
}
|
||||
|
||||
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
|
||||
return@forEach
|
||||
}
|
||||
|
||||
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
|
||||
val classFileName = "$classFileNameWithoutExtension.class"
|
||||
|
||||
if (isClassPattern) {
|
||||
val innerClassPattern = "$pattern$*"
|
||||
if (pattern in commandLineIncludePatterns) {
|
||||
commandLineIncludePatterns.add(innerClassPattern)
|
||||
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
|
||||
} else {
|
||||
filter.includePatterns.add(innerClassPattern)
|
||||
val parentNames = if (jUnit5Enabled) {
|
||||
/*
|
||||
* If we run test from inner test class with junit 5 we need
|
||||
* to include all containing classes of our class
|
||||
*/
|
||||
val nestedNames = classFileNameWithoutExtension.split("$")
|
||||
mutableListOf(nestedNames.first()).also {
|
||||
for (s in nestedNames.subList(1, nestedNames.size)) {
|
||||
it += "${it.last()}\$$s"
|
||||
}
|
||||
}
|
||||
} else emptyList()
|
||||
|
||||
val parentNames = if (jUnit5Enabled) {
|
||||
/*
|
||||
* If we run test from inner test class with junit 5 we need
|
||||
* to include all containing classes of our class
|
||||
*/
|
||||
val nestedNames = classFileNameWithoutExtension.split("$")
|
||||
mutableListOf(nestedNames.first()).also {
|
||||
for (s in nestedNames.subList(1, nestedNames.size)) {
|
||||
it += "${it.last()}\$$s"
|
||||
}
|
||||
}
|
||||
} else emptyList()
|
||||
|
||||
include { treeElement ->
|
||||
val path = treeElement.path
|
||||
if (treeElement.isDirectory) {
|
||||
classFileNameWithoutExtension.startsWith(path)
|
||||
include { treeElement ->
|
||||
val path = treeElement.path
|
||||
if (treeElement.isDirectory) {
|
||||
classFileNameWithoutExtension.startsWith(path)
|
||||
} else {
|
||||
if (jUnit5Enabled) {
|
||||
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
|
||||
} else {
|
||||
if (jUnit5Enabled) {
|
||||
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
|
||||
} else {
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
|
||||
}
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldInstrument) {
|
||||
val instrumentationArgsProperty = project.providers.gradleProperty("kotlin.test.instrumentation.args")
|
||||
val testInstrumenterOutputs = project.tasks.findByPath(":test-instrumenter:jar")!!.outputs.files
|
||||
doFirst {
|
||||
val agent = testInstrumenterOutputs.singleFile
|
||||
val args = instrumentationArgsProperty.orNull?.let { "=$it" }.orEmpty()
|
||||
jvmArgs("-javaagent:$agent$args")
|
||||
}
|
||||
dependsOn(":test-instrumenter:jar")
|
||||
}
|
||||
|
||||
jvmArgs(
|
||||
"-ea",
|
||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
||||
"-XX:+UseCodeCacheFlushing",
|
||||
"-XX:ReservedCodeCacheSize=256m",
|
||||
"-Djna.nosys=true"
|
||||
)
|
||||
|
||||
maxHeapSize = "1600m"
|
||||
systemProperty("idea.is.unit.test", "true")
|
||||
systemProperty("idea.home.path", project.intellijRootDir().canonicalPath)
|
||||
systemProperty("java.awt.headless", "true")
|
||||
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
|
||||
environment("PROJECT_CLASSES_DIRS", project.testSourceSet.output.classesDirs.asPath)
|
||||
environment("PROJECT_BUILD_DIR", project.buildDir)
|
||||
systemProperty("jps.kotlin.home", project.rootProject.extra["distKotlinHomeDir"]!!)
|
||||
systemProperty("kotlin.ni", if (project.rootProject.hasProperty("newInferenceTests")) "true" else "false")
|
||||
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (project.rootProject.hasProperty("skipMutedTests")) "true" else "false")
|
||||
|
||||
systemProperty("idea.ignore.disabled.plugins", "true")
|
||||
|
||||
var subProjectTempRoot: Path? = null
|
||||
val projectName = project.name
|
||||
val teamcity = project.rootProject.findProperty("teamcity") as? Map<*, *>
|
||||
if (project.findProperty("kotlin.test.instrumentation.disable")?.toString()?.toBoolean() != true) {
|
||||
doFirst {
|
||||
val systemTempRoot =
|
||||
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
|
||||
// Should be fixed soon on Teamcity side
|
||||
(teamcity?.get("teamcity.build.tempDir") as? String)
|
||||
?: System.getProperty("java.io.tmpdir")
|
||||
systemTempRoot.let {
|
||||
val prefix = (projectName + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
|
||||
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
|
||||
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
|
||||
val agent = tasks.findByPath(":test-instrumenter:jar")!!.outputs.files.singleFile
|
||||
val args = project.findProperty("kotlin.test.instrumentation.args")?.let { "=$it" }.orEmpty()
|
||||
jvmArgs("-javaagent:$agent$args")
|
||||
}
|
||||
dependsOn(":test-instrumenter:jar")
|
||||
}
|
||||
|
||||
jvmArgs(
|
||||
"-ea",
|
||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
||||
"-XX:+UseCodeCacheFlushing",
|
||||
"-XX:ReservedCodeCacheSize=256m",
|
||||
"-Djna.nosys=true"
|
||||
)
|
||||
|
||||
maxHeapSize = "1600m"
|
||||
systemProperty("idea.is.unit.test", "true")
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
systemProperty("java.awt.headless", "true")
|
||||
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
|
||||
environment("PROJECT_CLASSES_DIRS", testSourceSet.output.classesDirs.asPath)
|
||||
environment("PROJECT_BUILD_DIR", buildDir)
|
||||
systemProperty("jps.kotlin.home", rootProject.extra["distKotlinHomeDir"]!!)
|
||||
systemProperty("kotlin.ni", if (rootProject.hasProperty("newInferenceTests")) "true" else "false")
|
||||
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (rootProject.hasProperty("skipMutedTests")) "true" else "false")
|
||||
|
||||
if (Platform[202].orHigher()) {
|
||||
systemProperty("idea.ignore.disabled.plugins", "true")
|
||||
}
|
||||
|
||||
var subProjectTempRoot: Path? = null
|
||||
doFirst {
|
||||
val teamcity = rootProject.findProperty("teamcity") as? Map<*, *>
|
||||
val systemTempRoot =
|
||||
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
|
||||
// Should be fixed soon on Teamcity side
|
||||
(teamcity?.get("teamcity.build.tempDir") as? String)
|
||||
?: System.getProperty("java.io.tmpdir")
|
||||
systemTempRoot.let {
|
||||
val prefix = (project.name + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
|
||||
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
|
||||
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
|
||||
}
|
||||
}
|
||||
|
||||
doLast {
|
||||
subProjectTempRoot?.let {
|
||||
try {
|
||||
delete(it)
|
||||
} catch (e: Exception) {
|
||||
project.logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val fs = project.serviceOf<FileSystemOperations>()
|
||||
doLast {
|
||||
subProjectTempRoot?.let {
|
||||
try {
|
||||
fs.delete {
|
||||
delete(it)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parallel && !jUnit5Enabled) {
|
||||
maxParallelForks =
|
||||
project.providers.gradleProperty("kotlin.test.maxParallelForks").forUseAtConfigurationTime().orNull?.toInt()
|
||||
?: (Runtime.getRuntime().availableProcessors() / if (project.kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
|
||||
}
|
||||
}.apply { configure(body) }
|
||||
if (parallel && !jUnit5Enabled) {
|
||||
maxParallelForks =
|
||||
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
|
||||
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
|
||||
}
|
||||
body()
|
||||
}
|
||||
|
||||
private inline fun String.isFirstChar(f: (Char) -> Boolean) = isNotEmpty() && f(first())
|
||||
@@ -257,25 +229,18 @@ private fun Task.useAndroidConfiguration(systemPropertyName: String, configName:
|
||||
val configuration = with(project) {
|
||||
configurations.getOrCreate(configName)
|
||||
.also {
|
||||
if (it.allDependencies.matching { dep ->
|
||||
dep is ProjectDependency &&
|
||||
dep.targetConfiguration == configName &&
|
||||
dep.dependencyProject.path == ":dependencies:android-sdk"
|
||||
}.count() == 0) {
|
||||
dependencies.add(
|
||||
configName,
|
||||
dependencies.project(":dependencies:android-sdk", configuration = configName)
|
||||
)
|
||||
}
|
||||
dependencies.add(
|
||||
configName,
|
||||
dependencies.project(":dependencies:android-sdk", configuration = configName)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
dependsOn(configuration)
|
||||
|
||||
if (this is Test) {
|
||||
val androidFilePath = configuration.singleFile.canonicalPath
|
||||
doFirst {
|
||||
systemProperty(systemPropertyName, androidFilePath)
|
||||
systemProperty(systemPropertyName, configuration.singleFile.canonicalPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,30 +252,3 @@ fun Task.useAndroidSdk() {
|
||||
fun Task.useAndroidJar() {
|
||||
TaskUtils.useAndroidJar(this)
|
||||
}
|
||||
|
||||
// Workaround to make PublishToMavenLocal compatible with Gradle configuration cache
|
||||
// TODO: remove it when https://github.com/gradle/gradle/pull/16945 merged into used in build Gradle version
|
||||
abstract class PublishToMavenLocalSerializable : AbstractPublishToMaven() {
|
||||
private val normalizedPublication = Cached.of { this.computeNormalizedPublication() }
|
||||
|
||||
private fun computeNormalizedPublication(): MavenNormalizedPublication {
|
||||
val publicationInternal: MavenPublicationInternal = publicationInternal
|
||||
?: throw InvalidUserDataException("The 'publication' property is required")
|
||||
duplicatePublicationTracker.checkCanPublishToMavenLocal(publicationInternal)
|
||||
return publicationInternal.asNormalisedPublication()
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
open fun publish() {
|
||||
val normalizedPublication = normalizedPublication.get()
|
||||
object : PublishOperation(normalizedPublication.name, "mavenLocal") {
|
||||
override fun publish() {
|
||||
val localPublisher = mavenPublishers.getLocalPublisher(
|
||||
temporaryDirFactory
|
||||
)
|
||||
val validatingPublisher: MavenPublisher = ValidatingMavenPublisher(localPublisher)
|
||||
validatingPublisher.publish(normalizedPublication, null)
|
||||
}
|
||||
}.run()
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
|
||||
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
|
||||
val testDistributionEnabled =
|
||||
project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean() ?: false
|
||||
val testDistributionEnabled = project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean()
|
||||
?: isTeamcityBuild
|
||||
|
||||
useJUnitPlatform()
|
||||
extensions.configure(TestDistributionExtension::class.java) {
|
||||
|
||||
@@ -24,17 +24,24 @@ dependencies {
|
||||
testApi(projectTests(":compiler:tests-compiler-utils"))
|
||||
testApi(projectTests(":compiler:tests-common-new"))
|
||||
|
||||
testCompile(projectTests(":jps-plugin"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
|
||||
testCompile(intellijDep()) { includeJars("util", "idea", "idea_rt", rootProject = rootProject) }
|
||||
testCompile(intellijDep()) { includeJars("groovy", rootProject = rootProject) }
|
||||
Platform[193].orLower {
|
||||
testCompile(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
|
||||
}
|
||||
|
||||
testCompile(intellijDep()) { includeJars("util", "idea", "idea_rt", rootProject = rootProject) }
|
||||
Platform[202].orHigher {
|
||||
testCompile(intellijDep()) { includeJars("groovy", rootProject = rootProject) }
|
||||
}
|
||||
Platform[201].orLower {
|
||||
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) }
|
||||
}
|
||||
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
|
||||
testCompile(jpsStandalone()) { includeJars("jps-model") }
|
||||
testCompile(jpsBuildTest())
|
||||
|
||||
testRuntimeOnly(compile(intellijCoreDep()) { includeJars("intellij-core") })
|
||||
|
||||
testCompile("org.junit.platform:junit-platform-launcher:${commonVer("org.junit.platform", "")}")
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
|
||||
private fun getFlavorUnitTestFolder(flavourName: String): String {
|
||||
return pathManager.srcFolderInAndroidTmpFolder +
|
||||
"/androidTest${flavourName.replaceFirstChar(Char::uppercaseChar)}/java/" +
|
||||
"/androidTest${flavourName.capitalize()}/java/" +
|
||||
testClassPackage.replace(".", "/") + "/"
|
||||
}
|
||||
|
||||
@@ -354,8 +354,8 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
extractor.provideConfigurationKeys()
|
||||
extractor.configure(keyConfiguration, module.directives)
|
||||
}
|
||||
val kind = JvmEnvironmentConfigurator.extractConfigurationKind(module.directives)
|
||||
val jdkKind = JvmEnvironmentConfigurator.extractJdkKind(module.directives)
|
||||
val kind = configuratorForFlags.extractConfigurationKind(module.directives)
|
||||
val jdkKind = configuratorForFlags.extractJdkKind(module.directives)
|
||||
|
||||
keyConfiguration.languageVersionSettings = module.languageVersionSettings
|
||||
|
||||
@@ -379,7 +379,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
configure(backend)
|
||||
testInfo = KotlinTestInfo(
|
||||
"org.jetbrains.kotlin.android.tests.AndroidRunner",
|
||||
"test${testDataFile.nameWithoutExtension.replaceFirstChar(Char::uppercaseChar)}",
|
||||
"test${testDataFile.nameWithoutExtension.capitalize()}",
|
||||
emptySet()
|
||||
)
|
||||
}.build(testDataFile.path)
|
||||
|
||||
@@ -27,7 +27,7 @@ class UnitTestFileWriter(
|
||||
}
|
||||
|
||||
fun generate() {
|
||||
FileWriter(File(flavourFolder, flavourName.replaceFirstChar(Char::uppercaseChar) + ".java").also { it.parentFile.mkdirs() }).use { suite ->
|
||||
FileWriter(File(flavourFolder, flavourName.capitalize() + ".java").also { it.parentFile.mkdirs() }).use { suite ->
|
||||
val p = Printer(suite)
|
||||
p.println(
|
||||
"""package ${CodegenTestsOnAndroidGenerator.testClassPackage};
|
||||
@@ -35,7 +35,7 @@ class UnitTestFileWriter(
|
||||
|import ${CodegenTestsOnAndroidGenerator.baseTestClassPackage}.${CodegenTestsOnAndroidGenerator.baseTestClassName};
|
||||
|
|
||||
|/* This class is generated by ${CodegenTestsOnAndroidGenerator.generatorName}. DO NOT MODIFY MANUALLY */
|
||||
|public class ${flavourName.replaceFirstChar(Char::uppercaseChar)} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
||||
|public class ${flavourName.capitalize()} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
||||
|
|
||||
""".trimMargin()
|
||||
)
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* 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.backend.common
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
|
||||
import org.jetbrains.kotlin.resolve.sam.getAbstractMembers
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class SamType constructor(val type: KotlinType) {
|
||||
|
||||
val classDescriptor: ClassDescriptor
|
||||
get() = type.constructor.declarationDescriptor as? ClassDescriptor ?: error("Sam/Fun interface not a class descriptor: $type")
|
||||
|
||||
val kotlinFunctionType: KotlinType
|
||||
get() = classDescriptor.defaultFunctionTypeForSamInterface!!
|
||||
|
||||
val originalAbstractMethod: SimpleFunctionDescriptor
|
||||
get() = getAbstractMembers(classDescriptor)[0] as SimpleFunctionDescriptor
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return other is SamType && type == other.type
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return type.hashCode()
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "SamType($type)"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* 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.backend.common
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.checker.intersectWrappedTypes
|
||||
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithNothing
|
||||
|
||||
class SamTypeApproximator(builtIns: KotlinBuiltIns, languageVersionSettings: LanguageVersionSettings) {
|
||||
private val typeApproximator = TypeApproximator(builtIns, languageVersionSettings)
|
||||
|
||||
fun getSamTypeForValueParameter(valueParameter: ValueParameterDescriptor): KotlinType? {
|
||||
val singleArgumentType: KotlinType
|
||||
val originalSingleArgumentType: KotlinType?
|
||||
val varargElementType = valueParameter.varargElementType
|
||||
if (varargElementType != null) {
|
||||
singleArgumentType = varargElementType
|
||||
originalSingleArgumentType = valueParameter.original.varargElementType
|
||||
assert(originalSingleArgumentType != null) {
|
||||
"Value parameter and original value parameter have inconsistent varargs: " +
|
||||
valueParameter + "; " + valueParameter.original
|
||||
}
|
||||
} else {
|
||||
singleArgumentType = valueParameter.type
|
||||
originalSingleArgumentType = valueParameter.original.type
|
||||
}
|
||||
if (singleArgumentType.isError || originalSingleArgumentType!!.isError) {
|
||||
return null
|
||||
}
|
||||
|
||||
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
|
||||
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
|
||||
// (see testData genericSamProjectedOut.kt for details)
|
||||
// In such a case we can't have a proper supertype since wildcards are not allowed there,
|
||||
// so we use Nothing arguments instead that leads to a raw type used for a SAM wrapper.
|
||||
// See org.jetbrains.kotlin.codegen.state.KotlinTypeMapper#writeGenericType to understand how
|
||||
// raw types and Nothing arguments relate.
|
||||
val originalTypeToUse =
|
||||
if (KotlinBuiltIns.isNothing(singleArgumentType))
|
||||
originalSingleArgumentType.replaceArgumentsWithNothing()
|
||||
else
|
||||
singleArgumentType
|
||||
val approximatedOriginalTypeToUse =
|
||||
typeApproximator.approximateToSubType(
|
||||
originalTypeToUse,
|
||||
TypeApproximatorConfiguration.UpperBoundAwareIntersectionTypeApproximator
|
||||
) ?: originalTypeToUse
|
||||
approximatedOriginalTypeToUse as KotlinType
|
||||
|
||||
return approximatedOriginalTypeToUse.removeExternalProjections()
|
||||
}
|
||||
|
||||
private fun KotlinType.removeExternalProjections(): KotlinType {
|
||||
val newArguments = arguments.map { TypeProjectionImpl(Variance.INVARIANT, it.type) }
|
||||
return replace(newArguments)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class SamTypeFactory {
|
||||
open fun isSamType(type: KotlinType): Boolean {
|
||||
val descriptor = type.constructor.declarationDescriptor
|
||||
return descriptor is ClassDescriptor && descriptor.isFun
|
||||
}
|
||||
|
||||
fun create(originalType: KotlinType): SamType? {
|
||||
return if (isSamType(originalType)) SamType(originalType) else null
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ fun mangleNameIfNeeded(name: String): String {
|
||||
if (c.isValidCharacter()) {
|
||||
append(c)
|
||||
} else {
|
||||
val hexString = Integer.toHexString(c.code)
|
||||
val hexString = Integer.toHexString(c.toInt())
|
||||
assert(hexString.length <= 4)
|
||||
append("_u").append(hexString)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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 org.jetbrains.org.objectweb.asm.Opcodes
|
||||
|
||||
// This object should help compiling against different ASM versions from different bunch versions
|
||||
object VersionIndependentOpcodes {
|
||||
const val ACC_RECORD = 0
|
||||
}
|
||||
@@ -18,10 +18,7 @@ interface TypeMappingContext<Writer : JvmDescriptorTypeWriter<Type>> {
|
||||
val typeContext: TypeSystemCommonBackendContextForTypeMapping
|
||||
|
||||
fun getClassInternalName(typeConstructor: TypeConstructorMarker): String
|
||||
fun getScriptInternalName(typeConstructor: TypeConstructorMarker): String
|
||||
|
||||
// NB: The counterpart, [KotlinTypeMapper#writeGenericType], doesn't have restriction on [type]
|
||||
fun Writer.writeGenericType(type: KotlinTypeMarker, asmType: Type, mode: TypeMappingMode)
|
||||
fun Writer.writeGenericType(type: SimpleTypeMarker, asmType: Type, mode: TypeMappingMode)
|
||||
}
|
||||
|
||||
object AbstractTypeMapper {
|
||||
@@ -46,7 +43,6 @@ object AbstractTypeMapper {
|
||||
sw: Writer? = null
|
||||
): Type = context.typeContext.mapType(context, type, mode, sw)
|
||||
|
||||
// NB: The counterpart, [descriptorBasedTypeSignatureMapping#mapType] doesn't have restriction on [type].
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
private fun <Writer : JvmDescriptorTypeWriter<Type>> TypeSystemCommonBackendContextForTypeMapping.mapType(
|
||||
context: TypeMappingContext<Writer>,
|
||||
@@ -54,7 +50,10 @@ object AbstractTypeMapper {
|
||||
mode: TypeMappingMode = TypeMappingMode.DEFAULT,
|
||||
sw: Writer? = null
|
||||
): Type {
|
||||
if (type is SimpleTypeMarker && type.isSuspendFunction()) {
|
||||
if (type !is SimpleTypeMarker) {
|
||||
error("Unexpected type: $type (original Kotlin type=$type of ${type.let { it::class }})")
|
||||
}
|
||||
if (type.isSuspendFunction()) {
|
||||
val argumentsCount = type.argumentsCount()
|
||||
val argumentsList = type.asArgumentList()
|
||||
|
||||
@@ -79,7 +78,7 @@ object AbstractTypeMapper {
|
||||
val typeConstructor = type.typeConstructor()
|
||||
|
||||
when {
|
||||
type is SimpleTypeMarker && type.isArrayOrNullableArray() -> {
|
||||
type.isArrayOrNullableArray() -> {
|
||||
val typeArgument = type.asArgumentList()[0]
|
||||
val (variance, memberType) = when {
|
||||
typeArgument.isStarProjection() -> Variance.OUT_VARIANCE to nullableAnyType()
|
||||
@@ -99,7 +98,7 @@ object AbstractTypeMapper {
|
||||
return AsmUtil.getArrayType(arrayElementType)
|
||||
}
|
||||
|
||||
type is SimpleTypeMarker && typeConstructor.isClassTypeConstructor() -> {
|
||||
typeConstructor.isClassTypeConstructor() -> {
|
||||
if (typeConstructor.isInlineClass() && !mode.needInlineClassWrapping) {
|
||||
val expandedType = computeExpandedTypeForInlineClass(type)
|
||||
require(expandedType is SimpleTypeMarker?)
|
||||
@@ -117,10 +116,6 @@ object AbstractTypeMapper {
|
||||
return asmType
|
||||
}
|
||||
|
||||
typeConstructor.isScript() -> {
|
||||
return Type.getObjectType(context.getScriptInternalName(typeConstructor))
|
||||
}
|
||||
|
||||
typeConstructor.isTypeParameter() -> {
|
||||
val typeParameter = typeConstructor as TypeParameterMarker
|
||||
return mapType(context, typeParameter.representativeUpperBound(), mode, null).also { asmType ->
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.inline.FileMapping;
|
||||
import org.jetbrains.kotlin.codegen.inline.SMAPBuilder;
|
||||
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP;
|
||||
|
||||
public abstract class AbstractClassBuilder implements ClassBuilder {
|
||||
protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {};
|
||||
protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {};
|
||||
|
||||
private String thisName;
|
||||
|
||||
private final JvmSerializationBindings serializationBindings = new JvmSerializationBindings();
|
||||
|
||||
private String sourceName;
|
||||
|
||||
private String debugInfo;
|
||||
|
||||
public static class Concrete extends AbstractClassBuilder {
|
||||
private final ClassVisitor v;
|
||||
|
||||
public Concrete(@NotNull ClassVisitor v) {
|
||||
this.v = v;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ClassVisitor getVisitor() {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FieldVisitor newField(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable Object value
|
||||
) {
|
||||
FieldVisitor visitor = getVisitor().visitField(access, name, desc, signature, value);
|
||||
if (visitor == null) {
|
||||
return EMPTY_FIELD_VISITOR;
|
||||
}
|
||||
return visitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public MethodVisitor newMethod(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable String[] exceptions
|
||||
) {
|
||||
MethodVisitor visitor = getVisitor().visitMethod(access, name, desc, signature, exceptions);
|
||||
if (visitor == null) {
|
||||
return EMPTY_METHOD_VISITOR;
|
||||
}
|
||||
return visitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public JvmSerializationBindings getSerializationBindings() {
|
||||
return serializationBindings;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) {
|
||||
return getVisitor().visitAnnotation(desc, visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void done() {
|
||||
getVisitor().visitSource(sourceName, debugInfo);
|
||||
getVisitor().visitEnd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defineClass(
|
||||
@Nullable PsiElement origin,
|
||||
int version,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@Nullable String signature,
|
||||
@NotNull String superName,
|
||||
@NotNull String[] interfaces
|
||||
) {
|
||||
thisName = name;
|
||||
getVisitor().visit(version, access, name, signature, superName, interfaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSource(@NotNull String name, @Nullable String debug) {
|
||||
assert sourceName == null || sourceName.equals(name) : "inconsistent file name: " + sourceName + " vs " + name;
|
||||
sourceName = name;
|
||||
debugInfo = debug;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) {
|
||||
if (!GENERATE_SMAP) return;
|
||||
|
||||
List<FileMapping> fileMappings = smap.getResultMappings();
|
||||
if (fileMappings.isEmpty()) return;
|
||||
|
||||
visitSource(fileMappings.get(0).getName(), SMAPBuilder.INSTANCE.build(fileMappings, backwardsCompatibleSyntax));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) {
|
||||
getVisitor().visitOuterClass(owner, name, desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) {
|
||||
getVisitor().visitInnerClass(name, outerName, innerName, access);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getThisName() {
|
||||
assert thisName != null : "This name isn't set";
|
||||
return thisName;
|
||||
}
|
||||
}
|
||||
@@ -34,10 +34,10 @@ import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.AnnotationChecker;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker;
|
||||
import org.jetbrains.kotlin.resolve.constants.*;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.OptionalAnnotationUtil;
|
||||
import org.jetbrains.kotlin.types.FlexibleType;
|
||||
import org.jetbrains.kotlin.types.FlexibleTypesKt;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
@@ -376,7 +376,7 @@ public abstract class AnnotationCodegen {
|
||||
// We do not generate annotations whose classes are optional (annotated with `@OptionalExpectation`) because if an annotation entry
|
||||
// is resolved to the expected declaration, this means that annotation has no actual class, and thus should not be generated.
|
||||
// (Otherwise we would've resolved the entry to the actual annotation class.)
|
||||
if (OptionalAnnotationUtil.isOptionalAnnotationClass(classDescriptor)) {
|
||||
if (ExpectedActualDeclarationChecker.isOptionalAnnotationClass(classDescriptor)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,12 +20,14 @@ import org.jetbrains.kotlin.codegen.inline.NameGenerator
|
||||
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner.Companion.putReifiedOperationMarker
|
||||
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner.OperationKind
|
||||
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeParametersUsages
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.types.TypeSystemCommonBackendContext
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
|
||||
import org.jetbrains.kotlin.types.model.TypeParameterMarker
|
||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
||||
|
||||
interface BaseExpressionCodegen {
|
||||
|
||||
val frameMap: FrameMapBase<*>
|
||||
|
||||
val visitor: InstructionAdapter
|
||||
@@ -38,14 +40,25 @@ interface BaseExpressionCodegen {
|
||||
|
||||
fun propagateChildReifiedTypeParametersUsages(reifiedTypeParametersUsages: ReifiedTypeParametersUsages)
|
||||
|
||||
fun pushClosureOnStack(
|
||||
classDescriptor: ClassDescriptor,
|
||||
putThis: Boolean,
|
||||
callGenerator: CallGenerator,
|
||||
functionReferenceReceiver: StackValue?
|
||||
)
|
||||
|
||||
fun markLineNumberAfterInlineIfNeeded(registerLineNumberAfterwards: Boolean)
|
||||
|
||||
fun consumeReifiedOperationMarker(typeParameter: TypeParameterMarker)
|
||||
}
|
||||
|
||||
fun BaseExpressionCodegen.putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind): Boolean {
|
||||
val (typeParameter, second) = typeSystem.extractReificationArgument(type) ?: return false
|
||||
consumeReifiedOperationMarker(typeParameter)
|
||||
putReifiedOperationMarker(operationKind, second, visitor)
|
||||
return true
|
||||
@JvmDefault
|
||||
fun putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind) {
|
||||
with(typeSystem) {
|
||||
val (typeParameter, second) = extractReificationArgument(type) ?: return
|
||||
if (typeParameter.isReified()) {
|
||||
consumeReifiedOperationMarker(typeParameter)
|
||||
putReifiedOperationMarker(operationKind, second, visitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ enum class ValueKind {
|
||||
DEFAULT_MASK,
|
||||
METHOD_HANDLE_IN_DEFAULT,
|
||||
CAPTURED,
|
||||
DEFAULT_LAMBDA_CAPTURED_PARAMETER,
|
||||
NON_INLINEABLE_ARGUMENT_FOR_INLINE_PARAMETER_CALLED_IN_SUSPEND,
|
||||
NON_INLINEABLE_ARGUMENT_FOR_INLINE_SUSPEND_PARAMETER
|
||||
}
|
||||
@@ -39,9 +40,13 @@ interface CallGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
override fun processHiddenParameters() {}
|
||||
override fun processAndPutHiddenParameters(justProcess: Boolean) {
|
||||
|
||||
override fun putHiddenParamsIntoLocals() {}
|
||||
}
|
||||
|
||||
override fun putHiddenParamsIntoLocals() {
|
||||
|
||||
}
|
||||
|
||||
override fun genValueAndPut(
|
||||
valueParameterDescriptor: ValueParameterDescriptor?,
|
||||
@@ -136,8 +141,9 @@ interface CallGenerator {
|
||||
paramIndex: Int
|
||||
)
|
||||
|
||||
fun processHiddenParameters()
|
||||
fun processAndPutHiddenParameters(justProcess: Boolean)
|
||||
|
||||
/*should be called if justProcess = true in processAndPutHiddenParameters*/
|
||||
fun putHiddenParamsIntoLocals()
|
||||
|
||||
fun reorderArgumentsIfNeeded(actualArgsWithDeclIndex: List<ArgumentAndDeclIndex>, valueParameterTypes: List<Type>)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.codegen.state.StaticTypeMapperForOldBackend
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
||||
@@ -52,7 +51,7 @@ class CallableMethod(
|
||||
|
||||
override fun genInvokeInstruction(v: InstructionAdapter) {
|
||||
if (boxInlineClassBeforeInvoke) {
|
||||
StackValue.boxInlineClass(dispatchReceiverKotlinType!!, v, StaticTypeMapperForOldBackend)
|
||||
StackValue.boxInlineClass(dispatchReceiverKotlinType!!, v)
|
||||
}
|
||||
v.visitMethodInsn(
|
||||
invokeOpcode,
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
|
||||
public interface ClassBuilder {
|
||||
@NotNull
|
||||
FieldVisitor newField(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable Object value
|
||||
);
|
||||
|
||||
@NotNull
|
||||
MethodVisitor newMethod(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable String[] exceptions
|
||||
);
|
||||
|
||||
@NotNull
|
||||
JvmSerializationBindings getSerializationBindings();
|
||||
|
||||
@NotNull
|
||||
AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible);
|
||||
|
||||
void done();
|
||||
|
||||
@NotNull
|
||||
ClassVisitor getVisitor();
|
||||
|
||||
void defineClass(
|
||||
@Nullable PsiElement origin,
|
||||
int version,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@Nullable String signature,
|
||||
@NotNull String superName,
|
||||
@NotNull String[] interfaces
|
||||
);
|
||||
|
||||
void visitSource(@NotNull String name, @Nullable String debug);
|
||||
|
||||
void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax);
|
||||
|
||||
void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc);
|
||||
|
||||
void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access);
|
||||
|
||||
@NotNull
|
||||
String getThisName();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
@Suppress("UNUSED_PARAMETER", "unused")
|
||||
fun ClassBuilder.addRecordComponent(name: String, desc: String, signature: String?) {
|
||||
// newRecordComponent(name, desc, signature)
|
||||
}
|
||||
@@ -52,14 +52,13 @@ import org.jetbrains.org.objectweb.asm.Type;
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.getMappingFileName;
|
||||
|
||||
public class ClassFileFactory implements OutputFileCollection {
|
||||
private final GenerationState state;
|
||||
private final ClassBuilderFactory builderFactory;
|
||||
private final Map<String, OutAndSourceFileList> generators = Collections.synchronizedMap(new LinkedHashMap<>());
|
||||
private final Map<String, OutAndSourceFileList> generators = new LinkedHashMap<>();
|
||||
|
||||
private boolean isDone = false;
|
||||
|
||||
@@ -347,9 +346,7 @@ public class ClassFileFactory implements OutputFileCollection {
|
||||
|
||||
@Override
|
||||
public byte[] asBytes(ClassBuilderFactory factory) {
|
||||
synchronized(this) {
|
||||
return factory.asBytes(classBuilder);
|
||||
}
|
||||
return factory.asBytes(classBuilder);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,6 @@ import kotlin.Unit;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.SamType;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure;
|
||||
import org.jetbrains.kotlin.codegen.context.ClosureContext;
|
||||
@@ -32,6 +31,7 @@ import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader;
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf;
|
||||
import org.jetbrains.kotlin.psi.KtElement;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
|
||||
@@ -40,7 +40,6 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.TransientReceiver;
|
||||
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.SimpleType;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
@@ -158,14 +157,7 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
||||
for (int i = 0; i < superInterfaceTypes.size(); i++) {
|
||||
KotlinType superInterfaceType = superInterfaceTypes.get(i);
|
||||
sw.writeInterface();
|
||||
Type superInterfaceAsmType;
|
||||
if (samType != null && superInterfaceType.getConstructor() == samType.getType().getConstructor()) {
|
||||
superInterfaceAsmType = typeMapper.mapSupertype(superInterfaceType, null);
|
||||
sw.writeAsmType(superInterfaceAsmType);
|
||||
} else {
|
||||
superInterfaceAsmType = typeMapper.mapSupertype(superInterfaceType, sw);
|
||||
}
|
||||
superInterfaceAsmTypes[i] = superInterfaceAsmType.getInternalName();
|
||||
superInterfaceAsmTypes[i] = typeMapper.mapSupertype(superInterfaceType, sw).getInternalName();
|
||||
sw.writeInterfaceEnd();
|
||||
}
|
||||
|
||||
@@ -376,12 +368,10 @@ public class ClosureCodegen extends MemberCodegen<KtElement> {
|
||||
value = StackValue.local(slot, type, bridgeParameterKotlinTypes.get(i));
|
||||
slot += type.getSize();
|
||||
}
|
||||
if (InlineClassesCodegenUtilKt.isInlineClassWithUnderlyingTypeAnyOrAnyN(parameterType) && functionReferenceCall == null) {
|
||||
ClassDescriptor descriptor = TypeUtils.getClassDescriptor(parameterType);
|
||||
InlineClassRepresentation<SimpleType> representation =
|
||||
descriptor != null ? descriptor.getInlineClassRepresentation() : null;
|
||||
assert representation != null : "Not an inline class type: " + parameterType;
|
||||
parameterType = representation.getUnderlyingType();
|
||||
if (InlineClassesCodegenUtilKt.isInlineClassWithUnderlyingTypeAnyOrAnyN(parameterType) &&
|
||||
functionReferenceCall == null
|
||||
) {
|
||||
parameterType = InlineClassesUtilsKt.unsubstitutedUnderlyingParameter(parameterType).getType();
|
||||
}
|
||||
value.put(typeMapper.mapType(calleeParameter), parameterType, iv);
|
||||
}
|
||||
|
||||
@@ -6,17 +6,19 @@
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
|
||||
import org.jetbrains.kotlin.codegen.inline.loadCompiledInlineFunction
|
||||
import org.jetbrains.kotlin.codegen.optimization.nullCheck.usesLocalExceptParameterNullCheck
|
||||
import org.jetbrains.kotlin.codegen.inline.InlineCodegen
|
||||
import org.jetbrains.kotlin.codegen.optimization.nullCheck.isCheckParameterIsNotNull
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.FunctionImportedFromObject
|
||||
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DescriptorWithContainerSource
|
||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode
|
||||
import org.jetbrains.org.objectweb.asm.tree.VarInsnNode
|
||||
|
||||
class DelegatedPropertiesCodegenHelper(private val state: GenerationState) {
|
||||
|
||||
@@ -63,15 +65,27 @@ class DelegatedPropertiesCodegenHelper(private val state: GenerationState) {
|
||||
this
|
||||
|
||||
private fun isDelegatedPropertyMetadataRequiredForFunctionFromBinaries(calleeDescriptor: FunctionDescriptor): Boolean {
|
||||
require(calleeDescriptor is DescriptorWithContainerSource) {
|
||||
assert(calleeDescriptor is DescriptorWithContainerSource) {
|
||||
"Function descriptor from binaries expected: $calleeDescriptor"
|
||||
}
|
||||
|
||||
val metadataParameterIndex = getMetadataParameterIndex(calleeDescriptor)
|
||||
val containerId = KotlinTypeMapper.getContainingClassesForDeserializedCallable(calleeDescriptor).implClassId
|
||||
val asmMethod = state.typeMapper.mapAsmMethod(calleeDescriptor)
|
||||
val isMangled = requiresFunctionNameManglingForReturnType(calleeDescriptor)
|
||||
val methodNode = loadCompiledInlineFunction(containerId, asmMethod, calleeDescriptor.isSuspend, isMangled, state).node
|
||||
return methodNode.usesLocalExceptParameterNullCheck(metadataParameterIndex)
|
||||
val methodNode = InlineCodegen.createSpecialInlineMethodNodeFromBinaries(calleeDescriptor, state)
|
||||
|
||||
return isMetadataParameterUsedInCompiledMethodBody(metadataParameterIndex, methodNode)
|
||||
}
|
||||
|
||||
private fun isMetadataParameterUsedInCompiledMethodBody(metadataParameterIndex: Int, methodNode: MethodNode): Boolean =
|
||||
methodNode.instructions.toArray().any { insn ->
|
||||
insn is VarInsnNode && insn.opcode == Opcodes.ALOAD && insn.`var` == metadataParameterIndex &&
|
||||
!isParameterNullCheckArgument(insn)
|
||||
}
|
||||
|
||||
private fun isParameterNullCheckArgument(insn: AbstractInsnNode): Boolean {
|
||||
val next1 = insn.next
|
||||
val next2 = next1.next
|
||||
return next1 != null && next2 != null &&
|
||||
next1.opcode == Opcodes.LDC && next2.isCheckParameterIsNotNull()
|
||||
}
|
||||
|
||||
private fun getMetadataParameterIndex(calleeDescriptor: FunctionDescriptor): Int {
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
|
||||
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
|
||||
public abstract class DelegatingClassBuilder implements ClassBuilder {
|
||||
@NotNull
|
||||
protected abstract ClassBuilder getDelegate();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FieldVisitor newField(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable Object value
|
||||
) {
|
||||
return getDelegate().newField(origin, access, name, desc, signature, value);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public MethodVisitor newMethod(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@NotNull String desc,
|
||||
@Nullable String signature,
|
||||
@Nullable String[] exceptions
|
||||
) {
|
||||
return getDelegate().newMethod(origin, access, name, desc, signature, exceptions);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JvmSerializationBindings getSerializationBindings() {
|
||||
return getDelegate().getSerializationBindings();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) {
|
||||
return getDelegate().newAnnotation(desc, visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void done() {
|
||||
getDelegate().done();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ClassVisitor getVisitor() {
|
||||
return getDelegate().getVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void defineClass(
|
||||
@Nullable PsiElement origin,
|
||||
int version,
|
||||
int access,
|
||||
@NotNull String name,
|
||||
@Nullable String signature,
|
||||
@NotNull String superName,
|
||||
@NotNull String[] interfaces
|
||||
) {
|
||||
getDelegate().defineClass(origin, version, access, name, signature, superName, interfaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSource(@NotNull String name, @Nullable String debug) {
|
||||
getDelegate().visitSource(name, debug);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) {
|
||||
getDelegate().visitSMAP(smap, backwardsCompatibleSyntax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) {
|
||||
getDelegate().visitOuterClass(owner, name, desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) {
|
||||
getDelegate().visitInnerClass(name, outerName, innerName, access);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getThisName() {
|
||||
return getDelegate().getThisName();
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class ErasedInlineClassBodyCodegen(
|
||||
}
|
||||
|
||||
private fun generateUnboxMethod() {
|
||||
val boxMethodDescriptor = InlineClassDescriptorResolver.createBoxFunctionDescriptor(descriptor)
|
||||
val boxMethodDescriptor = InlineClassDescriptorResolver.createBoxFunctionDescriptor(descriptor) ?: return
|
||||
|
||||
functionCodegen.generateMethod(
|
||||
Synthetic(null, boxMethodDescriptor), boxMethodDescriptor, object : FunctionGenerationStrategy.CodegenBased(state) {
|
||||
@@ -103,7 +103,7 @@ class ErasedInlineClassBodyCodegen(
|
||||
}
|
||||
|
||||
private fun generateSpecializedEqualsStub() {
|
||||
val specializedEqualsDescriptor = InlineClassDescriptorResolver.createSpecializedEqualsDescriptor(descriptor)
|
||||
val specializedEqualsDescriptor = InlineClassDescriptorResolver.createSpecializedEqualsDescriptor(descriptor) ?: return
|
||||
|
||||
functionCodegen.generateMethod(
|
||||
Synthetic(null, specializedEqualsDescriptor), specializedEqualsDescriptor, object : FunctionGenerationStrategy.CodegenBased(state) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import kotlin.text.StringsKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil;
|
||||
import org.jetbrains.kotlin.backend.common.SamType;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.codegen.binding.CalculatedClosure;
|
||||
import org.jetbrains.kotlin.codegen.binding.CodegenBinding;
|
||||
@@ -89,7 +88,6 @@ import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
import org.jetbrains.kotlin.types.checker.ClassicTypeSystemContextImpl;
|
||||
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS;
|
||||
import org.jetbrains.kotlin.types.model.KotlinTypeMarker;
|
||||
import org.jetbrains.kotlin.types.model.TypeParameterMarker;
|
||||
import org.jetbrains.kotlin.types.typesApproximation.CapturedTypeApproximationKt;
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions;
|
||||
@@ -107,7 +105,6 @@ import java.util.stream.Collectors;
|
||||
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isInt;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.boxType;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.BaseExpressionCodegenKt.putReifiedOperationMarkerIfTypeIsReifiedParameter;
|
||||
import static org.jetbrains.kotlin.codegen.CodegenUtilKt.*;
|
||||
import static org.jetbrains.kotlin.codegen.DescriptorAsmUtil.boxType;
|
||||
import static org.jetbrains.kotlin.codegen.DescriptorAsmUtil.*;
|
||||
@@ -266,23 +263,13 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
);
|
||||
}
|
||||
|
||||
private static void addReifiedParametersFromSignature(@NotNull MemberCodegen<?> member, @NotNull ClassDescriptor descriptor) {
|
||||
private static void addReifiedParametersFromSignature(@NotNull MemberCodegen member, @NotNull ClassDescriptor descriptor) {
|
||||
for (KotlinType type : descriptor.getTypeConstructor().getSupertypes()) {
|
||||
processTypeArguments(member, type);
|
||||
}
|
||||
}
|
||||
|
||||
private static void processTypeArguments(@NotNull MemberCodegen<?> member, KotlinType type) {
|
||||
for (TypeProjection supertypeArgument : type.getArguments()) {
|
||||
if (supertypeArgument.isStarProjection()) continue;
|
||||
|
||||
TypeParameterDescriptor parameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(supertypeArgument.getType());
|
||||
if (parameterDescriptor != null) {
|
||||
if (parameterDescriptor.isReified()) {
|
||||
for (TypeProjection supertypeArgument : type.getArguments()) {
|
||||
TypeParameterDescriptor parameterDescriptor = TypeUtils.getTypeParameterDescriptorOrNull(supertypeArgument.getType());
|
||||
if (parameterDescriptor != null && parameterDescriptor.isReified()) {
|
||||
member.getReifiedTypeParametersUsages().addUsedReifiedParameter(parameterDescriptor.getName().asString());
|
||||
}
|
||||
} else {
|
||||
processTypeArguments(member, supertypeArgument.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1262,8 +1249,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
if (closure.isSuspendLambda()) {
|
||||
// When inlining crossinline lambda, the ACONST_NULL is never popped.
|
||||
// Thus, do not generate it. Otherwise, it leads to VerifyError on run-time.
|
||||
boolean isCrossinlineLambda = (callGenerator instanceof PsiInlineCodegen) &&
|
||||
Objects.requireNonNull(((PsiInlineCodegen) callGenerator).getActiveLambda(),
|
||||
boolean isCrossinlineLambda = (callGenerator instanceof InlineCodegen<?>) &&
|
||||
Objects.requireNonNull(((InlineCodegen) callGenerator).getActiveLambda(),
|
||||
"no active lambda found").isCrossInline;
|
||||
if (!isCrossinlineLambda) {
|
||||
v.aconst(null);
|
||||
@@ -2025,12 +2012,10 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
// Do not unbox parameters of suspend lambda, they are unboxed in `invoke` method
|
||||
!CoroutineCodegenUtilKt.isInvokeSuspendOfLambda(context.getFunctionDescriptor())
|
||||
) {
|
||||
ClassDescriptor inlineClass = (ClassDescriptor) inlineClassType.getConstructor().getDeclarationDescriptor();
|
||||
InlineClassRepresentation<SimpleType> representation =
|
||||
inlineClass != null ? inlineClass.getInlineClassRepresentation() : null;
|
||||
assert representation != null : "Not an inline class: " + inlineClassType;
|
||||
KotlinType underlyingType = representation.getUnderlyingType();
|
||||
return StackValue.underlyingValueOfInlineClass(typeMapper.mapType(underlyingType), underlyingType, localOrCaptured);
|
||||
KotlinType underlyingType = InlineClassesUtilsKt.underlyingRepresentation(
|
||||
(ClassDescriptor) inlineClassType.getConstructor().getDeclarationDescriptor()).getType();
|
||||
return StackValue.underlyingValueOfInlineClass(
|
||||
typeMapper.mapType(underlyingType), underlyingType, localOrCaptured);
|
||||
}
|
||||
}
|
||||
return localOrCaptured;
|
||||
@@ -2781,8 +2766,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
putReceiverAndInlineMarkerIfNeeded(callableMethod, resolvedCall, receiver, maybeSuspensionPoint, isConstructor);
|
||||
}
|
||||
|
||||
callGenerator.processHiddenParameters();
|
||||
callGenerator.putHiddenParamsIntoLocals();
|
||||
callGenerator.processAndPutHiddenParameters(false);
|
||||
|
||||
List<ResolvedValueArgument> valueArguments = resolvedCall.getValueArgumentsByIndex();
|
||||
assert valueArguments != null : "Failed to arrange value arguments by index: " + resolvedCall.getResultingDescriptor();
|
||||
@@ -2951,12 +2935,13 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
bindingContext, state
|
||||
);
|
||||
|
||||
PsiSourceCompilerForInline sourceCompiler = new PsiSourceCompilerForInline(this, callElement);
|
||||
FunctionDescriptor functionDescriptor =
|
||||
InlineUtil.isArrayConstructorWithLambda(original)
|
||||
? FictitiousArrayConstructor.create((ConstructorDescriptor) original) : original.getOriginal();
|
||||
PsiSourceCompilerForInline sourceCompiler = new PsiSourceCompilerForInline(this, callElement, functionDescriptor);
|
||||
|
||||
JvmMethodSignature signature = typeMapper.mapSignatureWithGeneric(functionDescriptor, sourceCompiler.getContext().getContextKind());
|
||||
sourceCompiler.initializeInlineFunctionContext(functionDescriptor);
|
||||
JvmMethodSignature signature = typeMapper.mapSignatureWithGeneric(functionDescriptor, sourceCompiler.getContextKind());
|
||||
if (signature.getAsmMethod().getName().contains("-") &&
|
||||
!state.getConfiguration().getBoolean(JVMConfigurationKeys.USE_OLD_INLINE_CLASSES_MANGLING_SCHEME)
|
||||
) {
|
||||
@@ -2964,15 +2949,17 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
InlineClassesCodegenUtilKt.classFileContainsMethod(functionDescriptor, state, signature.getAsmMethod());
|
||||
if (classFileContainsMethod != null && !classFileContainsMethod) {
|
||||
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(true);
|
||||
signature = typeMapper.mapSignatureWithGeneric(functionDescriptor, sourceCompiler.getContext().getContextKind());
|
||||
signature = typeMapper.mapSignatureWithGeneric(functionDescriptor, sourceCompiler.getContextKind());
|
||||
typeMapper.setUseOldManglingRulesForFunctionAcceptingInlineClass(false);
|
||||
}
|
||||
}
|
||||
Type methodOwner = typeMapper.mapImplementationOwner(functionDescriptor);
|
||||
if (isDefaultCompilation) {
|
||||
return new InlineCodegenForDefaultBody(functionDescriptor, this, state, signature, sourceCompiler);
|
||||
} else {
|
||||
return new PsiInlineCodegen(this, state, functionDescriptor, signature, typeParameterMappings, sourceCompiler,
|
||||
typeMapper.mapImplementationOwner(functionDescriptor), typeMapper.mapOwner(descriptor));
|
||||
return new InlineCodegenForDefaultBody(functionDescriptor, this, state, methodOwner, signature, sourceCompiler);
|
||||
}
|
||||
else {
|
||||
return new PsiInlineCodegen(this, state, functionDescriptor, methodOwner, signature, typeParameterMappings, sourceCompiler,
|
||||
typeMapper.mapOwner(descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3020,7 +3007,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
@NotNull
|
||||
private KotlinType approximateCapturedType(@NotNull KotlinType type) {
|
||||
if (state.getLanguageVersionSettings().supportsFeature(LanguageFeature.NewInference)) {
|
||||
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns(), state.getLanguageVersionSettings());
|
||||
TypeApproximator approximator = new TypeApproximator(state.getModule().getBuiltIns());
|
||||
|
||||
KotlinType approximatedType =
|
||||
TypeUtils.contains(type, (containedType) -> CapturedTypeConstructorKt.isCaptured(containedType)) ?
|
||||
@@ -3556,7 +3543,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
if (TypeUtils.isTypeParameter(type)) {
|
||||
assert TypeUtils.isReifiedTypeParameter(type) :
|
||||
"Non-reified type parameter under ::class should be rejected by type checker: " + type;
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(this, type, ReifiedTypeInliner.OperationKind.JAVA_CLASS);
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(type, ReifiedTypeInliner.OperationKind.JAVA_CLASS);
|
||||
}
|
||||
|
||||
putJavaLangClassInstance(v, typeMapper.mapType(type), type, typeMapper);
|
||||
@@ -4929,7 +4916,10 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
public void newArrayInstruction(@NotNull KotlinType arrayType) {
|
||||
if (KotlinBuiltIns.isArray(arrayType)) {
|
||||
KotlinType elementJetType = arrayType.getArguments().get(0).getType();
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(this, elementJetType, ReifiedTypeInliner.OperationKind.NEW_ARRAY);
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(
|
||||
elementJetType,
|
||||
ReifiedTypeInliner.OperationKind.NEW_ARRAY
|
||||
);
|
||||
v.newarray(boxType(typeMapper.mapTypeAsDeclaration(elementJetType)));
|
||||
}
|
||||
else {
|
||||
@@ -5233,7 +5223,7 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
|
||||
boolean safeAs = opToken == KtTokens.AS_SAFE;
|
||||
if (TypeUtils.isReifiedTypeParameter(rightKotlinType)) {
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(this, rightKotlinType,
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(rightKotlinType,
|
||||
safeAs ? ReifiedTypeInliner.OperationKind.SAFE_AS
|
||||
: ReifiedTypeInliner.OperationKind.AS);
|
||||
v.checkcast(boxedRightType);
|
||||
@@ -5290,7 +5280,7 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
|
||||
Type type = boxType(typeMapper.mapTypeAsDeclaration(rhsKotlinType));
|
||||
if (TypeUtils.isReifiedTypeParameter(rhsKotlinType)) {
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(this, rhsKotlinType, ReifiedTypeInliner.OperationKind.IS);
|
||||
putReifiedOperationMarkerIfTypeIsReifiedParameter(rhsKotlinType, ReifiedTypeInliner.OperationKind.IS);
|
||||
v.instanceOf(type);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -68,13 +68,6 @@ open class FrameMapBase<T : Any> {
|
||||
return Mark(currentSize)
|
||||
}
|
||||
|
||||
fun skipTo(target: Int): Mark {
|
||||
return mark().also {
|
||||
if (currentSize < target)
|
||||
currentSize = target
|
||||
}
|
||||
}
|
||||
|
||||
inner class Mark(private val myIndex: Int) {
|
||||
|
||||
fun dropTo() {
|
||||
|
||||
@@ -53,7 +53,6 @@ import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.SimpleType;
|
||||
import org.jetbrains.kotlin.types.TypeUtils;
|
||||
import org.jetbrains.org.objectweb.asm.Label;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
@@ -370,22 +369,23 @@ public class FunctionCodegen {
|
||||
public static void generateMethodInsideInlineClassWrapper(
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
@NotNull FunctionDescriptor functionDescriptor,
|
||||
@NotNull ClassDescriptor inlineClass,
|
||||
@NotNull ClassDescriptor containingDeclaration,
|
||||
@NotNull MethodVisitor mv,
|
||||
@NotNull KotlinTypeMapper typeMapper
|
||||
) {
|
||||
mv.visitCode();
|
||||
|
||||
Type fieldOwnerType = typeMapper.mapClass(inlineClass);
|
||||
Type fieldOwnerType = typeMapper.mapClass(containingDeclaration);
|
||||
Method erasedMethodImpl = typeMapper.mapAsmMethod(functionDescriptor.getOriginal(), OwnerKind.ERASED_INLINE_CLASS);
|
||||
|
||||
InlineClassRepresentation<SimpleType> representation = inlineClass.getInlineClassRepresentation();
|
||||
assert representation != null : "Not an inline class: " + inlineClass;
|
||||
ValueParameterDescriptor valueRepresentation = InlineClassesUtilsKt.underlyingRepresentation(containingDeclaration);
|
||||
if (valueRepresentation == null) return;
|
||||
|
||||
Type fieldType = typeMapper.mapType(valueRepresentation);
|
||||
|
||||
generateDelegateToStaticErasedVersion(
|
||||
mv, erasedMethodImpl, fieldOwnerType,
|
||||
representation.getUnderlyingPropertyName().asString(),
|
||||
typeMapper.mapType(representation.getUnderlyingType())
|
||||
mv, erasedMethodImpl,
|
||||
fieldOwnerType, valueRepresentation.getName().asString(), fieldType
|
||||
);
|
||||
|
||||
endVisit(mv, null, origin.getElement());
|
||||
@@ -1152,10 +1152,8 @@ public class FunctionCodegen {
|
||||
|
||||
// $default methods are never private to be accessible from other class files (e.g. inner) without the need of synthetic accessors
|
||||
// $default methods are never protected to be accessible from subclass nested classes
|
||||
// TODO: maybe best to generate private default in interface as private
|
||||
int visibilityFlag =
|
||||
(!isInterface(functionDescriptor.getContainingDeclaration()) || kind == OwnerKind.DEFAULT_IMPLS) &&
|
||||
(DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor))
|
||||
DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor)
|
||||
? AsmUtil.NO_FLAG_PACKAGE_PRIVATE : Opcodes.ACC_PUBLIC;
|
||||
int flags = visibilityFlag | getDeprecatedAccessFlag(functionDescriptor) | ACC_SYNTHETIC;
|
||||
if (!(functionDescriptor instanceof ConstructorDescriptor &&
|
||||
@@ -1691,7 +1689,7 @@ public class FunctionCodegen {
|
||||
return (kind != OwnerKind.DEFAULT_IMPLS && !isSyntheticInCompatibilityOrJvmDefault) ||
|
||||
(kind == OwnerKind.DEFAULT_IMPLS &&
|
||||
(isSyntheticInCompatibilityOrJvmDefault ||
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))) && !DescriptorVisibilities.isPrivate(memberDescriptor.getVisibility()));
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
|
||||
} else {
|
||||
switch (kind) {
|
||||
case DEFAULT_IMPLS: return true;
|
||||
|
||||
@@ -34,8 +34,7 @@ import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.correctElementType;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.isPrimitive;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.DescriptorAsmUtil.*;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.JAVA_STRING_TYPE;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.OBJECT_TYPE;
|
||||
@@ -307,7 +306,7 @@ public class FunctionsFromAnyGeneratorImpl extends FunctionsFromAnyGenerator {
|
||||
|
||||
iv.load(secondParameterIndex, OBJECT_TYPE);
|
||||
iv.checkcast(wrapperType);
|
||||
StackValue.unboxInlineClass(wrapperType, wrapperKotlinType, iv, typeMapper);
|
||||
StackValue.unboxInlineClass(wrapperType, wrapperKotlinType, iv);
|
||||
iv.store(unboxedValueIndex, underlyingType.getType());
|
||||
|
||||
return unboxedValueIndex;
|
||||
|
||||
@@ -55,7 +55,6 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver;
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
|
||||
import org.jetbrains.kotlin.serialization.DescriptorSerializer;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.SimpleType;
|
||||
import org.jetbrains.org.objectweb.asm.FieldVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.MethodVisitor;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
@@ -275,25 +274,26 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
@Override
|
||||
protected void generateUnboxMethodForInlineClass() {
|
||||
if (!(myClass instanceof KtClass)) return;
|
||||
InlineClassRepresentation<SimpleType> inlineClassRepresentation = descriptor.getInlineClassRepresentation();
|
||||
if (inlineClassRepresentation == null) return;
|
||||
if (!InlineClassesUtilsKt.isInlineClass(descriptor)) return;
|
||||
|
||||
Type ownerType = typeMapper.mapClass(descriptor);
|
||||
Type valueType = typeMapper.mapType(inlineClassRepresentation.getUnderlyingType());
|
||||
ValueParameterDescriptor inlinedValue = InlineClassesUtilsKt.underlyingRepresentation(this.descriptor);
|
||||
if (inlinedValue == null) return;
|
||||
|
||||
Type valueType = typeMapper.mapType(inlinedValue.getType());
|
||||
SimpleFunctionDescriptor functionDescriptor = InlineClassDescriptorResolver.createUnboxFunctionDescriptor(this.descriptor);
|
||||
assert functionDescriptor != null : "FunctionDescriptor for unbox method should be not null during codegen";
|
||||
|
||||
functionCodegen.generateMethod(
|
||||
JvmDeclarationOriginKt.UnboxMethodOfInlineClass(functionDescriptor), functionDescriptor,
|
||||
new FunctionGenerationStrategy.CodegenBased(state) {
|
||||
@Override
|
||||
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
|
||||
public void doGenerateBody(
|
||||
@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature
|
||||
) {
|
||||
InstructionAdapter iv = codegen.v;
|
||||
iv.load(0, OBJECT_TYPE);
|
||||
iv.getfield(
|
||||
ownerType.getInternalName(),
|
||||
inlineClassRepresentation.getUnderlyingPropertyName().asString(),
|
||||
valueType.getDescriptor()
|
||||
);
|
||||
iv.getfield(ownerType.getInternalName(), inlinedValue.getName().asString(), valueType.getDescriptor());
|
||||
iv.areturn(valueType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,12 +188,6 @@ class JvmRuntimeTypes(
|
||||
else -> if (isMutable) mutablePropertyReferences else propertyReferences
|
||||
}
|
||||
|
||||
return if (arity >= 0) {
|
||||
classes[arity].defaultType
|
||||
} else {
|
||||
//in case of ErrorUtils.ERROR_PROPERTY there would be no dispatchReceiverParameter and arity becomes negative
|
||||
//so we just take zero argument reference class (because it is incorrect anyway)
|
||||
classes[0].defaultType
|
||||
}
|
||||
return classes[arity].defaultType
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* 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.codegen
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.SamTypeFactory
|
||||
import org.jetbrains.kotlin.load.java.sam.JavaSingleAbstractMethodUtils
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class JvmSamTypeFactory : SamTypeFactory() {
|
||||
override fun isSamType(type: KotlinType) =
|
||||
JavaSingleAbstractMethodUtils.isSamType(type)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user