Compare commits

...

62 Commits

Author SHA1 Message Date
Vadim Brilyantov
fe77e5af09 Merge with master and resolve version conflicts. 2018-10-18 19:32:22 +03:00
Vadim Brilyantov
e2c36703c2 merged with master 2018-10-11 15:05:29 +03:00
Vadim Brilyantov
ccfe547d8e fix gradle cache bug with nativeplatforms (rubbygrapefruit) 2018-07-01 21:39:51 +03:00
Vadim Brilyantov
ab401c0553 split Common into new/old modules 2018-07-01 21:39:50 +03:00
Vadim Brilyantov
7913b84713 split Client into new/old modules 2018-07-01 21:39:48 +03:00
Vadim Brilyantov
a95e083410 introduce common Daemon Client interface
new common interface for new/old daemon impls
2018-07-01 21:39:47 +03:00
Vadim Brilyantov
7fd4992482 fix connection with old daemon version 2018-07-01 21:39:45 +03:00
Vadim Brilyantov
e87cb06187 assume arbitrary short messages are Keep Alives 2018-07-01 21:39:44 +03:00
Vadim Brilyantov
30abd783b2 fix parallel start test 2018-07-01 21:39:43 +03:00
Vadim Brilyantov
7532aaeaf7 add KeepAlives mechanism to Kotlin Daemon 2018-07-01 21:39:42 +03:00
Vadim Brilyantov
67a2685ea9 More fixes for daemon concurrent behaviour
fixed lots of bugs faced while testing daemon parallel start and daemon parallel compile
2018-07-01 21:39:41 +03:00
Vadim Brilyantov
fe90621b8b fix repl with ifAlive reentrant issue 2018-07-01 21:39:40 +03:00
Vadim Brilyantov
634fa083c9 fix daemon shutdown when unused 2018-07-01 21:39:38 +03:00
Vadim Brilyantov
689b07155a move suspend to public API 2018-07-01 21:39:37 +03:00
Vadim Brilyantov
956800306a fix parallel compile test 2018-07-01 21:39:36 +03:00
Vadim Brilyantov
414801bc43 remove all runBlocking statements possibly leading to a deadlock 2018-07-01 21:39:34 +03:00
Vadim Brilyantov
67301f1f2c fix all npe's (possibly in deserialization or repl) 2018-07-01 21:39:33 +03:00
Vadim Brilyantov
d28da4a4f3 add kotlin actors for network IO
Actors give an opportunity to deal with some queries to a specific channel sequentually.
That allows to fix bugs with mixing up messages when sending them concurrently
2018-07-01 21:39:32 +03:00
Vadim Brilyantov
ac2ec69ea0 fix timeout and async bugs in handshakes 2018-07-01 21:39:30 +03:00
Vadim Brilyantov
24be522424 add new tests for multiple connections
multiple connections between different types of daemon. New client, new daemon, old client, old daemon --- and their different combinations running simultaneously
2018-07-01 21:39:29 +03:00
Vadim Brilyantov
df9b066a40 fix timeout bug after dserialization 2018-07-01 21:39:28 +03:00
Vadim Brilyantov
b058d433b7 add serialization tests 2018-07-01 21:39:27 +03:00
Vadim Brilyantov
7569e9e117 cleenup infrastructural code 2018-07-01 21:39:25 +03:00
Vadim Brilyantov
19b60ed4ad fix new security mechanisms 2018-07-01 21:39:24 +03:00
Vadim Brilyantov
8ebe8c2daa add handshakes mechanism and connection verification 2018-07-01 21:39:23 +03:00
Vadim Brilyantov
b69b386157 add timeout for client's authentification 2018-07-01 21:39:22 +03:00
Vadim Brilyantov
f273deb18c resolve connection problems between all versions of daemon 2018-07-01 21:39:21 +03:00
Vadim Brilyantov
2da6ec4a36 Minor: change all print's to logger usage 2018-07-01 21:39:20 +03:00
Vadim Brilyantov
85089075f2 pass DaemonAPI test 2018-07-01 21:39:19 +03:00
Vadim Brilyantov
1e16916583 fix all Proguard warnings 2018-07-01 21:39:18 +03:00
Vadim Brilyantov
0f29939151 fix simple connection fixed, refactor client/server infrastructure
refactor: now autoclosable clients and no delegations in server
2018-07-01 21:39:17 +03:00
Vadim Brilyantov
edd10d35c5 fix project build, add unit tests and fix small bugs 2018-07-01 21:39:16 +03:00
Vadim Brilyantov
1ebc9cb5dd merge with kotlin/master and some fixes 2018-03-01 20:35:52 +03:00
Vadim Brilyantov
bca2e4468a Merge remote-tracking branch 'kotlin/master' into daemon-sockets-vadim-brilyantov 2018-03-01 20:20:58 +03:00
Vadim Brilyantov
8878545ec0 Merge remote-tracking branch 'remotes/kotlin/master' into daemon-sockets-vadim-brilyantov 2018-03-01 18:18:45 +03:00
Vadim Brilyantov
608aad6ac7 tmp upd 2018-03-01 17:44:35 +03:00
Vadim Brilyantov
f97f3c9c96 RMI CompileService Server Wrapper _ Added registry files 2018-02-20 20:01:43 +03:00
Vadim Brilyantov
04df7ffff7 some fixes (connect to server and some TODO fixes) 2018-02-20 18:51:30 +03:00
Vadim Brilyantov
bf38ccd50b common part is almost done(not tested) 2018-02-20 18:29:08 +03:00
Vadim Brilyantov
f03c475069 some updates (servers interactions, some updates) 2018-02-19 18:04:00 +03:00
Vadim Brilyantov
d7481ea3c6 huge update(daemon client, rmi wrappers , refactor(delegations by default server)) 2018-02-15 20:10:46 +03:00
Vadim Brilyantov
b65d6c9ca9 full cpy 2018-02-08 15:59:54 +03:00
Vadim Brilyantov
c3e093f6f9 tmp 2018-02-06 18:52:20 +03:00
Vadim Brilyantov
b3f17fa30b new updates, TMP COMMIT 2018-02-06 18:52:20 +03:00
Vadim Brilyantov
ef02366201 after code review 2018-02-06 18:52:19 +03:00
Vadim Brilyantov
9697718cd3 redudant old package usages cleenUp 2018-02-06 18:52:19 +03:00
Vadim Brilyantov
8ce02ffa03 small CE fixes 2018-02-06 18:52:19 +03:00
Vadim Brilyantov
99dbae1d95 kotlinremote repl service upd 2018-02-06 18:52:19 +03:00
Vadim Brilyantov
d9ed4865c0 CompileDaemon socket impl 2018-02-06 18:52:19 +03:00
Vadim Brilyantov
751f281ac2 all interfaces to new design 2018-02-06 18:52:19 +03:00
Vadim Brilyantov
2de5d806e9 no compiler errors 2018-02-06 18:52:19 +03:00
Vadim Brilyantov
f28f7ab770 redesign 2018-02-06 18:52:18 +03:00
Vadim Brilyantov
93ca691d57 essential update and socket lookups update 2018-02-06 18:52:18 +03:00
Vadim Brilyantov
1b07661dfe socket lookups update 2018-02-06 18:52:18 +03:00
Vadim Brilyantov
35406c8fac essential update 2018-02-06 18:52:18 +03:00
Vadim Brilyantov
939f717921 fixes 2018-02-06 18:52:18 +03:00
Vadim Brilyantov
227eaa7c2b interfaces updated 2018-02-06 18:52:17 +03:00
Vadim Brilyantov
cfad8b17c0 build.kts : Ktor added 2018-02-06 18:52:17 +03:00
Vadim Brilyantov
677e965548 small refactor 2018-02-06 18:51:47 +03:00
Vadim Brilyantov
17ac4e9839 some updates (infr.) 2018-02-06 18:51:47 +03:00
Vadim Brilyantov
cccfd7976d some updates 2018-02-06 18:51:47 +03:00
Vadim Brilyantov
362c31d6ec initial commit 2018-02-06 18:51:47 +03:00
18404 changed files with 1341192 additions and 356212 deletions

7
.bunch Normal file
View File

@@ -0,0 +1,7 @@
182
181
173_181
as31_173_181
as32_181
as33
183

3
.gitignore vendored
View File

@@ -29,7 +29,10 @@ build/
!**/testData/**/*.iml
.idea/libraries/Gradle*.xml
.idea/libraries/Maven*.xml
.idea/artifacts
.idea/modules
.idea/runConfigurations/JPS_*.xml
.idea/libraries
.idea/modules.xml
.idea/gradle.xml
.idea/compiler.xml

10
.idea/ant.xml generated
View File

@@ -1,18 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/compiler/frontend/buildLexer.xml" />
<buildFile url="file://$PROJECT_DIR$/update_dependencies.xml" />
<buildFile url="file://$PROJECT_DIR$/TeamCityBuild.xml">
<maximumHeapSize value="512" />
</buildFile>
<buildFile url="file://$PROJECT_DIR$/idea-runner/runner.xml" />
<buildFile url="file://$PROJECT_DIR$/libraries/build-docs.xml">
<maximumHeapSize value="1024" />
<properties>
<property name="dokka.path" value="../../dokka" />
</properties>
</buildFile>
<buildFile url="file://$PROJECT_DIR$/TeamCityRelay.xml" />
</component>
</project>

View File

@@ -1,289 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="LINE_SEPARATOR" value="&#10;" />
<option name="PREFER_LONGER_NAMES" value="false" />
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
<value>
<package name="java.awt" withSubpackages="false" static="false" />
<package name="javax.tools" withSubpackages="true" static="false" />
<package name="javax.swing" withSubpackages="false" static="false" />
</value>
</option>
<option name="STATIC_METHODS_ORDER_WEIGHT" value="5" />
<option name="METHODS_ORDER_WEIGHT" value="4" />
<option name="RIGHT_MARGIN" value="140" />
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="CFML">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="CoffeeScript">
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="ECMA Script Level 4">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="GSP">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Groovy">
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<indentOptions>
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="Scala">
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

View File

@@ -1,50 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</value>
</option>
<option name="LINE_SEPARATOR" value="&#10;" />
<option name="RIGHT_MARGIN" value="140" />
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<GroovyCodeStyleSettings>
<option name="STATIC_METHODS_ORDER_WEIGHT" value="5" />
<option name="METHODS_ORDER_WEIGHT" value="4" />
</GroovyCodeStyleSettings>
<JavaCodeStyleSettings>
<option name="PREFER_LONGER_NAMES" value="false" />
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
@@ -56,102 +13,15 @@
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CONTINUATION_INDENT_IN_PARAMETER_LISTS" value="false" />
<option name="CONTINUATION_INDENT_IN_ARGUMENT_LISTS" value="false" />
<option name="CONTINUATION_INDENT_FOR_EXPRESSION_BODIES" value="false" />
<option name="CONTINUATION_INDENT_FOR_CHAINED_CALLS" value="false" />
<option name="CONTINUATION_INDENT_IN_SUPERTYPE_LISTS" value="false" />
<option name="CONTINUATION_INDENT_IN_IF_CONDITIONS" value="false" />
<option name="WRAP_EXPRESSION_BODY_FUNCTIONS" value="1" />
<option name="IF_RPAREN_ON_NEW_LINE" value="true" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="CFML">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ASSIGNMENT_WRAP" value="1" />
</codeStyleSettings>
<codeStyleSettings language="CoffeeScript">
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
</codeStyleSettings>
<codeStyleSettings language="ECMA Script Level 4">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
</codeStyleSettings>
<codeStyleSettings language="GSP">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Groovy">
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
</codeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JAVA">
@@ -192,9 +62,6 @@
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<indentOptions>
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="ELSE_ON_NEW_LINE" value="true" />
@@ -217,69 +84,21 @@
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
</codeStyleSettings>
<codeStyleSettings language="Scala">
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<codeStyleSettings language="PROTO">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="5" />
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@@ -1,7 +1,7 @@
<component name="CopyrightManager">
<copyright>
<option name="allowReplaceRegexp" value="JetBrains" />
<option name="notice" value="Copyright 2010-&amp;#36;today.year JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license &#10;that can be found in the license/LICENSE.txt file." />
<option name="myName" value="apache" />
<option name="notice" value="Copyright 2000-&amp;#36;today.year JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license &#10;that can be found in the license/LICENSE.txt file." />
</copyright>
</component>

View File

@@ -1,7 +1,7 @@
<component name="CopyrightManager">
<settings default="">
<settings>
<module2copyright>
<element module="all except testData" copyright="apache" />
<element module="Apply copyright" copyright="apache" />
</module2copyright>
<LanguageOptions name="Groovy">
<option name="fileTypeOverride" value="1" />

View File

@@ -1,6 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="4u7">
<words>
<w>cidr</w>
<w>foldable</w>
</words>
</dictionary>

View File

@@ -7,9 +7,9 @@
<w>fqname</w>
<w>goto</w>
<w>gradle</w>
<w>infos</w>
<w>intrinsics</w>
<w>kdoc</w>
<w>kompiler</w>
<w>memoize</w>
<w>memoized</w>
<w>multiline</w>

View File

@@ -4,6 +4,7 @@
<w>ctor</w>
<w>inlining</w>
<w>interner</w>
<w>intrinsicify</w>
<w>kclass</w>
<w>lookups</w>
<w>minification</w>

7
.idea/dictionaries/dmitriy_dolovov.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<component name="ProjectDictionaryState">
<dictionary name="dmitriy.dolovov">
<words>
<w>konan</w>
</words>
</dictionary>
</component>

View File

@@ -7,6 +7,7 @@
<w>experimentality</w>
<w>insn</w>
<w>liveness</w>
<w>parameterless</w>
</words>
</dictionary>
</component>
</component>

View File

@@ -1,10 +1,12 @@
<component name="ProjectDictionaryState">
<dictionary name="yan">
<words>
<w>debuggee</w>
<w>deserializes</w>
<w>impls</w>
<w>kapt</w>
<w>parceler</w>
<w>repl</w>
<w>uast</w>
</words>
</dictionary>

3
.idea/encodings.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/libraries" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/browser-example" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/examples/browser-example-with-library" charset="UTF-8" />
@@ -14,6 +14,7 @@
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-plugin" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-plugin-test" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-sam-with-receiver" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-maven-serialization" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/kotlin-osgi-bundle" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/maven-archetypes" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/libraries/tools/maven-archetypes/kotlin-archetype-js" charset="UTF-8" />

View File

@@ -55,9 +55,6 @@
<inspection_tool class="DoubleCheckedLocking" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreOnVolatileVariables" value="true" />
</inspection_tool>
<inspection_tool class="DuplicateCondition" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreSideEffectConditions" value="true" />
</inspection_tool>
<inspection_tool class="EmptyStatementBody" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_reportEmptyBlocks" value="false" />
</inspection_tool>
@@ -98,6 +95,21 @@
<option name="insideTryAllowed" value="false" />
</inspection_tool>
<inspection_tool class="IfStatementWithIdenticalBranches" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="IncompatibleAPI" enabled="true" level="ERROR" enabled_by_default="true">
<option name="problems">
<list>
<Problem reference="com.intellij.openapi.progress.ProgressManager#getProgressIndicator" reason="Not null starting from 181. Use getProgressIndicatorNullable instead." />
<Problem reference="com.intellij.testFramework.PlatformTestCase#createModuleAt" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.testFramework.PlatformTestCase#doCreateRealModuleIn" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.openapi.progress.ProgressManager#getProgressIndicator" reason="Nullable in 181. Temporary use progressIndicatorNullable instead." />
<Problem reference="org.jetbrains.java.decompiler.main.decompiler.BaseDecompiler#addSpace" reason="Method was replaced with outher methods in 182. Use addSpaceEx instead." />
<Problem reference="com.intellij.psi.codeStyle.CommonCodeStyleSettings#copyFrom" reason="Absent in 173. Use CompatibilityKt.copyFromEx instead." />
<Problem reference="com.intellij.psi.codeStyle.CommonCodeStyleSettingsManager#copy" reason="Removed since 181. Use CompatibilityKt.copyFromEx instead." />
<Problem reference="com.intellij.notification.NotificationAction#createSimple" reason="Absent in 173." />
<Problem reference="com.intellij.notification.NotificationAction#create" reason="Absent in 173." />
</list>
</option>
</inspection_tool>
<inspection_tool class="InnerClassMayBeStatic" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="InstanceofCatchParameter" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="InstanceofIncompatibleInterface" enabled="true" level="WARNING" enabled_by_default="true" />
@@ -275,13 +287,25 @@
<inspection_tool class="PackageDirectoryMismatch" enabled="true" level="WARNING" enabled_by_default="false">
<scope name="all except testData" level="WARNING" enabled="true" />
</inspection_tool>
<inspection_tool class="ProblematicAPIUsage" enabled="true" level="ERROR" enabled_by_default="true">
<option name="problems">
<list>
<Problem reference="com.intellij.testFramework.PlatformTestCase#createModuleAt" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.testFramework.PlatformTestCase#doCreateRealModuleIn" reason="Not static anymore in 181 after 7dacf096c47d2125e17031c71a037b63ab00ec53" />
<Problem reference="com.intellij.openapi.progress.ProgressManager#getProgressIndicator" reason="Nullable in 181. Temporary use progressIndicatorNullable instead." />
<Problem reference="com.intellij.testFramework.fixtures.CodeInsightTestFixture#getProjectDisposable" reason="Method was introduced in 173 and absent in 172. Use getProjectDisposableEx instead. (95eaf81e0ea497f8c69263c11fd3202d28a7a1b2)" />
</list>
</option>
</inspection_tool>
<inspection_tool class="ProtectedMemberInFinalClass" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PublicFieldAccessedInSynchronizedContext" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="ERROR" enabled_by_default="true">
<option name="fromVersion" value="2.4" />
<option name="toVersion" value="3.1" />
</inspection_tool>
<inspection_tool class="Reformat" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="Reformat" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="processChangedFilesOnly" value="true" />
</inspection_tool>
<inspection_tool class="ReplaceAssignmentWithOperatorAssignment" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreLazyOperators" value="true" />
<option name="ignoreObscureOperators" value="true" />

19
.idea/libraries/KotlinJavaRuntime.xml generated Normal file
View File

@@ -0,0 +1,19 @@
<component name="libraryTable">
<library name="KotlinJavaRuntime">
<CLASSES>
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-test.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib-jdk7.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib-jdk8.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib-sources.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect-sources.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-test-sources.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib-jdk7-sources.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib-jdk8-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@@ -0,0 +1,15 @@
<component name="libraryTable">
<library name="KotlinJavaRuntime (2)">
<CLASSES>
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-test.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-stdlib-sources.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-reflect-sources.jar!/" />
<root url="jar://$KOTLIN_BUNDLED$/lib/kotlin-test-sources.jar!/" />
</SOURCES>
</library>
</component>

34
.idea/misc.xml generated
View File

@@ -44,6 +44,38 @@
</list>
</option>
</component>
<component name="NullableNotNullManager">
<option name="myNullables">
<value>
<list size="9">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="9">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="javax.validation.constraints.NotNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
</list>
</value>
</option>
</component>
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
@@ -53,6 +85,8 @@
<component name="SuppressABINotification">
<option name="modulesWithSuppressedNotConfigured">
<set>
<option value="daemon-common" />
<option value="backend.src" />
<option value="kotlin-stdlib-common" />
<option value="kotlin-stdlib-js" />
<option value="kotlin-test-common" />

View File

@@ -1,171 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="LINE_SEPARATOR" value="&#10;" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="IF_BRACE_FORCE" value="1" />
<ADDITIONAL_INDENT_OPTIONS fileType="css">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="groovy">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="gsp">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="haml">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="js">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="jsp">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="php">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="py">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="sass">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="scala">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="sql">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="xml">
<option name="INDENT_SIZE" value="4" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="yml">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="8" />
<option name="TAB_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</ADDITIONAL_INDENT_OPTIONS>
<codeStyleSettings language="JAVA">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<indentOptions />
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

View File

@@ -4,7 +4,7 @@
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-x :ultimate:generateTests" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>

View File

@@ -10,9 +10,6 @@
</option>
<option name="taskNames">
<list>
<option value=":kotlin-runtime:clean" />
<option value=":kotlin-stdlib:clean" />
<option value=":kotlin-reflect:clean" />
<option value=":tools:binary-compatibility-validator:cleanTest" />
<option value=":tools:binary-compatibility-validator:test" />
</list>

3
.idea/scopes/Apply_copyright.xml generated Normal file
View File

