mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-07 08:31:28 +00:00
Compare commits
323 Commits
build-1.5.
...
push/nativ
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de840b7e70 | ||
|
|
99bf2c48a1 | ||
|
|
2d88f0cd79 | ||
|
|
842dbb9006 | ||
|
|
6594fac213 | ||
|
|
fe6ddcc1fa | ||
|
|
77161af92a | ||
|
|
6791ae81db | ||
|
|
aa196ae813 | ||
|
|
0bd5fdb611 | ||
|
|
ed98d878df | ||
|
|
cdb2dd6661 | ||
|
|
64abb2501f | ||
|
|
c9f41a2440 | ||
|
|
149064803d | ||
|
|
4099dfc7e0 | ||
|
|
6fab1305e9 | ||
|
|
95654bb9bc | ||
|
|
77c263fcc4 | ||
|
|
391458c355 | ||
|
|
d3b42709fd | ||
|
|
6429ac17d8 | ||
|
|
050db6d454 | ||
|
|
0d8fff7186 | ||
|
|
607a598f1a | ||
|
|
79935e29de | ||
|
|
b60ebc0975 | ||
|
|
ab8f64a3ee | ||
|
|
92eac7e124 | ||
|
|
d023f09bd4 | ||
|
|
f339748f5b | ||
|
|
41d1ef22b6 | ||
|
|
6b774b07e0 | ||
|
|
aedd8a104d | ||
|
|
8588412a56 | ||
|
|
d0d3b57366 | ||
|
|
91d2f32a57 | ||
|
|
b87c2a15b5 | ||
|
|
7f7bb70596 | ||
|
|
e06bacafad | ||
|
|
4e98d1b857 | ||
|
|
f8828abeba | ||
|
|
4dc040b91a | ||
|
|
d49913944c | ||
|
|
0dd18006e8 | ||
|
|
fe207492b7 | ||
|
|
ded234074d | ||
|
|
869a153327 | ||
|
|
848b08a475 | ||
|
|
ead0b50107 | ||
|
|
600e1725cb | ||
|
|
023b7fbb8f | ||
|
|
ff5b2404af | ||
|
|
d4b3ae92cb | ||
|
|
09ad5ca602 | ||
|
|
5f4a4fd8ae | ||
|
|
44e6483090 | ||
|
|
dbfe45993a | ||
|
|
99ce047733 | ||
|
|
9476175cc2 | ||
|
|
5d3afbad54 | ||
|
|
be0dd84a06 | ||
|
|
0d4e9ca0b9 | ||
|
|
1f15ce2d26 | ||
|
|
bb790195a2 | ||
|
|
09fb2cd746 | ||
|
|
e05c8ac57b | ||
|
|
7c63105bb7 | ||
|
|
7d07010785 | ||
|
|
22f1814911 | ||
|
|
10567d9a37 | ||
|
|
9c786a9cd9 | ||
|
|
ef01411d20 | ||
|
|
375441832e | ||
|
|
c066b7843c | ||
|
|
bc6c17d4b2 | ||
|
|
e9da385f7c | ||
|
|
43d7536a28 | ||
|
|
bac6a7346e | ||
|
|
83da5f61fd | ||
|
|
4dc228a0a3 | ||
|
|
32d0c99289 | ||
|
|
4c6b5ff0b8 | ||
|
|
d1ee05c7f6 | ||
|
|
543ab3fa2a | ||
|
|
590bab82e2 | ||
|
|
3f953bcdfc | ||
|
|
7e7552bf5d | ||
|
|
9bdae40ad8 | ||
|
|
2b994e1b66 | ||
|
|
55561fad37 | ||
|
|
4f20d2dccf | ||
|
|
f4c63c8ba2 | ||
|
|
83383ab9e5 | ||
|
|
78ed758704 | ||
|
|
c5a9f20a6f | ||
|
|
bc5fc122c5 | ||
|
|
75850a618c | ||
|
|
057ead358c | ||
|
|
b45d5abeb1 | ||
|
|
2ae7740c46 | ||
|
|
875cf1acf9 | ||
|
|
35df00e071 | ||
|
|
57f5939f5e | ||
|
|
6bd44df861 | ||
|
|
1751b5182b | ||
|
|
9be06da045 | ||
|
|
ca7dfe02b2 | ||
|
|
078849d133 | ||
|
|
46b056c929 | ||
|
|
da6544ae3c | ||
|
|
ce49664366 | ||
|
|
74ab5c21a8 | ||
|
|
5f10c98a38 | ||
|
|
0e4e90dc13 | ||
|
|
89a78a02d4 | ||
|
|
2a49dcab47 | ||
|
|
faf9600ff0 | ||
|
|
ce19063e43 | ||
|
|
27956adf3f | ||
|
|
111e67dc8d | ||
|
|
6e8bad6ef6 | ||
|
|
d2da15e039 | ||
|
|
815e40620c | ||
|
|
dceb8b2991 | ||
|
|
932eed2c14 | ||
|
|
65ea4e184a | ||
|
|
0108f8a1b4 | ||
|
|
01e8019c4c | ||
|
|
f82c7c4678 | ||
|
|
f1edca8ca8 | ||
|
|
8995fe36f3 | ||
|
|
fbe18164b4 | ||
|
|
cba63f2c12 | ||
|
|
74118930b4 | ||
|
|
f3135baba9 | ||
|
|
0cca07fa19 | ||
|
|
737fbe271f | ||
|
|
00a335129b | ||
|
|
bf844aa8e4 | ||
|
|
c7498dd74d | ||
|
|
6608ca5795 | ||
|
|
d941d41776 | ||
|
|
a3a745e7a5 | ||
|
|
5d0760c685 | ||
|
|
f7099d34d4 | ||
|
|
cd2f55ea2f | ||
|
|
c1848a26c3 | ||
|
|
7a11c722c6 | ||
|
|
76d93b6dca | ||
|
|
a7fda66fa1 | ||
|
|
ca99fc4fed | ||
|
|
66a29c70bf | ||
|
|
efceb89b98 | ||
|
|
f648d86d2b | ||
|
|
7edbf79b4b | ||
|
|
02b5b931d4 | ||
|
|
ba3f27b5ce | ||
|
|
8f97ba97f2 | ||
|
|
f159a424f5 | ||
|
|
0858a92b12 | ||
|
|
3935c290a9 | ||
|
|
72bb1f5b30 | ||
|
|
eb54689801 | ||
|
|
e53c8ba6ca | ||
|
|
f840b45ae1 | ||
|
|
fcbb921194 | ||
|
|
f9f948fea6 | ||
|
|
f5f7e976f6 | ||
|
|
357f2be14e | ||
|
|
bd614aba0b | ||
|
|
6641b4f029 | ||
|
|
679756ad07 | ||
|
|
8294aed40c | ||
|
|
e3dc112c5f | ||
|
|
cd9463ae8d | ||
|
|
bdaeaca5ae | ||
|
|
5fc9f3bc17 | ||
|
|
247efb220c | ||
|
|
81baf4fae5 | ||
|
|
770468c78e | ||
|
|
4bc019736b | ||
|
|
d8a3dacdc5 | ||
|
|
efa43052db | ||
|
|
fd02802028 | ||
|
|
6427117a35 | ||
|
|
d8fb54c6bd | ||
|
|
628d75c7cd | ||
|
|
9e5bf7e05c | ||
|
|
1a3515dbab | ||
|
|
0fb99f1bf2 | ||
|
|
b41cc57ff7 | ||
|
|
010ea39417 | ||
|
|
4f33abf5e4 | ||
|
|
6b0f080ed8 | ||
|
|
d07ede7305 | ||
|
|
1737bdd4d4 | ||
|
|
6697c4d197 | ||
|
|
20ab88c001 | ||
|
|
298b595826 | ||
|
|
82589c0898 | ||
|
|
f0669c752f | ||
|
|
3778d1d631 | ||
|
|
d3c60ab72e | ||
|
|
fa9285aac7 | ||
|
|
52d0250dc6 | ||
|
|
cdba0d029e | ||
|
|
885026f6db | ||
|
|
b30ebe2842 | ||
|
|
bfe0623837 | ||
|
|
1f17d238f8 | ||
|
|
d7ed8ff804 | ||
|
|
36294352ef | ||
|
|
c6d8cddcd9 | ||
|
|
3012839f49 | ||
|
|
f7d977d7c4 | ||
|
|
f1739980d3 | ||
|
|
ec1e4fb26e | ||
|
|
5e41a7c66b | ||
|
|
f43626d545 | ||
|
|
12be9c99ca | ||
|
|
7bdbc893a0 | ||
|
|
a0baecc6e4 | ||
|
|
126b634529 | ||
|
|
607568fb73 | ||
|
|
e96dd3b301 | ||
|
|
eddeef1d51 | ||
|
|
3d6893e518 | ||
|
|
6527452143 | ||
|
|
7dbb0c7d20 | ||
|
|
e79c9a3618 | ||
|
|
b6bb8a576e | ||
|
|
e17b7f01b6 | ||
|
|
ee11202db5 | ||
|
|
6ddca4a592 | ||
|
|
4d51d71699 | ||
|
|
3568eba1b2 | ||
|
|
71c134e54f | ||
|
|
8b8262096c | ||
|
|
9970851684 | ||
|
|
a2200b5386 | ||
|
|
7c11dde2cf | ||
|
|
d311fe21f8 | ||
|
|
8a28175302 | ||
|
|
0130ecd21d | ||
|
|
b7e13d677d | ||
|
|
63925ee018 | ||
|
|
4401589974 | ||
|
|
e7a45bba91 | ||
|
|
aa5874e073 | ||
|
|
10b0d147af | ||
|
|
5db71209b2 | ||
|
|
58564a7b89 | ||
|
|
2e1c1cd154 | ||
|
|
c96c50a73c | ||
|
|
e17aa5efaa | ||
|
|
c072c8200b | ||
|
|
2042508df0 | ||
|
|
d78f579a42 | ||
|
|
2a8e2613a2 | ||
|
|
2ed98ee732 | ||
|
|
db2d6c7e0a | ||
|
|
0340a89045 | ||
|
|
9a7ef11043 | ||
|
|
81a495b494 | ||
|
|
1c1492da3d | ||
|
|
421cb6971d | ||
|
|
c2f6a2cb96 | ||
|
|
ed57bcb3b1 | ||
|
|
037505d9f2 | ||
|
|
7eb9b1188f | ||
|
|
15c3269e38 | ||
|
|
1e4d7ff690 | ||
|
|
f6e564ffa6 | ||
|
|
9cc8f44390 | ||
|
|
58e6f775bb | ||
|
|
3da3f0e653 | ||
|
|
e5631addf3 | ||
|
|
965c118521 | ||
|
|
566f97ae3e | ||
|
|
5e0860ca14 | ||
|
|
bec4d1903b | ||
|
|
1f8de46b3c | ||
|
|
22d269a0a8 | ||
|
|
f332192de8 | ||
|
|
8ff0b1e243 | ||
|
|
027df41740 | ||
|
|
e7e17cdaa9 | ||
|
|
36ff952a0f | ||
|
|
a0b901b23a | ||
|
|
4ed341b152 | ||
|
|
1d42c70056 | ||
|
|
b744f41c0d | ||
|
|
179cf303da | ||
|
|
297aa17b6e | ||
|
|
117cfc763a | ||
|
|
d06ec61b79 | ||
|
|
8158a07063 | ||
|
|
27904c0fb9 | ||
|
|
b45de517c4 | ||
|
|
03df752e8e | ||
|
|
9bdfbc948c | ||
|
|
e6ccdff2f7 | ||
|
|
aa829c2321 | ||
|
|
ca26c193ae | ||
|
|
1f6ce874a1 | ||
|
|
745aa620d0 | ||
|
|
bd7689d381 | ||
|
|
8324f499cd | ||
|
|
ee1bc45bd6 | ||
|
|
ab68bb6ddb | ||
|
|
8368812432 | ||
|
|
8b24f4b5c6 | ||
|
|
1ba943eb4a | ||
|
|
7e2c365b79 | ||
|
|
50d4979531 | ||
|
|
284e6f5bb3 | ||
|
|
28452fc38e | ||
|
|
149282a888 | ||
|
|
1c06972ec6 | ||
|
|
d6961a6e60 | ||
|
|
70d434e992 | ||
|
|
3537c699b5 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -54,6 +54,7 @@ build/
|
||||
.idea/artifacts/kotlin_test_js_ir_*
|
||||
.idea/artifacts/kotlin_stdlib_wasm_*
|
||||
.idea/jarRepositories.xml
|
||||
.idea/csv-plugin.xml
|
||||
kotlin-ultimate/
|
||||
node_modules/
|
||||
.rpt2_cache/
|
||||
@@ -63,4 +64,4 @@ buildSrcTmp/
|
||||
distTmp/
|
||||
outTmp/
|
||||
/test.output
|
||||
/kotlin-native/dist
|
||||
/kotlin-native/dist
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT">
|
||||
<output-path>$PROJECT_DIR$/kotlin-native/endorsedLibraries/kotlinx.cli/build/libs</output-path>
|
||||
<root id="archive" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT.jar">
|
||||
<element id="module-output" name="kotlin.kotlin-native.endorsedLibraries.kotlinx.cli.jvmMain" />
|
||||
</root>
|
||||
<root id="archive" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT.jar" />
|
||||
</artifact>
|
||||
</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">
|
||||
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
|
||||
<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 Compiler Tests" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<configuration default="false" name="Generate Compiler Tests" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/compiler" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -21,4 +21,4 @@
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
|
||||
<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">
|
||||
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true" folderName="IDEA">
|
||||
<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">
|
||||
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<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">
|
||||
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<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">
|
||||
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<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">
|
||||
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -16,4 +16,4 @@
|
||||
<option name="vmOptions" value="" />
|
||||
</ExternalSystemSettings>
|
||||
</configuration>
|
||||
</component>
|
||||
</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">
|
||||
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
|
||||
<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">
|
||||
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
|
||||
<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">
|
||||
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
@@ -19,4 +19,4 @@
|
||||
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
</component>
|
||||
|
||||
@@ -92,18 +92,16 @@ benchmark {
|
||||
}
|
||||
}
|
||||
|
||||
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.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.register<JavaExec>("runBenchmark") {
|
||||
|
||||
@@ -25,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.createSession
|
||||
import org.jetbrains.kotlin.fir.createSessionForTests
|
||||
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
|
||||
import org.jetbrains.kotlin.fir.resolve.firProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
|
||||
@@ -150,7 +150,7 @@ abstract class AbstractSimpleFileBenchmark {
|
||||
private fun analyzeGreenFileIr(bh: Blackhole) {
|
||||
val scope = GlobalSearchScope.filesScope(env.project, listOf(file.virtualFile))
|
||||
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
|
||||
val session = createSession(env, scope)
|
||||
val session = createSessionForTests(env, scope)
|
||||
val firProvider = session.firProvider as FirProviderImpl
|
||||
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.build
|
||||
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,11 +26,13 @@ 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"
|
||||
|
||||
@@ -182,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.0.88"
|
||||
extra["versions.r8"] = "2.1.75"
|
||||
val immutablesVersion = "0.3.1"
|
||||
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
|
||||
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
@@ -242,6 +242,7 @@ extra["compilerModules"] = arrayOf(
|
||||
":compiler:ir.psi2ir",
|
||||
":compiler:ir.backend.common",
|
||||
":compiler:backend.jvm",
|
||||
":compiler:backend.jvm:backend.jvm.entrypoint",
|
||||
":compiler:backend.js",
|
||||
":compiler:backend.wasm",
|
||||
":compiler:ir.serialization.common",
|
||||
@@ -564,10 +565,13 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
gradle.buildFinished {
|
||||
val taskGraph = gradle?.taskGraph
|
||||
if (taskGraph != null) {
|
||||
taskGraph.allTasks
|
||||
if ((gradle.startParameter as? org.gradle.api.internal.StartParameterInternal)?.isConfigurationCache != true) {
|
||||
// TODO: remove it once Gradle is bumped to 6.8:
|
||||
// See https://docs.gradle.org/6.8/release-notes.html#more-cache-hits-when-empty-directories-are-present
|
||||
gradle.buildFinished {
|
||||
val taskGraph = gradle?.taskGraph
|
||||
if (taskGraph != null) {
|
||||
taskGraph.allTasks
|
||||
.filterIsInstance<SourceTask>()
|
||||
.filter { it.didWork }
|
||||
.forEach {
|
||||
@@ -577,6 +581,7 @@ gradle.buildFinished {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,17 +625,12 @@ val ideaPlugin by task<Task> {
|
||||
}
|
||||
|
||||
tasks {
|
||||
named("clean") {
|
||||
doLast {
|
||||
delete("$buildDir/repo")
|
||||
delete(distDir)
|
||||
}
|
||||
named<Delete>("clean") {
|
||||
delete += setOf("$buildDir/repo", distDir)
|
||||
}
|
||||
|
||||
register("cleanupArtifacts") {
|
||||
doLast {
|
||||
delete(artifactsDir)
|
||||
}
|
||||
register<Delete>("cleanupArtifacts") {
|
||||
delete = setOf(artifactsDir)
|
||||
}
|
||||
|
||||
listOf("clean", "assemble", "install").forEach { taskName ->
|
||||
@@ -729,10 +729,12 @@ tasks {
|
||||
register("scriptingTest") {
|
||||
dependsOn("dist")
|
||||
dependsOn(":kotlin-script-util:test")
|
||||
dependsOn(":kotlin-scripting-compiler-embeddable:test")
|
||||
dependsOn(":kotlin-scripting-compiler:test")
|
||||
dependsOn(":kotlin-scripting-compiler:testWithIr")
|
||||
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")
|
||||
@@ -740,6 +742,7 @@ 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")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:test")
|
||||
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
|
||||
dependsOn(":kotlin-scripting-js-test:test")
|
||||
@@ -891,17 +894,11 @@ tasks {
|
||||
if (Ide.IJ()) {
|
||||
dependsOn(
|
||||
":libraries:tools:new-project-wizard: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
|
||||
":libraries:tools:new-project-wizard:new-project-wizard-cli:test"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
register("ideaIntegrationsTests") {
|
||||
if (Ide.IJ()) {
|
||||
dependsOn(":idea:idea-new-project-wizard:test")
|
||||
}
|
||||
}
|
||||
|
||||
register("kaptIdeTest") {
|
||||
dependsOn(":kotlin-annotation-processing:test")
|
||||
@@ -1208,7 +1205,8 @@ val Jar.outputFile: File
|
||||
val Project.sourceSetsOrNull: SourceSetContainer?
|
||||
get() = convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets
|
||||
|
||||
val disableVerificationTasks = System.getProperty("disable.verification.tasks") == "true"
|
||||
val disableVerificationTasks = providers.systemProperty("disable.verification.tasks")
|
||||
.forUseAtConfigurationTime().orNull?.toBoolean() ?: false
|
||||
if (disableVerificationTasks) {
|
||||
gradle.taskGraph.whenReady {
|
||||
allTasks.forEach {
|
||||
|
||||
@@ -161,7 +161,7 @@ dependencies {
|
||||
|
||||
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")
|
||||
|
||||
implementation("org.gradle:test-retry-gradle-plugin:1.1.9")
|
||||
implementation("org.gradle:test-retry-gradle-plugin:1.2.0")
|
||||
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
|
||||
|
||||
compileOnly(gradleApi())
|
||||
@@ -199,6 +199,7 @@ java {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile>().configureEach {
|
||||
kotlinOptions.allWarningsAsErrors = true
|
||||
kotlinOptions.freeCompilerArgs += listOf(
|
||||
"-Xopt-in=kotlin.RequiresOptIn",
|
||||
"-Xskip-runtime-version-check",
|
||||
@@ -262,4 +263,4 @@ gradlePlugin {
|
||||
implementationClass = "org.jetbrains.kotlin.NativeInteropPlugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
51
buildSrc/src/main/kotlin/InstrumentJava.kt
Normal file
51
buildSrc/src/main/kotlin/InstrumentJava.kt
Normal file
@@ -0,0 +1,51 @@
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ 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
|
||||
|
||||
@@ -8,48 +8,37 @@ package tasks
|
||||
import groovy.util.Node
|
||||
import groovy.util.XmlParser
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
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.*
|
||||
|
||||
|
||||
|
||||
|
||||
open class WriteCopyrightToFile : DefaultTask() {
|
||||
|
||||
abstract class WriteCopyrightToFile : DefaultTask() {
|
||||
@InputFile
|
||||
var path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
|
||||
val path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
|
||||
|
||||
@OutputFile
|
||||
var outputFile: File? = null
|
||||
@get:OutputFile
|
||||
abstract val outputFile: RegularFileProperty
|
||||
|
||||
@Input
|
||||
var commented: Boolean = true
|
||||
@get:Input
|
||||
val commented: Property<Boolean> = project.objects.property(Boolean::class.java).convention(true)
|
||||
|
||||
@TaskAction
|
||||
fun write() {
|
||||
if (commented) {
|
||||
outputFile!!.writeText(project.readCopyrightCommented())
|
||||
} else {
|
||||
outputFile!!.writeText(project.readCopyright())
|
||||
}
|
||||
val file = outputFile.asFile.get()
|
||||
file.writeText(if (commented.get()) readCopyrightCommented() else readCopyright())
|
||||
}
|
||||
|
||||
|
||||
fun Project.readCopyright(): String {
|
||||
val file = rootDir.resolve(".idea/copyright/apache.xml")
|
||||
|
||||
assert(file.exists()) {
|
||||
"File $file with copyright not found"
|
||||
private fun readCopyright(): String {
|
||||
assert(path.exists()) {
|
||||
"File $path with copyright not found"
|
||||
}
|
||||
|
||||
|
||||
val xmlParser = XmlParser()
|
||||
val node = xmlParser.parse(file)
|
||||
val node = xmlParser.parse(path)
|
||||
assert(node.attribute("name") == "CopyrightManager") {
|
||||
"Format changed occasionally?"
|
||||
}
|
||||
@@ -59,7 +48,7 @@ open class WriteCopyrightToFile : DefaultTask() {
|
||||
return noticeNode.attribute("value").toString().replace("$today.year", GregorianCalendar()[Calendar.YEAR].toString())
|
||||
}
|
||||
|
||||
fun Project.readCopyrightCommented(): String {
|
||||
private fun readCopyrightCommented(): String {
|
||||
return "/*\n" + readCopyright().prependIndent(" * ") + "\n */"
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,6 @@ fun Project.rewriteDepsToShadedJar(
|
||||
archiveClassifier.set("original")
|
||||
}
|
||||
|
||||
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
|
||||
|
||||
shadowJarTask.configure {
|
||||
dependsOn(originalJarTask)
|
||||
@@ -136,7 +135,8 @@ 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:
|
||||
exclude { it.file == compilerDummyJarFile }
|
||||
val compilerDummyJarFile = project.provider { configurations.getByName("compilerDummyJar").singleFile }
|
||||
exclude { it.file == compilerDummyJarFile.get() }
|
||||
|
||||
archiveClassifier.set("original")
|
||||
body()
|
||||
|
||||
@@ -21,15 +21,18 @@ 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") }.all {
|
||||
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.configureEach {
|
||||
// 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:
|
||||
@@ -42,31 +45,36 @@ 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.
|
||||
val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile?
|
||||
testCompile?.doFirst {
|
||||
val originalClassesDirs = files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy"))
|
||||
if (!tasks.names.contains("compileTestKotlin")) return@configureEach
|
||||
|
||||
testCompile.classpath = (testCompile.classpath
|
||||
- mainSourceSet.output.classesDirs
|
||||
+ originalClassesDirs)
|
||||
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)
|
||||
|
||||
// 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)
|
||||
classpath = (classpath
|
||||
- classesDirs
|
||||
+ originalClassesDirs)
|
||||
|
||||
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
|
||||
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
|
||||
// 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 setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
|
||||
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
|
||||
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 })
|
||||
}
|
||||
addFreeCompilerArgs(testCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
|
||||
@@ -76,7 +84,7 @@ fun Project.configureFormInstrumentation() {
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
sourceSets.all { sourceSetParam ->
|
||||
sourceSets.forEach { sourceSetParam ->
|
||||
// This copy will ignore filters, but they are unlikely to be used.
|
||||
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
|
||||
|
||||
@@ -88,66 +96,82 @@ 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).onlyIf { !classesDirsCopy.isEmpty }
|
||||
sourceSet = sourceSetParam
|
||||
instrumentationClasspath = instrumentationClasspathCfg
|
||||
originalClassesDirs = classesDirsCopy
|
||||
output = instrumentedClassesDir
|
||||
outputs.dir(instrumentedClassesDir)
|
||||
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)
|
||||
}
|
||||
|
||||
// Ensure that our task is invoked when the source set is built
|
||||
sourceSetParam.compiledBy(instrumentTask)
|
||||
@Suppress("UNUSED_EXPRESSION")
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@CacheableTask
|
||||
open class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
abstract class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
companion object {
|
||||
private const val FILTER_ANNOTATION_REGEXP_CLASS = "com.intellij.ant.ClassFilterAnnotationRegexp"
|
||||
private const val LOADER_REF = "java2.loader"
|
||||
}
|
||||
|
||||
@Classpath
|
||||
var instrumentationClasspath: Configuration? = null
|
||||
@Transient
|
||||
@Internal
|
||||
lateinit var instrumentationClasspathConfiguration: Configuration
|
||||
|
||||
@InputFiles
|
||||
@PathSensitive(PathSensitivity.RELATIVE)
|
||||
var originalClassesDirs: FileCollection? = null
|
||||
@get:Classpath
|
||||
val instrumentationClasspath: String by lazy {
|
||||
instrumentationClasspathConfiguration.asPath
|
||||
}
|
||||
|
||||
@get:InputFiles
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
@get:SkipWhenEmpty
|
||||
abstract val originalClassesDirs: ConfigurableFileCollection
|
||||
|
||||
@get:Input
|
||||
var instrumentNotNull: Boolean = false
|
||||
|
||||
@Internal
|
||||
var sourceSet: SourceSet? = null
|
||||
@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 }
|
||||
}
|
||||
|
||||
@get:InputFiles
|
||||
@get:PathSensitive(PathSensitivity.RELATIVE)
|
||||
val sourceDirs: FileCollection
|
||||
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
|
||||
abstract val sourceDirs: ConfigurableFileCollection
|
||||
|
||||
@get:OutputDirectory
|
||||
lateinit var output: File
|
||||
abstract val output: RegularFileProperty
|
||||
|
||||
@get:Inject
|
||||
abstract val fs: FileSystemOperations
|
||||
|
||||
@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.deleteRecursively()
|
||||
output.asFile.get().deleteRecursively()
|
||||
copyOriginalClasses()
|
||||
|
||||
val classpath = instrumentationClasspath!!
|
||||
val classpath = instrumentationClasspath
|
||||
|
||||
ant.withGroovyBuilder {
|
||||
"taskdef"(
|
||||
"name" to "instrumentIdeaExtensions",
|
||||
"classpath" to classpath.asPath,
|
||||
"classpath" to classpath,
|
||||
"loaderref" to LOADER_REF,
|
||||
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
|
||||
)
|
||||
@@ -155,14 +179,14 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
|
||||
|
||||
logger.info("Compiling forms and instrumenting code with nullability preconditions")
|
||||
if (instrumentNotNull) {
|
||||
prepareNotNullInstrumenting(classpath.asPath)
|
||||
prepareNotNullInstrumenting(classpath)
|
||||
}
|
||||
|
||||
instrumentCode(sourceDirs, instrumentNotNull)
|
||||
}
|
||||
|
||||
private fun copyOriginalClasses() {
|
||||
project.copy {
|
||||
fs.copy {
|
||||
from(originalClassesDirs)
|
||||
into(output)
|
||||
}
|
||||
@@ -181,12 +205,10 @@ open 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(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
|
||||
depSourceDirectorySets.fold(compileClasspath as FileCollection) { acc, v -> acc + v }.asPath.also {
|
||||
logger.info("Using following dependency source dirs: $it")
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,9 @@ 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 {
|
||||
@@ -72,11 +75,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 = coordinates.groupId
|
||||
groupId.textContent = cGroupId
|
||||
val artifactId = dependency.appendChild(document.createElement("artifactId"))
|
||||
artifactId.textContent = coordinates.artifactId
|
||||
artifactId.textContent = cArtifactId
|
||||
val version = dependency.appendChild(document.createElement("version"))
|
||||
version.textContent = coordinates.version
|
||||
version.textContent = cVersion
|
||||
}
|
||||
|
||||
pom.name.set(declaration.displayName)
|
||||
|
||||
@@ -6,12 +6,15 @@
|
||||
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
|
||||
open class DexMethodCount : DefaultTask() {
|
||||
abstract class DexMethodCount : DefaultTask() {
|
||||
|
||||
data class Counts(
|
||||
val total: Int,
|
||||
@@ -24,16 +27,18 @@ open class DexMethodCount : DefaultTask() {
|
||||
@Classpath
|
||||
lateinit var jarFile: File
|
||||
|
||||
@Optional
|
||||
@Input
|
||||
var ownPackages: List<String>? = null
|
||||
@get:Optional
|
||||
@get:Input
|
||||
abstract val ownPackages: ListProperty<String>
|
||||
|
||||
@Internal
|
||||
var artifactName: String? = null
|
||||
|
||||
private val projectName = project.name
|
||||
|
||||
@get:Input
|
||||
val artifactOrArchiveName: String
|
||||
get() = artifactName ?: project.name
|
||||
get() = artifactName ?: projectName
|
||||
|
||||
fun from(jar: Jar) {
|
||||
jarFile = jar.archiveFile.get().asFile
|
||||
@@ -45,8 +50,9 @@ open class DexMethodCount : DefaultTask() {
|
||||
lateinit var counts: Counts
|
||||
|
||||
@get:OutputFile
|
||||
val detailOutputFile: File
|
||||
get() = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
|
||||
val detailOutputFile: File by lazy {
|
||||
project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
fun invoke() {
|
||||
@@ -59,9 +65,9 @@ open class DexMethodCount : DefaultTask() {
|
||||
val byPackage = this.groupingBy { it.`package` }.eachCount()
|
||||
val byClass = this.groupingBy { it.declaringType }.eachCount()
|
||||
|
||||
val ownPackages = ownPackages?.map { "$it." }
|
||||
val byOwnPackages = if (ownPackages != null) {
|
||||
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) } }.let {
|
||||
val ownPackages = ownPackages.map { list -> list.map { "$it." } }
|
||||
val byOwnPackages = if (ownPackages.isPresent) {
|
||||
this.partition { method -> ownPackages.get().any { method.declaringType.startsWith(it) } }.let {
|
||||
it.first.size to it.second.size
|
||||
}
|
||||
} else (null to null)
|
||||
@@ -78,7 +84,7 @@ open class DexMethodCount : DefaultTask() {
|
||||
private fun outputDetails(counts: Counts) {
|
||||
detailOutputFile.printWriter().use { writer ->
|
||||
writer.println("${counts.total.padRight()}\tTotal methods")
|
||||
ownPackages?.let { packages ->
|
||||
ownPackages.orNull?.let { packages ->
|
||||
writer.println("${counts.totalOwnPackages?.padRight()}\tTotal methods from packages ${packages.joinToString { "$it.*" }}")
|
||||
writer.println("${counts.totalOtherPackages?.padRight()}\tTotal methods from other packages")
|
||||
}
|
||||
@@ -96,23 +102,24 @@ open class DexMethodCount : DefaultTask() {
|
||||
}
|
||||
}
|
||||
|
||||
open class DexMethodCountStats : DefaultTask() {
|
||||
|
||||
@Internal
|
||||
lateinit var from: TaskProvider<DexMethodCount>
|
||||
|
||||
abstract class DexMethodCountStats : DefaultTask() {
|
||||
@get:InputFile
|
||||
internal val inputFile
|
||||
get() = from.get().detailOutputFile
|
||||
internal abstract val inputFile: RegularFileProperty
|
||||
|
||||
@get:Input
|
||||
internal abstract val artifactOrArchiveName: Property<String>
|
||||
|
||||
@get:Input
|
||||
@get:Optional
|
||||
internal abstract val ownPackages: ListProperty<String>
|
||||
|
||||
@TaskAction
|
||||
private fun printStats() {
|
||||
val artifactOrArchiveName = from.get().artifactOrArchiveName
|
||||
inputFile.reader().useLines { lines ->
|
||||
val artifactOrArchiveName = artifactOrArchiveName.get()
|
||||
inputFile.get().asFile.reader().useLines { lines ->
|
||||
fun String.getStatValue() = substringBefore("\t").trim()
|
||||
|
||||
val ownPackages = from.get().ownPackages
|
||||
val statsLineCount = if (ownPackages == null) 1 else 3
|
||||
val statsLineCount = if (!ownPackages.isPresent) 1 else 3
|
||||
val stats = lines.take(statsLineCount).map { it.getStatValue() }.toList()
|
||||
|
||||
val total = stats[0]
|
||||
@@ -122,7 +129,7 @@ open class DexMethodCountStats : DefaultTask() {
|
||||
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='$total']")
|
||||
}
|
||||
|
||||
ownPackages?.let { packages ->
|
||||
ownPackages.map { packages ->
|
||||
val totalOwnPackages = stats[1]
|
||||
val totalOtherPackages = stats[2]
|
||||
|
||||
@@ -141,7 +148,9 @@ open class DexMethodCountStats : DefaultTask() {
|
||||
fun Project.printStats(dexMethodCount: TaskProvider<DexMethodCount>) {
|
||||
val dexMethodCountStats = tasks.register("dexMethodCountStats", DexMethodCountStats::class.java) {
|
||||
dependsOn(dexMethodCount)
|
||||
from = dexMethodCount
|
||||
inputFile.set(dexMethodCount.flatMap { objects.fileProperty().apply { set(it.detailOutputFile) } })
|
||||
artifactOrArchiveName.set(dexMethodCount.map { it.artifactOrArchiveName })
|
||||
ownPackages.set(dexMethodCount.flatMap { it.ownPackages })
|
||||
}
|
||||
|
||||
dexMethodCount.configure {
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
|
||||
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.tasks.TaskProvider
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
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
|
||||
@@ -80,129 +83,141 @@ fun Project.projectTest(
|
||||
shortenTempRootName: Boolean = false,
|
||||
jUnit5Enabled: Boolean = false,
|
||||
body: Test.() -> Unit = {}
|
||||
): 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 {
|
||||
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()
|
||||
|
||||
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 {
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
): TaskProvider<Test> {
|
||||
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
|
||||
.forUseAtConfigurationTime().orNull?.toBoolean() != true
|
||||
if (shouldInstrument) {
|
||||
evaluationDependsOn(":test-instrumenter")
|
||||
}
|
||||
|
||||
if (project.findProperty("kotlin.test.instrumentation.disable")?.toString()?.toBoolean() != true) {
|
||||
return getOrCreateTask<Test>(taskName) {
|
||||
doFirst {
|
||||
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")
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
jvmArgs(
|
||||
"-ea",
|
||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
||||
"-XX:+UseCodeCacheFlushing",
|
||||
"-XX:ReservedCodeCacheSize=256m",
|
||||
"-Djna.nosys=true"
|
||||
)
|
||||
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
|
||||
return@forEach
|
||||
}
|
||||
|
||||
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")
|
||||
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
|
||||
val classFileName = "$classFileNameWithoutExtension.class"
|
||||
|
||||
if (Platform[202].orHigher()) {
|
||||
systemProperty("idea.ignore.disabled.plugins", "true")
|
||||
}
|
||||
if (isClassPattern) {
|
||||
val innerClassPattern = "$pattern$*"
|
||||
if (pattern in commandLineIncludePatterns) {
|
||||
commandLineIncludePatterns.add(innerClassPattern)
|
||||
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
|
||||
} else {
|
||||
filter.includePatterns.add(innerClassPattern)
|
||||
}
|
||||
}
|
||||
|
||||
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())
|
||||
}
|
||||
}
|
||||
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()
|
||||
|
||||
doLast {
|
||||
subProjectTempRoot?.let {
|
||||
try {
|
||||
delete(it)
|
||||
} catch (e: Exception) {
|
||||
project.logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
|
||||
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 {
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parallel && !jUnit5Enabled) {
|
||||
maxParallelForks =
|
||||
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
|
||||
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
|
||||
}
|
||||
body()
|
||||
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")
|
||||
|
||||
if (Platform[202].orHigher()) {
|
||||
systemProperty("idea.ignore.disabled.plugins", "true")
|
||||
}
|
||||
|
||||
var subProjectTempRoot: Path? = null
|
||||
val projectName = project.name
|
||||
val teamcity = project.rootProject.findProperty("teamcity") as? Map<*, *>
|
||||
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 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) }
|
||||
}
|
||||
|
||||
private inline fun String.isFirstChar(f: (Char) -> Boolean) = isNotEmpty() && f(first())
|
||||
@@ -229,18 +244,25 @@ private fun Task.useAndroidConfiguration(systemPropertyName: String, configName:
|
||||
val configuration = with(project) {
|
||||
configurations.getOrCreate(configName)
|
||||
.also {
|
||||
dependencies.add(
|
||||
configName,
|
||||
dependencies.project(":dependencies:android-sdk", configuration = configName)
|
||||
)
|
||||
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)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependsOn(configuration)
|
||||
|
||||
if (this is Test) {
|
||||
val androidFilePath = configuration.singleFile.canonicalPath
|
||||
doFirst {
|
||||
systemProperty(systemPropertyName, configuration.singleFile.canonicalPath)
|
||||
systemProperty(systemPropertyName, androidFilePath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
|
||||
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
|
||||
if (extensions.findByType(TestDistributionExtension::class.java) == null) return
|
||||
|
||||
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
|
||||
val testDistributionEnabled = project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean()
|
||||
?: isTeamcityBuild
|
||||
|
||||
useJUnitPlatform()
|
||||
extensions.configure(TestDistributionExtension::class.java) {
|
||||
enabled.set(testDistributionEnabled)
|
||||
enabled.set(true)
|
||||
maxRemoteExecutors.set(20)
|
||||
if (isTeamcityBuild) {
|
||||
requirements.set(setOf("os=${OperatingSystem.current().familyName}"))
|
||||
|
||||
@@ -116,6 +116,12 @@ object AbstractTypeMapper {
|
||||
return asmType
|
||||
}
|
||||
|
||||
typeConstructor.isScript() -> {
|
||||
val asmType = AsmTypes.JAVA_CLASS_TYPE
|
||||
with(context) { sw?.writeGenericType(type, asmType, mode) }
|
||||
return asmType
|
||||
}
|
||||
|
||||
typeConstructor.isTypeParameter() -> {
|
||||
val typeParameter = typeConstructor as TypeParameterMarker
|
||||
return mapType(context, typeParameter.representativeUpperBound(), mode, null).also { asmType ->
|
||||
|
||||
@@ -51,7 +51,6 @@ interface BaseExpressionCodegen {
|
||||
|
||||
fun consumeReifiedOperationMarker(typeParameter: TypeParameterMarker)
|
||||
|
||||
@JvmDefault
|
||||
fun putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind) {
|
||||
with(typeSystem) {
|
||||
val (typeParameter, second) = extractReificationArgument(type) ?: return
|
||||
|
||||
@@ -88,6 +88,7 @@ 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;
|
||||
@@ -5532,4 +5533,11 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
parentCodegen.getReifiedTypeParametersUsages().addUsedReifiedParameter(typeParameterDescriptor.getName().asString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putReifiedOperationMarkerIfTypeIsReifiedParameter(
|
||||
@NotNull KotlinTypeMarker type, @NotNull ReifiedTypeInliner.OperationKind operationKind
|
||||
) {
|
||||
BaseExpressionCodegen.DefaultImpls.putReifiedOperationMarkerIfTypeIsReifiedParameter(this, type, operationKind);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1152,8 +1152,10 @@ 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 =
|
||||
DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor)
|
||||
(!isInterface(functionDescriptor.getContainingDeclaration()) || kind == OwnerKind.DEFAULT_IMPLS) &&
|
||||
(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 &&
|
||||
@@ -1689,7 +1691,7 @@ public class FunctionCodegen {
|
||||
return (kind != OwnerKind.DEFAULT_IMPLS && !isSyntheticInCompatibilityOrJvmDefault) ||
|
||||
(kind == OwnerKind.DEFAULT_IMPLS &&
|
||||
(isSyntheticInCompatibilityOrJvmDefault ||
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
|
||||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))) && !DescriptorVisibilities.isPrivate(memberDescriptor.getVisibility()));
|
||||
} else {
|
||||
switch (kind) {
|
||||
case DEFAULT_IMPLS: return true;
|
||||
|
||||
@@ -34,9 +34,13 @@ import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtTypeAlias
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
|
||||
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_SYNTHETIC_ANNOTATION_FQ_NAME
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
|
||||
@@ -125,8 +129,19 @@ class MultifileClassCodegenImpl(
|
||||
val superClassForFacade = if (shouldGeneratePartHierarchy) partInternalNamesSorted.last() else J_L_OBJECT
|
||||
|
||||
state.factory.newVisitor(MultifileClass(files.firstOrNull(), actualPackageFragment), facadeClassType, files).apply {
|
||||
var attributes = FACADE_CLASS_ATTRIBUTES
|
||||
|
||||
val nonJvmSyntheticParts = files.filterNot { it.isJvmSynthetic() }
|
||||
if (nonJvmSyntheticParts.isEmpty()) {
|
||||
attributes = attributes or Opcodes.ACC_SYNTHETIC
|
||||
} else if (nonJvmSyntheticParts.size < files.size) {
|
||||
for (part in nonJvmSyntheticParts) {
|
||||
state.diagnostics.report(ErrorsJvm.NOT_ALL_MULTIFILE_CLASS_PARTS_ARE_JVM_SYNTHETIC.on(part.packageDirective ?: part))
|
||||
}
|
||||
}
|
||||
|
||||
defineClass(
|
||||
singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
|
||||
singleSourceFile, state.classFileVersion, attributes,
|
||||
facadeClassType.internalName, null, superClassForFacade, emptyArray()
|
||||
)
|
||||
if (singleSourceFile != null) {
|
||||
@@ -146,6 +161,13 @@ class MultifileClassCodegenImpl(
|
||||
}
|
||||
}
|
||||
|
||||
private fun KtFile.isJvmSynthetic(): Boolean {
|
||||
return annotationEntries.any { entry ->
|
||||
val descriptor = state.bindingContext[BindingContext.ANNOTATION, entry]
|
||||
descriptor?.annotationClass?.let(DescriptorUtils::getFqNameSafe) == JVM_SYNTHETIC_ANNOTATION_FQ_NAME
|
||||
}
|
||||
}
|
||||
|
||||
override fun generate() {
|
||||
assert(delegateGenerationTasks.isEmpty()) { "generate() is called twice for facade class $facadeFqName" }
|
||||
|
||||
|
||||
@@ -36,14 +36,16 @@ class SamWrapperClasses(private val state: GenerationState) {
|
||||
expressionCodegen: ExpressionCodegen,
|
||||
contextDescriptor: CallableMemberDescriptor
|
||||
): Type {
|
||||
val isInsideInline = InlineUtil.isInlineOrContainingInline(expressionCodegen.context.contextDescriptor) ||
|
||||
isInsideInlineLambdaContext(expressionCodegen.context, state)
|
||||
val parentContext = expressionCodegen.context
|
||||
val isInsideInline = InlineUtil.isInlineOrContainingInline(parentContext.contextDescriptor) ||
|
||||
isInsideInlineLambdaContext(parentContext, state)
|
||||
return samInterfaceToWrapperClass.getOrPut(WrapperKey(samType, file, isInsideInline)) {
|
||||
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, isInsideInline).genWrapper(file, contextDescriptor)
|
||||
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, parentContext, isInsideInline)
|
||||
.genWrapper(file, contextDescriptor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState):Boolean {
|
||||
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState): Boolean {
|
||||
var parent: CodegenContext<*>? = context
|
||||
while (parent != null && parent != state.rootContext) {
|
||||
if (parent is InlineLambdaContext) return true
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.backend.common.CodegenUtil;
|
||||
import org.jetbrains.kotlin.codegen.context.ClassContext;
|
||||
import org.jetbrains.kotlin.codegen.context.CodegenContext;
|
||||
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
|
||||
import org.jetbrains.kotlin.config.LanguageFeature;
|
||||
@@ -64,6 +63,7 @@ public class SamWrapperCodegen {
|
||||
private final KotlinTypeMapper typeMapper;
|
||||
private final SamType samType;
|
||||
private final MemberCodegen<?> parentCodegen;
|
||||
private final CodegenContext<?> parentContext;
|
||||
private final int visibility;
|
||||
private final int classFlags;
|
||||
public static final String SAM_WRAPPER_SUFFIX = "$0";
|
||||
@@ -72,6 +72,7 @@ public class SamWrapperCodegen {
|
||||
@NotNull GenerationState state,
|
||||
@NotNull SamType samType,
|
||||
@NotNull MemberCodegen<?> parentCodegen,
|
||||
@NotNull CodegenContext<?> parentContext,
|
||||
boolean isInsideInline
|
||||
) {
|
||||
this.state = state;
|
||||
@@ -79,6 +80,7 @@ public class SamWrapperCodegen {
|
||||
this.typeMapper = state.getTypeMapper();
|
||||
this.samType = samType;
|
||||
this.parentCodegen = parentCodegen;
|
||||
this.parentContext = parentContext;
|
||||
visibility = isInsideInline ? ACC_PUBLIC : NO_FLAG_PACKAGE_PRIVATE;
|
||||
int synth = state.getLanguageVersionSettings().supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic) ? ACC_SYNTHETIC : 0;
|
||||
classFlags = visibility | ACC_FINAL | ACC_SUPER | synth;
|
||||
@@ -170,7 +172,6 @@ public class SamWrapperCodegen {
|
||||
|
||||
private void generateInnerClassInformation(@NotNull KtFile file, Type asmType, ClassBuilder cv) {
|
||||
parentCodegen.addSyntheticAnonymousInnerClass(new SyntheticInnerClassInfo(asmType.getInternalName(), classFlags));
|
||||
FieldOwnerContext<?> parentContext = parentCodegen.context;
|
||||
CodegenContext<?> outerContext = MemberCodegen.getNonInlineOuterContext(parentContext);
|
||||
assert outerContext != null :
|
||||
"Outer context for SAM wrapper " + asmType.getInternalName() + " is null, parentContext:" + parentContext;
|
||||
|
||||
@@ -1217,6 +1217,27 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
|
||||
fun isAlive(insnIndex: Int, variableIndex: Int): Boolean =
|
||||
liveness[insnIndex].isAlive(variableIndex)
|
||||
|
||||
fun nextSuspensionPointEndLabel(insn: AbstractInsnNode): LabelNode {
|
||||
val suspensionPoint =
|
||||
InsnSequence(insn, method.instructions.last).firstOrNull { isAfterSuspendMarker(it) } ?: method.instructions.last
|
||||
return suspensionPoint as? LabelNode ?: suspensionPoint.findNextOrNull { it is LabelNode } as LabelNode
|
||||
}
|
||||
|
||||
fun nextSuspensionPointStartLabel(insn: AbstractInsnNode): LabelNode {
|
||||
val suspensionPoint =
|
||||
InsnSequence(insn, method.instructions.last).firstOrNull { isBeforeSuspendMarker(it) } ?: method.instructions.last
|
||||
return suspensionPoint as? LabelNode ?: suspensionPoint.findPreviousOrNull { it is LabelNode } as LabelNode
|
||||
}
|
||||
|
||||
fun min(a: LabelNode, b: LabelNode): LabelNode =
|
||||
if (method.instructions.indexOf(a) < method.instructions.indexOf(b)) a else b
|
||||
|
||||
fun max(a: LabelNode, b: LabelNode): LabelNode =
|
||||
if (method.instructions.indexOf(a) < method.instructions.indexOf(b)) b else a
|
||||
|
||||
fun containsSuspensionPoint(a: LabelNode, b: LabelNode): Boolean =
|
||||
InsnSequence(min(a, b), max(a, b)).none { isBeforeSuspendMarker(it) }
|
||||
|
||||
val oldLvt = arrayListOf<LocalVariableNode>()
|
||||
for (record in method.localVariables) {
|
||||
oldLvt += record
|
||||
@@ -1237,23 +1258,35 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
|
||||
// No variable in LVT -> do not add one
|
||||
val lvtRecord = oldLvt.findRecord(insnIndex, variableIndex) ?: continue
|
||||
if (lvtRecord.name == CONTINUATION_VARIABLE_NAME) continue
|
||||
val endLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode ?: continue
|
||||
// Extend lvt record to the next suspension point
|
||||
val endLabel = min(lvtRecord.end, nextSuspensionPointEndLabel(insn))
|
||||
// startLabel can be null in case of parameters
|
||||
@Suppress("NAME_SHADOWING") val startLabel = startLabel ?: lvtRecord.start
|
||||
// Attempt to extend existing local variable node corresponding to the record in
|
||||
// the original local variable table.
|
||||
var recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
|
||||
if (recordToExtend != null && InsnSequence(recordToExtend.end, startLabel).none { isBeforeSuspendMarker(it) }) {
|
||||
val recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
|
||||
if (recordToExtend != null && containsSuspensionPoint(recordToExtend.end, startLabel)) {
|
||||
recordToExtend.end = endLabel
|
||||
} else {
|
||||
val node = LocalVariableNode(lvtRecord.name, lvtRecord.desc, lvtRecord.signature, startLabel, endLabel, lvtRecord.index)
|
||||
method.localVariables.add(node)
|
||||
if (lvtRecord !in oldLvtNodeToLatestNewLvtNode) {
|
||||
method.localVariables.add(node)
|
||||
}
|
||||
oldLvtNodeToLatestNewLvtNode[lvtRecord] = node
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val deadVariables = arrayListOf<Int>()
|
||||
outer@for (variableIndex in start until method.maxLocals) {
|
||||
if (oldLvt.none { it.index == variableIndex }) continue
|
||||
for (insnIndex in 0 until (method.instructions.size() - 1)) {
|
||||
if (isAlive(insnIndex, variableIndex)) continue@outer
|
||||
}
|
||||
deadVariables += variableIndex
|
||||
}
|
||||
|
||||
for (variable in oldLvt) {
|
||||
// $continuation and $result are dead, but they are used by debugger, as well as fake inliner variables
|
||||
// For example, $continuation is used to create async stack trace
|
||||
@@ -1262,10 +1295,26 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
|
||||
isFakeLocalVariableForInline(variable.name)
|
||||
) {
|
||||
method.localVariables.add(variable)
|
||||
continue
|
||||
}
|
||||
// this acts like $continuation for lambdas. For example, it is used by debugger to create async stack trace. Keep it.
|
||||
if (variable.name == "this" && !isForNamedFunction) {
|
||||
method.localVariables.add(variable)
|
||||
continue
|
||||
}
|
||||
|
||||
// Shrink LVT records of dead variables to the next suspension point
|
||||
if (variable.index in deadVariables) {
|
||||
method.localVariables.add(
|
||||
LocalVariableNode(
|
||||
variable.name,
|
||||
variable.desc,
|
||||
variable.signature,
|
||||
variable.start,
|
||||
nextSuspensionPointStartLabel(variable.start),
|
||||
variable.index
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,11 +108,9 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
|
||||
)
|
||||
}
|
||||
|
||||
protected fun generateStub(resolvedCall: ResolvedCall<*>?, codegen: BaseExpressionCodegen) {
|
||||
protected fun generateStub(text: String, codegen: BaseExpressionCodegen) {
|
||||
leaveTemps()
|
||||
assert(resolvedCall != null)
|
||||
val message = "Call is part of inline cycle: " + resolvedCall!!.call.callElement.text
|
||||
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", message)
|
||||
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", "Call is part of inline cycle: $text")
|
||||
}
|
||||
|
||||
protected fun endCall(result: InlineResult, registerLineNumberAfterwards: Boolean) {
|
||||
|
||||
@@ -60,8 +60,8 @@ class PsiInlineCodegen(
|
||||
callDefault: Boolean,
|
||||
codegen: ExpressionCodegen
|
||||
) {
|
||||
if (!state.globalInlineContext.enterIntoInlining(resolvedCall?.resultingDescriptor, resolvedCall?.call?.callElement)) {
|
||||
generateStub(resolvedCall, codegen)
|
||||
if (!state.globalInlineContext.enterIntoInlining(functionDescriptor, resolvedCall?.call?.callElement)) {
|
||||
generateStub(resolvedCall?.call?.callElement?.text ?: "<no source>", codegen)
|
||||
return
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -61,7 +61,7 @@ class InsnSequence(val from: AbstractInsnNode, val to: AbstractInsnNode?) : Sequ
|
||||
}
|
||||
}
|
||||
|
||||
fun InsnList.asSequence() = InsnSequence(this)
|
||||
fun InsnList.asSequence(): Sequence<AbstractInsnNode> = if (size() == 0) emptySequence() else InsnSequence(this)
|
||||
|
||||
fun MethodNode.prepareForEmitting() {
|
||||
stripOptimizationMarkers()
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.codegen.optimization.transformer;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
import org.jetbrains.org.objectweb.asm.tree.MethodNode;
|
||||
import org.jetbrains.org.objectweb.asm.tree.analysis.*;
|
||||
|
||||
@@ -31,7 +32,7 @@ public abstract class MethodTransformer {
|
||||
return analyzer.analyze(internalClassName, node);
|
||||
}
|
||||
catch (AnalyzerException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -213,13 +213,13 @@ class GenerationState private constructor(
|
||||
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS)
|
||||
if (fromConfig != null && target >= fromConfig.minJvmTarget)
|
||||
fromConfig
|
||||
else {
|
||||
// TODO wait for KT-44844 (properly support 'invokedynamic' in JPS incremental compilation)
|
||||
// Use JvmClosureGenerationScheme.INDY if
|
||||
// JVM target is at least JVM_1_8 &&
|
||||
// SamWrapperClassesAreSynthetic language feature is supported
|
||||
else if (
|
||||
target >= JvmClosureGenerationScheme.INDY.minJvmTarget &&
|
||||
languageVersionSettings.supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic)
|
||||
)
|
||||
JvmClosureGenerationScheme.INDY
|
||||
else
|
||||
JvmClosureGenerationScheme.CLASS
|
||||
}
|
||||
}
|
||||
|
||||
val lambdasScheme = run {
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.codegen
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.JvmAnalysisFlags
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.jetbrains.org.objectweb.asm.AnnotationVisitor
|
||||
|
||||
@@ -31,6 +32,9 @@ fun writeKotlinMetadata(
|
||||
) {
|
||||
val av = cb.newAnnotation(JvmAnnotationNames.METADATA_DESC, true)
|
||||
av.visit(JvmAnnotationNames.METADATA_VERSION_FIELD_NAME, state.metadataVersion.toArray())
|
||||
if (!state.metadataVersion.isAtLeast(1, 5, 0)) {
|
||||
av.visit("bv", JvmBytecodeBinaryVersion.INSTANCE.toArray())
|
||||
}
|
||||
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
|
||||
var flags = extraFlags
|
||||
if (state.languageVersionSettings.isPreRelease()) {
|
||||
|
||||
@@ -103,8 +103,11 @@ projectTest(parallel = true) {
|
||||
|
||||
workingDir = rootDir
|
||||
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
|
||||
val antLauncherJarPathProvider = project.provider {
|
||||
antLauncherJar.asPath
|
||||
}
|
||||
doFirst {
|
||||
systemProperty("kotlin.ant.classpath", antLauncherJar.asPath)
|
||||
systemProperty("kotlin.ant.classpath", antLauncherJarPathProvider.get())
|
||||
systemProperty("kotlin.ant.launcher.class", "org.apache.tools.ant.Main")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,10 @@ while [ $# -gt 0 ]; do
|
||||
;;
|
||||
-J*)
|
||||
java_args=("${java_args[@]}" "${1:2}")
|
||||
if [ "x${1:2}" = "x" ]; then
|
||||
echo "error: empty -J argument"
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -28,6 +28,10 @@ set _arg=%~1
|
||||
if "%_arg%" == "" goto loopend
|
||||
|
||||
if "%_arg:~0,2%"=="-J" (
|
||||
if "%_arg:~2%"=="" (
|
||||
echo error: empty -J argument
|
||||
goto error
|
||||
)
|
||||
set JAVA_OPTS=%JAVA_OPTS% "%_arg:~2%"
|
||||
) else (
|
||||
if "%_arg:~0,2%"=="-D" (
|
||||
@@ -67,7 +71,6 @@ if "!_KOTLIN_RUNNER!"=="1" (
|
||||
%_KOTLIN_COMPILER% %KOTLIN_OPTS%
|
||||
)
|
||||
|
||||
exit /b %ERRORLEVEL%
|
||||
goto end
|
||||
|
||||
rem ##########################################################################
|
||||
@@ -103,5 +106,8 @@ rem Needs to be executed in the EnableDelayedExpansion mode.
|
||||
)
|
||||
goto :eof
|
||||
|
||||
:error
|
||||
set ERRORLEVEL=1
|
||||
|
||||
:end
|
||||
endlocal
|
||||
exit /b %ERRORLEVEL%
|
||||
@@ -12,6 +12,7 @@ dependencies {
|
||||
compile(project(":compiler:backend-common"))
|
||||
compile(project(":compiler:backend"))
|
||||
compile(project(":compiler:backend.jvm"))
|
||||
implementation(project(":compiler:backend.jvm:backend.jvm.entrypoint"))
|
||||
compile(project(":compiler:ir.backend.common"))
|
||||
compile(project(":compiler:light-classes"))
|
||||
compile(project(":compiler:serialization"))
|
||||
|
||||
@@ -16,8 +16,54 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common
|
||||
|
||||
val KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY = "kotlin.environment.keepalive"
|
||||
import com.intellij.util.LineSeparator
|
||||
import java.util.*
|
||||
|
||||
enum class CompilerSystemProperties(val property: String) {
|
||||
COMPILE_DAEMON_ENABLED_PROPERTY("kotlin.daemon.enabled"),
|
||||
COMPILE_DAEMON_JVM_OPTIONS_PROPERTY("kotlin.daemon.jvm.options"),
|
||||
COMPILE_DAEMON_OPTIONS_PROPERTY("kotlin.daemon.options"),
|
||||
COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY("kotlin.daemon.client.options"),
|
||||
COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY("kotlin.daemon.client.alive.path"),
|
||||
COMPILE_DAEMON_LOG_PATH_PROPERTY("kotlin.daemon.log.path"),
|
||||
COMPILE_DAEMON_REPORT_PERF_PROPERTY("kotlin.daemon.perf"),
|
||||
COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY("kotlin.daemon.verbose"),
|
||||
COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY("kotlin.daemon.startup.timeout"),
|
||||
JAVA_RMI_SERVER_HOSTNAME("java.rmi.server.hostname"),
|
||||
DAEMON_RMI_SOCKET_BACKLOG_SIZE_PROPERTY("kotlin.daemon.socket.backlog.size"),
|
||||
DAEMON_RMI_SOCKET_CONNECT_ATTEMPTS_PROPERTY("kotlin.daemon.socket.connect.attempts"),
|
||||
DAEMON_RMI_SOCKET_CONNECT_INTERVAL_PROPERTY("kotlin.daemon.socket.connect.interval"),
|
||||
KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY("kotlin.environment.keepalive"),
|
||||
COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS("kotlin.daemon.custom.run.files.path.for.tests"),
|
||||
KOTLIN_COLORS_ENABLED_PROPERTY("kotlin.colors.enabled"),
|
||||
OS_NAME("os.name")
|
||||
;
|
||||
|
||||
var value
|
||||
get() = systemPropertyGetter(property)
|
||||
set(value) {
|
||||
systemPropertySetter(property, value!!)
|
||||
}
|
||||
|
||||
fun clear(): String? = systemPropertyCleaner(property)
|
||||
|
||||
companion object {
|
||||
var systemPropertyGetter: (String) -> String? = {
|
||||
System.getProperty(it)
|
||||
}
|
||||
|
||||
var systemPropertySetter: (String, String) -> String? = { key, value ->
|
||||
System.setProperty(key, value)
|
||||
}
|
||||
|
||||
var systemPropertyCleaner: (String) -> String? = { key ->
|
||||
System.clearProperty(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val isWindows: Boolean
|
||||
get() = CompilerSystemProperties.OS_NAME.value!!.toLowerCase(Locale.ENGLISH).startsWith("windows")
|
||||
|
||||
fun String?.toBooleanLenient(): Boolean? = when (this?.toLowerCase()) {
|
||||
null -> false
|
||||
|
||||
@@ -205,8 +205,8 @@ abstract class CLITool<A : CommonToolArguments> {
|
||||
if (System.getProperty("java.awt.headless") == null) {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
}
|
||||
if (System.getProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY) == null) {
|
||||
System.setProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY, "true")
|
||||
if (CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.value == null) {
|
||||
CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.value = "true"
|
||||
}
|
||||
|
||||
setupIdeaStandaloneExecution()
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.cli.common.messages;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.LineSeparator;
|
||||
import kotlin.text.StringsKt;
|
||||
import org.fusesource.jansi.Ansi;
|
||||
import org.fusesource.jansi.internal.CLibrary;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties;
|
||||
import org.jetbrains.kotlin.cli.common.PropertiesKt;
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.CapitalizeDecapitalizeKt;
|
||||
|
||||
import java.util.EnumSet;
|
||||
@@ -31,13 +31,12 @@ import java.util.Set;
|
||||
import static org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*;
|
||||
|
||||
public abstract class PlainTextMessageRenderer implements MessageRenderer {
|
||||
public static final String KOTLIN_COLORS_ENABLED_PROPERTY = "kotlin.colors.enabled";
|
||||
public static final boolean COLOR_ENABLED;
|
||||
|
||||
static {
|
||||
boolean colorEnabled = false;
|
||||
// TODO: investigate why ANSI escape codes on Windows only work in REPL for some reason
|
||||
if (!SystemInfo.isWindows && "true".equals(System.getProperty(KOTLIN_COLORS_ENABLED_PROPERTY))) {
|
||||
if (!PropertiesKt.isWindows() && "true".equals(CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.getValue())) {
|
||||
try {
|
||||
// AnsiConsole doesn't check isatty() for stderr (see https://github.com/fusesource/jansi/pull/35).
|
||||
colorEnabled = CLibrary.isatty(CLibrary.STDERR_FILENO) != 0;
|
||||
@@ -49,7 +48,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
|
||||
COLOR_ENABLED = colorEnabled;
|
||||
}
|
||||
|
||||
private static final String LINE_SEPARATOR = LineSeparator.getSystemLineSeparator().getSeparatorString();
|
||||
private static final String LINE_SEPARATOR = System.lineSeparator();
|
||||
|
||||
private static final Set<CompilerMessageSeverity> IMPORTANT_MESSAGE_SEVERITIES = EnumSet.of(EXCEPTION, ERROR, STRONG_WARNING, WARNING);
|
||||
|
||||
|
||||
@@ -23,13 +23,24 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
|
||||
import java.io.File
|
||||
import java.io.FileNotFoundException
|
||||
|
||||
fun OutputFileCollection.writeAll(outputDir: File, report: ((file: OutputFile, sources: List<File>, output: File) -> Unit)?) {
|
||||
for (file in asList()) {
|
||||
val sources = file.sourceFiles
|
||||
val output = File(outputDir, file.relativePath)
|
||||
report?.invoke(file, sources, output)
|
||||
FileUtil.writeToFile(output, file.asByteArray())
|
||||
try {
|
||||
FileUtil.writeToFile(output, file.asByteArray())
|
||||
} catch (e: FileNotFoundException) {
|
||||
if (outputDir.isDirectory) {
|
||||
// output directory exists
|
||||
throw NoPermissionException("error while writing $output (Permission denied)", e)
|
||||
}
|
||||
// Failed to create directory, possibly due to lack of write permission or clash with existing file.
|
||||
// In both cases, the directory will not exist, so for the sake of simplicity, we treat them same way.
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +49,16 @@ fun OutputFileCollection.writeAllTo(outputDir: File) {
|
||||
}
|
||||
|
||||
fun OutputFileCollection.writeAll(outputDir: File, messageCollector: MessageCollector, reportOutputFiles: Boolean) {
|
||||
if (!reportOutputFiles) writeAllTo(outputDir)
|
||||
else writeAll(outputDir) { _, sources, output ->
|
||||
messageCollector.report(CompilerMessageSeverity.OUTPUT, OutputMessageUtil.formatOutputMessage(sources, output))
|
||||
try {
|
||||
if (!reportOutputFiles) writeAllTo(outputDir)
|
||||
else writeAll(outputDir) { _, sources, output ->
|
||||
messageCollector.report(CompilerMessageSeverity.OUTPUT, OutputMessageUtil.formatOutputMessage(sources, output))
|
||||
}
|
||||
} catch (e: NoPermissionException) {
|
||||
messageCollector.report(CompilerMessageSeverity.ERROR, e.message!!)
|
||||
} catch (e: FileNotFoundException) {
|
||||
messageCollector.report(CompilerMessageSeverity.ERROR, "directory not found: $outputDir")
|
||||
}
|
||||
}
|
||||
|
||||
private class NoPermissionException(message: String, cause: Throwable?) : IllegalStateException(message, cause)
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFile;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection;
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity;
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector;
|
||||
import org.jetbrains.kotlin.cli.common.modules.ModuleChunk;
|
||||
import org.jetbrains.kotlin.cli.common.modules.ModuleXmlParser;
|
||||
@@ -104,16 +105,26 @@ public class CompileEnvironmentUtil {
|
||||
}
|
||||
|
||||
public static void writeToJar(
|
||||
File jarPath, boolean jarRuntime, boolean noReflect, boolean resetJarTimestamps, FqName mainClass, OutputFileCollection outputFiles
|
||||
File jarPath,
|
||||
boolean jarRuntime,
|
||||
boolean noReflect,
|
||||
boolean resetJarTimestamps,
|
||||
FqName mainClass,
|
||||
OutputFileCollection outputFiles,
|
||||
MessageCollector messageCollector
|
||||
) {
|
||||
FileOutputStream outputStream = null;
|
||||
try {
|
||||
// we should try to create the output dir first
|
||||
if (jarPath.getParentFile() != null) {
|
||||
jarPath.getParentFile().mkdirs();
|
||||
}
|
||||
outputStream = new FileOutputStream(jarPath);
|
||||
doWriteToJar(outputFiles, outputStream, mainClass, jarRuntime, noReflect, resetJarTimestamps);
|
||||
outputStream.close();
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
throw new CompileEnvironmentException("Invalid jar path " + jarPath, e);
|
||||
messageCollector.report(CompilerMessageSeverity.ERROR, "Invalid jar path: " + jarPath, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
|
||||
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.CliModuleVisibilityManagerImpl
|
||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.config.ContentRoot
|
||||
import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot
|
||||
import org.jetbrains.kotlin.cli.common.config.kotlinSourceRoots
|
||||
@@ -498,16 +498,13 @@ class KotlinCoreEnvironment private constructor(
|
||||
}
|
||||
// Disposing of the environment is unsafe in production then parallel builds are enabled, but turning it off universally
|
||||
// breaks a lot of tests, therefore it is disabled for production and enabled for tests
|
||||
if (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY).toBooleanLenient() != true) {
|
||||
if (CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value.toBooleanLenient() != true) {
|
||||
// JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ)
|
||||
// All projects share the same ApplicationEnvironment, and when the last project is disposed, the ApplicationEnvironment is disposed as well
|
||||
@Suppress("ObjectLiteralToLambda") // Disposer tree depends on identity of disposables.
|
||||
Disposer.register(parentDisposable, object : Disposable {
|
||||
override fun dispose() {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
if (--ourProjectCount <= 0) {
|
||||
disposeApplicationEnvironment()
|
||||
}
|
||||
Disposer.register(parentDisposable, Disposable {
|
||||
synchronized(APPLICATION_LOCK) {
|
||||
if (--ourProjectCount <= 0) {
|
||||
disposeApplicationEnvironment()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection
|
||||
import org.jetbrains.kotlin.backend.common.output.SimpleOutputFileCollection
|
||||
import org.jetbrains.kotlin.backend.common.phaser.PhaseConfig
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensions
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmGeneratorExtensionsImpl
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory
|
||||
import org.jetbrains.kotlin.backend.jvm.jvmPhases
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
@@ -57,9 +57,7 @@ import org.jetbrains.kotlin.fir.analysis.FirAnalyzerFacade
|
||||
import org.jetbrains.kotlin.fir.backend.jvm.FirJvmBackendClassResolver
|
||||
import org.jetbrains.kotlin.fir.backend.jvm.FirJvmBackendExtension
|
||||
import org.jetbrains.kotlin.fir.checkers.registerExtendedCommonCheckers
|
||||
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
|
||||
import org.jetbrains.kotlin.fir.session.FirJvmModuleInfo
|
||||
import org.jetbrains.kotlin.fir.session.FirSessionFactory
|
||||
import org.jetbrains.kotlin.fir.createSessionWithDependencies
|
||||
import org.jetbrains.kotlin.ir.backend.jvm.jvmResolveLibraries
|
||||
import org.jetbrains.kotlin.javac.JavacWrapper
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
|
||||
@@ -88,7 +86,7 @@ object KotlinToJVMBytecodeCompiler {
|
||||
val includeRuntime = configuration.get(JVMConfigurationKeys.INCLUDE_RUNTIME, false)
|
||||
val noReflect = configuration.get(JVMConfigurationKeys.NO_REFLECT, false)
|
||||
val resetJarTimestamps = !configuration.get(JVMConfigurationKeys.NO_RESET_JAR_TIMESTAMPS, false)
|
||||
CompileEnvironmentUtil.writeToJar(jarPath, includeRuntime, noReflect, resetJarTimestamps, mainClassFqName, outputFiles)
|
||||
CompileEnvironmentUtil.writeToJar(jarPath, includeRuntime, noReflect, resetJarTimestamps, mainClassFqName, outputFiles, messageCollector)
|
||||
if (reportOutputFiles) {
|
||||
val message = OutputMessageUtil.formatOutputMessage(outputFiles.asList().flatMap { it.sourceFiles }.distinct(), jarPath)
|
||||
messageCollector.report(OUTPUT, message)
|
||||
@@ -318,25 +316,26 @@ object KotlinToJVMBytecodeCompiler {
|
||||
if (!checkKotlinPackageUsage(environment, ktFiles)) return false
|
||||
val moduleConfiguration = projectConfiguration.applyModuleProperties(module, buildFile)
|
||||
|
||||
val scope = GlobalSearchScope.filesScope(project, ktFiles.map { it.virtualFile })
|
||||
val sourceScope = GlobalSearchScope.filesScope(project, ktFiles.map { it.virtualFile })
|
||||
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(project))
|
||||
val provider = FirProjectSessionProvider()
|
||||
|
||||
val librariesModuleInfo = FirJvmModuleInfo.createForLibraries()
|
||||
val librariesScope = ProjectScope.getLibrariesScope(project)
|
||||
FirSessionFactory.createLibrarySession(
|
||||
librariesModuleInfo, provider, librariesScope,
|
||||
project, environment.createPackagePartProvider(librariesScope)
|
||||
)
|
||||
|
||||
val moduleInfo = FirJvmModuleInfo(module, listOf(librariesModuleInfo))
|
||||
val session = FirSessionFactory.createJavaModuleBasedSession(moduleInfo, provider, scope, project) {
|
||||
val languageVersionSettings = moduleConfiguration.languageVersionSettings
|
||||
val session = createSessionWithDependencies(
|
||||
module,
|
||||
project,
|
||||
languageVersionSettings,
|
||||
sourceScope,
|
||||
librariesScope,
|
||||
environment::createPackagePartProvider
|
||||
) {
|
||||
if (extendedAnalysisMode) {
|
||||
registerExtendedCommonCheckers()
|
||||
}
|
||||
}
|
||||
|
||||
val firAnalyzerFacade = FirAnalyzerFacade(session, moduleConfiguration.languageVersionSettings, ktFiles)
|
||||
val firAnalyzerFacade = FirAnalyzerFacade(session, languageVersionSettings, ktFiles)
|
||||
|
||||
firAnalyzerFacade.runResolution()
|
||||
val firDiagnostics = firAnalyzerFacade.runCheckers().values.flatten()
|
||||
@@ -353,8 +352,8 @@ object KotlinToJVMBytecodeCompiler {
|
||||
performanceManager?.notifyGenerationStarted()
|
||||
|
||||
performanceManager?.notifyIRTranslationStarted()
|
||||
val extensions = JvmGeneratorExtensions()
|
||||
val (moduleFragment, symbolTable, sourceManager, components) = firAnalyzerFacade.convertToIr(extensions)
|
||||
val extensions = JvmGeneratorExtensionsImpl()
|
||||
val (moduleFragment, symbolTable, components) = firAnalyzerFacade.convertToIr(extensions)
|
||||
|
||||
performanceManager?.notifyIRTranslationFinished()
|
||||
|
||||
@@ -390,12 +389,11 @@ object KotlinToJVMBytecodeCompiler {
|
||||
performanceManager?.notifyIRLoweringStarted()
|
||||
generationState.beforeCompile()
|
||||
codegenFactory.generateModuleInFrontendIRMode(
|
||||
generationState, moduleFragment, symbolTable, sourceManager, extensions, FirJvmBackendExtension(session, components),
|
||||
{
|
||||
performanceManager?.notifyIRLoweringFinished()
|
||||
performanceManager?.notifyIRGenerationStarted()
|
||||
}
|
||||
)
|
||||
generationState, moduleFragment, symbolTable, extensions, FirJvmBackendExtension(session, components)
|
||||
) {
|
||||
performanceManager?.notifyIRLoweringFinished()
|
||||
performanceManager?.notifyIRGenerationStarted()
|
||||
}
|
||||
CodegenFactory.doCheckCancelled(generationState)
|
||||
generationState.factory.done()
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ internal class K2MetadataKlibSerializer(private val metadataVersion: BuiltInsBin
|
||||
configuration.languageVersionSettings,
|
||||
metadataVersion,
|
||||
project,
|
||||
exportKDoc = false,
|
||||
skipExpects = false,
|
||||
includeOnlyModuleContent = true
|
||||
).serializeModule(module)
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
|
||||
description = "Compiler runner + daemon client"
|
||||
|
||||
plugins {
|
||||
|
||||
@@ -25,8 +25,9 @@ tasks.withType<JavaCompile> {
|
||||
}
|
||||
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
inputs.property("compilerVersion", kotlinVersion)
|
||||
val kotlinVersionLocal = kotlinVersion
|
||||
inputs.property("compilerVersion", kotlinVersionLocal)
|
||||
filesMatching("META-INF/compiler.version") {
|
||||
filter<ReplaceTokens>("tokens" to mapOf("snapshot" to kotlinVersion))
|
||||
filter<ReplaceTokens>("tokens" to mapOf("snapshot" to kotlinVersionLocal))
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import kotlinx.coroutines.Deferred
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.daemon.client.CompileServiceSessionAsync
|
||||
@@ -44,13 +45,13 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
val DAEMON_DEFAULT_STARTUP_TIMEOUT_MS = 10000L
|
||||
val DAEMON_CONNECT_CYCLE_ATTEMPTS = 3
|
||||
|
||||
val verboseReporting = System.getProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY) != null
|
||||
val verboseReporting = CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value != null
|
||||
|
||||
private val log = Logger.getLogger("KotlinCompilerClient")
|
||||
|
||||
override fun getOrCreateClientFlagFile(daemonOptions: DaemonOptions): File =
|
||||
// for jps property is passed from IDEA to JPS in KotlinBuildProcessParametersProvider
|
||||
System.getProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY)
|
||||
CompilerSystemProperties.COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY.value
|
||||
?.let(String::trimQuotes)
|
||||
?.takeUnless(String::isBlank)
|
||||
?.let(::File)
|
||||
@@ -210,8 +211,6 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
}
|
||||
}
|
||||
|
||||
val COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY: String = "kotlin.daemon.client.options"
|
||||
|
||||
data class ClientOptions(
|
||||
var stop: Boolean = false
|
||||
) : OptionsGroup {
|
||||
@@ -220,11 +219,11 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
}
|
||||
|
||||
private fun configureClientOptions(opts: ClientOptions): ClientOptions {
|
||||
System.getProperty(COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY)?.let {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY.value?.let {
|
||||
val unrecognized = it.trimQuotes().split(",").filterExtractProps(opts.mappers, "")
|
||||
if (unrecognized.any())
|
||||
throw IllegalArgumentException(
|
||||
"Unrecognized client options passed via property $COMPILE_DAEMON_OPTIONS_PROPERTY: " + unrecognized.joinToString(" ") +
|
||||
"Unrecognized client options passed via property ${CompilerSystemProperties.COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY.property}: " + unrecognized.joinToString(" ") +
|
||||
"\nSupported options: " + opts.mappers.joinToString(", ", transform = { it.names.first() })
|
||||
)
|
||||
}
|
||||
@@ -456,11 +455,11 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
reportingTargets: DaemonReportingTargets
|
||||
): Boolean {
|
||||
val javaExecutable = File(File(System.getProperty("java.home"), "bin"), "java")
|
||||
val serverHostname = System.getProperty(JAVA_RMI_SERVER_HOSTNAME) ?: error("$JAVA_RMI_SERVER_HOSTNAME is not set!")
|
||||
val serverHostname = CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value ?: error("${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property} is not set!")
|
||||
val platformSpecificOptions = listOf(
|
||||
// hide daemon window
|
||||
"-Djava.awt.headless=true",
|
||||
"-D$JAVA_RMI_SERVER_HOSTNAME=$serverHostname"
|
||||
"-D${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property}=$serverHostname"
|
||||
)
|
||||
val args = listOf(
|
||||
javaExecutable.absolutePath, "-cp", compilerId.compilerClasspath.joinToString(File.pathSeparator)
|
||||
@@ -509,13 +508,13 @@ class KotlinCompilerClient : KotlinCompilerDaemonClient {
|
||||
}
|
||||
try {
|
||||
// trying to wait for process
|
||||
val daemonStartupTimeout = System.getProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY)?.let {
|
||||
val daemonStartupTimeout = CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.value?.let {
|
||||
try {
|
||||
it.toLong()
|
||||
} catch (e: Exception) {
|
||||
reportingTargets.report(
|
||||
DaemonReportCategory.INFO,
|
||||
"unable to interpret $COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY property ('$it'); using default timeout $DAEMON_DEFAULT_STARTUP_TIMEOUT_MS ms"
|
||||
"unable to interpret ${CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.property} property ('$it'); using default timeout $DAEMON_DEFAULT_STARTUP_TIMEOUT_MS ms"
|
||||
)
|
||||
null
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.client
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.daemon.common.*
|
||||
@@ -48,11 +49,11 @@ object KotlinCompilerClient {
|
||||
val DAEMON_DEFAULT_STARTUP_TIMEOUT_MS = 10000L
|
||||
val DAEMON_CONNECT_CYCLE_ATTEMPTS = 3
|
||||
|
||||
val verboseReporting = System.getProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY) != null
|
||||
val verboseReporting = CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value != null
|
||||
|
||||
fun getOrCreateClientFlagFile(daemonOptions: DaemonOptions): File =
|
||||
// for jps property is passed from IDEA to JPS in KotlinBuildProcessParametersProvider
|
||||
System.getProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY)
|
||||
CompilerSystemProperties.COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY.value
|
||||
?.let(String::trimQuotes)
|
||||
?.takeUnless(String::isBlank)
|
||||
?.let(::File)
|
||||
@@ -211,7 +212,6 @@ object KotlinCompilerClient {
|
||||
).get()
|
||||
}
|
||||
|
||||
val COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY: String = "kotlin.daemon.client.options"
|
||||
data class ClientOptions(
|
||||
var stop: Boolean = false
|
||||
) : OptionsGroup {
|
||||
@@ -220,11 +220,11 @@ object KotlinCompilerClient {
|
||||
}
|
||||
|
||||
private fun configureClientOptions(opts: ClientOptions): ClientOptions {
|
||||
System.getProperty(COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY)?.let {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY.value?.let {
|
||||
val unrecognized = it.trimQuotes().split(",").filterExtractProps(opts.mappers, "")
|
||||
if (unrecognized.any())
|
||||
throw IllegalArgumentException(
|
||||
"Unrecognized client options passed via property $COMPILE_DAEMON_OPTIONS_PROPERTY: " + unrecognized.joinToString(" ") +
|
||||
"Unrecognized client options passed via property ${CompilerSystemProperties.COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY.property}: " + unrecognized.joinToString(" ") +
|
||||
"\nSupported options: " + opts.mappers.joinToString(", ", transform = { it.names.first() }))
|
||||
}
|
||||
return opts
|
||||
@@ -369,11 +369,11 @@ object KotlinCompilerClient {
|
||||
|
||||
private fun startDaemon(compilerId: CompilerId, daemonJVMOptions: DaemonJVMOptions, daemonOptions: DaemonOptions, reportingTargets: DaemonReportingTargets): Boolean {
|
||||
val javaExecutable = File(File(System.getProperty("java.home"), "bin"), "java")
|
||||
val serverHostname = System.getProperty(JAVA_RMI_SERVER_HOSTNAME) ?: error("$JAVA_RMI_SERVER_HOSTNAME is not set!")
|
||||
val serverHostname = CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value ?: error("${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property} is not set!")
|
||||
val platformSpecificOptions = listOf(
|
||||
// hide daemon window
|
||||
"-Djava.awt.headless=true",
|
||||
"-D$JAVA_RMI_SERVER_HOSTNAME=$serverHostname")
|
||||
"-D$${CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.property}=$serverHostname")
|
||||
val javaVersion = System.getProperty("java.specification.version")?.toIntOrNull()
|
||||
val javaIllegalAccessWorkaround =
|
||||
if (javaVersion != null && javaVersion >= 16)
|
||||
@@ -424,12 +424,12 @@ object KotlinCompilerClient {
|
||||
}
|
||||
try {
|
||||
// trying to wait for process
|
||||
val daemonStartupTimeout = System.getProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY)?.let {
|
||||
val daemonStartupTimeout = CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.value?.let {
|
||||
try {
|
||||
it.toLong()
|
||||
}
|
||||
catch (e: Exception) {
|
||||
reportingTargets.report(DaemonReportCategory.INFO, "unable to interpret $COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY property ('$it'); using default timeout $DAEMON_DEFAULT_STARTUP_TIMEOUT_MS ms")
|
||||
reportingTargets.report(DaemonReportCategory.INFO, "unable to interpret ${CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.property} property ('$it'); using default timeout $DAEMON_DEFAULT_STARTUP_TIMEOUT_MS ms")
|
||||
null
|
||||
}
|
||||
} ?: DAEMON_DEFAULT_STARTUP_TIMEOUT_MS
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.common
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
import java.lang.management.ManagementFactory
|
||||
@@ -24,53 +24,47 @@ import java.security.MessageDigest
|
||||
import java.util.*
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
|
||||
const val COMPILER_JAR_NAME: String = "kotlin-compiler.jar"
|
||||
const val COMPILER_SERVICE_RMI_NAME: String = "KotlinJvmCompilerService"
|
||||
const val COMPILER_DAEMON_CLASS_FQN: String = "org.jetbrains.kotlin.daemon.KotlinCompileDaemon"
|
||||
const val COMPILE_DAEMON_FIND_PORT_ATTEMPTS: Int = 10
|
||||
const val COMPILE_DAEMON_PORTS_RANGE_START: Int = 17001
|
||||
const val COMPILE_DAEMON_PORTS_RANGE_END: Int = 18000
|
||||
const val COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX: String = "--daemon-"
|
||||
const val COMPILE_DAEMON_DEFAULT_FILES_PREFIX: String = "kotlin-daemon"
|
||||
const val COMPILE_DAEMON_TIMEOUT_INFINITE_S: Int = 0
|
||||
const val COMPILE_DAEMON_DEFAULT_IDLE_TIMEOUT_S: Int = 7200 // 2 hours
|
||||
const val COMPILE_DAEMON_DEFAULT_UNUSED_TIMEOUT_S: Int = 60
|
||||
const val COMPILE_DAEMON_DEFAULT_SHUTDOWN_DELAY_MS: Long = 1000L // 1 sec
|
||||
const val COMPILE_DAEMON_MEMORY_THRESHOLD_INFINITE: Long = 0L
|
||||
const val COMPILE_DAEMON_FORCE_SHUTDOWN_DEFAULT_TIMEOUT_MS: Long = 10000L // 10 secs
|
||||
const val COMPILE_DAEMON_TIMEOUT_INFINITE_MS: Long = 0L
|
||||
const val COMPILE_DAEMON_IS_READY_MESSAGE = "Kotlin compile daemon is ready"
|
||||
|
||||
val COMPILER_JAR_NAME: String = "kotlin-compiler.jar"
|
||||
val COMPILER_SERVICE_RMI_NAME: String = "KotlinJvmCompilerService"
|
||||
val COMPILER_DAEMON_CLASS_FQN: String = "org.jetbrains.kotlin.daemon.KotlinCompileDaemon"
|
||||
val COMPILE_DAEMON_FIND_PORT_ATTEMPTS: Int = 10
|
||||
val COMPILE_DAEMON_PORTS_RANGE_START: Int = 17001
|
||||
val COMPILE_DAEMON_PORTS_RANGE_END: Int = 18000
|
||||
val COMPILE_DAEMON_ENABLED_PROPERTY: String = "kotlin.daemon.enabled"
|
||||
val COMPILE_DAEMON_JVM_OPTIONS_PROPERTY: String = "kotlin.daemon.jvm.options"
|
||||
val COMPILE_DAEMON_OPTIONS_PROPERTY: String = "kotlin.daemon.options"
|
||||
val COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY: String = "kotlin.daemon.client.alive.path"
|
||||
val COMPILE_DAEMON_LOG_PATH_PROPERTY: String = "kotlin.daemon.log.path"
|
||||
val COMPILE_DAEMON_REPORT_PERF_PROPERTY: String = "kotlin.daemon.perf"
|
||||
val COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY: String = "kotlin.daemon.verbose"
|
||||
val COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX: String = "--daemon-"
|
||||
val COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY: String = "kotlin.daemon.startup.timeout"
|
||||
val COMPILE_DAEMON_DEFAULT_FILES_PREFIX: String = "kotlin-daemon"
|
||||
val COMPILE_DAEMON_TIMEOUT_INFINITE_S: Int = 0
|
||||
val COMPILE_DAEMON_DEFAULT_IDLE_TIMEOUT_S: Int = 7200 // 2 hours
|
||||
val COMPILE_DAEMON_DEFAULT_UNUSED_TIMEOUT_S: Int = 60
|
||||
val COMPILE_DAEMON_DEFAULT_SHUTDOWN_DELAY_MS: Long = 1000L // 1 sec
|
||||
val COMPILE_DAEMON_MEMORY_THRESHOLD_INFINITE: Long = 0L
|
||||
val COMPILE_DAEMON_FORCE_SHUTDOWN_DEFAULT_TIMEOUT_MS: Long = 10000L // 10 secs
|
||||
val COMPILE_DAEMON_TIMEOUT_INFINITE_MS: Long = 0L
|
||||
val COMPILE_DAEMON_IS_READY_MESSAGE = "Kotlin compile daemon is ready"
|
||||
|
||||
val COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS: String = "kotlin.daemon.custom.run.files.path.for.tests"
|
||||
val COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH: String get() =
|
||||
System.getProperty(COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS)
|
||||
?: FileSystem.getRuntimeStateFilesPath("kotlin", "daemon")
|
||||
val COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH: String
|
||||
get() = CompilerSystemProperties.COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS.value ?: FileSystem.getRuntimeStateFilesPath(
|
||||
"kotlin",
|
||||
"daemon"
|
||||
)
|
||||
|
||||
val CLASSPATH_ID_DIGEST = "MD5"
|
||||
|
||||
|
||||
open class PropMapper<C, V, out P : KMutableProperty1<C, V>>(val dest: C,
|
||||
val prop: P,
|
||||
val names: List<String> = listOf(prop.name),
|
||||
val fromString: (String) -> V,
|
||||
val toString: ((V) -> String?) = { it.toString() },
|
||||
val skipIf: ((V) -> Boolean) = { false },
|
||||
val mergeDelimiter: String? = null) {
|
||||
open class PropMapper<C, V, out P : KMutableProperty1<C, V>>(
|
||||
val dest: C,
|
||||
val prop: P,
|
||||
val names: List<String> = listOf(prop.name),
|
||||
val fromString: (String) -> V,
|
||||
val toString: ((V) -> String?) = { it.toString() },
|
||||
val skipIf: ((V) -> Boolean) = { false },
|
||||
val mergeDelimiter: String? = null
|
||||
) {
|
||||
open fun toArgs(prefix: String = COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX): List<String> =
|
||||
when {
|
||||
skipIf(prop.get(dest)) -> listOf<String>()
|
||||
mergeDelimiter != null -> listOf(listOfNotNull(prefix + names.first(), toString(prop.get(dest))).joinToString(mergeDelimiter))
|
||||
else -> listOfNotNull(prefix + names.first(), toString(prop.get(dest)))
|
||||
}
|
||||
when {
|
||||
skipIf(prop.get(dest)) -> listOf<String>()
|
||||
mergeDelimiter != null -> listOf(listOfNotNull(prefix + names.first(), toString(prop.get(dest))).joinToString(mergeDelimiter))
|
||||
else -> listOfNotNull(prefix + names.first(), toString(prop.get(dest)))
|
||||
}
|
||||
|
||||
open fun apply(s: String) = prop.set(dest, fromString(s))
|
||||
}
|
||||
@@ -255,7 +249,7 @@ data class CompilerId(
|
||||
}
|
||||
|
||||
|
||||
fun isDaemonEnabled(): Boolean = System.getProperty(COMPILE_DAEMON_ENABLED_PROPERTY) != null
|
||||
fun isDaemonEnabled(): Boolean = CompilerSystemProperties.COMPILE_DAEMON_ENABLED_PROPERTY.value != null
|
||||
|
||||
fun configureDaemonJVMOptions(opts: DaemonJVMOptions,
|
||||
vararg additionalParams: String,
|
||||
@@ -289,16 +283,16 @@ fun configureDaemonJVMOptions(opts: DaemonJVMOptions,
|
||||
|
||||
if (inheritOtherJvmOptions) {
|
||||
opts.jvmParams.addAll(
|
||||
otherArgs.filterNot {
|
||||
it.startsWith("agentlib") ||
|
||||
it.startsWith("D" + COMPILE_DAEMON_LOG_PATH_PROPERTY) ||
|
||||
it.startsWith("D" + KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY) ||
|
||||
it.startsWith("D" + COMPILE_DAEMON_JVM_OPTIONS_PROPERTY) ||
|
||||
it.startsWith("D" + COMPILE_DAEMON_OPTIONS_PROPERTY)
|
||||
})
|
||||
otherArgs.filterNot {
|
||||
it.startsWith("agentlib") ||
|
||||
it.startsWith("D" + CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property) ||
|
||||
it.startsWith("D" + CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.property) ||
|
||||
it.startsWith("D" + CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property) ||
|
||||
it.startsWith("D" + CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property)
|
||||
})
|
||||
}
|
||||
}
|
||||
System.getProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)?.let {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.value?.let {
|
||||
opts.jvmParams.addAll(
|
||||
it.trimQuotes()
|
||||
.split("(?<!\\\\),".toRegex()) // using independent non-capturing group with negative lookahead zero length assertion to split only on non-escaped commas
|
||||
@@ -311,8 +305,8 @@ fun configureDaemonJVMOptions(opts: DaemonJVMOptions,
|
||||
opts.jvmParams.addAll(additionalParams)
|
||||
|
||||
if (inheritAdditionalProperties) {
|
||||
System.getProperty(COMPILE_DAEMON_LOG_PATH_PROPERTY)?.let { opts.jvmParams.add("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"$it\"") }
|
||||
System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY)?.let { opts.jvmParams.add("D$KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY") }
|
||||
CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.value?.let { opts.jvmParams.add("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"$it\"") }
|
||||
CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value?.let { opts.jvmParams.add("D${CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.property}") }
|
||||
}
|
||||
|
||||
if (opts.jvmParams.none { it.matches(jvmAssertArgsRegex) }) {
|
||||
@@ -338,15 +332,15 @@ fun configureDaemonJVMOptions(
|
||||
)
|
||||
|
||||
fun configureDaemonOptions(opts: DaemonOptions): DaemonOptions {
|
||||
System.getProperty(COMPILE_DAEMON_OPTIONS_PROPERTY)?.let {
|
||||
CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.value?.let {
|
||||
val unrecognized = it.trimQuotes().split(",").filterExtractProps(opts.mappers, "")
|
||||
if (unrecognized.any())
|
||||
throw IllegalArgumentException(
|
||||
"Unrecognized daemon options passed via property $COMPILE_DAEMON_OPTIONS_PROPERTY: " + unrecognized.joinToString(" ") +
|
||||
"Unrecognized daemon options passed via property ${CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property}: " + unrecognized.joinToString(" ") +
|
||||
"\nSupported options: " + opts.mappers.joinToString(", ", transform = { it.names.first() }))
|
||||
}
|
||||
System.getProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY)?.let { opts.verbose = true }
|
||||
System.getProperty(COMPILE_DAEMON_REPORT_PERF_PROPERTY)?.let { opts.reportPerf = true }
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value?.let { opts.verbose = true }
|
||||
CompilerSystemProperties.COMPILE_DAEMON_REPORT_PERF_PROPERTY.value?.let { opts.reportPerf = true }
|
||||
return opts
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.daemon.common
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import java.io.IOException
|
||||
import java.io.Serializable
|
||||
import java.net.*
|
||||
@@ -26,12 +27,7 @@ import java.rmi.server.RMIClientSocketFactory
|
||||
import java.rmi.server.RMIServerSocketFactory
|
||||
import java.util.*
|
||||
|
||||
|
||||
const val SOCKET_ANY_FREE_PORT = 0
|
||||
const val JAVA_RMI_SERVER_HOSTNAME = "java.rmi.server.hostname"
|
||||
const val DAEMON_RMI_SOCKET_BACKLOG_SIZE_PROPERTY = "kotlin.daemon.socket.backlog.size"
|
||||
const val DAEMON_RMI_SOCKET_CONNECT_ATTEMPTS_PROPERTY = "kotlin.daemon.socket.connect.attempts"
|
||||
const val DAEMON_RMI_SOCKET_CONNECT_INTERVAL_PROPERTY = "kotlin.daemon.socket.connect.interval"
|
||||
const val SOCKET_ANY_FREE_PORT = 0
|
||||
const val DEFAULT_SERVER_SOCKET_BACKLOG_SIZE = 50
|
||||
const val DEFAULT_SOCKET_CONNECT_ATTEMPTS = 3
|
||||
const val DEFAULT_SOCKET_CONNECT_INTERVAL_MS = 10L
|
||||
@@ -43,9 +39,9 @@ object LoopbackNetworkInterface {
|
||||
|
||||
// size of the requests queue for daemon services, so far seems that we don't need any big numbers here
|
||||
// but if we'll start getting "connection refused" errors, that could be the first place to try to fix it
|
||||
val SERVER_SOCKET_BACKLOG_SIZE by lazy { System.getProperty(DAEMON_RMI_SOCKET_BACKLOG_SIZE_PROPERTY)?.toIntOrNull() ?: DEFAULT_SERVER_SOCKET_BACKLOG_SIZE }
|
||||
val SOCKET_CONNECT_ATTEMPTS by lazy { System.getProperty(DAEMON_RMI_SOCKET_CONNECT_ATTEMPTS_PROPERTY)?.toIntOrNull() ?: DEFAULT_SOCKET_CONNECT_ATTEMPTS }
|
||||
val SOCKET_CONNECT_INTERVAL_MS by lazy { System.getProperty(DAEMON_RMI_SOCKET_CONNECT_INTERVAL_PROPERTY)?.toLongOrNull() ?: DEFAULT_SOCKET_CONNECT_INTERVAL_MS }
|
||||
val SERVER_SOCKET_BACKLOG_SIZE by lazy { CompilerSystemProperties.DAEMON_RMI_SOCKET_BACKLOG_SIZE_PROPERTY.value?.toIntOrNull() ?: DEFAULT_SERVER_SOCKET_BACKLOG_SIZE }
|
||||
val SOCKET_CONNECT_ATTEMPTS by lazy { CompilerSystemProperties.DAEMON_RMI_SOCKET_CONNECT_ATTEMPTS_PROPERTY.value?.toIntOrNull() ?: DEFAULT_SOCKET_CONNECT_ATTEMPTS }
|
||||
val SOCKET_CONNECT_INTERVAL_MS by lazy { CompilerSystemProperties.DAEMON_RMI_SOCKET_CONNECT_INTERVAL_PROPERTY.value?.toLongOrNull() ?: DEFAULT_SOCKET_CONNECT_INTERVAL_MS }
|
||||
|
||||
val serverLoopbackSocketFactory by lazy { ServerLoopbackSocketFactory() }
|
||||
val clientLoopbackSocketFactory by lazy { ClientLoopbackSocketFactory() }
|
||||
@@ -125,7 +121,7 @@ fun findPortAndCreateRegistry(attempts: Int, portRangeStart: Int, portRangeEnd:
|
||||
* which may be slow and can cause a timeout when there is a network problem/misconfiguration.
|
||||
*/
|
||||
fun ensureServerHostnameIsSetUp() {
|
||||
if (System.getProperty(JAVA_RMI_SERVER_HOSTNAME) == null) {
|
||||
System.setProperty(JAVA_RMI_SERVER_HOSTNAME, LoopbackNetworkInterface.loopbackInetAddressName)
|
||||
if (CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value == null) {
|
||||
CompilerSystemProperties.JAVA_RMI_SERVER_HOSTNAME.value = LoopbackNetworkInterface.loopbackInetAddressName
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.daemon
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
@@ -127,7 +128,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
|
||||
val logFile: Path = createTempFile("kotlin-daemon-test.", ".log")
|
||||
|
||||
val daemonJVMOptions = configureDaemonJVMOptions("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"",
|
||||
val daemonJVMOptions = configureDaemonJVMOptions("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${logFile.loggerCompatiblePath}\"",
|
||||
inheritMemoryLimits = false, inheritOtherJvmOptions = false, inheritAdditionalProperties = false)
|
||||
val jar = tmpdir.absolutePath + File.separator + "hello.jar"
|
||||
|
||||
@@ -167,7 +168,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
|
||||
val logFile: Path = createTempFile("kotlin-daemon-test.", ".log")
|
||||
|
||||
val daemonJVMOptions = configureDaemonJVMOptions("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"",
|
||||
val daemonJVMOptions = configureDaemonJVMOptions("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${logFile.loggerCompatiblePath}\"",
|
||||
inheritMemoryLimits = false, inheritOtherJvmOptions = false, inheritAdditionalProperties = false)
|
||||
try {
|
||||
val (code, outputs) = compileOnDaemon(
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.io.FileUtilRt
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.cli.AbstractCliTest
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
|
||||
import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.repl.*
|
||||
@@ -109,7 +110,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
fun makeTestDaemonJvmOptions(logFile: File? = null, xmx: Int = 384, args: Iterable<String> = listOf()): DaemonJVMOptions {
|
||||
val additionalArgs = arrayListOf<String>()
|
||||
if (logFile != null) {
|
||||
additionalArgs.add("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"")
|
||||
additionalArgs.add("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${logFile.loggerCompatiblePath}\"")
|
||||
}
|
||||
args.forEach { additionalArgs.add(it) }
|
||||
val baseOpts = if (xmx > 0) DaemonJVMOptions(maxMemory = "${xmx}m") else DaemonJVMOptions()
|
||||
@@ -160,16 +161,16 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
fun testDaemonJvmOptionsParsing() {
|
||||
val backupJvmOptions = System.getProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)
|
||||
val backupJvmOptions = System.getProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property)
|
||||
try {
|
||||
System.setProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, "-aaa,-bbb\\,ccc,-ddd,-Xmx200m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100,-xxx\\,yyy")
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, "-aaa,-bbb\\,ccc,-ddd,-Xmx200m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100,-xxx\\,yyy")
|
||||
val opts = configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
|
||||
assertEquals("200m", opts.maxMemory)
|
||||
assertEquals("10k", opts.maxMetaspaceSize)
|
||||
assertEquals("100", opts.reservedCodeCacheSize)
|
||||
assertEquals(arrayListOf("aaa", "bbb,ccc", "ddd", "xxx,yyy", "ea"), opts.jvmParams)
|
||||
|
||||
System.setProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, "-Xmx300m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100")
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, "-Xmx300m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100")
|
||||
val opts2 = configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
|
||||
assertEquals("300m", opts2.maxMemory)
|
||||
assertEquals( -1, DaemonJVMOptionsMemoryComparator().compare(opts, opts2))
|
||||
@@ -178,14 +179,14 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
val myXmxParam = ManagementFactory.getRuntimeMXBean().inputArguments.first { it.startsWith("-Xmx") }
|
||||
TestCase.assertNotNull(myXmxParam)
|
||||
val myXmxVal = myXmxParam.substring(4)
|
||||
System.clearProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)
|
||||
System.clearProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property)
|
||||
val opts3 = configureDaemonJVMOptions(inheritMemoryLimits = true,
|
||||
inheritOtherJvmOptions = true,
|
||||
inheritAdditionalProperties = false)
|
||||
assertEquals(myXmxVal, opts3.maxMemory)
|
||||
}
|
||||
finally {
|
||||
restoreSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, backupJvmOptions)
|
||||
restoreSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, backupJvmOptions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,12 +216,12 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
private fun withDaemonJvmOptionsSetTo(newValue: String?, fn: () -> Unit) {
|
||||
val backup = getAndSetSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, newValue)
|
||||
val backup = getAndSetSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, newValue)
|
||||
|
||||
try {
|
||||
fn()
|
||||
} finally {
|
||||
getAndSetSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, backup)
|
||||
getAndSetSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, backup)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,15 +238,15 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
fun testDaemonOptionsParsing() {
|
||||
val backupOptions = System.getProperty(COMPILE_DAEMON_OPTIONS_PROPERTY)
|
||||
val backupOptions = System.getProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property)
|
||||
try {
|
||||
System.setProperty(COMPILE_DAEMON_OPTIONS_PROPERTY, "runFilesPath=abcd,autoshutdownIdleSeconds=1111")
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property, "runFilesPath=abcd,autoshutdownIdleSeconds=1111")
|
||||
val opts = configureDaemonOptions(DaemonOptions(shutdownDelayMilliseconds = 1))
|
||||
assertEquals("abcd", opts.runFilesPath)
|
||||
assertEquals(1111, opts.autoshutdownIdleSeconds)
|
||||
}
|
||||
finally {
|
||||
restoreSystemProperty(COMPILE_DAEMON_OPTIONS_PROPERTY, backupOptions)
|
||||
restoreSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property, backupOptions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,12 +519,12 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
val daemonOptions = makeTestDaemonOptions(getTestName(true))
|
||||
val jar = testTempDir.absolutePath + File.separator + "hello.jar"
|
||||
val args = listOf(
|
||||
File(File(System.getProperty("java.home"), "bin"), "java").absolutePath,
|
||||
"-Xmx256m",
|
||||
"-D$COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY",
|
||||
"-cp",
|
||||
daemonClientClassPath.joinToString(File.pathSeparator) { it.absolutePath },
|
||||
KotlinCompilerClient::class.qualifiedName!!) +
|
||||
File(File(System.getProperty("java.home"), "bin"), "java").absolutePath,
|
||||
"-Xmx256m",
|
||||
"-D${CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.property}",
|
||||
"-cp",
|
||||
daemonClientClassPath.joinToString(File.pathSeparator) { it.absolutePath },
|
||||
KotlinCompilerClient::class.qualifiedName!!) +
|
||||
daemonOptions.mappers.flatMap { it.toArgs(COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX) } +
|
||||
compilerId.mappers.flatMap { it.toArgs(COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX) } +
|
||||
File(getHelloAppBaseDir(), "hello.kt").absolutePath +
|
||||
@@ -651,16 +652,16 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
}
|
||||
|
||||
System.setProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "true")
|
||||
System.setProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY, "100000")
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value = "true"
|
||||
CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.value = "100000"
|
||||
|
||||
val succeeded = try {
|
||||
(1..ParallelStartParams.threads).forEach { connectThread(it - 1) }
|
||||
doneLatch.await(PARALLEL_WAIT_TIMEOUT_S, TimeUnit.SECONDS)
|
||||
}
|
||||
finally {
|
||||
System.clearProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY)
|
||||
System.clearProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY)
|
||||
CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.clear()
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.clear()
|
||||
}
|
||||
|
||||
Thread.sleep(100) // Wait for processes to finish and close log files
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.daemon.experimental.integration
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
|
||||
@@ -217,7 +218,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
|
||||
log.info("creating daemonJVMOptions")
|
||||
val daemonJVMOptions = configureDaemonJVMOptions(
|
||||
"D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${externalLogFile.loggerCompatiblePath}\"",
|
||||
"D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${externalLogFile.loggerCompatiblePath}\"",
|
||||
inheritMemoryLimits = false,
|
||||
inheritOtherJvmOptions = false,
|
||||
inheritAdditionalProperties = false
|
||||
@@ -278,7 +279,7 @@ class CompilerApiTest : KotlinIntegrationTestBase() {
|
||||
reportPerf = true
|
||||
)
|
||||
val daemonJVMOptions = configureDaemonJVMOptions(
|
||||
"D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${externalLogFile.loggerCompatiblePath}\"",
|
||||
"D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${externalLogFile.loggerCompatiblePath}\"",
|
||||
inheritMemoryLimits = false, inheritOtherJvmOptions = false, inheritAdditionalProperties = false
|
||||
)
|
||||
try {
|
||||
|
||||
@@ -11,6 +11,7 @@ import junit.framework.TestCase
|
||||
import kotlinx.coroutines.*
|
||||
import org.jetbrains.kotlin.cli.AbstractCliTest
|
||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
|
||||
import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector
|
||||
import org.jetbrains.kotlin.cli.common.repl.*
|
||||
@@ -173,7 +174,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
fun makeTestDaemonJvmOptions(logFile: File? = null, xmx: Int = 384, args: Iterable<String> = listOf()): DaemonJVMOptions {
|
||||
val additionalArgs = arrayListOf<String>()
|
||||
if (logFile != null) {
|
||||
additionalArgs.add("D$COMPILE_DAEMON_LOG_PATH_PROPERTY=\"${logFile.loggerCompatiblePath}\"")
|
||||
additionalArgs.add("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${logFile.loggerCompatiblePath}\"")
|
||||
}
|
||||
args.forEach { additionalArgs.add(it) }
|
||||
val baseOpts = if (xmx > 0) DaemonJVMOptions(maxMemory = "${xmx}m") else DaemonJVMOptions()
|
||||
@@ -230,10 +231,10 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
fun ignore_testDaemonJvmOptionsParsing() {
|
||||
val backupJvmOptions = System.getProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)
|
||||
val backupJvmOptions = System.getProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property)
|
||||
try {
|
||||
System.setProperty(
|
||||
COMPILE_DAEMON_JVM_OPTIONS_PROPERTY,
|
||||
CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property,
|
||||
"-aaa,-bbb\\,ccc,-ddd,-Xmx200m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100,-xxx\\,yyy"
|
||||
)
|
||||
val opts =
|
||||
@@ -243,7 +244,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
assertEquals("100", opts.reservedCodeCacheSize)
|
||||
assertEquals(arrayListOf("aaa", "bbb,ccc", "ddd", "xxx,yyy", "ea"), opts.jvmParams)
|
||||
|
||||
System.setProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, "-Xmx300m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100")
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, "-Xmx300m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100")
|
||||
val opts2 =
|
||||
configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
|
||||
assertEquals("300m", opts2.maxMemory)
|
||||
@@ -253,7 +254,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
val myXmxParam = ManagementFactory.getRuntimeMXBean().inputArguments.first { it.startsWith("-Xmx") }
|
||||
TestCase.assertNotNull(myXmxParam)
|
||||
val myXmxVal = myXmxParam.substring(4)
|
||||
System.clearProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY)
|
||||
System.clearProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property)
|
||||
val opts3 = configureDaemonJVMOptions(
|
||||
inheritMemoryLimits = true,
|
||||
inheritOtherJvmOptions = true,
|
||||
@@ -262,7 +263,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
assertEquals(myXmxVal, opts3.maxMemory)
|
||||
} finally {
|
||||
restoreSystemProperty(
|
||||
COMPILE_DAEMON_JVM_OPTIONS_PROPERTY,
|
||||
CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property,
|
||||
backupJvmOptions
|
||||
)
|
||||
}
|
||||
@@ -294,12 +295,12 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
private fun withDaemonJvmOptionsSetTo(newValue: String?, fn: () -> Unit) {
|
||||
val backup = getAndSetSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, newValue)
|
||||
val backup = getAndSetSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, newValue)
|
||||
|
||||
try {
|
||||
fn()
|
||||
} finally {
|
||||
getAndSetSystemProperty(COMPILE_DAEMON_JVM_OPTIONS_PROPERTY, backup)
|
||||
getAndSetSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, backup)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,14 +317,14 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
fun ignore_testDaemonOptionsParsing() {
|
||||
val backupOptions = System.getProperty(COMPILE_DAEMON_OPTIONS_PROPERTY)
|
||||
val backupOptions = System.getProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property)
|
||||
try {
|
||||
System.setProperty(COMPILE_DAEMON_OPTIONS_PROPERTY, "runFilesPath=abcd,autoshutdownIdleSeconds=1111")
|
||||
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property, "runFilesPath=abcd,autoshutdownIdleSeconds=1111")
|
||||
val opts = configureDaemonOptions(DaemonOptions(shutdownDelayMilliseconds = 1))
|
||||
assertEquals("abcd", opts.runFilesPath)
|
||||
assertEquals(1111, opts.autoshutdownIdleSeconds)
|
||||
} finally {
|
||||
restoreSystemProperty(COMPILE_DAEMON_OPTIONS_PROPERTY, backupOptions)
|
||||
restoreSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_OPTIONS_PROPERTY.property, backupOptions)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -746,7 +747,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
val args = listOf(
|
||||
File(File(System.getProperty("java.home"), "bin"), "java").absolutePath,
|
||||
"-Xmx256m",
|
||||
"-D$COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY",
|
||||
"-D${CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.property}",
|
||||
"-cp",
|
||||
daemonClientClassPath.joinToString(File.pathSeparator) { it.absolutePath },
|
||||
KotlinCompilerClientInstance::class.qualifiedName!!
|
||||
@@ -946,15 +947,15 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
|
||||
}
|
||||
|
||||
runBlocking {
|
||||
System.setProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "true")
|
||||
System.setProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY, "100000")
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.value = "true"
|
||||
CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.value = "100000"
|
||||
|
||||
val succeeded = try {
|
||||
(1..ParallelStartParams.threads).forEach { connectThread(it - 1) }
|
||||
doneLatch.await(PARALLEL_WAIT_TIMEOUT_S, TimeUnit.SECONDS)
|
||||
} finally {
|
||||
System.clearProperty(COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY)
|
||||
System.clearProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY)
|
||||
CompilerSystemProperties.COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY.clear()
|
||||
CompilerSystemProperties.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY.clear()
|
||||
}
|
||||
|
||||
delay(1000) // Wait for processes to finish and close log files
|
||||
|
||||
@@ -25,8 +25,8 @@ import org.jetbrains.kotlin.build.report.BuildReporter
|
||||
import org.jetbrains.kotlin.build.report.RemoteBuildReporter
|
||||
import org.jetbrains.kotlin.build.report.RemoteReporter
|
||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import org.jetbrains.kotlin.cli.common.arguments.*
|
||||
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
@@ -102,7 +102,7 @@ abstract class CompileServiceImplBase(
|
||||
protected val log by lazy { Logger.getLogger("compiler") }
|
||||
|
||||
init {
|
||||
System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "true")
|
||||
CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value = "true"
|
||||
}
|
||||
|
||||
// wrapped in a class to encapsulate alive check logic
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.daemon
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback
|
||||
import org.jetbrains.kotlin.cli.js.K2JSCompiler
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
@@ -60,7 +61,7 @@ abstract class KotlinCompileDaemonBase {
|
||||
init {
|
||||
val logTime: String = SimpleDateFormat("yyyy-MM-dd.HH-mm-ss-SSS").format(Date())
|
||||
val (logPath: String, fileIsGiven: Boolean) =
|
||||
System.getProperty(COMPILE_DAEMON_LOG_PATH_PROPERTY)?.trimQuotes()?.let { Pair(it, File(it).isFile) } ?: Pair("%t", false)
|
||||
CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.value?.trimQuotes()?.let { Pair(it, File(it).isFile) } ?: Pair("%t", false)
|
||||
val cfg: String =
|
||||
"handlers = java.util.logging.FileHandler\n" +
|
||||
"java.util.logging.FileHandler.level = ALL\n" +
|
||||
|
||||
@@ -16,7 +16,7 @@ import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.channels.actor
|
||||
import kotlinx.coroutines.channels.consumeEach
|
||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
|
||||
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
|
||||
import org.jetbrains.kotlin.cli.common.repl.ReplCheckResult
|
||||
import org.jetbrains.kotlin.cli.common.repl.ReplCodeLine
|
||||
import org.jetbrains.kotlin.cli.common.repl.ReplCompileResult
|
||||
@@ -402,7 +402,7 @@ class CompileServiceServerSideImpl(
|
||||
scheduler = CompileServiceTaskScheduler(log)
|
||||
|
||||
// assuming logically synchronized
|
||||
System.setProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY, "true")
|
||||
CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value = "true"
|
||||
|
||||
// TODO UNCOMMENT THIS : this.toRMIServer(daemonOptions, compilerId) // also create RMI server in order to support old clients
|
||||
// rmiServer = this.toRMIServer(daemonOptions, compilerId)
|
||||
|
||||
@@ -601,6 +601,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/tryInLambda.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeMismatchOnExpectedJavaMap.kt")
|
||||
public void testTypeMismatchOnExpectedJavaMap() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/typeMismatchOnExpectedJavaMap.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("untouchedReturnInIf.kt")
|
||||
public void testUntouchedReturnInIf() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/untouchedReturnInIf.kt");
|
||||
@@ -2394,6 +2399,34 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/inlineClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class InlineClasses extends AbstractLazyBodyIsNotTouchedTilContractsPhaseTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInlineClasses() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolve/inlineClasses"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassConstructor.kt")
|
||||
public void testInlineClassConstructor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassDeclaration.kt")
|
||||
public void testInlineClassDeclaration() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassDeclaration.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassMembers.kt")
|
||||
public void testInlineClassMembers() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassMembers.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/analysis-tests/testData/resolve/innerClasses")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -38,7 +38,7 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirLoadBinariesTest() {
|
||||
val environment = KotlinCoreEnvironment.createForTests(testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
|
||||
|
||||
prepareProjectExtensions(environment.project)
|
||||
val sessionWithDependency = createSession(environment, GlobalSearchScope.EMPTY_SCOPE)
|
||||
val sessionWithDependency = createSessionForTests(environment, GlobalSearchScope.EMPTY_SCOPE)
|
||||
|
||||
val testDataDirectoryPath =
|
||||
"compiler/fir/analysis-tests/testData/loadCompiledKotlin/" +
|
||||
|
||||
@@ -18,7 +18,7 @@ class BuiltInsDeserializationForFirTestCase : AbstractFirLoadBinariesTest() {
|
||||
|
||||
fun testBuiltInPackagesContent() {
|
||||
val moduleDescriptor = BuiltinsTestUtils.compileBuiltinsModule(environment)
|
||||
val session = createSession(environment, GlobalSearchScope.allScope(project))
|
||||
val session = createSessionForTests(environment, GlobalSearchScope.allScope(project))
|
||||
for (packageFqName in BuiltinsTestUtils.BUILTIN_PACKAGE_NAMES) {
|
||||
val path = "compiler/fir/analysis-tests/testData/builtIns/" + packageFqName.asString().replace('.', '-') + ".txt"
|
||||
checkPackageContent(session, packageFqName, moduleDescriptor, path)
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.fir.FirRenderer
|
||||
import org.jetbrains.kotlin.fir.createSession
|
||||
import org.jetbrains.kotlin.fir.createSessionForTests
|
||||
import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass
|
||||
import org.jetbrains.kotlin.fir.resolve.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirCompositeSymbolProvider
|
||||
@@ -131,7 +131,7 @@ abstract class AbstractFirTypeEnhancementTest : KtUsefulTestCase() {
|
||||
|
||||
val scope = GlobalSearchScope.filesScope(project, virtualFiles)
|
||||
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(project))
|
||||
val session = createSession(environment, scope)
|
||||
val session = createSessionForTests(environment, scope)
|
||||
|
||||
val topPsiClasses = psiFiles.flatMap { it.getChildrenOfType<PsiClass>().toList() }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
public/*package*/ open class ArraysUtilJVM : R|kotlin/Any| {
|
||||
public/*package*/ open static fun <T : R|ft<@FlexibleNullability kotlin/Any, kotlin/Any?>!|> asList(p0: T[]): java.util.List<T>
|
||||
public/*package*/ open static fun <T : R|ft<kotlin/Any, kotlin/Any?>|> asList(p0: T[]): java.util.List<T>
|
||||
|
||||
public/*package*/ constructor(): R|kotlin/collections/ArraysUtilJVM|
|
||||
|
||||
@@ -304,4 +304,3 @@ public abstract class ShortIterator : R|kotlin/collections/Iterator<kotlin/Short
|
||||
public constructor(): R|kotlin/collections/ShortIterator|
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
}
|
||||
public open class NonNullNever : R|kotlin/Any| {
|
||||
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) public open field field: R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) public open field field: R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
@R|MyNullable|() public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) x: R|@FlexibleNullability kotlin/String?|, @R|MyNullable|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String?|
|
||||
@R|MyNullable|() public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) x: R|@EnhancedNullability kotlin/String?|, @R|MyNullable|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
public constructor(): R|NonNullNever|
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
public open class Simple : R|kotlin/Any| {
|
||||
@R|javax/annotation/Nullable|() public open field field: R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nullable|() public open field field: R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
@R|javax/annotation/Nullable|() public open fun foo(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nullable|() public open fun foo(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
public open class Strange : R|kotlin/Any| {
|
||||
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) public open field field: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) public open field field: R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.ALWAYS|()) x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.MAYBE|()) public open fun foo(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.ALWAYS|()) x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.NEVER|()) y: R|@EnhancedNullability kotlin/CharSequence?|): R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@R|FieldsAreNullable|() public open class A : R|kotlin/Any| {
|
||||
public open field field: R|@FlexibleNullability kotlin/String?|
|
||||
public open field field: R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
@R|javax/annotation/Nonnull|() public open field nonNullField: R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public open fun foo(q: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
public open fun foo(q: R|ft<kotlin/String, kotlin/String?>|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@R|spr/NonNullApi|() public open class A : R|kotlin/Any| {
|
||||
public open fun foo(x: R|@FlexibleNullability kotlin/String|, @R|spr/Nullable|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun foo(x: R|@EnhancedNullability kotlin/String|, @R|spr/Nullable|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
@R|spr/ForceFlexibility|() public open fun bar(x: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|javax/annotation/Nonnull|() y: R|@EnhancedNullability kotlin/CharSequence|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
@R|spr/ForceFlexibility|() public open fun bar(x: R|ft<kotlin/String, kotlin/String?>|, @R|javax/annotation/Nonnull|() y: R|@EnhancedNullability kotlin/CharSequence|): R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
public constructor(): R|A|
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@R|spr/NonNullApi|() public open class A : R|kotlin/Any|, R|B| {
|
||||
@R|spr/ForceFlexibility|() public open fun foo(x: R|@FlexibleNullability kotlin/String|): R|kotlin/Unit|
|
||||
@R|spr/ForceFlexibility|() public open fun foo(x: R|@EnhancedNullability kotlin/String|): R|kotlin/Unit|
|
||||
|
||||
public open fun bar(@R|spr/ForceFlexibility|() x: R|@FlexibleNullability kotlin/String|): R|kotlin/Unit|
|
||||
public open fun bar(@R|spr/ForceFlexibility|() x: R|@EnhancedNullability kotlin/String|): R|kotlin/Unit|
|
||||
|
||||
public open fun baz(@R|spr/UnknownNullability|() x: R|@FlexibleNullability kotlin/String|): R|kotlin/Unit|
|
||||
public open fun baz(@R|spr/UnknownNullability|() x: R|@EnhancedNullability kotlin/String|): R|kotlin/Unit|
|
||||
|
||||
public open fun foobar(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) x: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|): R|kotlin/Unit|
|
||||
public open fun foobar(@R|javax/annotation/Nonnull|(R|javax/annotation/meta/When.UNKNOWN|()) x: R|ft<kotlin/String, kotlin/String?>|): R|kotlin/Unit|
|
||||
|
||||
public constructor(): R|A|
|
||||
|
||||
|
||||
@@ -1,55 +1,55 @@
|
||||
@R|NonNullApi|() public open class A : R|kotlin/Any| {
|
||||
public open fun foo1(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun foo1(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public open fun foo2(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun foo2(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public open fun foo3(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun foo3(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
@R|javax/annotation/Nullable|() public open fun bar1(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nullable|() public open fun bar1(@R|javax/annotation/Nullable|() x: R|@EnhancedNullability kotlin/String?|): R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
@R|javax/annotation/Nullable|() public open fun bar2(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nullable|() public open fun bar2(@R|javax/annotation/Nullable|() x: R|@EnhancedNullability kotlin/String?|): R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
public open fun baz(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun baz(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public constructor(): R|A|
|
||||
|
||||
}
|
||||
@R|NonNullApi|() public abstract interface AInt : R|kotlin/Any| {
|
||||
public abstract fun foo1(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/CharSequence|
|
||||
public abstract fun foo1(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/CharSequence|
|
||||
|
||||
public abstract fun foo2(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/CharSequence|
|
||||
public abstract fun foo2(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/CharSequence|
|
||||
|
||||
public abstract fun foo3(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/CharSequence|
|
||||
public abstract fun foo3(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/CharSequence|
|
||||
|
||||
@R|javax/annotation/Nullable|() public abstract fun bar1(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/CharSequence?|
|
||||
@R|javax/annotation/Nullable|() public abstract fun bar1(@R|javax/annotation/Nullable|() x: R|@EnhancedNullability kotlin/String?|): R|@EnhancedNullability kotlin/CharSequence?|
|
||||
|
||||
@R|javax/annotation/Nullable|() public abstract fun bar2(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/CharSequence?|
|
||||
@R|javax/annotation/Nullable|() public abstract fun bar2(@R|javax/annotation/Nullable|() x: R|@EnhancedNullability kotlin/String?|): R|@EnhancedNullability kotlin/CharSequence?|
|
||||
|
||||
public abstract fun baz(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@FlexibleNullability kotlin/CharSequence|
|
||||
public abstract fun baz(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/CharSequence|
|
||||
|
||||
}
|
||||
@R|NullableApi|() public open class B : R|A|, R|AInt| {
|
||||
public open fun foo1(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun foo1(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
@R|javax/annotation/Nonnull|() public open fun foo2(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public open fun bar1(x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
|
||||
public open fun bar1(x: R|@EnhancedNullability kotlin/String?|): R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
public open fun baz(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun baz(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public constructor(): R|B|
|
||||
|
||||
}
|
||||
@R|NonNullApi|() public open class C : R|A|, R|AInt| {
|
||||
public open fun foo1(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun foo1(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public open fun foo2(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun foo2(@R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public open fun bar1(x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
|
||||
public open fun bar1(x: R|@EnhancedNullability kotlin/String?|): R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
@R|javax/annotation/Nullable|() public open fun bar2(@R|javax/annotation/Nullable|() x: R|@FlexibleNullability kotlin/String?|): R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nullable|() public open fun bar2(@R|javax/annotation/Nullable|() x: R|@EnhancedNullability kotlin/String?|): R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
public open fun baz(x: R|@FlexibleNullability kotlin/String|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun baz(x: R|@EnhancedNullability kotlin/String|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public constructor(): R|C|
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
@R|NonNullApi|() public open class A : R|kotlin/Any| {
|
||||
public open field field: R|@FlexibleNullability kotlin/String|
|
||||
public open field field: R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public open fun foo(x: R|@FlexibleNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun foo(x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
@R|NullableApi|() public open fun foobar(x: R|@FlexibleNullability kotlin/String?|, @R|NonNullApi|() y: R|@FlexibleNullability kotlin/CharSequence|): R|@FlexibleNullability kotlin/String?|
|
||||
@R|NullableApi|() public open fun foobar(x: R|@EnhancedNullability kotlin/String?|, @R|NonNullApi|() y: R|@EnhancedNullability kotlin/CharSequence|): R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
public open fun bar(): R|@FlexibleNullability kotlin/String|
|
||||
public open fun bar(): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
@R|javax/annotation/Nullable|() public open fun baz(): R|ft<@FlexibleNullability kotlin/collections/MutableList<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?, kotlin/collections/List<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?>?|
|
||||
@R|javax/annotation/Nullable|() public open fun baz(): R|ft<@EnhancedNullability kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>>?, @EnhancedNullability kotlin/collections/List<ft<kotlin/String, kotlin/String?>>?>|
|
||||
|
||||
public constructor(): R|A|
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@R|javax/annotation/ParametersAreNonnullByDefault|() public open class A : R|kotlin/Any| {
|
||||
@R|javax/annotation/Nullable|() public open field field: R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nullable|() public open field field: R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
public open fun foo(q: R|@FlexibleNullability kotlin/String|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
public open fun foo(q: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
public open class A : R|kotlin/Any| {
|
||||
@R|javax/annotation/Nullable|() public open field field: R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nullable|() public open field field: R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
public open fun foo(q: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
public open fun foo(q: R|ft<kotlin/String, kotlin/String?>|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
@@ -9,9 +9,9 @@ public open class A : R|kotlin/Any| {
|
||||
|
||||
}
|
||||
public open class A2 : R|kotlin/Any| {
|
||||
@R|javax/annotation/Nullable|() public open field field: R|@FlexibleNullability kotlin/String?|
|
||||
@R|javax/annotation/Nullable|() public open field field: R|@EnhancedNullability kotlin/String?|
|
||||
|
||||
public open fun foo(q: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
public open fun foo(q: R|ft<kotlin/String, kotlin/String?>|, @R|javax/annotation/Nonnull|() x: R|@EnhancedNullability kotlin/String|, @R|javax/annotation/CheckForNull|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
@R|javax/annotation/Nonnull|() public open fun bar(): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@R|spr/NonNullApi|() public open class A : R|kotlin/Any| {
|
||||
public open field field: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
public open field field: R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
public open fun foo(x: R|@FlexibleNullability kotlin/String|, @R|spr/Nullable|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|@FlexibleNullability kotlin/String|
|
||||
public open fun foo(x: R|@EnhancedNullability kotlin/String|, @R|spr/Nullable|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
public open fun bar(): R|@FlexibleNullability kotlin/String|
|
||||
public open fun bar(): R|@EnhancedNullability kotlin/String|
|
||||
|
||||
@R|spr/Nullable|() public open fun baz(): R|ft<@FlexibleNullability kotlin/collections/MutableList<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?, kotlin/collections/List<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?>?|
|
||||
@R|spr/Nullable|() public open fun baz(): R|ft<@EnhancedNullability kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>>?, @EnhancedNullability kotlin/collections/List<ft<kotlin/String, kotlin/String?>>?>|
|
||||
|
||||
public constructor(): R|A|
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
public open class A : R|kotlin/Any| {
|
||||
public open field field: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
public open field field: R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
public open fun foo(x: R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|, @R|spr/Nullable|() y: R|@FlexibleNullability kotlin/CharSequence?|): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
public open fun foo(x: R|ft<kotlin/String, kotlin/String?>|, @R|spr/Nullable|() y: R|@EnhancedNullability kotlin/CharSequence?|): R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
public open fun bar(): R|ft<@FlexibleNullability kotlin/String, kotlin/String?>!|
|
||||
public open fun bar(): R|ft<kotlin/String, kotlin/String?>|
|
||||
|
||||
@R|spr/Nullable|() public open fun baz(): R|ft<@FlexibleNullability kotlin/collections/MutableList<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?, kotlin/collections/List<ft<@FlexibleNullability kotlin/String, kotlin/String?>!>?>?|
|
||||
@R|spr/Nullable|() public open fun baz(): R|ft<@EnhancedNullability kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>>?, @EnhancedNullability kotlin/collections/List<ft<kotlin/String, kotlin/String?>>?>|
|
||||
|
||||
public constructor(): R|test/A|
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
public abstract class AbstractMap : R|kotlin/Any|, R|kotlin/collections/MutableMap<ft<@FlexibleNullability kotlin/String, kotlin/String?>!, ft<@FlexibleNullability kotlin/String, kotlin/String?>!>| {
|
||||
public abstract class AbstractMap : R|kotlin/Any|, R|kotlin/collections/MutableMap<ft<kotlin/String, kotlin/String?>, ft<kotlin/String, kotlin/String?>>| {
|
||||
public constructor(): R|AbstractMap|
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
public final fun array(a: R|kotlin/Array<kotlin/Int>|): R|ft<kotlin/Array<ft<kotlin/Int, kotlin/Int?>!>, kotlin/Array<out ft<kotlin/Int, kotlin/Int?>!>?>!|
|
||||
public final fun array(a: R|kotlin/Array<kotlin/Int>|): R|ft<kotlin/Array<ft<kotlin/Int, kotlin/Int?>>, kotlin/Array<out ft<kotlin/Int, kotlin/Int?>>?>|
|
||||
|
||||
public final fun list(): R|ft<kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>!>, kotlin/collections/List<ft<kotlin/String, kotlin/String?>!>?>!|
|
||||
|
||||
public final fun printStream(): R|ft<java/io/PrintStream, java/io/PrintStream?>!|
|
||||
public final fun list(): R|ft<kotlin/collections/MutableList<ft<kotlin/String, kotlin/String?>>, kotlin/collections/List<ft<kotlin/String, kotlin/String?>>?>|
|
||||
|
||||
public final fun printStream(): R|ft<java/io/PrintStream, java/io/PrintStream?>|
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FILE: main.kt
|
||||
public final fun test(list: R|kotlin/collections/List<kotlin/String>|, string: R|kotlin/String|): R|kotlin/Unit| {
|
||||
R|/Matchers.assertThat|<R|ft<kotlin/collections/List<kotlin/String>, kotlin/collections/List<kotlin/String>?>!|>(R|<local>/list|, R|/Matchers.hasItem|<R|ft<kotlin/String, kotlin/String?>!|>(R|<local>/string|))
|
||||
R|/Matchers.assertThat|<R|ft<kotlin/collections/List<kotlin/String>, kotlin/collections/List<kotlin/String>?>|>(R|<local>/list|, R|/Matchers.hasItem|<R|ft<kotlin/String, kotlin/String?>|>(R|<local>/string|))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ FILE: main.kt
|
||||
public abstract interface PsiClass : R|kotlin/Any| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval processor: R|AdapterProcessor<ft<PsiMethod, PsiMethod?>!, ft<PsiClass, PsiClass?>!>| = R|/AdapterProcessor.AdapterProcessor|<R|ft<PsiMethod, PsiMethod?>!|, R|ft<PsiClass, PsiClass?>!|>(R|/Function|<R|ft<PsiMethod, PsiMethod?>!|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
|
||||
lval processor: R|AdapterProcessor<ft<PsiMethod, PsiMethod?>, ft<PsiClass, PsiClass?>>| = R|/AdapterProcessor.AdapterProcessor|<R|ft<PsiMethod, PsiMethod?>|, R|ft<PsiClass, PsiClass?>|>(R|/Function|<R|ft<PsiMethod, PsiMethod?>|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
|
||||
^ R|<local>/method|?.{ $subj$.R|/PsiMethod.containingClass| }
|
||||
}
|
||||
))
|
||||
|
||||
4
compiler/fir/analysis-tests/testData/resolve/arguments/typeMismatchOnExpectedJavaMap.fir.txt
vendored
Normal file
4
compiler/fir/analysis-tests/testData/resolve/arguments/typeMismatchOnExpectedJavaMap.fir.txt
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
FILE: main.kt
|
||||
public final fun <T> test(executor: R|BuildActionExecuter<T>|, modelType: R|java/lang/Class<T>|, env: R|kotlin/collections/Map<kotlin/String, kotlin/String>|): R|kotlin/Unit| {
|
||||
lval model: R|ft<BuildActionExecuter<ft<T, T?>>, BuildActionExecuter<ft<T, T?>>?>| = R|<local>/executor|.R|SubstitutionOverride</BuildActionExecuter.setEnvironmentVariables: R|ft<BuildActionExecuter<ft<T, T?>>, BuildActionExecuter<ft<T, T?>>?>|>|(R|<local>/env|)
|
||||
}
|
||||
26
compiler/fir/analysis-tests/testData/resolve/arguments/typeMismatchOnExpectedJavaMap.kt
vendored
Normal file
26
compiler/fir/analysis-tests/testData/resolve/arguments/typeMismatchOnExpectedJavaMap.kt
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: LongRunningOperation.java
|
||||
import java.util.Map;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface LongRunningOperation {
|
||||
LongRunningOperation setEnvironmentVariables(@Nullable Map<String, String> envVariables);
|
||||
}
|
||||
|
||||
// FILE: ConfigurableLauncher.java
|
||||
import java.util.Map;
|
||||
|
||||
public interface ConfigurableLauncher<T extends ConfigurableLauncher<T>> extends LongRunningOperation {
|
||||
@Override
|
||||
T setEnvironmentVariables(Map<String, String> envVariables);
|
||||
}
|
||||
|
||||
// FILE: BuildActionExecuter.java
|
||||
public interface BuildActionExecuter<T> extends ConfigurableLauncher<BuildActionExecuter<T>> {}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun <T> test(executor: BuildActionExecuter<T>, modelType: Class<T>, env: Map<String, String>) {
|
||||
val model = executor.setEnvironmentVariables(env)
|
||||
}
|
||||
@@ -84,7 +84,7 @@ digraph initBlock_kt {
|
||||
20 -> {21};
|
||||
21 -> {22};
|
||||
22 -> {23};
|
||||
23 -> {28};
|
||||
23 -> {28} [label=onUncaughtException];
|
||||
23 -> {24} [style=dotted];
|
||||
24 -> {25} [style=dotted];
|
||||
25 -> {26} [style=dotted];
|
||||
|
||||
@@ -72,7 +72,7 @@ digraph jumps_kt {
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
17 -> {18};
|
||||
18 -> {29};
|
||||
18 -> {29} [label=onUncaughtException];
|
||||
18 -> {19} [style=dotted];
|
||||
19 -> {20} [style=dotted];
|
||||
20 -> {21} [style=dotted];
|
||||
|
||||
@@ -63,7 +63,7 @@ digraph lambdaReturningObject_kt {
|
||||
}
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {20};
|
||||
15 -> {20} [label=onUncaughtException];
|
||||
15 -> {16} [style=dotted];
|
||||
16 -> {17} [style=dotted];
|
||||
17 -> {20 18} [style=dotted];
|
||||
|
||||
@@ -107,7 +107,7 @@ digraph propertiesAndInitBlocks_kt {
|
||||
41 -> {42};
|
||||
42 -> {43};
|
||||
43 -> {44};
|
||||
44 -> {47};
|
||||
44 -> {47} [label=onUncaughtException];
|
||||
44 -> {45} [style=dotted];
|
||||
45 -> {46} [style=dotted];
|
||||
46 -> {47} [style=dotted];
|
||||
@@ -138,7 +138,7 @@ digraph propertiesAndInitBlocks_kt {
|
||||
51 -> {52};
|
||||
52 -> {53};
|
||||
53 -> {54};
|
||||
54 -> {58};
|
||||
54 -> {58} [label=onUncaughtException];
|
||||
54 -> {55} [style=dotted];
|
||||
55 -> {56} [style=dotted];
|
||||
56 -> {57} [style=dotted];
|
||||
@@ -199,7 +199,7 @@ digraph propertiesAndInitBlocks_kt {
|
||||
70 -> {71};
|
||||
71 -> {72};
|
||||
72 -> {73};
|
||||
73 -> {76};
|
||||
73 -> {76} [label=onUncaughtException];
|
||||
73 -> {74} [style=dotted];
|
||||
74 -> {75} [style=dotted];
|
||||
75 -> {76} [style=dotted];
|
||||
@@ -246,7 +246,7 @@ digraph propertiesAndInitBlocks_kt {
|
||||
28 -> {48 34} [color=green];
|
||||
28 -> {48 34} [style=dashed];
|
||||
29 -> {30};
|
||||
30 -> {81};
|
||||
30 -> {81} [label=onUncaughtException];
|
||||
30 -> {31} [style=dotted];
|
||||
31 -> {32} [style=dotted];
|
||||
32 -> {33} [style=dotted];
|
||||
|
||||
@@ -204,7 +204,8 @@ digraph returnValuesFromLambda_kt {
|
||||
57 -> {65} [style=dashed];
|
||||
58 -> {60} [style=dotted];
|
||||
59 -> {60} [style=dotted];
|
||||
60 -> {64 61} [style=dotted];
|
||||
60 -> {61} [style=dotted];
|
||||
60 -> {64} [style=dotted] [label=onUncaughtException];
|
||||
61 -> {62} [style=dotted];
|
||||
62 -> {63} [style=dotted];
|
||||
63 -> {64} [style=dotted];
|
||||
|
||||
@@ -20,13 +20,13 @@ FILE: main.kt
|
||||
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval map: R|util/HashMap<ft<kotlin/Int, kotlin/Int?>!, ft<kotlin/Int, kotlin/Int?>!>| = R|util/HashMap.HashMap|<R|ft<kotlin/Int, kotlin/Int?>!|, R|ft<kotlin/Int, kotlin/Int?>!|>()
|
||||
lval map: R|util/HashMap<ft<kotlin/Int, kotlin/Int?>, ft<kotlin/Int, kotlin/Int?>>| = R|util/HashMap.HashMap|<R|ft<kotlin/Int, kotlin/Int?>|, R|ft<kotlin/Int, kotlin/Int?>|>()
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval set: R|util/HashSet<kotlin/Int>| = R|util/HashSet.HashSet|<R|kotlin/Int|>()
|
||||
}
|
||||
public final fun test_3(): R|kotlin/Unit| {
|
||||
lval list: R|foo/ArrayList<ft<kotlin/Int, kotlin/Int?>!>| = R|foo/ArrayList.ArrayList|<R|ft<kotlin/Int, kotlin/Int?>!|>()
|
||||
lval list: R|foo/ArrayList<ft<kotlin/Int, kotlin/Int?>>| = R|foo/ArrayList.ArrayList|<R|ft<kotlin/Int, kotlin/Int?>|>()
|
||||
}
|
||||
public final fun test_4(): R|kotlin/Unit| {
|
||||
lval list: R|foo/LinkedList<kotlin/Int>| = R|foo/LinkedList.LinkedList|<R|kotlin/Int|>()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
data class A {}
|
||||
data <!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>class A<!> {}
|
||||
|
||||
<!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>data class B {
|
||||
data <!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>class B<!> {
|
||||
constructor()
|
||||
}<!>
|
||||
}
|
||||
|
||||
<!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>data class C {
|
||||
data <!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>class C<!> {
|
||||
constructor(x: Int)
|
||||
}<!>
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ FILE: KotlinImporterComponent.kt
|
||||
}
|
||||
|
||||
public final class State : R|kotlin/Any| {
|
||||
public constructor(directories: R|kotlin/collections/List<kotlin/String>| = R|java/util/ArrayList.ArrayList|<R|ft<kotlin/String, kotlin/String?>!|>()): R|simulation/KotlinImporterComponent.State| {
|
||||
public constructor(directories: R|kotlin/collections/List<kotlin/String>| = R|java/util/ArrayList.ArrayList|<R|ft<kotlin/String, kotlin/String?>|>()): R|simulation/KotlinImporterComponent.State| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ FILE: main.kt
|
||||
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval e: R|ft<@FlexibleNullability E, E?>!| = Q|Utils|.R|/Utils.getEnum|()
|
||||
lval e: R|ft<E, E?>| = Q|Utils|.R|/Utils.getEnum|()
|
||||
lval s: R|kotlin/String| = when (R|<local>/e|) {
|
||||
==($subj$, Null(null)) -> {
|
||||
^test_1 Unit
|
||||
@@ -34,7 +34,7 @@ FILE: main.kt
|
||||
R|<local>/s|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
lval e: R|ft<@FlexibleNullability E, E?>!| = Q|Utils|.R|/Utils.getEnum|()
|
||||
lval e: R|ft<E, E?>| = Q|Utils|.R|/Utils.getEnum|()
|
||||
lval s: R|kotlin/String| = when (R|<local>/e|) {
|
||||
==($subj$, Q|E|.R|/E.A|) -> {
|
||||
String()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user