@@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle" />
</component>

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,4 @@
[![official project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
<a href="http://slack.kotlinlang.org/"><img src="http://slack.kotlinlang.org/badge.svg" height="20"></a>
[![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/Kotlin_dev_Compiler.svg)](https://teamcity.jetbrains.com/viewType.html?buildTypeId=Kotlin_dev_Compiler&branch_Kotlin_dev=%3Cdefault%3E&tab=buildTypeStatusDiv)
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin/kotlin-maven-plugin.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
@@ -23,21 +22,22 @@ Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
* [Kotlin Eclipse Plugin](https://kotlinlang.org/docs/tutorials/getting-started-eclipse.html)
* [Kotlin TextMate Bundle](https://github.com/vkostyukov/kotlin-sublime-package)
* [Kotlin Sublime Text Package](https://github.com/vkostyukov/kotlin-sublime-package)
## Build environment requirements
In order to build Kotlin distribution you need to have:
- JDK 1.6, 1.7 and 1.8
- JDK 1.6, 1.7, 1.8 and 9
- Setup environment variables as following:
JAVA_HOME="path to JDK 1.8"
JDK_16="path to JDK 1.6"
JDK_17="path to JDK 1.7"
JDK_18="path to JDK 1.8"
JDK_9="path to JDK 9"
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 8 installed, and to point all of the environment variables mentioned above to your JDK 8 installation.
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 1.8 and JDK 9 installed, and to point JDK_16 and JDK_17 environment variables to your JDK 1.8 installation.
You also can use [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties) to setup JDK_* variables.
@@ -59,7 +59,7 @@ On the first project configuration gradle will download and setup the dependenci
* `intellij-core` is a part of command line compiler and contains only necessary APIs.
* `idea-full` is a full blown IntelliJ IDEA Community Edition to be used in the plugin module.
These dependencies are quite large, so depending on the qualify of your internet connection
These dependencies are quite large, so depending on the quality of your internet connection
you might face timeouts getting them. In this case you can increase timeout by specifying the following
command line parameters on the first run:
@@ -80,6 +80,24 @@ command line parameters on the first run:
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
### Building for different versions of IntelliJ IDEA and Android Studio
Kotlin plugin is indented to work with several recent versions of IntelliJ IDEA and Android Studio. Each platform is allowed to have a different set of features and might provide a slightly different API. Instead of using several parallel Git branches, project stores everything in a single branch, but files may have counterparts with version extensions (\*.as32, \*.172, \*.181). The primary file is expected to be replaced with its counterpart when targeting non-default platform.
More detailed description of this scheme can be found at https://github.com/JetBrains/bunches/blob/master/ReadMe.md.
Usually, there's no need to care about multiple platforms as all features are enabled everywhere by default. Additional counterparts should be created if there's an expected difference in behavior or an incompatible API usage is required **and** there's no reasonable workaround to save source compatibility. Kotlin plugin contains a pre-commit check that shows a warning if a file has been updated without its counterparts.
Development for some particular platform is possible after 'switching' that can be done with [Bunch Tool](https://github.com/JetBrains/bunches/releases) from the command line.
```sh
cd kotlin-project-dir
# switching to IntelliJ Idea 2018.2
bunch switch . 182
```
## <a name="working-in-idea"></a> Working with the project in IntelliJ IDEA
Working with the Kotlin project requires IntelliJ IDEA 2017.3. You can download IntelliJ IDEA 2017.3 [here](https://www.jetbrains.com/idea/download).
@@ -89,7 +107,7 @@ To import the project in Intellij choose project directory in Open project dialo
In the import dialog, select `use default gradle wrapper`.
To be able to run tests from IntelliJ easily, check `Delegate IDE build/run actions to Gradle` in the Gradle runner settings.
To be able to run tests from IntelliJ easily, check `Delegate IDE build/run actions to Gradle` and choose `Gradle Test Runner` in the Gradle runner settings.
At this time, you can use the latest released 1.2.x version of the Kotlin plugin for working with the code. To make sure you have the latest version installed, use Tools | Kotlin | Configure Kotlin Plugin Updates and press "Check for updates now".
@@ -101,6 +119,18 @@ From this root project there are Run/Debug Configurations for running IDEA or th
* Run the "IDEA" run configuration in the project
* a child IntelliJ IDEA with the Kotlin plugin will then startup
### Including into composite build
To include kotlin compiler into [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) you need to define `dependencySubstitution` for `kotlin-compiler` module in `settings.gradle`
```
includeBuild('/path/to/kotlin') {
dependencySubstitution {
substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler')
}
}
```
# Contributing
We love contributions! There's [lots to do on Kotlin](https://youtrack.jetbrains.com/issues/KT) and on the
@@ -120,14 +150,16 @@ In particular it'd be great if all functions included a nice example of how to u
This is implemented using the [`@sample`](https://github.com/JetBrains/kotlin/blob/1.1.0/libraries/stdlib/src/kotlin/collections/Maps.kt#L91)
macro to include code from a test function. The benefits of this approach are twofold; First, the API's documentation is improved via beneficial examples that help new users and second, the code coverage is increased.
Also the [JavaScript translation](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) could really use your help. See the [JavaScript contribution section](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) for more details.
Some of the code in the standard library is created by generating code from templates. See the [README](libraries/stdlib/ReadMe.md) in the stdlib section for how to run the code generator. The existing templates can be used as examples for creating new ones.
Also the [JavaScript back-end](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) could really use your help. See the [JavaScript contribution section](https://github.com/JetBrains/kotlin/blob/master/js/ReadMe.md) for more details.
If you want to contribute a new language feature, it is important to discuss it through a [KEEP](https://github.com/Kotlin/KEEP) first and get an approval from the language designers. This way you'll make sure your work will be in line with the overall language evolution plan and no other design decisions or considerations will block its acceptance.
## Submitting patches
The best way to submit a patch is to [fork the project on github](https://help.github.com/articles/fork-a-repo/) then send us a
[pull request](https://help.github.com/articles/creating-a-pull-request/) via [github](https://github.com).
The best way to submit a patch is to [fork the project on GitHub](https://help.github.com/articles/fork-a-repo/) and then send us a
[pull request](https://help.github.com/articles/creating-a-pull-request/) via [GitHub](https://github.com).
If you create your own fork, it might help to enable rebase by default
when you pull by executing
@@ -136,3 +168,14 @@ git config --global pull.rebase true
```
This will avoid your local repo having too many merge commits
which will help keep your pull request simple and easy to apply.
## Checklist
Before submitting the pull request, make sure that you can say "YES" to each point in this short checklist:
- You provided the link to the related issue(s) from YouTrack
- You made a reasonable amount of changes related only to the provided issues
- You can explain changes made in the pull request
- You ran the build locally and verified new functionality
- You ran related tests locally and they passed
- You do not have merge commits in the pull request

View File

@@ -1,121 +0,0 @@
<project name="Kotlin CI Steps" default="none">
<import file="common.xml" optional="false"/>
<property name="kotlin-home" value="${output}/kotlinc"/>
<property name="build.number" value="snapshot"/>
<property name="fail.on.plugin.verifier.error" value="true"/>
<property name="version_substitute_dir" value="${basedir}/versions_temp/"/>
<property name="artifact.output.path" value="${basedir}/dist/artifacts/ideaPlugin"/>
<property name="plugin.xml" value="idea/src/META-INF/plugin.xml"/>
<property name="plugin.xml.bk" value="${version_substitute_dir}/plugin.xml.bk"/>
<property name="plugin.xml.versioned" value="${plugin.xml}.versioned"/>
<property name="plugin.xml.version.number" value="${build.number}"/>
<property name="compiler.version.java" value="core/util.runtime/src/org/jetbrains/kotlin/config/KotlinCompilerVersion.java"/>
<property name="compiler.version.java.bk" value="${version_substitute_dir}/KotlinCompilerVersion.java.bk"/>
<property name="compiler.version.java.versioned" value="${compiler.version.java}.versioned"/>
<property name="compiler.version.number" value="${build.number}"/>
<property name="compiler.ant.fork.jvmargs" value="-Xmx1024m"/>
<property name="plugin.zip" value="${artifact.output.path}/kotlin-plugin-${build.number}.zip"/>
<property name="pluginArtifactDir" value="Kotlin" />
<macrodef name="echoprop">
<attribute name="prop"/>
<sequential>
<echo>@{prop}=${@{prop}}</echo>
</sequential>
</macrodef>
<echoprop prop="os.name"/>
<echoprop prop="os.version"/>
<echoprop prop="os.arch"/>
<echoprop prop="java.home"/>
<echoprop prop="java.vendor"/>
<echoprop prop="java.version"/>
<echoprop prop="user.name"/>
<echoprop prop="user.home"/>
<echoprop prop="user.dir"/>
<macrodef name="run-gradle">
<attribute name="tasks" />
<attribute name="args" default="" />
<sequential>
<java classname="org.gradle.wrapper.GradleWrapperMain"
fork="true"
dir="${basedir}"
failonerror="true"
timeout="4000000"
maxmemory="400m"
taskname="gradle">
<classpath>
<pathelement location="${basedir}/gradle/wrapper/gradle-wrapper.jar"/>
</classpath>
<arg line="--no-daemon" />
<arg line="@{tasks}" />
<arg line="@{args}" />
</java>
</sequential>
</macrodef>
<target name="cleanupArtifacts">
<run-gradle tasks="cleanupArtifacts" />
</target>
<target name="zip-compiler">
<run-gradle tasks="zipCompiler" args="-PdeployVersion=${build.number}" />
</target>
<target name="zip-test-data">
<run-gradle tasks="zipTestData" />
</target>
<target name="writeCompilerVersionToTemplateFile">
<!-- empty, version is written in gradle build -->
</target>
<target name="writePluginVersionToTemplateFile">
<run-gradle tasks="writePluginVersion" args="-PpluginVersion=${plugin.xml.version.number}" />
</target>
<target name="zipArtifacts">
<run-gradle tasks="zipPlugin" args="-PpluginArtifactDir=${pluginArtifactDir} -PpluginZipPath=${plugin.zip}"/>
</target>
<macrodef name="print-statistic">
<attribute name="key"/>
<attribute name="value"/>
<sequential>
<echo message="##teamcity[buildStatisticValue key='@{key}' value='@{value}']"/>
</sequential>
</macrodef>
<macrodef name="print-file-size-statistic">
<attribute name="path"/>
<attribute name="file-name"/>
<sequential>
<local name="file.size"/>
<length file="@{path}/@{file-name}" property="file.size"/>
<print-statistic key="@{file-name} size" value="${file.size}"/>
</sequential>
</macrodef>
<target name="printStatistics">
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-stdlib.jar"/>
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-reflect.jar"/>
<print-file-size-statistic path="${kotlin-home}/lib" file-name="kotlin-stdlib-js.jar"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="kotlin.js"/>
<print-file-size-statistic path="${js.stdlib.output.dir}" file-name="kotlin-test.js"/>
<print-file-size-statistic path="${basedir}/libraries/stdlib/js/build/classes/main" file-name="kotlin.meta.js"/>
</target>
<target name="none">
<fail message="Either specify pre_build or post_build"/>
</target>
</project>

View File

@@ -1,92 +0,0 @@
<project name="Change plugins version" default="change-version">
<property name="relay.origin.version" value="1.0.0-beta-2423"/>
<property name="relay.substitute.version" value="1.0.0-beta-2423-IJ-141-3"/>
<property name="relay.plugins.dir" value="artifacts"/>
<property name="relay.unpack.directory" value="relay-dir"/>
<macrodef name="substituteRegexpInFile">
<attribute name="src.file"/>
<attribute name="output.dir"/>
<attribute name="origin.version"/>
<attribute name="substituted.version"/>
<sequential>
<copy todir="@{output.dir}">
<fileset file="@{src.file}"/>
<filterchain>
<replaceregex pattern="@{origin.version}" replace="@{substituted.version}" />
</filterchain>
</copy>
</sequential>
</macrodef>
<macrodef name="substitudeVersionInPlugin">
<attribute name="plugin.path"/>
<attribute name="plugin.jar.name"/>
<attribute name="origin.version"/>
<attribute name="substituted.version"/>
<attribute name="plugin.subdir"/>
<attribute name="output-dir" default="@{substituted.version}"/>
<attribute name="output.plugin.file.name" default="@{plugin.jar.name}-@{substituted.version}.zip"/>
<attribute name="temp.origin.dir" default="${relay.unpack.directory}/@{plugin.jar.name}/plugin-origin"/>
<attribute name="temp.substitute.dir" default="${relay.unpack.directory}/@{plugin.jar.name}/substitute"/>
<sequential>
<delete dir="${relay.unpack.directory}/@{plugin.jar.name}"/>
<mkdir dir="${relay.unpack.directory}/@{plugin.jar.name}"/>
<unzip src="@{plugin.path}" dest="@{temp.origin.dir}">
<patternset>
<include name="**/lib/@{plugin.jar.name}.jar" />
</patternset>
<flattenmapper/>
</unzip>
<unzip src="@{temp.origin.dir}/@{plugin.jar.name}.jar" dest="@{temp.origin.dir}">
<patternset>
<include name="**/META-INF/plugin.xml" />
</patternset>
<flattenmapper/>
</unzip>
<substituteRegexpInFile
src.file="@{temp.origin.dir}/plugin.xml" output.dir="@{temp.substitute.dir}"
origin.version="@{origin.version}" substituted.version="@{substituted.version}"/>
<!-- Copy updated file back into jar -->
<copy file="@{temp.origin.dir}/@{plugin.jar.name}.jar" todir="@{temp.substitute.dir}"/>
<jar destfile="@{temp.substitute.dir}/@{plugin.jar.name}.jar" update="true">
<zipfileset file="@{temp.substitute.dir}/plugin.xml" prefix="META-INF"/>
</jar>
<!-- Pack updated plugin.jar back to zip file -->
<copy file="@{plugin.path}" tofile="@{substituted.version}/@{output.plugin.file.name}"/>
<zip destfile="@{substituted.version}/@{output.plugin.file.name}" update="true">
<zipfileset file="@{temp.substitute.dir}/@{plugin.jar.name}.jar" prefix="@{plugin.subdir}/lib"/>
</zip>
</sequential>
</macrodef>
<target name="change-version" description="Repack plugin with other version">
<delete dir="${relay.unpack.directory}"/>
<delete dir="${relay.substitute.version}"/>
<mkdir dir="${relay.unpack.directory}"/>
<mkdir dir="${relay.substitute.version}"/>
<substitudeVersionInPlugin
plugin.jar.name="kotlin-plugin"
plugin.path="${relay.plugins.dir}/kotlin-plugin-${relay.origin.version}.zip"
origin.version="${relay.origin.version}"
plugin.subdir="Kotlin"
substituted.version="${relay.substitute.version}"/>
<substitudeVersionInPlugin
plugin.jar.name="kotlin-android-extensions"
plugin.path="${relay.plugins.dir}/kotlin-android-extensions-plugin-${relay.origin.version}.zip"
origin.version="${relay.origin.version}"
plugin.subdir="KotlinAndroidExtensions"
substituted.version="${relay.substitute.version}"/>
</target>
</project>

View File

@@ -1,12 +1,14 @@
description = "Kotlin Ant Tools"
apply { plugin("kotlin") }
plugins {
kotlin("jvm")
}
dependencies {
compile(commonDep("org.apache.ant", "ant"))
compile(project(":kotlin-preloader"))
compile(projectDist(":kotlin-stdlib"))
compile(project(":kotlin-stdlib"))
}
sourceSets {

View File

@@ -38,7 +38,7 @@ internal object KotlinAntTaskUtil {
}
val compilerJar: File by jar("kotlin-compiler.jar")
val runtimeJar: File by jar("kotlin-runtime.jar")
val runtimeJar: File by jar("kotlin-stdlib.jar")
val reflectJar: File by jar("kotlin-reflect.jar")
private fun jar(name: String) = lazy {

View File

@@ -1,7 +1,10 @@
description = "Kotlin Build Common"
apply { plugin("kotlin") }
plugins {
kotlin("jvm")
id("jps-compatible")
}
dependencies {
compileOnly(project(":core:util.runtime"))
@@ -18,10 +21,10 @@ dependencies {
testCompile(projectTests(":compiler:tests-common"))
testCompile(commonDep("junit:junit"))
testCompile(protobufFull())
testCompile(projectDist(":kotlin-stdlib"))
testCompile(project(":kotlin-stdlib"))
testCompileOnly(intellijDep()) { includeJars("openapi") }
testRuntime(projectDist(":kotlin-reflect"))
testRuntime(project(":kotlin-reflect"))
}
sourceSets {

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.jetbrains.kotlin.serialization.java;
package org.jetbrains.kotlin.metadata.java;
import "core/deserialization/src/descriptors.proto";
import "core/metadata/src/metadata.proto";
option java_outer_classname = "JavaClassProtoBuf";
option optimize_for = LITE_RUNTIME;

View File

@@ -0,0 +1,81 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.config.isPreRelease
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import kotlin.reflect.KClass
interface BuildMetaInfo {
val isEAP: Boolean
val compilerBuildVersion: String
val languageVersionString: String
val apiVersionString: String
val coroutinesEnable: Boolean
val coroutinesWarn: Boolean
val coroutinesError: Boolean
val multiplatformEnable: Boolean
val metadataVersionMajor: Int
val metadataVersionMinor: Int
val metadataVersionPatch: Int
val ownVersion: Int
val coroutinesVersion: Int
val multiplatformVersion: Int
}
abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass: KClass<T>) {
protected abstract fun create(
isEAP: Boolean,
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
multiplatformVersion: Int,
metadataVersionArray: IntArray?
): T
fun create(args: CommonCompilerArguments): T {
val languageVersion = args.languageVersion?.let((LanguageVersion)::fromVersionString) ?: LanguageVersion.LATEST_STABLE
return create(
isEAP = languageVersion.isPreRelease(),
compilerBuildVersion = KotlinCompilerVersion.VERSION,
languageVersionString = languageVersion.versionString,
apiVersionString = args.apiVersion ?: languageVersion.versionString,
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
multiplatformEnable = args.multiPlatform,
ownVersion = OWN_VERSION,
coroutinesVersion = COROUTINES_VERSION,
multiplatformVersion = MULTIPLATFORM_VERSION,
metadataVersionArray = args.metadataVersion?.let((BinaryVersion)::parseVersionArray)
)
}
fun serializeToString(args: CommonCompilerArguments): String =
serializeToString(create(args))
fun serializeToString(info: T): String =
serializeToPlainText(info, metaInfoClass)
fun deserializeFromString(str: String): T? =
deserializeFromPlainText(str, metaInfoClass)
companion object {
const val OWN_VERSION: Int = 0
const val COROUTINES_VERSION: Int = 0
const val MULTIPLATFORM_VERSION: Int = 0
}
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
/**
* If you want to add a new field, check its type is supported by [serializeToPlainText], [deserializeFromPlainText]
*/
data class CommonBuildMetaInfo(
override val isEAP: Boolean,
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
override val metadataVersionPatch: Int,
override val ownVersion: Int,
override val coroutinesVersion: Int,
override val multiplatformVersion: Int
) : BuildMetaInfo {
companion object : BuildMetaInfoFactory<CommonBuildMetaInfo>(CommonBuildMetaInfo::class) {
override fun create(
isEAP: Boolean,
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
multiplatformVersion: Int,
metadataVersionArray: IntArray?
): CommonBuildMetaInfo {
val metadataVersion = metadataVersionArray?.let(::JvmMetadataVersion) ?: JvmMetadataVersion.INSTANCE
return CommonBuildMetaInfo(
isEAP = isEAP,
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,
metadataVersionPatch = metadataVersion.patch,
ownVersion = ownVersion,
coroutinesVersion = coroutinesVersion,
multiplatformVersion = multiplatformVersion
)
}
}
}

View File

@@ -0,0 +1,63 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.utils.JsMetadataVersion
/**
* If you want to add a new field, check its type is supported by [serializeToPlainText], [deserializeFromPlainText]
*/
data class JsBuildMetaInfo(
override val isEAP: Boolean,
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
override val metadataVersionPatch: Int,
override val ownVersion: Int,
override val coroutinesVersion: Int,
override val multiplatformVersion: Int
) : BuildMetaInfo {
companion object : BuildMetaInfoFactory<JsBuildMetaInfo>(JsBuildMetaInfo::class) {
override fun create(
isEAP: Boolean,
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
multiplatformVersion: Int,
metadataVersionArray: IntArray?
): JsBuildMetaInfo {
val metadataVersion = metadataVersionArray?.let(::JsMetadataVersion) ?: JsMetadataVersion.INSTANCE
return JsBuildMetaInfo(
isEAP = isEAP,
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,
metadataVersionPatch = metadataVersion.patch,
ownVersion = ownVersion,
coroutinesVersion = coroutinesVersion,
multiplatformVersion = multiplatformVersion
)
}
}
}

View File

@@ -16,66 +16,66 @@
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.KotlinCompilerVersion
import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.config.isPreRelease
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
/**
* If you want to add a new field, check its type is supported by [serializeToPlainText], [deserializeFromPlainText]
*/
data class JvmBuildMetaInfo(
val isEAP: Boolean,
val compilerBuildVersion: String,
val languageVersionString: String,
val apiVersionString: String,
val coroutinesEnable: Boolean,
val coroutinesWarn: Boolean,
val coroutinesError: Boolean,
val multiplatformEnable: Boolean,
val metadataVersionMajor: Int,
val metadataVersionMinor: Int,
val metadataVersionPatch: Int,
val bytecodeVersionMajor: Int,
val bytecodeVersionMinor: Int,
val bytecodeVersionPatch: Int,
val ownVersion: Int = JvmBuildMetaInfo.OWN_VERSION,
val coroutinesVersion: Int = JvmBuildMetaInfo.COROUTINES_VERSION,
val multiplatformVersion: Int = JvmBuildMetaInfo.MULTIPLATFORM_VERSION
) {
companion object {
const val OWN_VERSION: Int = 0
const val COROUTINES_VERSION: Int = 0
const val MULTIPLATFORM_VERSION: Int = 0
fun serializeToString(info: JvmBuildMetaInfo): String =
serializeToPlainText(info)
fun deserializeFromString(str: String): JvmBuildMetaInfo? =
deserializeFromPlainText(str)
override val isEAP: Boolean,
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
override val metadataVersionPatch: Int,
val bytecodeVersionMajor: Int,
val bytecodeVersionMinor: Int,
val bytecodeVersionPatch: Int,
override val ownVersion: Int,
override val coroutinesVersion: Int,
override val multiplatformVersion: Int
) : BuildMetaInfo {
companion object : BuildMetaInfoFactory<JvmBuildMetaInfo>(JvmBuildMetaInfo::class) {
override fun create(
isEAP: Boolean,
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
multiplatformVersion: Int,
metadataVersionArray: IntArray?
): JvmBuildMetaInfo {
val metadataVersion = metadataVersionArray?.let(::JvmMetadataVersion) ?: JvmMetadataVersion.INSTANCE
return JvmBuildMetaInfo(
isEAP = isEAP,
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,
metadataVersionPatch = metadataVersion.patch,
bytecodeVersionMajor = JvmBytecodeBinaryVersion.INSTANCE.major,
bytecodeVersionMinor = JvmBytecodeBinaryVersion.INSTANCE.minor,
bytecodeVersionPatch = JvmBytecodeBinaryVersion.INSTANCE.patch,
ownVersion = ownVersion,
coroutinesVersion = coroutinesVersion,
multiplatformVersion = multiplatformVersion
)
}
}
}
fun JvmBuildMetaInfo(args: CommonCompilerArguments): JvmBuildMetaInfo {
val languageVersion = args.languageVersion?.let((LanguageVersion)::fromVersionString) ?: LanguageVersion.LATEST_STABLE
return JvmBuildMetaInfo(
isEAP = languageVersion.isPreRelease(),
compilerBuildVersion = KotlinCompilerVersion.VERSION,
languageVersionString = languageVersion.versionString,
apiVersionString = args.apiVersion ?: languageVersion.versionString,
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
multiplatformEnable = args.multiPlatform,
metadataVersionMajor = JvmMetadataVersion.INSTANCE.major,
metadataVersionMinor = JvmMetadataVersion.INSTANCE.minor,
metadataVersionPatch = JvmMetadataVersion.INSTANCE.patch,
bytecodeVersionMajor = JvmBytecodeBinaryVersion.INSTANCE.major,
bytecodeVersionMinor = JvmBytecodeBinaryVersion.INSTANCE.minor,
bytecodeVersionPatch = JvmBytecodeBinaryVersion.INSTANCE.patch
)
}

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
import org.jetbrains.kotlin.metadata.jvm.deserialization.ModuleMapping
import org.jetbrains.kotlin.utils.sure
import java.io.File

View File

@@ -0,0 +1,9 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.build
val DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS = listOf("kt", "kts")

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.compilerRunner;
import com.intellij.util.containers.ContainerUtil;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmClassMappingKt;
import kotlin.reflect.KClass;
import kotlin.reflect.KProperty1;
@@ -26,6 +27,7 @@ import kotlin.reflect.jvm.ReflectJvmMapping;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.cli.common.arguments.Argument;
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments;
import org.jetbrains.kotlin.cli.common.arguments.InternalArgument;
import org.jetbrains.kotlin.cli.common.arguments.ParseCommandLineArgumentsKt;
import org.jetbrains.kotlin.utils.StringsKt;
@@ -46,6 +48,7 @@ public class ArgumentUtils {
Class<? extends CommonToolArguments> argumentsClass = arguments.getClass();
convertArgumentsToStringList(arguments, argumentsClass.newInstance(), JvmClassMappingKt.getKotlinClass(argumentsClass), result);
result.addAll(arguments.getFreeArgs());
result.addAll(CollectionsKt.map(arguments.getInternalArguments(), InternalArgument::getStringRepresentation));
return result;
}

View File

@@ -0,0 +1,192 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental
import com.intellij.util.io.EnumeratorStringDescriptor
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
import org.jetbrains.kotlin.metadata.deserialization.supertypes
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.io.File
import java.util.*
/**
* Incremental cache common for JVM and JS, ClassName type aware
*/
interface IncrementalCacheCommon {
val thisWithDependentCaches: Iterable<AbstractIncrementalCache<*>>
fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName>
fun getSubtypesOf(className: FqName): Sequence<FqName>
fun getSourceFileIfClass(fqName: FqName): File?
fun markDirty(removedAndCompiledSources: Collection<File>)
fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
fun clearComplementaryFilesMapping(dirtyFiles: Collection<File>): Collection<File>
fun registerComplementaryFiles(expectActualTracker: ExpectActualTrackerImpl)
fun dump(): String
}
/**
* Incremental cache common for JVM and JS for specifit ClassName type
*/
abstract class AbstractIncrementalCache<ClassName>(workingDir: File) : BasicMapsOwner(workingDir), IncrementalCacheCommon {
companion object {
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
private val COMPLEMENTARY_FILES = "complementary-files"
@JvmStatic protected val SOURCE_TO_CLASSES = "source-to-classes"
@JvmStatic protected val DIRTY_OUTPUT_CLASSES = "dirty-output-classes"
}
private val dependents = arrayListOf<AbstractIncrementalCache<ClassName>>()
fun addDependentCache(cache: AbstractIncrementalCache<ClassName>) {
dependents.add(cache)
}
override val thisWithDependentCaches: Iterable<AbstractIncrementalCache<ClassName>> by lazy {
val result = arrayListOf(this)
result.addAll(dependents)
result
}
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile))
internal abstract val sourceToClassesMap: AbstractSourceToOutputMap<ClassName>
internal abstract val dirtyOutputClassesMap: AbstractDirtyClassesMap<ClassName>
/**
* A file X is a complementary to a file Y if they contain corresponding expect/actual declarations.
* Complementary files should be compiled together during IC so the compiler does not complain
* about missing parts.
* TODO: provide a better solution (maintain an index of expect/actual declarations akin to IncrementalPackagePartProvider)
*/
private val complementaryFilesMap = registerMap(FilesMap(COMPLEMENTARY_FILES.storageFile))
override fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName> =
files.flatMapTo(HashSet()) { sourceToClassesMap.getFqNames(it) }
override fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
override fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
override fun markDirty(removedAndCompiledSources: Collection<File>) {
for (sourceFile in removedAndCompiledSources) {
val classes = sourceToClassesMap[sourceFile]
classes.forEach {
dirtyOutputClassesMap.markDirty(it)
}
sourceToClassesMap.clearOutputsForSource(sourceFile)
}
}
protected fun addToClassStorage(proto: ProtoBuf.Class, nameResolver: NameResolver, srcFile: File) {
val supertypes = proto.supertypes(TypeTable(proto.typeTable))
val parents = supertypes.map { nameResolver.getClassId(it.className).asSingleFqName() }
.filter { it.asString() != "kotlin.Any" }
.toSet()
val child = nameResolver.getClassId(proto.fqName).asSingleFqName()
parents.forEach { subtypesMap.add(it, child) }
val removedSupertypes = supertypesMap[child].filter { it !in parents }
removedSupertypes.forEach { subtypesMap.removeValues(it, setOf(child)) }
supertypesMap[child] = parents
classFqNameToSourceMap[child] = srcFile
}
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
if (removedClasses.isEmpty()) return
val removedFqNames = removedClasses.toSet()
for (removedClass in removedFqNames) {
for (affectedClass in withSubtypes(removedClass, thisWithDependentCaches)) {
changesCollector.collectSignature(affectedClass, areSubclassesAffected = false)
}
}
for (cache in thisWithDependentCaches) {
val parentsFqNames = hashSetOf<FqName>()
val childrenFqNames = hashSetOf<FqName>()
for (removedFqName in removedFqNames) {
parentsFqNames.addAll(cache.supertypesMap[removedFqName])
childrenFqNames.addAll(cache.subtypesMap[removedFqName])
cache.supertypesMap.remove(removedFqName)
cache.subtypesMap.remove(removedFqName)
}
for (child in childrenFqNames) {
cache.supertypesMap.removeValues(child, removedFqNames)
}
for (parent in parentsFqNames) {
cache.subtypesMap.removeValues(parent, removedFqNames)
}
}
removedFqNames.forEach { classFqNameToSourceMap.remove(it) }
}
protected class ClassFqNameToSourceMap(storageFile: File) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
operator fun set(fqName: FqName, sourceFile: File) {
storage[fqName.asString()] = sourceFile.canonicalPath
}
operator fun get(fqName: FqName): File? =
storage[fqName.asString()]?.let(::File)
fun remove(fqName: FqName) {
storage.remove(fqName.asString())
}
override fun dumpValue(value: String) = value
}
override fun clearComplementaryFilesMapping(dirtyFiles: Collection<File>): Collection<File> {
val complementaryFiles = HashSet<File>()
val filesQueue = ArrayDeque(dirtyFiles)
while (filesQueue.isNotEmpty()) {
val file = filesQueue.pollFirst()
complementaryFilesMap.remove(file).filterTo(filesQueue) { complementaryFiles.add(it) }
}
complementaryFiles.removeAll(dirtyFiles)
return complementaryFiles
}
override fun registerComplementaryFiles(expectActualTracker: ExpectActualTrackerImpl) {
val actualToExpect = hashMapOf<File, MutableSet<File>>()
for ((expect, actuals) in expectActualTracker.expectToActualMap) {
for (actual in actuals) {
actualToExpect.getOrPut(actual) { hashSetOf() }.add(expect)
}
complementaryFilesMap[expect] = actuals
}
for ((actual, expects) in actualToExpect) {
complementaryFilesMap[actual] = expects
}
}
}

View File

@@ -1,112 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.load.java.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion
import java.io.File
import java.io.IOException
private val NORMAL_VERSION = 8
private val DATA_CONTAINER_VERSION = 2
private val NORMAL_VERSION_FILE_NAME = "format-version.txt"
private val DATA_CONTAINER_VERSION_FILE_NAME = "data-container-format-version.txt"
class CacheVersion(
private val ownVersion: Int,
private val versionFile: File,
private val whenVersionChanged: CacheVersion.Action,
private val whenTurnedOn: CacheVersion.Action,
private val whenTurnedOff: CacheVersion.Action,
isEnabled: ()->Boolean
) {
private val isEnabled by lazy(isEnabled)
private val actualVersion: Int?
get() = try {
versionFile.readText().toInt()
}
catch (e: NumberFormatException) {
null
}
catch (e: IOException) {
null
}
private val expectedVersion: Int
get() {
val metadata = JvmMetadataVersion.INSTANCE
val bytecode = JvmBytecodeBinaryVersion.INSTANCE
return ownVersion * 1000000 +
bytecode.major * 10000 + bytecode.minor * 100 +
metadata.major * 1000 + metadata.minor
}
fun checkVersion(): Action =
when (versionFile.exists() to isEnabled) {
true to true -> if (actualVersion != expectedVersion) whenVersionChanged else Action.DO_NOTHING
false to true -> whenTurnedOn
true to false -> whenTurnedOff
else -> Action.DO_NOTHING
}
fun saveIfNeeded() {
if (!isEnabled) return
if (!versionFile.parentFile.exists()) {
versionFile.parentFile.mkdirs()
}
versionFile.writeText(expectedVersion.toString())
}
fun clean() {
versionFile.delete()
}
@get:TestOnly
val formatVersionFile: File
get() = versionFile
// Order of entries is important, because actions are sorted in KotlinBuilder::checkVersions
enum class Action {
REBUILD_ALL_KOTLIN,
REBUILD_CHUNK,
CLEAN_NORMAL_CACHES,
CLEAN_DATA_CONTAINER,
DO_NOTHING
}
}
fun normalCacheVersion(dataRoot: File, enabled: Boolean? = null): CacheVersion =
CacheVersion(ownVersion = NORMAL_VERSION,
versionFile = File(dataRoot, NORMAL_VERSION_FILE_NAME),
whenVersionChanged = CacheVersion.Action.REBUILD_CHUNK,
whenTurnedOn = CacheVersion.Action.REBUILD_CHUNK,
whenTurnedOff = CacheVersion.Action.CLEAN_NORMAL_CACHES,
isEnabled = { enabled ?: IncrementalCompilation.isEnabled() })
fun dataContainerCacheVersion(dataRoot: File, enabled: Boolean? = null): CacheVersion =
CacheVersion(ownVersion = DATA_CONTAINER_VERSION,
versionFile = File(dataRoot, DATA_CONTAINER_VERSION_FILE_NAME),
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOn = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOff = CacheVersion.Action.CLEAN_DATA_CONTAINER,
isEnabled = { enabled ?: IncrementalCompilation.isEnabled() })

View File

@@ -16,11 +16,12 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.deserialization.getClassId
class ChangesCollector {
private val removedMembers = hashMapOf<FqName, MutableSet<String>>()

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
import java.io.File
class ExpectActualTrackerImpl : ExpectActualTracker {
private val expectToActual = hashMapOf<File, MutableSet<File>>()
val expectToActualMap: Map<File, Set<File>>
get() = expectToActual
override fun report(expectedFile: File, actualFile: File) {
expectToActual.getOrPut(expectedFile) { hashSetOf() }.add(actualFile)
}
}

View File

@@ -1,140 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.incremental
import com.intellij.util.io.EnumeratorStringDescriptor
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.deserialization.TypeTable
import org.jetbrains.kotlin.serialization.deserialization.supertypes
import java.io.File
/**
* Incremental cache common for JVM and JS
*/
abstract class IncrementalCacheCommon<ClassName>(workingDir: File) : BasicMapsOwner(workingDir) {
companion object {
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
@JvmStatic protected val SOURCE_TO_CLASSES = "source-to-classes"
@JvmStatic protected val DIRTY_OUTPUT_CLASSES = "dirty-output-classes"
}
private val dependents = arrayListOf<IncrementalCacheCommon<ClassName>>()
fun addDependentCache(cache: IncrementalCacheCommon<ClassName>) {
dependents.add(cache)
}
val thisWithDependentCaches: Iterable<IncrementalCacheCommon<ClassName>> by lazy {
val result = arrayListOf(this)
result.addAll(dependents)
result
}
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile))
internal abstract val sourceToClassesMap: AbstractSourceToOutputMap<ClassName>
internal abstract val dirtyOutputClassesMap: AbstractDirtyClassesMap<ClassName>
fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
open fun markDirty(removedAndCompiledSources: List<File>) {
for (sourceFile in removedAndCompiledSources) {
val classes = sourceToClassesMap[sourceFile]
classes.forEach {
dirtyOutputClassesMap.markDirty(it)
}
sourceToClassesMap.clearOutputsForSource(sourceFile)
}
}
protected fun addToClassStorage(proto: ProtoBuf.Class, nameResolver: NameResolver, srcFile: File) {
val supertypes = proto.supertypes(TypeTable(proto.typeTable))
val parents = supertypes.map { nameResolver.getClassId(it.className).asSingleFqName() }
.filter { it.asString() != "kotlin.Any" }
.toSet()
val child = nameResolver.getClassId(proto.fqName).asSingleFqName()
parents.forEach { subtypesMap.add(it, child) }
val removedSupertypes = supertypesMap[child].filter { it !in parents }
removedSupertypes.forEach { subtypesMap.removeValues(it, setOf(child)) }
supertypesMap[child] = parents
classFqNameToSourceMap[child] = srcFile
}
abstract fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
if (removedClasses.isEmpty()) return
val removedFqNames = removedClasses.toSet()
for (removedClass in removedFqNames) {
for (affectedClass in withSubtypes(removedClass, thisWithDependentCaches)) {
changesCollector.collectSignature(affectedClass, areSubclassesAffected = false)
}
}
for (cache in thisWithDependentCaches) {
val parentsFqNames = hashSetOf<FqName>()
val childrenFqNames = hashSetOf<FqName>()
for (removedFqName in removedFqNames) {
parentsFqNames.addAll(cache.supertypesMap[removedFqName])
childrenFqNames.addAll(cache.subtypesMap[removedFqName])
cache.supertypesMap.remove(removedFqName)
cache.subtypesMap.remove(removedFqName)
}
for (child in childrenFqNames) {
cache.supertypesMap.removeValues(child, removedFqNames)
}
for (parent in parentsFqNames) {
cache.subtypesMap.removeValues(parent, removedFqNames)
}
}
removedFqNames.forEach { classFqNameToSourceMap.remove(it) }
}
protected class ClassFqNameToSourceMap(storageFile: File) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
operator fun set(fqName: FqName, sourceFile: File) {
storage[fqName.asString()] = sourceFile.canonicalPath
}
operator fun get(fqName: FqName): File? =
storage[fqName.asString()]?.let(::File)
fun remove(fqName: FqName) {
storage.remove(fqName.asString())
}
override fun dumpValue(value: String) = value
}
}

View File

@@ -23,23 +23,26 @@ import org.jetbrains.kotlin.incremental.storage.BasicStringMap
import org.jetbrains.kotlin.incremental.storage.DirtyClassesFqNameMap
import org.jetbrains.kotlin.incremental.storage.SourceToFqNameMap
import org.jetbrains.kotlin.incremental.storage.StringToLongMapExternalizer
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
import org.jetbrains.kotlin.metadata.deserialization.getExtensionOrNull
import org.jetbrains.kotlin.metadata.js.JsProtoBuf
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolverImpl
import org.jetbrains.kotlin.serialization.deserialization.getExtensionOrNull
import org.jetbrains.kotlin.serialization.js.JsProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import java.io.DataInput
import java.io.DataOutput
import java.io.File
open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon<FqName>(cachesDir) {
open class IncrementalJsCache(cachesDir: File) : AbstractIncrementalCache<FqName>(cachesDir) {
companion object {
private val TRANSLATION_RESULT_MAP = "translation-result"
private val INLINE_FUNCTIONS = "inline-functions"
private val HEADER_FILE_NAME = "header.meta"
fun hasHeaderFile(cachesDir: File) = File(cachesDir, HEADER_FILE_NAME).exists()
}
override val sourceToClassesMap = registerMap(SourceToFqNameMap(SOURCE_TO_CLASSES.storageFile))
@@ -59,7 +62,7 @@ open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon<FqName>(
headerFile.writeBytes(value)
}
override fun markDirty(removedAndCompiledSources: List<File>) {
override fun markDirty(removedAndCompiledSources: Collection<File>) {
super.markDirty(removedAndCompiledSources)
dirtySources.addAll(removedAndCompiledSources)
}
@@ -181,10 +184,11 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
}
proto.`package`.apply {
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName) ?: FqName.ROOT
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
return classes
}

View File

@@ -23,17 +23,20 @@ import com.intellij.util.io.EnumeratorStringDescriptor
import gnu.trove.THashSet
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.config.IncrementalCompilation
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.incremental.storage.version.clean
import org.jetbrains.kotlin.incremental.storage.version.localCacheVersionManager
import org.jetbrains.kotlin.inline.inlineFunctionsJvmNames
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
import org.jetbrains.kotlin.load.kotlin.incremental.components.JvmPackagePartProto
import org.jetbrains.kotlin.metadata.jvm.deserialization.BitEncoding
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.metadata.jvm.deserialization.ModuleMapping
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
import org.jetbrains.org.objectweb.asm.*
import java.io.File
import java.security.MessageDigest
@@ -42,9 +45,9 @@ import java.util.*
val KOTLIN_CACHE_DIRECTORY_NAME = "kotlin"
open class IncrementalJvmCache(
private val targetDataRoot: File,
targetOutputDir: File?
) : IncrementalCacheCommon<JvmClassName>(File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)), IncrementalCache {
private val targetDataRoot: File,
targetOutputDir: File?
) : AbstractIncrementalCache<JvmClassName>(File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)), IncrementalCache {
companion object {
private val PROTO_MAP = "proto"
private val CONSTANTS_MAP = "constants"
@@ -80,13 +83,16 @@ open class IncrementalJvmCache(
// used in gradle
@Suppress("unused")
fun classesBySources(sources: Iterable<File>): Iterable<JvmClassName> =
sources.flatMap { sourceToClassesMap[it] }
sources.flatMap { sourceToClassesMap[it] }
fun sourceInCache(file: File): Boolean =
sourceToClassesMap.contains(file)
fun sourcesByInternalName(internalName: String): Collection<File> =
internalNameToSource[internalName]
internalNameToSource[internalName]
fun isMultifileFacade(className: JvmClassName): Boolean =
className in multifileFacadeToParts
className in multifileFacadeToParts
override fun getClassFilePath(internalClassName: String): String {
return toSystemIndependentName(File(outputDir, "$internalClassName.class").canonicalPath)
@@ -125,7 +131,7 @@ open class IncrementalJvmCache(
}
KotlinClassHeader.Kind.MULTIFILE_CLASS -> {
val partNames = kotlinClass.classHeader.data?.toList()
?: throw AssertionError("Multifile class has no parts: ${kotlinClass.className}")
?: throw AssertionError("Multifile class has no parts: ${kotlinClass.className}")
multifileFacadeToParts[className] = partNames
// When a class is replaced with a facade with the same name,
// the class' proto wouldn't ever be deleted,
@@ -173,15 +179,15 @@ open class IncrementalJvmCache(
}
fun getObsoleteJavaClasses(): Collection<ClassId> =
dirtyOutputClassesMap.getDirtyOutputClasses()
.mapNotNull {
javaSourcesProtoMap[it]?.classId
}
dirtyOutputClassesMap.getDirtyOutputClasses()
.mapNotNull {
javaSourcesProtoMap[it]?.classId
}
fun isJavaClassToTrack(classId: ClassId): Boolean {
val jvmClassName = JvmClassName.byClassId(classId)
return dirtyOutputClassesMap.isDirty(jvmClassName) ||
jvmClassName !in javaSourcesProtoMap
jvmClassName !in javaSourcesProtoMap
}
fun isJavaClassAlreadyInCache(classId: ClassId): Boolean {
@@ -206,8 +212,7 @@ open class IncrementalJvmCache(
if (notRemovedParts.isEmpty()) {
multifileFacadeToParts.remove(facade)
}
else {
} else {
multifileFacadeToParts[facade] = notRemovedParts
}
}
@@ -261,7 +266,7 @@ open class IncrementalJvmCache(
override fun clean() {
super.clean()
normalCacheVersion(targetDataRoot).clean()
localCacheVersionManager(targetDataRoot, IncrementalCompilation.isEnabledForJvm()).clean()
}
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
@@ -286,9 +291,11 @@ open class IncrementalJvmCache(
val key = kotlinClass.className.internalName
val oldData = storage[key]
val newData = ProtoMapValue(header.kind != KotlinClassHeader.Kind.CLASS,
BitEncoding.decodeBytes(header.data!!),
header.strings!!)
val newData = ProtoMapValue(
header.kind != KotlinClassHeader.Kind.CLASS,
BitEncoding.decodeBytes(header.data!!),
header.strings!!
)
storage[key] = newData
val packageFqName = kotlinClass.className.packageFqName
@@ -296,10 +303,10 @@ open class IncrementalJvmCache(
}
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
className.internalName in storage
operator fun get(className: JvmClassName): ProtoMapValue? =
storage[className.internalName]
storage[className.internalName]
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
@@ -315,15 +322,16 @@ open class IncrementalJvmCache(
}
}
private inner class JavaSourcesProtoMap(storageFile: File) : BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
private inner class JavaSourcesProtoMap(storageFile: File) :
BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
fun process(jvmClassName: JvmClassName, newData: SerializedJavaClass, changesCollector: ChangesCollector) {
val key = jvmClassName.internalName
val oldData = storage[key]
storage[key] = newData
changesCollector.collectProtoChanges(
oldData?.toProtoData(), newData.toProtoData(),
collectAllMembersForNewClass = true
oldData?.toProtoData(), newData.toProtoData(),
collectAllMembersForNewClass = true
)
}
@@ -336,13 +344,13 @@ open class IncrementalJvmCache(
}
operator fun get(className: JvmClassName): SerializedJavaClass? =
storage[className.internalName]
storage[className.internalName]
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
className.internalName in storage
override fun dumpValue(value: SerializedJavaClass): String =
java.lang.Long.toHexString(value.proto.toByteArray().md5())
java.lang.Long.toHexString(value.proto.toByteArray().md5())
}
// todo: reuse code with InlineFunctionsMap?
@@ -364,7 +372,7 @@ open class IncrementalJvmCache(
}
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
className.internalName in storage
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
@@ -373,8 +381,7 @@ open class IncrementalJvmCache(
val newMap = getConstantsMap(kotlinClass.fileContents)
if (newMap.isNotEmpty()) {
storage[key] = newMap
}
else {
} else {
storage.remove(key)
}
@@ -388,7 +395,7 @@ open class IncrementalJvmCache(
}
override fun dumpValue(value: Map<String, Any>): String =
value.dumpMap(Any::toString)
value.dumpMap(Any::toString)
}
private inner class PackagePartMap(storageFile: File) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
@@ -401,21 +408,22 @@ open class IncrementalJvmCache(
}
fun isPackagePart(className: JvmClassName): Boolean =
className.internalName in storage
className.internalName in storage
override fun dumpValue(value: Boolean) = ""
}
private inner class MultifileClassFacadeMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
private inner class MultifileClassFacadeMap(storageFile: File) :
BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
operator fun set(className: JvmClassName, partNames: Collection<String>) {
storage[className.internalName] = partNames
}
operator fun get(className: JvmClassName): Collection<String>? =
storage[className.internalName]
storage[className.internalName]
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
className.internalName in storage
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
@@ -424,13 +432,14 @@ open class IncrementalJvmCache(
override fun dumpValue(value: Collection<String>): String = value.dumpCollection()
}
private inner class MultifileClassPartMap(storageFile: File) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
private inner class MultifileClassPartMap(storageFile: File) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
fun set(partName: String, facadeName: String) {
storage[partName] = facadeName
}
fun get(partName: JvmClassName): String? =
storage[partName.internalName]
storage[partName.internalName]
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
@@ -439,20 +448,21 @@ open class IncrementalJvmCache(
override fun dumpValue(value: String): String = value
}
inner class InternalNameToSourcesMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, EnumeratorStringDescriptor(), PathCollectionExternalizer) {
inner class InternalNameToSourcesMap(storageFile: File) :
BasicStringMap<Collection<String>>(storageFile, EnumeratorStringDescriptor(), PathCollectionExternalizer) {
operator fun set(internalName: String, sourceFiles: Iterable<File>) {
storage[internalName] = sourceFiles.map { it.canonicalPath }
}
operator fun get(internalName: String): Collection<File> =
(storage[internalName] ?: emptyList()).map(::File)
(storage[internalName] ?: emptyList()).map(::File)
fun remove(internalName: String) {
storage.remove(internalName)
}
override fun dumpValue(value: Collection<String>): String =
value.dumpCollection()
value.dumpCollection()
}
private fun addToClassStorage(kotlinClass: LocalFileKotlinClass, srcFile: File) {
@@ -460,7 +470,8 @@ open class IncrementalJvmCache(
addToClassStorage(proto, nameResolver, srcFile)
}
private inner class InlineFunctionsMap(storageFile: File) : BasicStringMap<Map<String, Long>>(storageFile, StringToLongMapExternalizer) {
private inner class InlineFunctionsMap(storageFile: File) :
BasicStringMap<Map<String, Long>>(storageFile, StringToLongMapExternalizer) {
private fun getInlineFunctionsMap(header: KotlinClassHeader, bytes: ByteArray): Map<String, Long> {
val inlineFunctions = inlineFunctionsJvmNames(header)
if (inlineFunctions.isEmpty()) return emptyMap()
@@ -468,7 +479,13 @@ open class IncrementalJvmCache(
val result = HashMap<String, Long>()
ClassReader(bytes).accept(object : ClassVisitor(Opcodes.ASM5) {
override fun visitMethod(access: Int, name: String, desc: String, signature: String?, exceptions: Array<out String>?): MethodVisitor? {
override fun visitMethod(
access: Int,
name: String,
desc: String,
signature: String?,
exceptions: Array<out String>?
): MethodVisitor? {
val dummyClassWriter = ClassWriter(Opcodes.ASM5)
return object : MethodVisitor(Opcodes.ASM5, dummyClassWriter.visitMethod(0, name, desc, null, exceptions)) {
@@ -495,30 +512,35 @@ open class IncrementalJvmCache(
val newMap = getInlineFunctionsMap(kotlinClass.classHeader, kotlinClass.fileContents)
if (newMap.isNotEmpty()) {
storage[key] = newMap
}
else {
} else {
storage.remove(key)
}
for (fn in oldMap.keys + newMap.keys) {
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(), functionNameBySignature(fn), oldMap[fn], newMap[fn])
changesCollector.collectMemberIfValueWasChanged(
kotlinClass.scopeFqName(),
functionNameBySignature(fn),
oldMap[fn],
newMap[fn]
)
}
}
// TODO get name in better way instead of using substringBefore
private fun functionNameBySignature(signature: String): String =
signature.substringBefore("(")
signature.substringBefore("(")
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
override fun dumpValue(value: Map<String, Long>): String =
value.dumpMap { java.lang.Long.toHexString(it) }
value.dumpMap { java.lang.Long.toHexString(it) }
}
}
private object PathCollectionExternalizer : CollectionExternalizer<String>(PathStringDescriptor, { THashSet(FileUtil.PATH_HASHING_STRATEGY) })
private object PathCollectionExternalizer :
CollectionExternalizer<String>(PathStringDescriptor, { THashSet(FileUtil.PATH_HASHING_STRATEGY) })
sealed class ChangeInfo(val fqName: FqName) {
open class MembersChanged(fqName: FqName, val names: Collection<String>) : ChangeInfo(fqName) {
@@ -538,10 +560,10 @@ sealed class ChangeInfo(val fqName: FqName) {
}
private fun LocalFileKotlinClass.scopeFqName() =
when (classHeader.kind) {
KotlinClassHeader.Kind.CLASS -> className.fqNameForClassNameWithoutDollars
else -> className.packageFqName
}
when (classHeader.kind) {
KotlinClassHeader.Kind.CLASS -> className.fqNameForClassNameWithoutDollars
else -> className.packageFqName
}
fun ByteArray.md5(): Long {
val d = MessageDigest.getInstance("MD5").digest(this)!!
@@ -553,23 +575,24 @@ fun ByteArray.md5(): Long {
or ((d[5].toLong() and 0xFFL) shl 40)
or ((d[6].toLong() and 0xFFL) shl 48)
or ((d[7].toLong() and 0xFFL) shl 56)
)
)
}
@TestOnly
fun <K : Comparable<K>, V> Map<K, V>.dumpMap(dumpValue: (V)->String): String =
buildString {
append("{")
for (key in keys.sorted()) {
if (length != 1) {
append(", ")
}
val value = get(key)?.let(dumpValue) ?: "null"
append("$key -> $value")
fun <K : Comparable<K>, V> Map<K, V>.dumpMap(dumpValue: (V) -> String): String =
buildString {
append("{")
for (key in keys.sorted()) {
if (length != 1) {
append(", ")
}
append("}")
}
@TestOnly fun <T : Comparable<T>> Collection<T>.dumpCollection(): String =
"[${sorted().joinToString(", ", transform = Any::toString)}]"
val value = get(key)?.let(dumpValue) ?: "null"
append("$key -> $value")
}
append("}")
}
@TestOnly
fun <T : Comparable<T>> Collection<T>.dumpCollection(): String =
"[${sorted().joinToString(", ", transform = Any::toString)}]"

View File

@@ -16,20 +16,30 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.builtins.BuiltInSerializerProtocol
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.java.JavaVisibilities
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
import org.jetbrains.kotlin.metadata.serialization.MutableVersionRequirementTable
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.scopes.MemberScope
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.serialization.KotlinSerializerExtensionBase
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.java.JavaClassProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol
// It uses BuiltInSerializerProtocol for annotations serialization
class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSerializerProtocol) {
override fun serializeClass(descriptor: ClassDescriptor, proto: ProtoBuf.Class.Builder) {
super.serializeClass(descriptor, proto)
override val metadataVersion: BinaryVersion
get() = JvmMetadataVersion.INVALID_VERSION
override fun serializeClass(
descriptor: ClassDescriptor,
proto: ProtoBuf.Class.Builder,
versionRequirementTable: MutableVersionRequirementTable
) {
super.serializeClass(descriptor, proto, versionRequirementTable)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateClass, true)
}
@@ -53,8 +63,12 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
}
}
override fun serializeProperty(descriptor: PropertyDescriptor, proto: ProtoBuf.Property.Builder) {
super.serializeProperty(descriptor, proto)
override fun serializeProperty(
descriptor: PropertyDescriptor,
proto: ProtoBuf.Property.Builder,
versionRequirementTable: MutableVersionRequirementTable
) {
super.serializeProperty(descriptor, proto, versionRequirementTable)
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateField, true)
}

View File

@@ -23,15 +23,17 @@ import org.jetbrains.kotlin.descriptors.findClassAcrossModuleDependencies
import org.jetbrains.kotlin.load.java.JavaClassesTracker
import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor
import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaClassDescriptor
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolverImpl
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.protobuf.ExtensionRegistryLite
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
import org.jetbrains.kotlin.resolve.source.PsiSourceElement
import org.jetbrains.kotlin.serialization.DescriptorSerializer
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolverImpl
import org.jetbrains.kotlin.serialization.java.JavaClassProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.util.PerformanceCounter
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import org.jetbrains.kotlin.utils.sure
@@ -93,8 +95,15 @@ fun JavaClassDescriptor.convertToProto(): SerializedJavaClassWithSource {
val file = javaSourceFile.sure { "convertToProto should only be called for source based classes" }
val extension = JavaClassesSerializerExtension()
val serializer = DescriptorSerializer.createTopLevel(extension)
val classProto = serializer.classProto(this).build()
val classProto = try {
DescriptorSerializer.create(this, extension, null).classProto(this).build()
} catch (e: Exception) {
throw IllegalStateException(
"Error during writing proto for descriptor: ${DescriptorRenderer.DEBUG_TEXT.render(this)}\n" +
"Source file: $file",
e
)
}
val (stringTable, qualifiedNameTable) = extension.stringTable.buildProto()

View File

@@ -16,14 +16,15 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.builtins.BuiltInsProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
import org.jetbrains.kotlin.metadata.js.JsProtoBuf
import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf
import org.jetbrains.kotlin.metadata.serialization.Interner
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf
import org.jetbrains.kotlin.serialization.js.JsProtoBuf
import org.jetbrains.kotlin.serialization.java.JavaClassProtoBuf
import org.jetbrains.kotlin.utils.Interner
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.util.*
/** This file is generated by org.jetbrains.kotlin.generators.protobuf.GenerateProtoBufCompare. DO NOT MODIFY MANUALLY */
@@ -176,10 +177,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (!checkEquals(old.typeTable, new.typeTable)) return false
}
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
if (old.hasVersionRequirement()) {
if (old.versionRequirement != new.versionRequirement) return false
}
if (!checkEqualsClassVersionRequirement(old, new)) return false
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
if (old.hasVersionRequirementTable()) {
@@ -250,7 +248,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
ENUM_ENTRY_LIST,
SEALED_SUBCLASS_FQ_NAME_LIST,
TYPE_TABLE,
VERSION_REQUIREMENT,
VERSION_REQUIREMENT_LIST,
VERSION_REQUIREMENT_TABLE,
JVM_EXT_CLASS_MODULE_NAME,
JVM_EXT_CLASS_LOCAL_VARIABLE_LIST,
@@ -301,10 +299,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (!checkEquals(old.typeTable, new.typeTable)) result.add(ProtoBufClassKind.TYPE_TABLE)
}
if (old.hasVersionRequirement() != new.hasVersionRequirement()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT)
if (old.hasVersionRequirement()) {
if (old.versionRequirement != new.versionRequirement) result.add(ProtoBufClassKind.VERSION_REQUIREMENT)
}
if (!checkEqualsClassVersionRequirement(old, new)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_LIST)
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
if (old.hasVersionRequirementTable()) {
@@ -403,10 +398,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (!checkEquals(old.typeTable, new.typeTable)) return false
}
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
if (old.hasVersionRequirement()) {
if (old.versionRequirement != new.versionRequirement) return false
}
if (!checkEqualsFunctionVersionRequirement(old, new)) return false
if (old.hasContract() != new.hasContract()) return false
if (old.hasContract()) {
@@ -509,16 +501,18 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (old.setterFlags != new.setterFlags) return false
}
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
if (old.hasVersionRequirement()) {
if (old.versionRequirement != new.versionRequirement) return false
}
if (!checkEqualsPropertyVersionRequirement(old, new)) return false
if (old.hasExtension(JvmProtoBuf.propertySignature) != new.hasExtension(JvmProtoBuf.propertySignature)) return false
if (old.hasExtension(JvmProtoBuf.propertySignature)) {
if (!checkEquals(old.getExtension(JvmProtoBuf.propertySignature), new.getExtension(JvmProtoBuf.propertySignature))) return false
}
if (old.hasExtension(JvmProtoBuf.flags) != new.hasExtension(JvmProtoBuf.flags)) return false
if (old.hasExtension(JvmProtoBuf.flags)) {
if (old.getExtension(JvmProtoBuf.flags) != new.getExtension(JvmProtoBuf.flags)) return false
}
if (old.getExtensionCount(JsProtoBuf.propertyAnnotation) != new.getExtensionCount(JsProtoBuf.propertyAnnotation)) {
return false
}
@@ -597,10 +591,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (!checkEqualsTypeAliasAnnotation(old, new)) return false
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
if (old.hasVersionRequirement()) {
if (old.versionRequirement != new.versionRequirement) return false
}
if (!checkEqualsTypeAliasVersionRequirement(old, new)) return false
return true
}
@@ -782,10 +773,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (!checkEqualsConstructorValueParameter(old, new)) return false
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
if (old.hasVersionRequirement()) {
if (old.versionRequirement != new.versionRequirement) return false
}
if (!checkEqualsConstructorVersionRequirement(old, new)) return false
if (old.hasExtension(JvmProtoBuf.constructorSignature) != new.hasExtension(JvmProtoBuf.constructorSignature)) return false
if (old.hasExtension(JvmProtoBuf.constructorSignature)) {
@@ -989,6 +977,16 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
if (!checkEqualsAnnotationArgumentValueArrayElement(old, new)) return false
if (old.hasArrayDimensionCount() != new.hasArrayDimensionCount()) return false
if (old.hasArrayDimensionCount()) {
if (old.arrayDimensionCount != new.arrayDimensionCount) return false
}
if (old.hasFlags() != new.hasFlags()) return false
if (old.hasFlags()) {
if (old.flags != new.flags) return false
}
return true
}
@@ -1251,6 +1249,16 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
return true
}
open fun checkEqualsClassVersionRequirement(old: ProtoBuf.Class, new: ProtoBuf.Class): Boolean {
if (old.versionRequirementCount != new.versionRequirementCount) return false
for(i in 0..old.versionRequirementCount - 1) {
if (old.getVersionRequirement(i) != new.getVersionRequirement(i)) return false
}
return true
}
open fun checkEqualsFunctionTypeParameter(old: ProtoBuf.Function, new: ProtoBuf.Function): Boolean {
if (old.typeParameterCount != new.typeParameterCount) return false
@@ -1271,6 +1279,16 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
return true
}
open fun checkEqualsFunctionVersionRequirement(old: ProtoBuf.Function, new: ProtoBuf.Function): Boolean {
if (old.versionRequirementCount != new.versionRequirementCount) return false
for(i in 0..old.versionRequirementCount - 1) {
if (old.getVersionRequirement(i) != new.getVersionRequirement(i)) return false
}
return true
}
open fun checkEqualsPropertyTypeParameter(old: ProtoBuf.Property, new: ProtoBuf.Property): Boolean {
if (old.typeParameterCount != new.typeParameterCount) return false
@@ -1281,6 +1299,16 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
return true
}
open fun checkEqualsPropertyVersionRequirement(old: ProtoBuf.Property, new: ProtoBuf.Property): Boolean {
if (old.versionRequirementCount != new.versionRequirementCount) return false
for(i in 0..old.versionRequirementCount - 1) {
if (old.getVersionRequirement(i) != new.getVersionRequirement(i)) return false
}
return true
}
open fun checkEqualsTypeAliasTypeParameter(old: ProtoBuf.TypeAlias, new: ProtoBuf.TypeAlias): Boolean {
if (old.typeParameterCount != new.typeParameterCount) return false
@@ -1301,6 +1329,16 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
return true
}
open fun checkEqualsTypeAliasVersionRequirement(old: ProtoBuf.TypeAlias, new: ProtoBuf.TypeAlias): Boolean {
if (old.versionRequirementCount != new.versionRequirementCount) return false
for(i in 0..old.versionRequirementCount - 1) {
if (old.getVersionRequirement(i) != new.getVersionRequirement(i)) return false
}
return true
}
open fun checkEqualsTypeTableType(old: ProtoBuf.TypeTable, new: ProtoBuf.TypeTable): Boolean {
if (old.typeCount != new.typeCount) return false
@@ -1361,6 +1399,16 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
return true
}
open fun checkEqualsConstructorVersionRequirement(old: ProtoBuf.Constructor, new: ProtoBuf.Constructor): Boolean {
if (old.versionRequirementCount != new.versionRequirementCount) return false
for(i in 0..old.versionRequirementCount - 1) {
if (old.getVersionRequirement(i) != new.getVersionRequirement(i)) return false
}
return true
}
open fun checkEqualsAnnotationArgument(old: ProtoBuf.Annotation, new: ProtoBuf.Annotation): Boolean {
if (old.argumentCount != new.argumentCount) return false
@@ -1551,8 +1599,8 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
}
if (hasVersionRequirement()) {
hashCode = 31 * hashCode + versionRequirement
for(i in 0..versionRequirementCount - 1) {
hashCode = 31 * hashCode + getVersionRequirement(i)
}
if (hasVersionRequirementTable()) {
@@ -1631,8 +1679,8 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
}
if (hasVersionRequirement()) {
hashCode = 31 * hashCode + versionRequirement
for(i in 0..versionRequirementCount - 1) {
hashCode = 31 * hashCode + getVersionRequirement(i)
}
if (hasContract()) {
@@ -1715,14 +1763,18 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
hashCode = 31 * hashCode + setterFlags
}
if (hasVersionRequirement()) {
hashCode = 31 * hashCode + versionRequirement
for(i in 0..versionRequirementCount - 1) {
hashCode = 31 * hashCode + getVersionRequirement(i)
}
if (hasExtension(JvmProtoBuf.propertySignature)) {
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.propertySignature).hashCode(stringIndexes, fqNameIndexes)
}
if (hasExtension(JvmProtoBuf.flags)) {
hashCode = 31 * hashCode + getExtension(JvmProtoBuf.flags)
}
for(i in 0..getExtensionCount(JsProtoBuf.propertyAnnotation) - 1) {
hashCode = 31 * hashCode + getExtension(JsProtoBuf.propertyAnnotation, i).hashCode(stringIndexes, fqNameIndexes)
}
@@ -1787,8 +1839,8 @@ fun ProtoBuf.TypeAlias.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int
hashCode = 31 * hashCode + getAnnotation(i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasVersionRequirement()) {
hashCode = 31 * hashCode + versionRequirement
for(i in 0..versionRequirementCount - 1) {
hashCode = 31 * hashCode + getVersionRequirement(i)
}
return hashCode
@@ -1945,8 +1997,8 @@ fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasVersionRequirement()) {
hashCode = 31 * hashCode + versionRequirement
for(i in 0..versionRequirementCount - 1) {
hashCode = 31 * hashCode + getVersionRequirement(i)
}
if (hasExtension(JvmProtoBuf.constructorSignature)) {
@@ -2119,6 +2171,14 @@ fun ProtoBuf.Annotation.Argument.Value.hashCode(stringIndexes: (Int) -> Int, fqN
hashCode = 31 * hashCode + getArrayElement(i).hashCode(stringIndexes, fqNameIndexes)
}
if (hasArrayDimensionCount()) {
hashCode = 31 * hashCode + arrayDimensionCount
}
if (hasFlags()) {
hashCode = 31 * hashCode + flags
}
return hashCode
}

View File

@@ -34,11 +34,14 @@ import org.jetbrains.kotlin.synthetic.SAM_LOOKUP_NAME
import java.io.File
import java.util.*
const val DELETE_MODULE_FILE_PROPERTY = "kotlin.delete.module.file.after.build"
fun makeModuleFile(
name: String,
isTest: Boolean,
outputDir: File,
sourcesToCompile: Iterable<File>,
commonSources: Iterable<File>,
javaSourceRoots: Iterable<JvmSourceRoot>,
classpath: Iterable<File>,
friendDirs: Iterable<File>
@@ -47,9 +50,13 @@ fun makeModuleFile(
builder.addModule(
name,
outputDir.absolutePath,
sourcesToCompile,
// important to transform file to absolute paths,
// otherwise compiler will use module file's parent as base path (a temporary file; see below)
// (see org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.getAbsolutePaths)
sourcesToCompile.map { it.absoluteFile },
javaSourceRoots,
classpath,
commonSources.map { it.absoluteFile },
null,
"java-production",
isTest,
@@ -78,10 +85,10 @@ fun makeCompileServices(
}
fun updateIncrementalCache(
generatedFiles: Iterable<GeneratedFile>,
cache: IncrementalJvmCache,
changesCollector: ChangesCollector,
javaChangesTracker: JavaClassesTrackerImpl?
generatedFiles: Iterable<GeneratedFile>,
cache: IncrementalJvmCache,
changesCollector: ChangesCollector,
javaChangesTracker: JavaClassesTrackerImpl?
) {
for (generatedFile in generatedFiles) {
when {
@@ -116,8 +123,8 @@ data class DirtyData(
)
fun ChangesCollector.getDirtyData(
caches: Iterable<IncrementalCacheCommon<*>>,
reporter: ICReporter
caches: Iterable<IncrementalCacheCommon>,
reporter: ICReporter
): DirtyData {
val dirtyLookupSymbols = HashSet<LookupSymbol>()
val dirtyClassesFqNames = HashSet<FqName>()
@@ -127,6 +134,7 @@ fun ChangesCollector.getDirtyData(
if (change is ChangeInfo.SignatureChanged) {
val fqNames = if (!change.areSubclassesAffected) listOf(change.fqName) else withSubtypes(change.fqName, caches)
dirtyClassesFqNames.addAll(fqNames)
for (classFqName in fqNames) {
assert(!classFqName.isRoot) { "$classFqName is root when processing $change" }
@@ -170,10 +178,10 @@ fun mapLookupSymbolsToFiles(
}
fun mapClassesFqNamesToFiles(
caches: Iterable<IncrementalCacheCommon<*>>,
classesFqNames: Iterable<FqName>,
reporter: ICReporter,
excludes: Set<File> = emptySet()
caches: Iterable<IncrementalCacheCommon>,
classesFqNames: Iterable<FqName>,
reporter: ICReporter,
excludes: Set<File> = emptySet()
): Set<File> {
val dirtyFiles = HashSet<File>()
@@ -192,7 +200,7 @@ fun mapClassesFqNamesToFiles(
fun withSubtypes(
typeFqName: FqName,
caches: Iterable<IncrementalCacheCommon<*>>
caches: Iterable<IncrementalCacheCommon>
): Set<FqName> {
val types = LinkedList(listOf(typeFqName))
val subtypes = hashSetOf<FqName>()

View File

@@ -21,11 +21,8 @@ import java.io.File
fun File.isJavaFile() =
extension.equals("java", ignoreCase = true)
fun File.isKotlinFile(): Boolean =
extension.let {
"kt".equals(it, ignoreCase = true) ||
"kts".equals(it, ignoreCase = true)
}
fun File.isKotlinFile(sourceFilesExtensions: List<String>): Boolean =
!isJavaFile() && sourceFilesExtensions.any { it.equals(extension, ignoreCase = true) }
fun File.isClassFile(): Boolean =
extension.equals("class", ignoreCase = true)

View File

@@ -0,0 +1,21 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.js
import org.jetbrains.kotlin.incremental.IncrementalJsCache
import org.jetbrains.kotlin.utils.JsMetadataVersion
import java.io.File
class IncrementalDataProviderFromCache(private val cache: IncrementalJsCache) : IncrementalDataProvider {
override val headerMetadata: ByteArray
get() = cache.header
override val compiledPackageParts: Map<File, TranslationResultValue>
get() = cache.nonDirtyPackageParts()
override val metadataVersion: IntArray
get() = JsMetadataVersion.INSTANCE.toArray() // TODO: store and load correct metadata version
}

View File

@@ -20,13 +20,13 @@ import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufClassKind
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.Flags
import org.jetbrains.kotlin.serialization.ProtoBuf
import org.jetbrains.kotlin.serialization.deserialization.Deserialization
import org.jetbrains.kotlin.serialization.deserialization.NameResolver
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import java.util.*
data class Difference(
@@ -41,16 +41,15 @@ data class PackagePartProtoData(val proto: ProtoBuf.Package, val nameResolver: N
fun ProtoMapValue.toProtoData(packageFqName: FqName): ProtoData =
if (isPackageFacade) {
val packageData = JvmProtoBufUtil.readPackageDataFrom(bytes, strings)
PackagePartProtoData(packageData.packageProto, packageData.nameResolver, packageFqName)
}
else {
val classData = JvmProtoBufUtil.readClassDataFrom(bytes, strings)
ClassProtoData(classData.classProto, classData.nameResolver)
val (nameResolver, packageProto) = JvmProtoBufUtil.readPackageDataFrom(bytes, strings)
PackagePartProtoData(packageProto, nameResolver, packageFqName)
} else {
val (nameResolver, classProto) = JvmProtoBufUtil.readClassDataFrom(bytes, strings)
ClassProtoData(classProto, nameResolver)
}
internal val MessageLite.isPrivate: Boolean
get() = Visibilities.isPrivate(Deserialization.visibility(
get() = Visibilities.isPrivate(ProtoEnumFlags.visibility(
when (this) {
is ProtoBuf.Constructor -> Flags.VISIBILITY.get(flags)
is ProtoBuf.Function -> Flags.VISIBILITY.get(flags)
@@ -224,7 +223,7 @@ class DifferenceCalculatorForClass(
ProtoBufClassKind.TYPE_TABLE -> {
// TODO
}
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT,
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT_LIST,
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT_TABLE -> {
// TODO
}

View File

@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
internal class FileToIdMap(file: File) : BasicMap<File, Int>(file, FileKeyDescriptor, IntExternalizer) {
@@ -34,5 +33,12 @@ internal class FileToIdMap(file: File) : BasicMap<File, Int>(file, FileKeyDescri
storage.remove(file)
}
fun toMap(): Map<File, Int> = storage.keys.keysToMap { storage[it]!! }
fun toMap(): Map<File, Int> {
val result = HashMap<File, Int>()
for (key in storage.keys) {
val value = storage[key] ?: continue
result[key] = value
}
return result
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.incremental.dumpCollection
import java.io.File
class FilesMap(storageFile: File)
: BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer) {
operator fun set(sourceFile: File, outputFiles: Collection<File>) {
storage[sourceFile.absolutePath] = outputFiles.map { it.absolutePath }
}
operator fun get(sourceFile: File): Collection<File> =
storage[sourceFile.absolutePath].orEmpty().map(::File)
override fun dumpValue(value: Collection<String>) =
value.dumpCollection()
fun remove(file: File): Collection<File> =
get(file).also { storage.remove(file.absolutePath) }
}

View File

@@ -22,20 +22,27 @@ import org.jetbrains.kotlin.resolve.jvm.JvmClassName
internal interface NameTransformer<Name> {
fun asString(name: Name): String
fun asName(string: String): Name
fun asFqName(string: String): FqName
}
internal object FqNameTransformer : NameTransformer<FqName> {
override fun asString(name: FqName): String =
name.asString()
name.asString()
override fun asName(string: String): FqName =
FqName(string)
FqName(string)
override fun asFqName(string: String): FqName =
asName(string)
}
internal object JvmClassNameTransformer : NameTransformer<JvmClassName> {
override fun asString(name: JvmClassName): String =
name.internalName
name.internalName
override fun asName(string: String): JvmClassName =
JvmClassName.byInternalName(string)
JvmClassName.byInternalName(string)
override fun asFqName(string: String): FqName =
asName(string).fqNameForClassNameWithoutDollars
}

View File

@@ -42,6 +42,9 @@ internal abstract class AbstractSourceToOutputMap<Name>(
operator fun get(sourceFile: File): Collection<Name> =
storage[sourceFile.absolutePath].orEmpty().map(nameTransformer::asName)
fun getFqNames(sourceFile: File): Collection<FqName> =
storage[sourceFile.absolutePath].orEmpty().map(nameTransformer::asFqName)
override fun dumpValue(value: Collection<String>) =
value.dumpCollection()

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage.version
/**
* Diff between actual and expected cache attributes.
* [status] are calculated based on this diff (see [CacheStatus]).
* Based on that [status] system may perform required actions (i.e. rebuild something, clearing caches, etc...).
*
* [CacheAttributesDiff] can be used to cache current attribute values and as facade for version operations.
*/
data class CacheAttributesDiff<Attrs: Any>(
val manager: CacheAttributesManager<Attrs>,
val actual: Attrs?,
val expected: Attrs?
) {
val status: CacheStatus
get() =
if (expected != null) {
if (actual != null && manager.isCompatible(actual, expected)) CacheStatus.VALID
else CacheStatus.INVALID
} else {
if (actual != null) CacheStatus.SHOULD_BE_CLEARED
else CacheStatus.CLEARED
}
fun saveExpectedIfNeeded() {
if (expected != actual) manager.writeActualVersion(expected)
}
override fun toString(): String {
return "$status: actual=$actual -> expected=$expected"
}
}

View File

@@ -0,0 +1,79 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage.version
/**
* Manages cache attributes values.
*
* Attribute values can be loaded by calling [loadActual].
* Based on loaded actual and fixed [expected] values [CacheAttributesDiff] can be constructed which can calculate [CacheStatus].
* Build system may perform required actions based on that (i.e. rebuild something, clearing caches, etc...).
*
* [CacheAttributesDiff] can be used to cache current attribute values and then can be used as facade for cache version operations.
*/
interface CacheAttributesManager<Attrs : Any> {
/**
* Cache attribute values expected by the current version of build system and compiler.
* `null` means that cache is not required (incremental compilation is disabled).
*/
val expected: Attrs?
/**
* Load actual cache attribute values.
* `null` means that cache is not yet created.
*
* This is internal operation that should be implemented by particular implementation of CacheAttributesManager.
* Consider using `loadDiff().actual` for getting actual values.
*/
fun loadActual(): Attrs?
/**
* Write [values] as cache attributes for next build execution.
*
* This is internal operation that should be implemented by particular implementation of CacheAttributesManager.
* Consider using `loadDiff().saveExpectedIfNeeded()` for saving attributes values for next build.
*/
fun writeActualVersion(values: Attrs?)
/**
* Check if cache with [actual] attributes values can be used when [expected] attributes are required.
*/
fun isCompatible(actual: Attrs, expected: Attrs): Boolean = actual == expected
}
fun <Attrs : Any> CacheAttributesManager<Attrs>.loadDiff(
actual: Attrs? = this.loadActual(),
expected: Attrs? = this.expected
) = CacheAttributesDiff(this, actual, expected)
fun <Attrs : Any> CacheAttributesManager<Attrs>.loadAndCheckStatus() =
loadDiff().status
/**
* This method is kept only for compatibility.
* Save [expected] cache attributes values if it is enabled and not equals to [actual].
*/
@Deprecated(
message = "Consider using `this.loadDiff().saveExpectedIfNeeded()` and cache `loadDiff()` result.",
replaceWith = ReplaceWith("loadDiff().saveExpectedIfNeeded()")
)
fun <Attrs : Any> CacheAttributesManager<Attrs>.saveIfNeeded(
actual: Attrs? = this.loadActual(),
expected: Attrs = this.expected
?: error("To save disabled cache status [delete] should be called (this behavior is kept for compatibility)")
) = loadDiff(actual, expected).saveExpectedIfNeeded()
/**
* This method is kept only for compatibility.
* Delete actual cache attributes values if it existed.
*/
@Deprecated(
message = "Consider using `this.loadDiff().saveExpectedIfNeeded()` and cache `loadDiff()` result.",
replaceWith = ReplaceWith("writeActualVersion(null)")
)
fun CacheAttributesManager<*>.clean() {
writeActualVersion(null)
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage.version
/**
* Status that is used by system to perform required actions (i.e. rebuild something, clearing caches, etc...).
*/
enum class CacheStatus {
/**
* Cache is valid and ready to use.
*/
VALID,
/**
* Cache is not exists or have outdated versions and/or other attributes.
*/
INVALID,
/**
* Cache is exists, but not required anymore.
*/
SHOULD_BE_CLEARED,
/**
* Cache is not exists and not required.
*/
CLEARED
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage.version
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
import java.io.File
import java.io.IOException
/**
* Manages files with actual version [loadActual] and provides expected version [expected].
* Based on that actual and expected versions [CacheStatus] can be calculated.
* This can be done by constructing [CacheAttributesDiff] and calling [CacheAttributesDiff.status].
* Based on that status system may perform required actions (i.e. rebuild something, clearing caches, etc...).
*/
class CacheVersionManager(
private val versionFile: File,
expectedOwnVersion: Int?
) : CacheAttributesManager<CacheVersion> {
override val expected: CacheVersion? =
if (expectedOwnVersion == null) null
else {
val metadata = JvmMetadataVersion.INSTANCE
val bytecode = JvmBytecodeBinaryVersion.INSTANCE
CacheVersion(
expectedOwnVersion * 1000000 +
bytecode.major * 10000 + bytecode.minor * 100 +
metadata.major * 1000 + metadata.minor
)
}
override fun loadActual(): CacheVersion? =
if (!versionFile.exists()) null
else try {
CacheVersion(versionFile.readText().toInt())
} catch (e: NumberFormatException) {
null
} catch (e: IOException) {
null
}
override fun writeActualVersion(values: CacheVersion?) {
if (values == null) versionFile.delete()
else {
versionFile.parentFile.mkdirs()
versionFile.writeText(values.version.toString())
}
}
@get:TestOnly
val versionFileForTesting: File
get() = versionFile
}
data class CacheVersion(val version: Int)

View File

@@ -0,0 +1,17 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage.version
import java.io.File
private val NORMAL_VERSION = 9
private val NORMAL_VERSION_FILE_NAME = "format-version.txt"
fun localCacheVersionManager(dataRoot: File, isCachesEnabled: Boolean) =
CacheVersionManager(
File(dataRoot, NORMAL_VERSION_FILE_NAME),
if (isCachesEnabled) NORMAL_VERSION else null
)

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage.version
import java.io.File
private val DATA_CONTAINER_VERSION_FILE_NAME = "data-container-format-version.txt"
private val DATA_CONTAINER_VERSION = 3
fun lookupsCacheVersionManager(dataRoot: File, isEnabled: Boolean) =
CacheVersionManager(
File(dataRoot, DATA_CONTAINER_VERSION_FILE_NAME),
if (isEnabled) DATA_CONTAINER_VERSION else null
)
fun readLookupsCacheStatus(dataRoot: File, isEnabled: Boolean): CacheStatus =
lookupsCacheVersionManager(dataRoot, isEnabled).loadAndCheckStatus()

View File

@@ -0,0 +1,118 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: build-common/src/java_descriptors.proto
package org.jetbrains.kotlin.metadata.java;
public final class JavaClassProtoBuf {
private JavaClassProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite registry) {
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isStaticMethod);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateMethod);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isStaticField);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateField);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateClass);
registry.add(org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf.isPackagePrivateConstructor);
}
public static final int IS_STATIC_METHOD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Function,
java.lang.Boolean> isStaticMethod = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Function.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_METHOD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Function,
java.lang.Boolean> isPackagePrivateMethod = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Function.getDefaultInstance(),
false,
null,
null,
1001,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_STATIC_FIELD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.lang.Boolean> isStaticField = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_FIELD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Property,
java.lang.Boolean> isPackagePrivateField = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Property.getDefaultInstance(),
false,
null,
null,
1001,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_CLASS_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Class,
java.lang.Boolean> isPackagePrivateClass = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Class.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_CONSTRUCTOR_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.metadata.ProtoBuf.Constructor,
java.lang.Boolean> isPackagePrivateConstructor = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.metadata.ProtoBuf.Constructor.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
static {
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -34,16 +34,18 @@ class KotlinModuleXmlBuilder {
}
fun addModule(
moduleName: String,
outputDir: String,
sourceFiles: Iterable<File>,
javaSourceRoots: Iterable<JvmSourceRoot>,
classpathRoots: Iterable<File>,
modularJdkRoot: File?,
targetTypeId: String,
isTests: Boolean,
directoriesToFilterOut: Set<File>,
friendDirs: Iterable<File>): KotlinModuleXmlBuilder {
moduleName: String,
outputDir: String,
sourceFiles: Iterable<File>,
javaSourceRoots: Iterable<JvmSourceRoot>,
classpathRoots: Iterable<File>,
commonSourceFiles: Iterable<File>,
modularJdkRoot: File?,
targetTypeId: String,
isTests: Boolean,
directoriesToFilterOut: Set<File>,
friendDirs: Iterable<File>
): KotlinModuleXmlBuilder {
assert(!done) { "Already done" }
p.println("<!-- Module script for ${if (isTests) "tests" else "production"} -->")
@@ -62,6 +64,10 @@ class KotlinModuleXmlBuilder {
p.println("<", SOURCES, " ", PATH, "=\"", getEscapedPath(sourceFile), "\"/>")
}
for (commonSourceFile in commonSourceFiles) {
p.println("<", COMMON_SOURCES, " ", PATH, "=\"", getEscapedPath(commonSourceFile), "\"/>")
}
processJavaSourceRoots(javaSourceRoots)
processClasspath(classpathRoots, directoriesToFilterOut)
@@ -78,7 +84,7 @@ class KotlinModuleXmlBuilder {
directoriesToFilterOut: Set<File>) {
p.println("<!-- Classpath -->")
for (file in files) {
val isOutput = directoriesToFilterOut.contains(file) && !IncrementalCompilation.isEnabled()
val isOutput = directoriesToFilterOut.contains(file) && !IncrementalCompilation.isEnabledForJvm()
if (isOutput) {
// For IDEA's make (incremental compilation) purposes, output directories of the current module and its dependencies
// appear on the class path, so we are at risk of seeing the results of the previous build, i.e. if some class was

View File

@@ -1,118 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: build-common/src/java_descriptors.proto
package org.jetbrains.kotlin.serialization.java;
public final class JavaClassProtoBuf {
private JavaClassProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistryLite registry) {
registry.add(org.jetbrains.kotlin.serialization.java.JavaClassProtoBuf.isStaticMethod);
registry.add(org.jetbrains.kotlin.serialization.java.JavaClassProtoBuf.isPackagePrivateMethod);
registry.add(org.jetbrains.kotlin.serialization.java.JavaClassProtoBuf.isStaticField);
registry.add(org.jetbrains.kotlin.serialization.java.JavaClassProtoBuf.isPackagePrivateField);
registry.add(org.jetbrains.kotlin.serialization.java.JavaClassProtoBuf.isPackagePrivateClass);
registry.add(org.jetbrains.kotlin.serialization.java.JavaClassProtoBuf.isPackagePrivateConstructor);
}
public static final int IS_STATIC_METHOD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.serialization.ProtoBuf.Function,
java.lang.Boolean> isStaticMethod = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.serialization.ProtoBuf.Function.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_METHOD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.serialization.ProtoBuf.Function,
java.lang.Boolean> isPackagePrivateMethod = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.serialization.ProtoBuf.Function.getDefaultInstance(),
false,
null,
null,
1001,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_STATIC_FIELD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.serialization.ProtoBuf.Property,
java.lang.Boolean> isStaticField = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.serialization.ProtoBuf.Property.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_FIELD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.serialization.ProtoBuf.Property,
java.lang.Boolean> isPackagePrivateField = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.serialization.ProtoBuf.Property.getDefaultInstance(),
false,
null,
null,
1001,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_CLASS_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.serialization.ProtoBuf.Class,
java.lang.Boolean> isPackagePrivateClass = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.serialization.ProtoBuf.Class.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
public static final int IS_PACKAGE_PRIVATE_CONSTRUCTOR_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessageLite.GeneratedExtension<
org.jetbrains.kotlin.serialization.ProtoBuf.Constructor,
java.lang.Boolean> isPackagePrivateConstructor = org.jetbrains.kotlin.protobuf.GeneratedMessageLite
.newSingularGeneratedExtension(
org.jetbrains.kotlin.serialization.ProtoBuf.Constructor.getDefaultInstance(),
false,
null,
null,
1000,
org.jetbrains.kotlin.protobuf.WireFormat.FieldType.BOOL,
java.lang.Boolean.class);
static {
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.build
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.junit.Assert.assertNotEquals
import org.junit.Test
class BuildMetaInfoTest : TestCase() {
@Test
fun testJvmSerialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo.create(args)
val actual = JvmBuildMetaInfo.serializeToString(info)
val expectedKeys = listOf(
"apiVersionString",
"bytecodeVersionMajor",
"bytecodeVersionMinor",
"bytecodeVersionPatch",
"compilerBuildVersion",
"coroutinesEnable",
"coroutinesError",
"coroutinesVersion",
"coroutinesWarn",
"isEAP",
"languageVersionString",
"metadataVersionMajor",
"metadataVersionMinor",
"metadataVersionPatch",
"multiplatformEnable",
"multiplatformVersion",
"ownVersion"
)
assertEquals(expectedKeys, actual.split("\r\n", "\n").map { line -> line.split("=").first() })
}
@Test
fun testJvmSerializationDeserialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo.create(args)
val serialized = JvmBuildMetaInfo.serializeToString(info)
val deserialized = JvmBuildMetaInfo.deserializeFromString(serialized)
assertEquals(info, deserialized)
}
@Test
fun testJsSerializationDeserialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo.create(args)
val serialized = JvmBuildMetaInfo.serializeToString(info)
val deserialized = JvmBuildMetaInfo.deserializeFromString(serialized)
assertEquals(info, deserialized)
}
@Test
fun testJvmEquals() {
val args1 = K2JVMCompilerArguments()
args1.coroutinesState = CommonCompilerArguments.ENABLE
val info1 = JvmBuildMetaInfo.create(args1)
val args2 = K2JVMCompilerArguments()
args2.coroutinesState = CommonCompilerArguments.WARN
val info2 = JvmBuildMetaInfo.create(args2)
assertNotEquals(info1, info2)
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
}
}

View File

@@ -1,75 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.build
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.junit.Assert.assertNotEquals
import org.junit.Test
class JvmBuildMetaInfoTest : TestCase() {
@Test
fun testSerialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo(args)
val actual = JvmBuildMetaInfo.serializeToString(info)
val expectedKeys = listOf(
"apiVersionString",
"bytecodeVersionMajor",
"bytecodeVersionMinor",
"bytecodeVersionPatch",
"compilerBuildVersion",
"coroutinesEnable",
"coroutinesError",
"coroutinesVersion",
"coroutinesWarn",
"isEAP",
"languageVersionString",
"metadataVersionMajor",
"metadataVersionMinor",
"metadataVersionPatch",
"multiplatformEnable",
"multiplatformVersion",
"ownVersion"
)
assertEquals(expectedKeys, actual.split("\r\n", "\n").map { line -> line.split("=").first() })
}
@Test
fun testSerializationDeserialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo(args)
val serialized = JvmBuildMetaInfo.serializeToString(info)
val deserialized = JvmBuildMetaInfo.deserializeFromString(serialized)
assertEquals(info, deserialized)
}
@Test
fun testEquals() {
val args1 = K2JVMCompilerArguments()
args1.coroutinesState = CommonCompilerArguments.ENABLE
val info1 = JvmBuildMetaInfo(args1)
val args2 = K2JVMCompilerArguments()
args2.coroutinesState = CommonCompilerArguments.WARN
val info2 = JvmBuildMetaInfo(args2)
assertNotEquals(info1, info2)
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
}
}

View File

@@ -27,10 +27,11 @@ data class BuildLogFinder(
private const val JS_LOG = "js-build.log"
private const val GRADLE_LOG = "gradle-build.log"
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
const val JS_JPS_LOG = "js-jps-build.log"
private const val SIMPLE_LOG = "build.log"
fun isJpsLogFile(file: File): Boolean =
file.name.let { it == SIMPLE_LOG || it == DATA_CONTAINER_LOG }
file.name in arrayOf(SIMPLE_LOG, JS_JPS_LOG, DATA_CONTAINER_LOG)
}
fun findBuildLog(dir: File): File? {
@@ -39,6 +40,7 @@ data class BuildLogFinder(
val matchedName = when {
isJsEnabled && JS_LOG in files -> JS_LOG
isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG
isJsEnabled && JS_JPS_LOG in files -> JS_JPS_LOG
isDataContainerBuildLogEnabled && DATA_CONTAINER_LOG in files -> DATA_CONTAINER_LOG
SIMPLE_LOG in files -> SIMPLE_LOG
else -> null

View File

@@ -17,24 +17,30 @@
package org.jetbrains.kotlin.incremental.testingUtils
import com.intellij.openapi.util.io.FileUtil
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
import org.jetbrains.kotlin.js.parser.sourcemaps.SourceMapError
import org.jetbrains.kotlin.js.parser.sourcemaps.SourceMapParser
import org.jetbrains.kotlin.js.parser.sourcemaps.SourceMapSuccess
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.metadata.DebugProtoBuf
import org.jetbrains.kotlin.metadata.js.DebugJsProtoBuf
import org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf
import org.jetbrains.kotlin.metadata.jvm.deserialization.BitEncoding
import org.jetbrains.kotlin.protobuf.ExtensionRegistry
import org.jetbrains.kotlin.serialization.DebugProtoBuf
import org.jetbrains.kotlin.serialization.jvm.BitEncoding
import org.jetbrains.kotlin.serialization.jvm.DebugJvmProtoBuf
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.serialization.js.KotlinJavascriptSerializationUtil
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadata
import org.jetbrains.kotlin.utils.KotlinJavascriptMetadataUtils
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.org.objectweb.asm.ClassReader
import org.jetbrains.org.objectweb.asm.util.TraceClassVisitor
import org.junit.Assert
import org.junit.Assert.assertNotNull
import java.io.ByteArrayInputStream
import java.io.File
import java.io.PrintWriter
import java.io.StringWriter
import java.io.*
import java.util.*
import java.util.zip.CRC32
import kotlin.comparisons.compareBy
import java.util.zip.GZIPInputStream
// Set this to true if you want to dump all bytecode (test will fail in this case)
private val DUMP_ALL = System.getProperty("comparison.dump.all") == "true"
@@ -163,6 +169,57 @@ private fun classFileToString(classFile: File): String {
return out.toString()
}
private fun metaJsToString(metaJsFile: File): String {
val out = StringWriter()
val metadataList = arrayListOf<KotlinJavascriptMetadata>()
KotlinJavascriptMetadataUtils.parseMetadata(metaJsFile.readText(), metadataList)
for (metadata in metadataList) {
val (header, content) = GZIPInputStream(ByteArrayInputStream(metadata.body)).use { stream ->
DebugJsProtoBuf.Header.parseDelimitedFrom(stream, JsSerializerProtocol.extensionRegistry) to
DebugJsProtoBuf.Library.parseFrom(stream, JsSerializerProtocol.extensionRegistry)
}
out.write("\n------ header -----\n$header")
out.write("\n------ library -----\n$content")
}
return out.toString()
}
private fun kjsmToString(kjsmFile: File): String {
val out = StringWriter()
val stream = DataInputStream(kjsmFile.inputStream())
// Read and skip the metadata version
repeat(stream.readInt()) { stream.readInt() }
val (header, content) =
DebugJsProtoBuf.Header.parseDelimitedFrom(stream, JsSerializerProtocol.extensionRegistry) to
DebugJsProtoBuf.Library.parseFrom(stream, JsSerializerProtocol.extensionRegistry)
out.write("\n------ header -----\n$header")
out.write("\n------ library -----\n$content")
return out.toString()
}
private fun sourceMapFileToString(sourceMapFile: File, generatedJsFile: File): String {
val sourceMapParseResult = SourceMapParser.parse(StringReader(sourceMapFile.readText()))
return when (sourceMapParseResult) {
is SourceMapSuccess -> {
val bytesOut = ByteArrayOutputStream()
PrintStream(bytesOut).use { printStream ->
sourceMapParseResult.value.debugVerbose(printStream, generatedJsFile)
}
bytesOut.toString()
}
is SourceMapError -> {
sourceMapParseResult.message
}
}
}
private fun getExtensionRegistry(): ExtensionRegistry {
val registry = ExtensionRegistry.newInstance()!!
DebugJvmProtoBuf.registerAllExtensions(registry)
@@ -174,6 +231,16 @@ private fun fileToStringRepresentation(file: File): String {
file.name.endsWith(".class") -> {
classFileToString(file)
}
file.name.endsWith(KotlinJavascriptMetadataUtils.META_JS_SUFFIX) -> {
metaJsToString(file)
}
file.name.endsWith(KotlinJavascriptSerializationUtil.CLASS_METADATA_FILE_EXTENSION) -> {
kjsmToString(file)
}
file.name.endsWith(".js.map") -> {
val generatedJsPath = file.canonicalPath.removeSuffix(".map")
sourceMapFileToString(file, File(generatedJsPath))
}
else -> {
file.readText()
}

View File

@@ -39,14 +39,14 @@ fun copyTestSources(testDataDir: File, sourceDestinationDir: File, filePrefix: S
if (!file.isFile) continue
val renamedFile =
if (filePrefix.isEmpty()) {
file
}
else {
File(sourceDestinationDir, file.name.removePrefix(filePrefix)).apply {
file.renameTo(this)
}
if (filePrefix.isEmpty()) {
file
}
else {
File(sourceDestinationDir, file.name.removePrefix(filePrefix)).apply {
file.renameTo(this)
}
}
mapping[renamedFile] = File(testDataDir, file.name)
}
@@ -55,10 +55,10 @@ fun copyTestSources(testDataDir: File, sourceDestinationDir: File, filePrefix: S
}
fun getModificationsToPerform(
testDataDir: File,
moduleNames: Collection<String>?,
allowNoFilesWithSuffixInTestData: Boolean,
touchPolicy: TouchPolicy
testDataDir: File,
moduleNames: Collection<String>?,
allowNoFilesWithSuffixInTestData: Boolean,
touchPolicy: TouchPolicy
): List<List<Modification>> {
fun getModificationsForIteration(newSuffix: String, touchSuffix: String, deleteSuffix: String): List<Modification> {
@@ -67,12 +67,18 @@ fun getModificationsToPerform(
val underscore = fileName.indexOf("_")
if (underscore != -1) {
val module = fileName.substring(0, underscore)
var moduleName = fileName.substring(0, underscore)
var moduleFileName = fileName.substring(underscore + 1)
if (moduleName.all { it.isDigit() }) {
val (moduleName1, moduleFileName1) = moduleFileName.split("_")
moduleName = moduleName1
moduleFileName = moduleFileName1
}
assert(moduleNames != null) { "File name has module prefix, but multi-module environment is absent" }
assert(module in moduleNames!!) { "Module not found for file with prefix: $fileName" }
assert(moduleName in moduleNames!!) { "Module not found for file with prefix: $fileName" }
return Pair(module, fileName.substring(underscore + 1))
return Pair(moduleName, moduleFileName)
}
assert(moduleNames == null) { "Test is multi-module, but file has no module prefix: $fileName" }
@@ -80,9 +86,9 @@ fun getModificationsToPerform(
}
val rules = mapOf<String, (String, File) -> Modification>(
newSuffix to { path, file -> ModifyContent(path, file) },
touchSuffix to { path, _ -> TouchFile(path, touchPolicy) },
deleteSuffix to { path, _ -> DeleteFile(path) }
newSuffix to { path, file -> ModifyContent(path, file) },
touchSuffix to { path, _ -> TouchFile(path, touchPolicy) },
deleteSuffix to { path, _ -> DeleteFile(path) }
)
val modifications = ArrayList<Modification>()
@@ -122,8 +128,8 @@ fun getModificationsToPerform(
}
else {
return (1..10)
.map { getModificationsForIteration(".new.$it", ".touch.$it", ".delete.$it") }
.filter { it.isNotEmpty() }
.map { getModificationsForIteration(".new.$it", ".touch.$it", ".delete.$it") }
.filter { it.isNotEmpty() }
}
}

View File

@@ -1,16 +1,16 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: core/deserialization/src/ext_options.debug.proto
// source: core/metadata/src/ext_options.debug.proto
package org.jetbrains.kotlin.serialization;
package org.jetbrains.kotlin.metadata;
public final class DebugExtOptionsProtoBuf {
private DebugExtOptionsProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.fqNameIdInTable);
registry.add(org.jetbrains.kotlin.serialization.DebugExtOptionsProtoBuf.stringIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.stringIdInTable);
}
public static final int SKIP_IN_COMPARISON_FIELD_NUMBER = 50000;
/**
@@ -65,16 +65,16 @@ public final class DebugExtOptionsProtoBuf {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n0core/deserialization/src/ext_options.d" +
"ebug.proto\022\"org.jetbrains.kotlin.seriali" +
"zation\032 google/protobuf/descriptor.proto" +
":;\n\022skip_in_comparison\022\035.google.protobuf" +
".FieldOptions\030\320\206\003 \001(\010:9\n\020name_id_in_tabl" +
"e\022\035.google.protobuf.FieldOptions\030\321\206\003 \001(\010" +
":<\n\023fq_name_id_in_table\022\035.google.protobu" +
"f.FieldOptions\030\322\206\003 \001(\010:;\n\022string_id_in_t" +
"able\022\035.google.protobuf.FieldOptions\030\323\206\003 " +
"\001(\010B\031B\027DebugExtOptionsProtoBuf"
"\n)core/metadata/src/ext_options.debug.pr" +
"oto\022\035org.jetbrains.kotlin.metadata\032 goog" +
"le/protobuf/descriptor.proto:;\n\022skip_in_" +
"comparison\022\035.google.protobuf.FieldOption" +
"s\030\320\206\003 \001(\010:9\n\020name_id_in_table\022\035.google.p" +
"rotobuf.FieldOptions\030\321\206\003 \001(\010:<\n\023fq_name_" +
"id_in_table\022\035.google.protobuf.FieldOptio" +
"ns\030\322\206\003 \001(\010:;\n\022string_id_in_table\022\035.googl" +
"e.protobuf.FieldOptions\030\323\206\003 \001(\010B\031B\027Debug" +
"ExtOptionsProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,200 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: core/metadata/src/builtins.debug.proto
package org.jetbrains.kotlin.metadata.builtins;
public final class DebugBuiltInsProtoBuf {
private DebugBuiltInsProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.packageFqName);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.classAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.parameterAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.typeAnnotation);
registry.add(org.jetbrains.kotlin.metadata.builtins.DebugBuiltInsProtoBuf.typeParameterAnnotation);
}
public static final int PACKAGE_FQ_NAME_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Package { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Package,
java.lang.Integer> packageFqName = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int CLASS_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> classAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> constructorAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int FUNCTION_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> functionAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> propertyAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.Argument.Value> compileTimeValue = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.Argument.Value.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
public static final int ENUM_ENTRY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.EnumEntry { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.EnumEntry,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> enumEntryAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.ValueParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.ValueParameter,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> parameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Type { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> typeAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.metadata.TypeParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeParameter,
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation>> typeParameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n&core/metadata/src/builtins.debug.proto" +
"\022&org.jetbrains.kotlin.metadata.builtins" +
"\032&core/metadata/src/metadata.debug.proto" +
":@\n\017package_fq_name\022&.org.jetbrains.kotl" +
"in.metadata.Package\030\227\001 \001(\005:j\n\020class_anno" +
"tation\022$.org.jetbrains.kotlin.metadata.C" +
"lass\030\226\001 \003(\0132).org.jetbrains.kotlin.metad" +
"ata.Annotation:v\n\026constructor_annotation" +
"\022*.org.jetbrains.kotlin.metadata.Constru" +
"ctor\030\226\001 \003(\0132).org.jetbrains.kotlin.metad",
"ata.Annotation:p\n\023function_annotation\022\'." +
"org.jetbrains.kotlin.metadata.Function\030\226" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:p\n\023property_annotation\022\'.org.je" +
"tbrains.kotlin.metadata.Property\030\226\001 \003(\0132" +
").org.jetbrains.kotlin.metadata.Annotati" +
"on:~\n\022compile_time_value\022\'.org.jetbrains" +
".kotlin.metadata.Property\030\227\001 \001(\01328.org.j" +
"etbrains.kotlin.metadata.Annotation.Argu" +
"ment.Value:s\n\025enum_entry_annotation\022(.or",
"g.jetbrains.kotlin.metadata.EnumEntry\030\226\001" +
" \003(\0132).org.jetbrains.kotlin.metadata.Ann" +
"otation:w\n\024parameter_annotation\022-.org.je" +
"tbrains.kotlin.metadata.ValueParameter\030\226" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:h\n\017type_annotation\022#.org.jetbra" +
"ins.kotlin.metadata.Type\030\226\001 \003(\0132).org.je" +
"tbrains.kotlin.metadata.Annotation:{\n\031ty" +
"pe_parameter_annotation\022,.org.jetbrains." +
"kotlin.metadata.TypeParameter\030\226\001 \003(\0132).o",
"rg.jetbrains.kotlin.metadata.AnnotationB" +
"\027B\025DebugBuiltInsProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(),
}, assigner);
packageFqName.internalInit(descriptor.getExtensions().get(0));
classAnnotation.internalInit(descriptor.getExtensions().get(1));
constructorAnnotation.internalInit(descriptor.getExtensions().get(2));
functionAnnotation.internalInit(descriptor.getExtensions().get(3));
propertyAnnotation.internalInit(descriptor.getExtensions().get(4));
compileTimeValue.internalInit(descriptor.getExtensions().get(5));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(6));
parameterAnnotation.internalInit(descriptor.getExtensions().get(7));
typeAnnotation.internalInit(descriptor.getExtensions().get(8));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(9));
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,131 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: build-common/src/java_descriptors.debug.proto
package org.jetbrains.kotlin.metadata.java;
public final class DebugJavaClassProtoBuf {
private DebugJavaClassProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isStaticMethod);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateMethod);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isStaticField);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateField);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateClass);
registry.add(org.jetbrains.kotlin.metadata.java.DebugJavaClassProtoBuf.isPackagePrivateConstructor);
}
public static final int IS_STATIC_METHOD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.lang.Boolean> isStaticMethod = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_METHOD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.lang.Boolean> isPackagePrivateMethod = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_STATIC_FIELD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.lang.Boolean> isStaticField = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_FIELD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.lang.Boolean> isPackagePrivateField = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_CLASS_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
java.lang.Boolean> isPackagePrivateClass = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_CONSTRUCTOR_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
java.lang.Boolean> isPackagePrivateConstructor = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n-build-common/src/java_descriptors.debu" +
"g.proto\022\"org.jetbrains.kotlin.metadata.j" +
"ava\032&core/metadata/src/metadata.debug.pr" +
"oto:B\n\020is_static_method\022\'.org.jetbrains." +
"kotlin.metadata.Function\030\350\007 \001(\010:K\n\031is_pa" +
"ckage_private_method\022\'.org.jetbrains.kot" +
"lin.metadata.Function\030\351\007 \001(\010:A\n\017is_stati" +
"c_field\022\'.org.jetbrains.kotlin.metadata." +
"Property\030\350\007 \001(\010:J\n\030is_package_private_fi" +
"eld\022\'.org.jetbrains.kotlin.metadata.Prop",
"erty\030\351\007 \001(\010:G\n\030is_package_private_class\022" +
"$.org.jetbrains.kotlin.metadata.Class\030\350\007" +
" \001(\010:S\n\036is_package_private_constructor\022*" +
".org.jetbrains.kotlin.metadata.Construct" +
"or\030\350\007 \001(\010B\030B\026DebugJavaClassProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(),
}, assigner);
isStaticMethod.internalInit(descriptor.getExtensions().get(0));
isPackagePrivateMethod.internalInit(descriptor.getExtensions().get(1));
isStaticField.internalInit(descriptor.getExtensions().get(2));
isPackagePrivateField.internalInit(descriptor.getExtensions().get(3));
isPackagePrivateClass.internalInit(descriptor.getExtensions().get(4));
isPackagePrivateConstructor.internalInit(descriptor.getExtensions().get(5));
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,203 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: core/deserialization/src/builtins.debug.proto
package org.jetbrains.kotlin.serialization.builtins;
public final class DebugBuiltInsProtoBuf {
private DebugBuiltInsProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.packageFqName);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.classAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.parameterAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.typeAnnotation);
registry.add(org.jetbrains.kotlin.serialization.builtins.DebugBuiltInsProtoBuf.typeParameterAnnotation);
}
public static final int PACKAGE_FQ_NAME_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Package { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Package,
java.lang.Integer> packageFqName = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int CLASS_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Class,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> classAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int CONSTRUCTOR_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Constructor,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> constructorAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int FUNCTION_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Function,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> functionAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PROPERTY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Property,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> propertyAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int COMPILE_TIME_VALUE_FIELD_NUMBER = 151;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Property,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value> compileTimeValue = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.Argument.Value.getDefaultInstance());
public static final int ENUM_ENTRY_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.EnumEntry { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.EnumEntry,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> enumEntryAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.ValueParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.ValueParameter,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> parameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Type { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> typeAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int TYPE_PARAMETER_ANNOTATION_FIELD_NUMBER = 150;
/**
* <code>extend .org.jetbrains.kotlin.serialization.TypeParameter { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeParameter,
java.util.List<org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation>> typeParameterAnnotation = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.serialization.DebugProtoBuf.Annotation.getDefaultInstance());
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n-core/deserialization/src/builtins.debu" +
"g.proto\022+org.jetbrains.kotlin.serializat" +
"ion.builtins\0320core/deserialization/src/d" +
"escriptors.debug.proto:E\n\017package_fq_nam" +
"e\022+.org.jetbrains.kotlin.serialization.P" +
"ackage\030\227\001 \001(\005:t\n\020class_annotation\022).org." +
"jetbrains.kotlin.serialization.Class\030\226\001 " +
"\003(\0132..org.jetbrains.kotlin.serialization" +
".Annotation:\200\001\n\026constructor_annotation\022/" +
".org.jetbrains.kotlin.serialization.Cons",
"tructor\030\226\001 \003(\0132..org.jetbrains.kotlin.se" +
"rialization.Annotation:z\n\023function_annot" +
"ation\022,.org.jetbrains.kotlin.serializati" +
"on.Function\030\226\001 \003(\0132..org.jetbrains.kotli" +
"n.serialization.Annotation:z\n\023property_a" +
"nnotation\022,.org.jetbrains.kotlin.seriali" +
"zation.Property\030\226\001 \003(\0132..org.jetbrains.k" +
"otlin.serialization.Annotation:\210\001\n\022compi" +
"le_time_value\022,.org.jetbrains.kotlin.ser" +
"ialization.Property\030\227\001 \001(\0132=.org.jetbrai",
"ns.kotlin.serialization.Annotation.Argum" +
"ent.Value:}\n\025enum_entry_annotation\022-.org" +
".jetbrains.kotlin.serialization.EnumEntr" +
"y\030\226\001 \003(\0132..org.jetbrains.kotlin.serializ" +
"ation.Annotation:\201\001\n\024parameter_annotatio" +
"n\0222.org.jetbrains.kotlin.serialization.V" +
"alueParameter\030\226\001 \003(\0132..org.jetbrains.kot" +
"lin.serialization.Annotation:r\n\017type_ann" +
"otation\022(.org.jetbrains.kotlin.serializa" +
"tion.Type\030\226\001 \003(\0132..org.jetbrains.kotlin.",
"serialization.Annotation:\205\001\n\031type_parame" +
"ter_annotation\0221.org.jetbrains.kotlin.se" +
"rialization.TypeParameter\030\226\001 \003(\0132..org.j" +
"etbrains.kotlin.serialization.Annotation" +
"B\027B\025DebugBuiltInsProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.serialization.DebugProtoBuf.getDescriptor(),
}, assigner);
packageFqName.internalInit(descriptor.getExtensions().get(0));
classAnnotation.internalInit(descriptor.getExtensions().get(1));
constructorAnnotation.internalInit(descriptor.getExtensions().get(2));
functionAnnotation.internalInit(descriptor.getExtensions().get(3));
propertyAnnotation.internalInit(descriptor.getExtensions().get(4));
compileTimeValue.internalInit(descriptor.getExtensions().get(5));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(6));
parameterAnnotation.internalInit(descriptor.getExtensions().get(7));
typeAnnotation.internalInit(descriptor.getExtensions().get(8));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(9));
org.jetbrains.kotlin.serialization.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -1,132 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: build-common/src/java_descriptors.debug.proto
package org.jetbrains.kotlin.serialization.java;
public final class DebugJavaClassProtoBuf {
private DebugJavaClassProtoBuf() {}
public static void registerAllExtensions(
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry) {
registry.add(org.jetbrains.kotlin.serialization.java.DebugJavaClassProtoBuf.isStaticMethod);
registry.add(org.jetbrains.kotlin.serialization.java.DebugJavaClassProtoBuf.isPackagePrivateMethod);
registry.add(org.jetbrains.kotlin.serialization.java.DebugJavaClassProtoBuf.isStaticField);
registry.add(org.jetbrains.kotlin.serialization.java.DebugJavaClassProtoBuf.isPackagePrivateField);
registry.add(org.jetbrains.kotlin.serialization.java.DebugJavaClassProtoBuf.isPackagePrivateClass);
registry.add(org.jetbrains.kotlin.serialization.java.DebugJavaClassProtoBuf.isPackagePrivateConstructor);
}
public static final int IS_STATIC_METHOD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Function,
java.lang.Boolean> isStaticMethod = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_METHOD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Function,
java.lang.Boolean> isPackagePrivateMethod = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_STATIC_FIELD_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Property,
java.lang.Boolean> isStaticField = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_FIELD_FIELD_NUMBER = 1001;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Property,
java.lang.Boolean> isPackagePrivateField = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_CLASS_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Class,
java.lang.Boolean> isPackagePrivateClass = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static final int IS_PACKAGE_PRIVATE_CONSTRUCTOR_FIELD_NUMBER = 1000;
/**
* <code>extend .org.jetbrains.kotlin.serialization.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.serialization.DebugProtoBuf.Constructor,
java.lang.Boolean> isPackagePrivateConstructor = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.Boolean.class,
null);
public static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n-build-common/src/java_descriptors.debu" +
"g.proto\022\'org.jetbrains.kotlin.serializat" +
"ion.java\0320core/deserialization/src/descr" +
"iptors.debug.proto:G\n\020is_static_method\022," +
".org.jetbrains.kotlin.serialization.Func" +
"tion\030\350\007 \001(\010:P\n\031is_package_private_method" +
"\022,.org.jetbrains.kotlin.serialization.Fu" +
"nction\030\351\007 \001(\010:F\n\017is_static_field\022,.org.j" +
"etbrains.kotlin.serialization.Property\030\350" +
"\007 \001(\010:O\n\030is_package_private_field\022,.org.",
"jetbrains.kotlin.serialization.Property\030" +
"\351\007 \001(\010:L\n\030is_package_private_class\022).org" +
".jetbrains.kotlin.serialization.Class\030\350\007" +
" \001(\010:X\n\036is_package_private_constructor\022/" +
".org.jetbrains.kotlin.serialization.Cons" +
"tructor\030\350\007 \001(\010B\030B\026DebugJavaClassProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
public org.jetbrains.kotlin.protobuf.ExtensionRegistry assignDescriptors(
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor[] {
org.jetbrains.kotlin.serialization.DebugProtoBuf.getDescriptor(),
}, assigner);
isStaticMethod.internalInit(descriptor.getExtensions().get(0));
isPackagePrivateMethod.internalInit(descriptor.getExtensions().get(1));
isStaticField.internalInit(descriptor.getExtensions().get(2));
isPackagePrivateField.internalInit(descriptor.getExtensions().get(3));
isPackagePrivateClass.internalInit(descriptor.getExtensions().get(4));
isPackagePrivateConstructor.internalInit(descriptor.getExtensions().get(5));
org.jetbrains.kotlin.serialization.DebugProtoBuf.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -1,63 +1,74 @@
import com.sun.javafx.scene.CameraHelper.project
import jdk.nashorn.internal.objects.NativeArray.forEach
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import java.util.*
import java.io.File
import org.gradle.api.tasks.bundling.Jar
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
import java.nio.file.Files.delete
import proguard.gradle.ProGuardTask
buildscript {
extra["defaultSnapshotVersion"] = "1.2-SNAPSHOT"
extra["defaultSnapshotVersion"] = "1.3-SNAPSHOT"
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.2.40-dev-165", onlySuccessBootstrap = false))
val repos = listOfNotNull(
bootstrapKotlinRepo,
"https://jcenter.bintray.com/",
"https://plugins.gradle.org/m2",
"http://dl.bintray.com/kotlin/kotlinx",
"https://repo.gradle.org/gradle/libs-releases-local", // for native-platform
"https://jetbrains.bintray.com/intellij-third-party-dependencies") // for jflex
extra["repos"] = repos
extra["versions.proguard"] = "5.3.3"
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.3.20-dev-564", onlySuccessBootstrap = false))
repositories {
for (repo in repos) {
maven(url = repo)
}
bootstrapKotlinRepo?.let(::maven)
maven("https://plugins.gradle.org/m2")
}
// a workaround for kotlin compiler classpath in kotlin project: sometimes gradle substitutes
// kotlin-stdlib external dependency with local project :kotlin-stdlib in kotlinCompilerClasspath configuration.
// see also configureCompilerClasspath@
val bootstrapCompilerClasspath by configurations.creating
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("com.gradle.publish:plugin-publish-plugin:0.9.7")
classpath(kotlinDep("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath("net.sf.proguard:proguard-gradle:5.3.3")
}
}
plugins {
`build-scan`
idea
id("jps-compatible")
}
pill {
excludedDirs(
"out",
"buildSrc/build",
"buildSrc/prepare-deps/android-dx/build",
"buildSrc/prepare-deps/intellij-sdk/build"
)
}
buildScan {
setLicenseAgreementUrl("https://gradle.com/terms-of-service")
setLicenseAgree("yes")
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
setTermsOfServiceAgree("yes")
}
val configuredJdks: List<JdkId> =
getConfiguredJdks().also {
it.forEach {
logger.info("Using ${it.majorVersion} home: ${it.homeDir}")
}
getConfiguredJdks().also {
it.forEach {
logger.info("Using ${it.majorVersion} home: ${it.homeDir}")
}
}
val defaultSnapshotVersion: String by extra
val buildNumber by extra(findProperty("build.number")?.toString() ?: defaultSnapshotVersion)
val kotlinVersion by extra(findProperty("deployVersion")?.toString() ?: buildNumber)
val kotlinLanguageVersion by extra("1.2")
val kotlinLanguageVersion by extra("1.3")
allprojects {
group = "org.jetbrains.kotlin"
@@ -66,16 +77,10 @@ allprojects {
extra["kotlin_root"] = rootDir
val bootstrapCompileCfg = configurations.create("bootstrapCompile")
repositories {
for (repo in (rootProject.extra["repos"] as List<String>)) {
maven(url = repo)
}
}
val cidrKotlinPlugin by configurations.creating
dependencies {
bootstrapCompileCfg(kotlinDep("compiler-embeddable", bootstrapKotlinVersion))
cidrKotlinPlugin(project(":prepare:cidr-plugin", "runtimeJar"))
}
val commonBuildDir = File(rootDir, "build")
@@ -87,6 +92,7 @@ val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox"
val ideaUltimateSandboxDir = "$commonLocalDataDir/ideaUltimateSandbox"
val ideaPluginDir = "$distDir/artifacts/ideaPlugin/Kotlin"
val ideaUltimatePluginDir = "$distDir/artifacts/ideaUltimatePlugin/Kotlin"
val cidrPluginDir = "$distDir/artifacts/cidrPlugin/Kotlin"
// TODO: use "by extra()" syntax where possible
extra["distLibDir"] = project.file(distLibDir)
@@ -96,25 +102,18 @@ extra["ideaSandboxDir"] = project.file(ideaSandboxDir)
extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir)
extra["ideaPluginDir"] = project.file(ideaPluginDir)
extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir)
extra["cidrPluginDir"] = project.file(cidrPluginDir)
extra["isSonatypeRelease"] = false
Properties().apply {
load(File(rootDir, "resources", "kotlinManifest.properties").reader())
forEach {
val key = it.key
if (key != null && key is String)
extra[key] = it.value
}
}
extra["JDK_16"] = jdkPath("1.6")
extra["JDK_17"] = jdkPath("1.7")
extra["JDK_18"] = jdkPath("1.8")
extra["JDK_9"] = jdkPathIfFound("9")
extra["JDK_9"] = jdkPath("9")
extra["JDK_10"] = jdkPathIfFound("10")
rootProject.apply {
from(rootProject.file("versions.gradle.kts"))
from(rootProject.file("report.gradle.kts"))
}
extra["versions.protobuf-java"] = "2.6.1"
@@ -126,22 +125,26 @@ extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.8.2"
extra["versions.android"] = "2.3.1"
extra["versions.kotlinx-coroutines-core"] = "0.20"
extra["versions.kotlinx-coroutines-jdk8"] = "0.20"
extra["versions.kotlinx-coroutines-core"] = "0.26.1-eap13"
extra["versions.kotlinx-coroutines-jdk8"] = "0.26.1-eap13"
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.ant-launcher"] = "1.8.0"
extra["versions.robolectric"] = "3.1"
extra["versions.org.springframework"] = "4.2.0.RELEASE"
extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["versions.ktor-network"] = "0.9.5-rc13"
val markdownVer = "4054 - Kotlin 1.0.2-dev-566".replace(" ", "%20") // fixed here, was last with "status:SUCCESS,tag:forKotlin"
val markdownVer = "4054 - Kotlin 1.0.2-dev-566".replace(" ", "%20") // fixed here, was last with "status:SUCCESS,tag:forKotlin"
extra["markdownParserVersion"] = markdownVer
extra["markdownParserRepo"] = "https://teamcity.jetbrains.com/guestAuth/repository/download/IntelliJMarkdownParser_Build/$markdownVer/([artifact]_[ext]/)[artifact](.[ext])"
extra["markdownParserRepo"] =
"https://teamcity.jetbrains.com/guestAuth/repository/download/IntelliJMarkdownParser_Build/$markdownVer/([artifact]_[ext]/)[artifact](.[ext])"
val isTeamcityBuild = project.hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null
val intellijUltimateEnabled = project.getBooleanProperty("intellijUltimateEnabled") ?: isTeamcityBuild
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
@@ -149,92 +152,87 @@ extra["intellijUltimateEnabled"] = intellijUltimateEnabled
extra["intellijSeparateSdks"] = intellijSeparateSdks
extra["IntellijCoreDependencies"] =
listOf("annotations",
"asm-all",
"guava-21.0",
"jdom",
"jna",
"log4j",
"picocontainer",
"snappy-in-java-0.5.1",
"streamex",
"trove4j",
"xpp3-1.1.4-min",
"xstream-1.4.8")
listOf(
"annotations",
"asm-all",
"guava",
"jdom",
"jna",
"log4j",
"picocontainer",
"snappy-in-java",
"streamex",
"trove4j"
)
extra["nativePlatformVariants"] =
listOf("windows-amd64",
"windows-i386",
"osx-amd64",
"osx-i386",
"linux-amd64",
"linux-i386",
"freebsd-amd64-libcpp",
"freebsd-amd64-libstdcpp",
"freebsd-i386-libcpp",
"freebsd-i386-libstdcpp")
extra["compilerModules"] = arrayOf(
":compiler:util",
":compiler:container",
":compiler:conditional-preprocessor",
":compiler:resolution",
":compiler:serialization",
":compiler:frontend",
":compiler:frontend.java",
":compiler:frontend.script",
":compiler:cli-common",
":compiler:daemon-common",
":compiler:daemon",
":compiler:ir.tree",
":compiler:ir.psi2ir",
":compiler:backend-common",
":compiler:backend",
":compiler:plugin-api",
":compiler:light-classes",
":compiler:cli",
":compiler:incremental-compilation-impl",
":js:js.ast",
":js:js.serializer",
":js:js.parser",
":js:js.frontend",
":js:js.translator",
":js:js.dce",
":compiler",
":kotlin-build-common",
":core:descriptors",
":core:descriptors.jvm",
":core:deserialization",
":core:util.runtime"
":compiler:util",
":compiler:container",
":compiler:resolution",
":compiler:serialization",
":compiler:psi",
":compiler:frontend",
":compiler:frontend.java",
":compiler:frontend.script",
":compiler:cli-common",
":compiler:daemon-common",
":compiler:daemon-common-new",
":compiler:daemon",
":compiler:ir.tree",
":compiler:ir.psi2ir",
":compiler:ir.backend.common",
":compiler:backend.js",
":compiler:backend-common",
":compiler:backend",
":compiler:plugin-api",
":compiler:light-classes",
":compiler:cli",
":compiler:incremental-compilation-impl",
":js:js.ast",
":js:js.serializer",
":js:js.parser",
":js:js.frontend",
":js:js.translator",
":js:js.dce",
":compiler",
":kotlin-build-common",
":core:metadata",
":core:metadata.jvm",
":core:descriptors",
":core:descriptors.jvm",
":core:deserialization",
":core:util.runtime"
)
val coreLibProjects = listOf(
":kotlin-stdlib",
":kotlin-stdlib-common",
":kotlin-stdlib-js",
":kotlin-stdlib-jre7",
":kotlin-stdlib-jre8",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-test:kotlin-test-common",
":kotlin-test:kotlin-test-jvm",
":kotlin-test:kotlin-test-junit",
":kotlin-test:kotlin-test-testng",
":kotlin-test:kotlin-test-js",
":kotlin-reflect"
":kotlin-stdlib",
":kotlin-stdlib-common",
":kotlin-stdlib-js",
":kotlin-stdlib-jre7",
":kotlin-stdlib-jre8",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-test:kotlin-test-common",
":kotlin-test:kotlin-test-jvm",
":kotlin-test:kotlin-test-junit",
":kotlin-test:kotlin-test-junit5",
":kotlin-test:kotlin-test-testng",
":kotlin-test:kotlin-test-js",
":kotlin-reflect"
)
val gradlePluginProjects = listOf(
":kotlin-gradle-plugin",
":kotlin-gradle-plugin:plugin-marker",
":kotlin-gradle-plugin-api",
":kotlin-gradle-plugin",
":kotlin-gradle-plugin:plugin-marker",
":kotlin-gradle-plugin-api",
// ":kotlin-gradle-plugin-integration-tests", // TODO: build fails
":kotlin-allopen",
":kotlin-allopen:plugin-marker",
":kotlin-annotation-processing-gradle",
":kotlin-noarg",
":kotlin-noarg:plugin-marker",
":kotlin-sam-with-receiver"
":kotlin-allopen",
":kotlin-allopen:plugin-marker",
":kotlin-annotation-processing-gradle",
":kotlin-noarg",
":kotlin-noarg:plugin-marker",
":kotlin-sam-with-receiver"
)
apply {
@@ -249,11 +247,6 @@ apply {
}
}
fun Project.allprojectsRecursive(body: Project.() -> Unit) {
this.body()
this.subprojects { allprojectsRecursive(body) }
}
fun Task.listConfigurationContents(configName: String) {
doFirst {
project.configurations.findByName(configName)?.let {
@@ -275,21 +268,27 @@ allprojects {
// - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location
// - idea seems unable to exclude common builddir from indexing
// therefore it is disabled by default
// buildDir = File(commonBuildDir, project.name)
// buildDir = File(commonBuildDir, project.name)
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
repositories {
for (repo in (rootProject.extra["repos"] as List<String>)) {
maven { setUrl(repo) }
}
ivy {
artifactPattern(rootProject.extra["markdownParserRepo"] as String)
}
intellijSdkRepo(project)
androidDxJarRepo(project)
mirrorRepo?.let(::maven)
bootstrapKotlinRepo?.let(::maven)
jcenter()
maven("http://dl.bintray.com/kotlin/ktor")
}
configureJvmProject(javaHome!!, jvmTarget!!)
val commonCompilerArgs = listOf("-Xallow-kotlin-package", "-Xread-deserialized-contracts")
val commonCompilerArgs = listOfNotNull(
"-Xallow-kotlin-package",
"-Xread-deserialized-contracts",
"-Xread-deserialized-contracts",
"-Xprogressive".takeIf { hasProperty("test.progressive.mode") } // TODO: change to "-progressive" after bootstrap
)
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
kotlinOptions {
@@ -336,18 +335,50 @@ allprojects {
fun File.toProjectRootRelativePathOrSelf() = (relativeToOrNull(rootDir)?.takeUnless { it.startsWith("..") } ?: this).path
fun FileCollection.printClassPath(role: String) =
println("${project.path} $role classpath:\n ${joinToString("\n ") { it.toProjectRootRelativePathOrSelf() } }")
println("${project.path} $role classpath:\n ${joinToString("\n ") { it.toProjectRootRelativePathOrSelf() }}")
try { the<JavaPluginConvention>() } catch (_: UnknownDomainObjectException) { null }?.let { javaConvention ->
try {
javaPluginConvention()
} catch (_: UnknownDomainObjectException) {
null
}?.let { javaConvention ->
task("printCompileClasspath") { doFirst { javaConvention.sourceSets["main"].compileClasspath.printClassPath("compile") } }
task("printRuntimeClasspath") { doFirst { javaConvention.sourceSets["main"].runtimeClasspath.printClassPath("runtime") } }
task("printTestCompileClasspath") { doFirst { javaConvention.sourceSets["test"].compileClasspath.printClassPath("test compile") } }
task("printTestRuntimeClasspath") { doFirst { javaConvention.sourceSets["test"].runtimeClasspath.printClassPath("test runtime") } }
}
run configureCompilerClasspath@{
val bootstrapCompilerClasspath by rootProject.buildscript.configurations
configurations.findByName("kotlinCompilerClasspath")?.let {
dependencies.add(it.name, files(bootstrapCompilerClasspath))
}
}
}
}
val distTask = task<Copy>("dist") {
gradle.taskGraph.whenReady {
if (isTeamcityBuild) {
logger.warn("CI build profile is active (IC is off, proguard is on). Use -Pteamcity=false to reproduce local build")
for (task in allTasks) {
when (task) {
is AbstractKotlinCompile<*> -> task.incremental = false
is JavaCompile -> task.options.isIncremental = false
}
}
} else {
logger.warn("Local build profile is active (IC is on, proguard is off). Use -Pteamcity=true to reproduce TC build")
for (task in allTasks) {
when (task) {
// todo: remove when Gradle 4.10+ is used (Java IC on by default)
is JavaCompile -> task.options.isIncremental = true
is org.gradle.jvm.tasks.Jar -> task.entryCompression = ZipEntryCompression.STORED
}
}
}
}
val dist by task<Copy> {
val childDistTasks = getTasksByName("dist", true) - this@task
dependsOn(childDistTasks)
@@ -356,73 +387,75 @@ val distTask = task<Copy>("dist") {
from(files("license")) { into("kotlinc/license") }
}
val compilerCopyTask = task<Copy>("idea-plugin-copy-compiler") {
dependsOn(distTask)
val copyCompilerToIdeaPlugin by task<Copy> {
dependsOn(dist)
into(ideaPluginDir)
from(distDir) { include("kotlinc/**") }
}
task<Copy>("ideaPlugin") {
dependsOn(compilerCopyTask)
val ideaPlugin by task<Task> {
dependsOn(copyCompilerToIdeaPlugin)
val childIdeaPluginTasks = getTasksByName("ideaPlugin", true) - this@task
dependsOn(childIdeaPluginTasks)
into("$ideaPluginDir/lib")
}
tasks {
"clean" {
create("clean") {
doLast {
delete("$buildDir/repo")
delete(distDir)
}
}
// TODO: copied from TeamCityBuild.xml (with ultimate-related modification), consider removing after migrating from it
"cleanupArtifacts" {
create("cleanupArtifacts") {
doLast {
delete(ideaPluginDir)
delete(ideaUltimatePluginDir)
delete(cidrPluginDir)
}
}
"coreLibsTest" {
create("coreLibsTest") {
(coreLibProjects + listOf(
":kotlin-stdlib:samples",
":kotlin-test:kotlin-test-js:kotlin-test-js-it",
":tools:binary-compatibility-validator"
":kotlin-stdlib:samples",
":kotlin-test:kotlin-test-js:kotlin-test-js-it",
":kotlinx-metadata-jvm",
":tools:binary-compatibility-validator"
)).forEach {
dependsOn(it + ":check")
}
}
"gradlePluginTest" {
create("gradlePluginTest") {
gradlePluginProjects.forEach {
dependsOn(it + ":check")
}
}
"gradlePluginIntegrationTest" {
create("gradlePluginIntegrationTest") {
dependsOn(":kotlin-gradle-plugin-integration-tests:check")
}
"jvmCompilerTest" {
create("jvmCompilerTest") {
dependsOn("dist")
dependsOn(":compiler:test",
":compiler:container:test",
":compiler:tests-java8:test")
dependsOn(
":compiler:test",
":compiler:container:test",
":compiler:tests-java8:test"
)
}
"jsCompilerTest" {
create("jsCompilerTest") {
dependsOn(":js:js.tests:test")
dependsOn(":js:js.tests:runMocha")
}
"scriptingTest" {
create("scriptingTest") {
dependsOn("dist")
dependsOn(":kotlin-script-util:test")
}
"compilerTest" {
create("compilerTest") {
dependsOn("jvmCompilerTest")
dependsOn("jsCompilerTest")
@@ -431,97 +464,121 @@ tasks {
dependsOn(":compiler:incremental-compilation-impl:test")
}
"examplesTest" {
create("toolsTest") {
dependsOn(":tools:kotlinp:test")
}
create("examplesTest") {
dependsOn("dist")
(project(":examples").subprojects + project(":kotlin-gradle-subplugin-example")).forEach { p ->
dependsOn("${p.path}:check")
}
}
"distTest" {
create("distTest") {
dependsOn("compilerTest")
dependsOn("toolsTest")
dependsOn("gradlePluginTest")
dependsOn("examplesTest")
}
"androidCodegenTest" {
create("specTest") {
dependsOn("dist")
dependsOn(":compiler:tests-spec:test")
}
create("androidCodegenTest") {
dependsOn(":compiler:android-tests:test")
}
"jps-tests" {
create("jps-tests") {
dependsOn("dist")
dependsOn(":jps-plugin:test")
}
"idea-plugin-main-tests" {
create("idea-plugin-main-tests") {
dependsOn("dist")
dependsOn(":idea:test")
}
"idea-plugin-additional-tests" {
create("idea-plugin-additional-tests") {
dependsOn("dist")
dependsOn(":idea:idea-gradle:test",
":idea:idea-maven:test",
":j2k:test",
":eval4j:test")
}
"idea-plugin-tests" {
dependsOn("dist")
dependsOn("idea-plugin-main-tests",
"idea-plugin-additional-tests")
}
"android-ide-tests" {
dependsOn("dist")
dependsOn(":plugins:android-extensions-ide:test",
":idea:idea-android:test",
":kotlin-annotation-processing:test")
}
"plugins-tests" {
dependsOn("dist")
dependsOn(":kotlin-annotation-processing:test",
":kotlin-source-sections-compiler-plugin:test",
":kotlin-allopen-compiler-plugin:test",
":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test",
":plugins:uast-kotlin:test",
":kotlin-annotation-processing-gradle:test")
}
"ideaPluginTest" {
dependsOn(
"idea-plugin-tests",
"jps-tests",
"plugins-tests",
"android-ide-tests",
":generators:test"
":idea:idea-gradle:test",
":idea:idea-maven:test",
":j2k:test",
":eval4j:test"
)
}
create("idea-plugin-tests") {
dependsOn("dist")
dependsOn(
"idea-plugin-main-tests",
"idea-plugin-additional-tests"
)
}
create("android-ide-tests") {
dependsOn("dist")
dependsOn(
":plugins:android-extensions-ide:test",
":idea:idea-android:test",
":kotlin-annotation-processing:test"
)
}
create("plugins-tests") {
dependsOn("dist")
dependsOn(
":kotlin-annotation-processing:test",
":kotlin-source-sections-compiler-plugin:test",
":kotlin-allopen-compiler-plugin:test",
":kotlin-noarg-compiler-plugin:test",
":kotlin-sam-with-receiver-compiler-plugin:test",
":plugins:uast-kotlin:test",
":kotlin-annotation-processing-gradle:test",
":kotlinx-serialization-ide-plugin:test"
)
}
"test" {
create("ideaPluginTest") {
dependsOn(
"idea-plugin-tests",
"jps-tests",
"plugins-tests",
"android-ide-tests",
":generators:test"
)
}
create("test") {
doLast {
throw GradleException("Don't use directly, use aggregate tasks *-check instead")
}
}
"check" { dependsOn("test") }
create("check") {
dependsOn("test")
}
}
fun CopySpec.compilerScriptPermissionsSpec() {
filesMatching("bin/*") { mode = 0b111101101 }
filesMatching("bin/*.bat") { mode = 0b110100100 }
fun CopySpec.setExecutablePermissions() {
filesMatching("**/bin/*") { mode = 0b111101101 }
filesMatching("**/bin/*.bat") { mode = 0b110100100 }
}
val zipCompiler by task<Zip> {
dependsOn(dist)
destinationDir = file(distDir)
archiveName = "kotlin-compiler-$kotlinVersion.zip"
from(distKotlinHomeDir) {
into("kotlinc")
compilerScriptPermissionsSpec()
}
from(distKotlinHomeDir)
into("kotlinc")
setExecutablePermissions()
doLast {
logger.lifecycle("Compiler artifacts packed to $archivePath")
}
@@ -533,6 +590,8 @@ val zipTestData by task<Zip> {
from("compiler/testData") { into("compiler") }
from("idea/testData") { into("ide") }
from("idea/idea-completion/testData") { into("ide/completion") }
from("libraries/stdlib/common/test") { into("stdlib/common") }
from("libraries/stdlib/test") { into("stdlib/test") }
doLast {
logger.lifecycle("Test data packed to $archivePath")
}
@@ -552,15 +611,48 @@ val zipPlugin by task<Zip> {
doFirst {
if (destPath == null) throw GradleException("Specify target zip path with 'pluginZipPath' property")
}
into("Kotlin") {
from("$src/kotlinc") {
into("kotlinc")
compilerScriptPermissionsSpec()
}
from(src) {
exclude("kotlinc")
}
from(src)
into("Kotlin")
setExecutablePermissions()
doLast {
logger.lifecycle("Plugin artifacts packed to $archivePath")
}
}
val cidrPlugin by task<Copy> {
dependsOn(ideaPlugin)
into(cidrPluginDir)
from(ideaPluginDir) {
exclude("lib/kotlin-plugin.jar")
exclude("lib/android-lint.jar")
exclude("lib/android-ide.jar")
exclude("lib/android-output-parser-ide.jar")
exclude("lib/android-extensions-ide.jar")
exclude("lib/android-extensions-compiler.jar")
exclude("lib/kapt3-idea.jar")
exclude("lib/jps-ide.jar")
exclude("lib/jps/**")
exclude("kotlinc/**")
exclude("lib/maven-ide.jar")
}
from(cidrKotlinPlugin) { into("lib") }
}
val zipCidrPlugin by task<Zip> {
val destPath = project.findProperty("pluginZipPath") as String?
?: "$distDir/artifacts/kotlin-plugin-$kotlinVersion-CIDR.zip"
val destFile = File(destPath)
destinationDir = destFile.parentFile
archiveName = destFile.name
from(cidrPlugin)
into("Kotlin")
setExecutablePermissions()
doLast {
logger.lifecycle("Plugin artifacts packed to $archivePath")
}
@@ -569,11 +661,11 @@ val zipPlugin by task<Zip> {
configure<IdeaModel> {
module {
excludeDirs = files(
project.buildDir,
commonLocalDataDir,
".gradle",
"dependencies",
"dist"
project.buildDir,
commonLocalDataDir,
".gradle",
"dependencies",
"dist"
).toSet()
}
}
@@ -585,14 +677,16 @@ fun jdkPathIfFound(version: String): String? {
}
fun jdkPath(version: String): String = jdkPathIfFound(version)
?: throw GradleException ("Please set environment variable JDK_${version.replace(".", "")} to point to JDK $version installation")
?: throw GradleException("Please set environment variable JDK_${version.replace(".", "")} to point to JDK $version installation")
fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
tasks.withType<JavaCompile> {
options.isFork = true
options.forkOptions.javaHome = file(javaHome)
options.compilerArgs.add("-proc:none")
options.encoding = "UTF-8"
if (name != "compileJava9Java") {
options.isFork = true
options.forkOptions.javaHome = file(javaHome)
options.compilerArgs.add("-proc:none")
options.encoding = "UTF-8"
}
}
tasks.withType<KotlinCompile> {
@@ -604,3 +698,41 @@ fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
executable = File(javaHome, "bin/java").canonicalPath
}
}
tasks.create("findShadowJarsInClasspath").doLast {
fun Collection<File>.printSorted(indent: String = " ") {
sortedBy { it.path }.forEach { println(indent + it.relativeTo(rootProject.projectDir)) }
}
val shadowJars = hashSetOf<File>()
for (project in rootProject.allprojects) {
for (task in project.tasks) {
when (task) {
is ShadowJar -> {
shadowJars.add(fileFrom(task.archivePath))
}
is ProGuardTask -> {
shadowJars.addAll(task.outputs.files.toList())
}
}
}
}
println("Shadow jars:")
shadowJars.printSorted()
fun Project.checkConfig(configName: String) {
val config = configurations.findByName(configName) ?: return
val shadowJarsInConfig = config.resolvedConfiguration.files.filter { it in shadowJars }
if (shadowJarsInConfig.isNotEmpty()) {
println()
println("Project $project contains shadow jars in configuration '$configName':")
shadowJarsInConfig.printSorted()
}
}
for (project in rootProject.allprojects) {
project.checkConfig("compileClasspath")
project.checkConfig("testCompileClasspath")
}
}

View File

@@ -2,8 +2,7 @@
buildscript {
val buildSrcKotlinVersion: String by extra(findProperty("buildSrc.kotlin.version")?.toString() ?: embeddedKotlinVersion)
val buildSrcKotlinRepo: String? by extra(findProperty("buildSrc.kotlin.repo") as String?)
extra["versions.shadow"] = "2.0.1"
extra["versions.intellij-plugin"] = "0.3.0-SNAPSHOT"
extra["versions.shadow"] = "2.0.2"
extra["versions.native-platform"] = "0.14"
repositories {
@@ -29,6 +28,20 @@ apply {
plugins {
`kotlin-dsl`
`java-gradle-plugin`
}
gradlePlugin {
plugins {
register("pill-configurable") {
id = "pill-configurable"
implementationClass = "org.jetbrains.kotlin.pill.PillConfigurablePlugin"
}
register("jps-compatible") {
id = "jps-compatible"
implementationClass = "org.jetbrains.kotlin.pill.JpsCompatiblePlugin"
}
}
}
fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)?.let {
@@ -46,7 +59,12 @@ val intellijUltimateEnabled by extra(project.getBooleanProperty("intellijUltimat
val intellijSeparateSdks by extra(project.getBooleanProperty("intellijSeparateSdks") ?: false)
extra["intellijRepo"] = "https://www.jetbrains.com/intellij-repository"
extra["intellijReleaseType"] = "releases" // or "snapshots"
extra["intellijReleaseType"] = if (extra["versions.intellijSdk"]?.toString()?.endsWith("SNAPSHOT") == true)
"snapshots"
else
"releases"
extra["versions.androidDxSources"] = "5.0.0_r2"
extra["customDepsOrg"] = "kotlin.build.custom.deps"
@@ -55,8 +73,6 @@ repositories {
extra["buildSrcKotlinRepo"]?.let {
maven(url = it)
}
maven(url = "https://dl.bintray.com/kotlin/kotlin-dev") // for dex-method-list
maven(url = "https://repo.gradle.org/gradle/libs-releases-local") // for native-platform
jcenter()
}
@@ -64,7 +80,7 @@ dependencies {
compile("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
compile("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
compile("net.rubygrapefruit:native-platform-windows-i386:${property("versions.native-platform")}")
compile("com.jakewharton.dex:dex-method-list:2.0.0-alpha")
compile("com.jakewharton.dex:dex-method-list:3.0.0")
// TODO: adding the dep to the plugin breaks the build unexpectedly, resolve and uncomment
// compile("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.extra["bootstrap_kotlin_version"]}")
// Shadow plugin is used in many projects of the main build. Once it's no longer used in buildSrc, please move this dependency to the root project

View File

@@ -0,0 +1,9 @@
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.configureondemand=false
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m
#buildSrc.kotlin.repo=https://jcenter.bintray.com
#buildSrc.kotlin.version=1.1.50
intellijUltimateEnabled=false

View File

@@ -0,0 +1,9 @@
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.configureondemand=false
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m
#buildSrc.kotlin.repo=https://jcenter.bintray.com
#buildSrc.kotlin.version=1.1.50
intellijUltimateEnabled=false

View File

@@ -0,0 +1,9 @@
org.gradle.daemon=true
org.gradle.parallel=false
org.gradle.configureondemand=false
org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx1600m
#buildSrc.kotlin.repo=https://jcenter.bintray.com
#buildSrc.kotlin.version=1.1.50
intellijUltimateEnabled=false

View File

@@ -1,5 +1,5 @@
import org.gradle.api.publish.ivy.internal.artifact.DefaultIvyArtifact
import org.gradle.api.publish.ivy.internal.artifact.FileBasedIvyArtifact
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyConfiguration
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublicationIdentity
import org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator
@@ -26,6 +26,9 @@ repositories {
ivy {
artifactPattern("https://dl-ssl.google.com/android/repository/[artifact]_[revision](-[classifier]).[ext]")
artifactPattern("https://android.googlesource.com/platform/dalvik/+archive/android-$dxSourcesVersion/[artifact].[ext]")
metadataSources {
artifact()
}
}
}
@@ -89,8 +92,8 @@ val prepareIvyXml by tasks.creating {
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(customDepsOrg, dxModuleName, dxRevision))) {
addConfiguration(DefaultIvyConfiguration("default"))
addConfiguration(DefaultIvyConfiguration("sources"))
addArtifact(DefaultIvyArtifact(File(dxRepoModuleDir, "dx.jar"), "dx", "jar", "jar", null).also { it.conf = "default" })
addArtifact(DefaultIvyArtifact(File(dxRepoModuleDir, "dx-sources.jar"), "dx", "jar", "sources", "sources").also { it.conf = "sources" })
addArtifact(FileBasedIvyArtifact(File(dxRepoModuleDir, "dx.jar"), DefaultIvyPublicationIdentity(customDepsOrg, "dx", dxRevision)).also { it.conf = "default" })
addArtifact(FileBasedIvyArtifact(File(dxRepoModuleDir, "dx-sources.jar"), DefaultIvyPublicationIdentity(customDepsOrg, "dx", dxRevision)).also { it.conf = "sources" })
writeTo(ivyFile)
}
}

View File

@@ -1,12 +1,22 @@
@file:Suppress("PropertyName")
import org.gradle.api.publish.ivy.internal.artifact.DefaultIvyArtifact
import org.gradle.api.publish.ivy.internal.artifact.FileBasedIvyArtifact
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyConfiguration
import org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublicationIdentity
import org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator
import java.io.File
import org.gradle.internal.os.OperatingSystem
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("com.github.jengelman.gradle.plugins:shadow:${property("versions.shadow")}")
}
}
val intellijUltimateEnabled: Boolean by rootProject.extra
val intellijRepo: String by rootProject.extra
@@ -18,6 +28,13 @@ val intellijSeparateSdks: Boolean by rootProject.extra
val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks
val installIntellijUltimate = intellijUltimateEnabled
val intellijVersionDelimiterIndex = intellijVersion.indexOfAny(charArrayOf('.', '-'))
if (intellijVersionDelimiterIndex == -1) {
error("Invalid IDEA version $intellijVersion")
}
val platformBaseVersion = intellijVersion.substring(0, intellijVersionDelimiterIndex)
logger.info("intellijUltimateEnabled: $intellijUltimateEnabled")
logger.info("intellijVersion: $intellijVersion")
@@ -44,6 +61,9 @@ repositories {
if (androidStudioRelease != null) {
ivy {
artifactPattern("https://dl.google.com/dl/android/studio/ide-zips/$androidStudioRelease/[artifact]-[revision]-$studioOs.zip")
metadataSources {
artifact()
}
}
}
maven { setUrl("$intellijRepo/$intellijReleaseType") }
@@ -115,7 +135,7 @@ fun removePathPrefix(path: String): String {
val unzipIntellijSdk by tasks.creating {
configureExtractFromConfigurationTask(intellij, pathRemap = { removePathPrefix(it) }) {
zipTree(it.singleFile).matching {
exclude("plugins/Kotlin/**")
exclude("**/plugins/Kotlin/**")
}
}
}
@@ -132,8 +152,12 @@ val unzipIntellijCore by tasks.creating { configureExtractFromConfigurationTask(
val unzipJpsStandalone by tasks.creating { configureExtractFromConfigurationTask(`jps-standalone`) { zipTree(it.singleFile) } }
val copyIntellijSdkSources by tasks.creating {
configureExtractFromConfigurationTask(sources) { it.singleFile }
val copyIntellijSdkSources by tasks.creating(ShadowJar::class.java) {
from(sources)
baseName = "ideaIC"
version = intellijVersion
classifier = "sources"
destinationDir = File(repoDir, sources.name)
}
val copyJpsBuildTest by tasks.creating { configureExtractFromConfigurationTask(`jps-build-test`) { it.singleFile } }
@@ -147,12 +171,12 @@ fun writeIvyXml(moduleName: String, fileName: String, jarFiles: FileCollection,
jarFiles.asFileTree.files.forEach {
if (it.isFile && it.extension == "jar") {
val relativeName = it.toRelativeString(baseDir).removeSuffix(".jar")
addArtifact(DefaultIvyArtifact(it, relativeName, "jar", "jar", null).also { it.conf = "default" })
addArtifact(FileBasedIvyArtifact(it, DefaultIvyPublicationIdentity(customDepsOrg, relativeName, intellijVersion)).also { it.conf = "default" })
}
}
if (sourcesJar != null) {
val sourcesArtifactName = sourcesJar.name.removeSuffix(".jar").substringBefore("-")
addArtifact(DefaultIvyArtifact(sourcesJar, sourcesArtifactName, "jar", "sources", "sources").also { it.conf = "sources" })
addArtifact(FileBasedIvyArtifact(sourcesJar, DefaultIvyPublicationIdentity(customDepsOrg, sourcesArtifactName, intellijVersion)).also { it.conf = "sources" })
}
writeTo(File(customDepsRepoModulesDir, "$fileName.ivy.xml"))
}

View File

@@ -4,6 +4,7 @@ import org.gradle.api.Project
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.kotlin.dsl.extra
import java.io.File
fun RepositoryHandler.androidDxJarRepo(project: Project): IvyArtifactRepository = ivy {
val baseDir = File("${project.rootDir}/buildSrc/prepare-deps/android-dx/build/repo")

View File

@@ -15,11 +15,12 @@ fun Project.kotlinBootstrapFrom(defaultSource: BootstrapOption) {
val customVersion = project.findProperty("bootstrap.kotlin.version") as String?
val customRepo = project.findProperty("bootstrap.kotlin.repo") as String?
val teamCityVersion = project.findProperty("bootstrap.teamcity.kotlin.version") as String?
val teamCityBuild = project.findProperty("bootstrap.teamcity.build.number") as String?
val teamCityProject = project.findProperty("bootstrap.teamcity.project") as String?
val bootstrapSource = when {
project.hasProperty("bootstrap.local") -> BootstrapOption.Local(project.findProperty("bootstrap.local.version") as String?, project.findProperty("bootstrap.local.path") as String?)
teamCityVersion != null -> BootstrapOption.TeamCity(teamCityVersion, projectExtId = teamCityProject, onlySuccessBootstrap = false)
teamCityVersion != null -> BootstrapOption.TeamCity(teamCityVersion, teamCityBuild, projectExtId = teamCityProject, onlySuccessBootstrap = false)
customVersion != null -> BootstrapOption.Custom(kotlinVersion = customVersion, repo = customRepo)
else -> defaultSource
}
@@ -47,14 +48,15 @@ sealed class BootstrapOption {
/** Get bootstrap from teamcity maven artifacts of the specified build configuration
*
* [kotlinVersion] build number and the version of maven artifacts
* [kotlinVersion] the version of maven artifacts
* [buildNumber] build number of a teamcity build, by default the same as [kotlinVersion],
* [projectExtId] extId of a teamcity build configuration, by default "Kotlin_dev_Compiler",
* [onlySuccessBootstrap] allow artifacts only from success builds of the default branch tagged with 'bootstrap' tag
*/
class TeamCity(val kotlinVersion: String, val projectExtId: String? = null, val onlySuccessBootstrap: Boolean = true) : BootstrapOption() {
class TeamCity(val kotlinVersion: String, val buildNumber: String? = null, val projectExtId: String? = null, val onlySuccessBootstrap: Boolean = true) : BootstrapOption() {
override fun applyToProject(project: Project) {
val query = if (onlySuccessBootstrap) "status:SUCCESS,tag:bootstrap,pinned:true" else "branch:default:any"
project.bootstrapKotlinRepo = "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:${projectExtId ?: "Kotlin_dev_Compiler"}),number:$kotlinVersion,$query/artifacts/content/maven/"
project.bootstrapKotlinRepo = "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:${projectExtId ?: "Kotlin_dev_Compiler"}),number:${buildNumber ?: kotlinVersion},$query/artifacts/content/maven/"
project.bootstrapKotlinVersion = kotlinVersion
}
}

View File

@@ -1,18 +1,20 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
// usages in build scripts are not tracked properly
@file:Suppress("unused")
import groovy.lang.Closure
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.file.CopySourceSpec
import org.gradle.api.file.SourceDirectorySet
import org.gradle.api.internal.AbstractTask
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.SourceSetOutput
import org.gradle.kotlin.dsl.creating
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.the
import java.io.File
import java.util.concurrent.Callable
inline fun <reified T : Task> Project.task(noinline configuration: T.() -> Unit) = tasks.creating(T::class, configuration)
@@ -20,7 +22,7 @@ fun Project.callGroovy(name: String, vararg args: Any?): Any? {
return (property(name) as Closure<*>).call(*args)
}
inline fun<T: Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
inline fun <T : Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
var res: T? = null
pluginManager.withPlugin("java") {
res = body()
@@ -28,31 +30,30 @@ inline fun<T: Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
return res
}
fun Project.getCompiledClasses(): SourceSetOutput? = withJavaPlugin {
the<JavaPluginConvention>().sourceSets.getByName("main").output
}
fun Project.getCompiledClasses(): SourceSetOutput? = withJavaPlugin { mainSourceSet.output }
fun Project.getSources(): SourceDirectorySet? = withJavaPlugin {
the<JavaPluginConvention>().sourceSets.getByName("main").allSource
}
fun Project.getSources(): SourceDirectorySet? = withJavaPlugin { mainSourceSet.allSource }
fun Project.getResourceFiles(): SourceDirectorySet? = withJavaPlugin {
the<JavaPluginConvention>().sourceSets.getByName("main").resources
}
fun Project.getResourceFiles(): SourceDirectorySet? = withJavaPlugin { mainSourceSet.resources }
fun File(root: File, vararg children: String): File = children.fold(root, { f, c -> File(f, c) })
fun File(root: String, vararg children: String): File = children.fold(File(root), { f, c -> File(f, c) })
fun fileFrom(root: File, vararg children: String): File = children.fold(root) { f, c -> File(f, c) }
fun fileFrom(root: String, vararg children: String): File = children.fold(File(root)) { f, c -> File(f, c) }
var Project.jvmTarget: String?
get() = extra.takeIf { it.has("jvmTarget") }?.get("jvmTarget") as? String
set(v) { extra["jvmTarget"] = v }
set(v) {
extra["jvmTarget"] = v
}
var Project.javaHome: String?
get() = extra.takeIf { it.has("javaHome") }?.get("javaHome") as? String
set(v) { extra["javaHome"] = v }
set(v) {
extra["javaHome"] = v
}
fun Project.generator(fqName: String) = task<JavaExec> {
classpath = the<JavaPluginConvention>().sourceSets["test"].runtimeClasspath
fun Project.generator(fqName: String, sourceSet: SourceSet? = null) = smartJavaExec {
classpath = (sourceSet ?: testSourceSet).runtimeClasspath
main = fqName
workingDir = rootDir
}
@@ -61,4 +62,8 @@ fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)
val v = it.toString()
if (v.isBlank()) true
else v.toBoolean()
}
}
inline fun CopySourceSpec.from(crossinline filesProvider: () -> Any?): CopySourceSpec = from(Callable { filesProvider() })
fun Project.javaPluginConvention(): JavaPluginConvention = the()

View File

@@ -0,0 +1,47 @@
import org.gradle.api.Project
import org.gradle.api.tasks.JavaExec
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.task
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
fun Project.smartJavaExec(configure: JavaExec.() -> Unit) = task<JavaExec> javaExec@{
configure()
val jarTask = project.task("${name}WriteClassPath", Jar::class) {
val classpath = classpath
val main = main
dependsOn(classpath)
inputs.property("main", main)
doFirst {
val classPathString = classpath.joinToString(" ") { project.file(it).toURI().toString() }
manifest {
attributes(
mapOf(
"Class-Path" to classPathString,
"Main-Class" to main
)
)
}
}
archiveName = "$main.${this@javaExec.name}.classpath.container.$extension"
destinationDir = temporaryDir
}
dependsOn(jarTask)
doFirst {
main = "-jar"
classpath = project.files()
val copyArgs = args.orEmpty().toList()
args(jarTask.outputs.files.singleFile)
args(copyArgs)
}
}

View File

@@ -8,7 +8,6 @@ import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.file.FileCollection
import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact
import org.gradle.api.plugins.BasePluginConvention
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
import java.io.File
@@ -23,7 +22,7 @@ fun Project.classesDirsArtifact(): FileCollection {
val classesDirsCfg = configurations.getOrCreate("classes-dirs")
val classesDirs = the<JavaPluginConvention>().sourceSets["main"].output.classesDirs
val classesDirs = mainSourceSet.output.classesDirs
val classesTask = tasks["classes"]
@@ -44,7 +43,7 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
return task<Jar>(MAGIC_DO_NOT_CHANGE_TEST_JAR_TASK_NAME) {
dependsOn("testClasses")
pluginManager.withPlugin("java") {
from(project.the<JavaPluginConvention>().sourceSets.getByName("test").output)
from(testSourceSet.output)
}
classifier = "tests"
body()
@@ -53,12 +52,23 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
}
fun Project.noDefaultJar() {
tasks.findByName("jar")?.enabled = false
tasks.findByName("jar")?.let { defaultJarTask ->
defaultJarTask.enabled = false
defaultJarTask.actions = emptyList()
configurations.forEach { cfg ->
cfg.artifacts.removeAll { artifact ->
artifact.file in defaultJarTask.outputs.files
}
}
}
}
fun<T> Project.runtimeJarArtifactBy(task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {
fun Project.runtimeJarArtifactBy(task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) {
addArtifact("archives", task, artifactRef, body)
addArtifact("runtimeJar", task, artifactRef, body)
configurations.findByName("runtime")?.let {
addArtifact(it, task, artifactRef, body)
}
}
fun<T: Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T {
@@ -67,23 +77,23 @@ fun<T: Jar> Project.runtimeJar(task: T, body: T.() -> Unit = {}): T {
configurations.getOrCreate("archives").artifacts.removeAll { (it as? ArchivePublishArtifact)?.archiveTask?.let { it == defaultJarTask } ?: false }
}
return task.apply {
setupPublicJar()
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setupPublicJar(project.the<BasePluginConvention>().archivesBaseName)
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
body()
project.runtimeJarArtifactBy(this, this)
}
}
fun Project.runtimeJar(taskName: String = "jar", body: Jar.() -> Unit = {}): Jar = runtimeJar(getOrCreateTask(taskName, body))
fun Project.runtimeJar(body: Jar.() -> Unit = {}): Jar = runtimeJar(getOrCreateTask("jar", body), { })
fun Project.sourcesJar(sourceSet: String? = "main", body: Jar.() -> Unit = {}): Jar =
getOrCreateTask("sourcesJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
classifier = "sources"
try {
if (sourceSet != null) {
project.pluginManager.withPlugin("java-base") {
from(project.the<JavaPluginConvention>().sourceSets[sourceSet].allSource)
from(project.javaPluginConvention().sourceSets[sourceSet].allSource)
}
}
} catch (e: UnknownDomainObjectException) {
@@ -95,7 +105,7 @@ fun Project.sourcesJar(sourceSet: String? = "main", body: Jar.() -> Unit = {}):
fun Project.javadocJar(body: Jar.() -> Unit = {}): Jar =
getOrCreateTask("javadocJar") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
classifier = "javadoc"
tasks.findByName("javadoc")?.let{ it as Javadoc }?.takeIf { it.enabled }?.let {
dependsOn(it)
@@ -176,25 +186,28 @@ private fun Project.runtimeJarTaskIfExists(): Task? =
fun ConfigurationContainer.getOrCreate(name: String): Configuration = findByName(name) ?: create(name)
fun Jar.setupPublicJar(classifier: String = "") {
fun Jar.setupPublicJar(baseName: String, classifier: String = "") {
val buildNumber = project.rootProject.extra["buildNumber"] as String
this.baseName = baseName
this.version = buildNumber
this.classifier = classifier
manifest.attributes.apply {
put("Implementation-Vendor", "JetBrains")
put("Implementation-Title", project.the<BasePluginConvention>().archivesBaseName)
put("Implementation-Version", project.rootProject.extra["buildNumber"])
put("Implementation-Title", baseName)
put("Implementation-Version", buildNumber)
put("Build-Jdk", System.getProperty("java.version"))
}
}
fun<T> Project.addArtifact(configuration: Configuration, task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) {
fun Project.addArtifact(configuration: Configuration, task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) {
artifacts.add(configuration.name, artifactRef) {
builtBy(task)
body()
}
}
fun<T> Project.addArtifact(configurationName: String, task: Task, artifactRef: T, body: ConfigurablePublishArtifact.() -> Unit = {}) =
fun Project.addArtifact(configurationName: String, task: Task, artifactRef: Any, body: ConfigurablePublishArtifact.() -> Unit = {}) =
addArtifact(configurations.getOrCreate(configurationName), task, artifactRef, body)
fun Project.cleanArtifacts() {

View File

@@ -5,6 +5,8 @@ import org.gradle.api.Project
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.tasks.AbstractCopyTask
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import java.io.File
@@ -48,14 +50,15 @@ fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File
}
fun Project.ideaUltimatePreloadedDeps(vararg artifactBaseNames: String, subdir: String? = null): ConfigurableFileCollection {
val ultimateDepsDir = File(rootDir, "ultimate", "dependencies")
val ultimateDepsDir = fileFrom(rootDir, "ultimate", "dependencies")
return if (ultimateDepsDir.isDirectory) preloadedDeps(*artifactBaseNames, baseDir = ultimateDepsDir, subdir = subdir)
else files()
}
fun Project.kotlinDep(artifactBaseName: String, version: String): String = "org.jetbrains.kotlin:kotlin-$artifactBaseName:$version"
fun DependencyHandler.projectDist(name: String): ProjectDependency = project(name, configuration = "distJar").apply { isTransitive = false }
@Deprecated("Depend on the default configuration instead", ReplaceWith("project(name)"))
fun DependencyHandler.projectDist(name: String): ProjectDependency = project(name)
fun DependencyHandler.projectTests(name: String): ProjectDependency = project(name, configuration = "tests-jar")
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
@@ -91,10 +94,33 @@ private fun String.toMaybeVersionedJarRegex(): Regex {
}
private val jreHome = System.getProperty("java.home")
fun firstFromJavaHomeThatExists(vararg paths: String): File? =
paths.mapNotNull { File(jreHome, it).takeIf { it.exists() } }.firstOrNull()
fun Project.firstFromJavaHomeThatExists(vararg paths: String, jdkHome: File = File(this.property("JDK_18") as String)): File? =
paths.map { File(jdkHome, it) }.firstOrNull { it.exists() }.also {
if (it == null)
logger.warn("Cannot find file by paths: ${paths.toList()} in $jdkHome")
}
fun toolsJar(): File? = firstFromJavaHomeThatExists("../lib/tools.jar", "../Classes/tools.jar")
fun Project.toolsJar(jdkHome: File = File(this.property("JDK_18") as String)): File? =
firstFromJavaHomeThatExists("lib/tools.jar", jdkHome = jdkHome)
object EmbeddedComponents {
val CONFIGURATION_NAME = "embeddedComponents"
}
fun AbstractCopyTask.fromEmbeddedComponents() {
val embeddedComponents = project.configurations.getByName(EmbeddedComponents.CONFIGURATION_NAME)
if (this is ShadowJar) {
from(embeddedComponents)
} else {
dependsOn(embeddedComponents)
from {
embeddedComponents.map { file ->
if (file.isDirectory)
project.files(file)
else
project.zipTree(file)
}
}
}
}

View File

@@ -6,6 +6,7 @@ import org.gradle.api.file.DuplicatesStrategy
import org.gradle.jvm.tasks.Jar
import org.gradle.kotlin.dsl.task
import org.gradle.kotlin.dsl.*
import java.io.File
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
@@ -64,7 +65,7 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
return task<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from(compilerJar)
body()
}
@@ -96,7 +97,7 @@ fun Project.embeddableCompilerDummyForDependenciesRewriting(taskName: String = "
return task<ShadowJar>(taskName) {
destinationDir = File(buildDir, "libs")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from(compilerDummyJar)
configureEmbeddableCompilerRelocation(withJavaxInject = false)
body()
@@ -118,7 +119,7 @@ fun Project.rewriteDepsToShadedJar(originalJarTask: Jar, shadowJarTask: Jar, bod
// which leads to the content of that JAR being excluded as well:
exclude { it.file == compilerDummyJarFile }
classifier = null
classifier = ""
body()
}
}

View File

@@ -45,7 +45,6 @@ fun Project.configureInstrumentation() {
// classes from the "friendly directory" to the compile classpath.
val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile?
testCompile?.doFirst {
val mainSourceSet = the<JavaPluginConvention>().sourceSets.getByName("main")
testCompile.classpath = (testCompile.classpath
- mainSourceSet.output.classesDirs
+ files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy")))
@@ -55,11 +54,11 @@ fun Project.configureInstrumentation() {
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
dependencies {
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all", "jgoodies-forms") }
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all") }
}
afterEvaluate {
the<JavaPluginConvention>().sourceSets.all { sourceSetParam ->
sourceSets.all { sourceSetParam ->
// This copy will ignore filters, but they are unlikely to be used.
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
@@ -106,12 +105,12 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
@get:OutputDirectory
var output: File? = null
lateinit var output: File
@TaskAction
fun instrumentClasses() {
logger.info("input files are: ${originalClassesDirs?.joinToString("; ", transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)" }"})}")
output?.deleteRecursively()
output.deleteRecursively()
copyOriginalClasses()
val classpath = instrumentationClasspath!!
@@ -150,7 +149,7 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
// 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.the<JavaPluginConvention>().sourceSets.getByName("main").allSource.sourceDirectories }
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
val instrumentationClasspath =
depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
logger.info("Using following dependency source dirs: $it")

View File

@@ -0,0 +1,180 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.gradle.api.Project
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.internal.ConventionTask
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.api.tasks.*
import org.gradle.api.tasks.compile.AbstractCompile
import org.gradle.kotlin.dsl.*
import java.io.File
fun Project.configureInstrumentation() {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
// When we change the output classes directory, Gradle will automatically configure
// the test compile tasks to use the instrumented classes. Normally this is fine,
// however, it causes problems for Kotlin projects:
// The "internal" modifier can be used to restrict access to the same module.
// To make it possible to use internal methods from the main source set in test classes,
// the Kotlin Gradle plugin adds the original output directory of the Java task
// as "friendly directory" which makes it possible to access internal members
// of the main module. Also this directory should be available on classpath during compilation
// 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 {
testCompile.classpath = (testCompile.classpath
- mainSourceSet.output.classesDirs
+ files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy")))
}
}
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
dependencies {
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all", "jgoodies-forms") }
}
afterEvaluate {
sourceSets.all { sourceSetParam ->
// This copy will ignore filters, but they are unlikely to be used.
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
val classesDirsCopy = project.files(classesDirs.toTypedArray()).filter { it.exists() }
(sourceSetParam as ExtensionAware).extra.set("classesDirsCopy", classesDirsCopy)
logger.info("Saving old sources dir for project ${project.name}")
val instrumentedClassesDir = File(project.buildDir, "classes/${sourceSetParam.name}-instrumented")
(sourceSetParam.output.classesDirs as ConfigurableFileCollection).setFrom(instrumentedClassesDir)
val instrumentTask = project.tasks.create(sourceSetParam.getTaskName("instrument", "classes"), IntelliJInstrumentCodeTask::class.java)
instrumentTask.apply {
dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty }
sourceSet = sourceSetParam
instrumentationClasspath = instrumentationClasspathCfg
originalClassesDirs = classesDirsCopy
output = instrumentedClassesDir
}
instrumentTask.outputs.dir(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() {
companion object {
private const val FILTER_ANNOTATION_REGEXP_CLASS = "com.intellij.ant.ClassFilterAnnotationRegexp"
private const val LOADER_REF = "java2.loader"
}
var sourceSet: SourceSet? = null
var instrumentationClasspath: Configuration? = null
@Input
var originalClassesDirs: FileCollection? = null
@get:InputFiles
val sourceDirs: FileCollection
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
@get:OutputDirectory
lateinit var output: File
@TaskAction
fun instrumentClasses() {
logger.info("input files are: ${originalClassesDirs?.joinToString("; ", transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)" }"})}")
output.deleteRecursively()
copyOriginalClasses()
val classpath = instrumentationClasspath!!
ant.withGroovyBuilder {
"taskdef"("name" to "instrumentIdeaExtensions",
"classpath" to classpath.asPath,
"loaderref" to LOADER_REF,
"classname" to "com.intellij.ant.InstrumentIdeaExtensions")
}
logger.info("Compiling forms and instrumenting code with nullability preconditions")
val instrumentNotNull = prepareNotNullInstrumenting(classpath.asPath)
instrumentCode(sourceDirs, instrumentNotNull)
}
private fun copyOriginalClasses() {
project.copy {
from(originalClassesDirs)
into(output)
}
}
private fun prepareNotNullInstrumenting(classpath: String): Boolean {
ant.withGroovyBuilder {
"typedef"("name" to "skip",
"classpath" to classpath,
"loaderref" to LOADER_REF,
"classname" to FILTER_ANNOTATION_REGEXP_CLASS)
}
return true
}
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
val headlessOldValue = System.setProperty("java.awt.headless", "true")
// 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 {
logger.info("Using following dependency source dirs: $it")
}
logger.info("Running instrumentIdeaExtensions with srcdir=${srcDirs.asPath}}, destdir=$output and classpath=$instrumentationClasspath")
ant.withGroovyBuilder {
"instrumentIdeaExtensions"("srcdir" to srcDirs.asPath,
"destdir" to output,
"classpath" to instrumentationClasspath,
"includeantruntime" to false,
"instrumentNotNull" to instrumentNotNull) {
if (instrumentNotNull) {
ant.withGroovyBuilder {
"skip"("pattern" to "kotlin/Metadata")
}
}
}
}
if (headlessOldValue != null) {
System.setProperty("java.awt.headless", headlessOldValue)
} else {
System.clearProperty("java.awt.headless")
}
}
}

Some files were not shown because too many files have changed in this diff Show More