mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-29 00:21:31 +00:00
Compare commits
68 Commits
native-sup
...
master_181
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c0c1c81bc | ||
|
|
73f08e5d63 | ||
|
|
e49aebeac2 | ||
|
|
312609d91c | ||
|
|
e0cb01eeb9 | ||
|
|
d707573493 | ||
|
|
2796a72652 | ||
|
|
02cf31e812 | ||
|
|
a9f98fbbe5 | ||
|
|
324f231f2b | ||
|
|
39cc7aa7cf | ||
|
|
eeabc28385 | ||
|
|
2926690e6c | ||
|
|
3fa4ddb5b5 | ||
|
|
83071b8823 | ||
|
|
70231ae12a | ||
|
|
8ce37d248a | ||
|
|
7903186b84 | ||
|
|
90bbce0eb9 | ||
|
|
23adb5bd15 | ||
|
|
2ed9c9c009 | ||
|
|
d51e304525 | ||
|
|
fd0bb96605 | ||
|
|
8d79b4d14c | ||
|
|
d681c19d7a | ||
|
|
56dd6c9801 | ||
|
|
5d17b3e4d6 | ||
|
|
a47eebf2b9 | ||
|
|
ed764834b6 | ||
|
|
11dd7a4284 | ||
|
|
de5006c465 | ||
|
|
b4c784a0de | ||
|
|
b80d2c9a90 | ||
|
|
70858b6774 | ||
|
|
e87748cf4d | ||
|
|
d47f5c337d | ||
|
|
a872281647 | ||
|
|
62113cc539 | ||
|
|
173af4f9eb | ||
|
|
ac9198914a | ||
|
|
d8a72ad137 | ||
|
|
014c23f71a | ||
|
|
389ed8787c | ||
|
|
11de3b4ba8 | ||
|
|
e054c7f800 | ||
|
|
3fa2985c9c | ||
|
|
ac96bc7e80 | ||
|
|
b8ddda6986 | ||
|
|
3f45689b1f | ||
|
|
dd428286c7 | ||
|
|
31e21f3d45 | ||
|
|
837362d911 | ||
|
|
0bbed83235 | ||
|
|
dc1ff036c8 | ||
|
|
72a841e77f | ||
|
|
0c7b876412 | ||
|
|
ba50a3ddf9 | ||
|
|
4ab1ddde71 | ||
|
|
1ee1e79d31 | ||
|
|
76cdd7b87a | ||
|
|
56dc3a1dcb | ||
|
|
8b6961f22c | ||
|
|
db5b83d72a | ||
|
|
1171fea35f | ||
|
|
00034d56b2 | ||
|
|
ca86dde953 | ||
|
|
0698280b7d | ||
|
|
26968d7d19 |
9
.idea/ant.xml
generated
9
.idea/ant.xml
generated
@@ -1,8 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AntConfiguration">
|
||||
<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>
|
||||
289
.idea/codeStyleSettings.xml
generated
Normal file
289
.idea/codeStyleSettings.xml
generated
Normal file
@@ -0,0 +1,289 @@
|
||||
<?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=" " />
|
||||
<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>
|
||||
194
.idea/codeStyles/Project.xml
generated
194
.idea/codeStyles/Project.xml
generated
@@ -1,7 +1,50 @@
|
||||
<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=" " />
|
||||
<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">
|
||||
@@ -13,15 +56,102 @@
|
||||
</option>
|
||||
</JavaCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
<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" />
|
||||
</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">
|
||||
@@ -62,6 +192,9 @@
|
||||
<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" />
|
||||
@@ -88,17 +221,72 @@
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</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>
|
||||
<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>
|
||||
1
.idea/dictionaries/bashor.xml
generated
1
.idea/dictionaries/bashor.xml
generated
@@ -4,7 +4,6 @@
|
||||
<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
7
.idea/dictionaries/dmitriy_dolovov.xml
generated
@@ -1,7 +0,0 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="dmitriy.dolovov">
|
||||
<words>
|
||||
<w>konan</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
1
.idea/dictionaries/yan.xml
generated
1
.idea/dictionaries/yan.xml
generated
@@ -1,7 +1,6 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="yan">
|
||||
<words>
|
||||
<w>debuggee</w>
|
||||
<w>deserializes</w>
|
||||
<w>impls</w>
|
||||
<w>kapt</w>
|
||||
|
||||
3
.idea/encodings.xml
generated
3
.idea/encodings.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
|
||||
<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,7 +14,6 @@
|
||||
<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" />
|
||||
|
||||
30
.idea/inspectionProfiles/idea_default.xml
generated
30
.idea/inspectionProfiles/idea_default.xml
generated
@@ -55,6 +55,9 @@
|
||||
<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>
|
||||
@@ -95,19 +98,6 @@
|
||||
<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." />
|
||||
</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" />
|
||||
@@ -285,25 +275,13 @@
|
||||
<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">
|
||||
<option name="processChangedFilesOnly" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="Reformat" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="ReplaceAssignmentWithOperatorAssignment" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoreLazyOperators" value="true" />
|
||||
<option name="ignoreObscureOperators" value="true" />
|
||||
|
||||
32
.idea/misc.xml
generated
32
.idea/misc.xml
generated
@@ -44,38 +44,6 @@
|
||||
</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>
|
||||
|
||||
171
.idea/projectCodeStyle.xml
generated
Normal file
171
.idea/projectCodeStyle.xml
generated
Normal file
@@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CodeStyleSettingsManager">
|
||||
<option name="PER_PROJECT_SETTINGS">
|
||||
<value>
|
||||
<option name="LINE_SEPARATOR" value=" " />
|
||||
<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>
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
</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>
|
||||
|
||||
1083
ChangeLog.md
1083
ChangeLog.md
File diff suppressed because it is too large
Load Diff
44
ReadMe.md
44
ReadMe.md
@@ -1,4 +1,5 @@
|
||||
[](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>
|
||||
[](https://teamcity.jetbrains.com/viewType.html?buildTypeId=Kotlin_dev_Compiler&branch_Kotlin_dev=%3Cdefault%3E&tab=buildTypeStatusDiv)
|
||||
[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22)
|
||||
[](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
@@ -22,7 +23,7 @@ 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 Sublime Text Package](https://github.com/vkostyukov/kotlin-sublime-package)
|
||||
* [Kotlin TextMate Bundle](https://github.com/vkostyukov/kotlin-sublime-package)
|
||||
|
||||
## Build environment requirements
|
||||
|
||||
@@ -80,24 +81,6 @@ 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).
|
||||
@@ -107,7 +90,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` and choose `Gradle Test Runner` in the Gradle runner settings.
|
||||
To be able to run tests from IntelliJ easily, check `Delegate IDE build/run actions to Gradle` 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".
|
||||
|
||||
@@ -150,16 +133,14 @@ 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/) and 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/) 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
|
||||
@@ -168,14 +149,3 @@ 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
|
||||
|
||||
121
TeamCityBuild.xml
Normal file
121
TeamCityBuild.xml
Normal file
@@ -0,0 +1,121 @@
|
||||
<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>
|
||||
92
TeamCityRelay.xml
Normal file
92
TeamCityRelay.xml
Normal file
@@ -0,0 +1,92 @@
|
||||
<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>
|
||||
@@ -38,7 +38,7 @@ internal object KotlinAntTaskUtil {
|
||||
}
|
||||
|
||||
val compilerJar: File by jar("kotlin-compiler.jar")
|
||||
val runtimeJar: File by jar("kotlin-stdlib.jar")
|
||||
val runtimeJar: File by jar("kotlin-runtime.jar")
|
||||
val reflectJar: File by jar("kotlin-reflect.jar")
|
||||
|
||||
private fun jar(name: String) = lazy {
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,66 +16,66 @@
|
||||
|
||||
package org.jetbrains.kotlin.build
|
||||
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
|
||||
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
|
||||
|
||||
/**
|
||||
* If you want to add a new field, check its type is supported by [serializeToPlainText], [deserializeFromPlainText]
|
||||
*/
|
||||
data class JvmBuildMetaInfo(
|
||||
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
|
||||
)
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.build
|
||||
|
||||
import org.jetbrains.kotlin.incremental.LocalFileKotlinClass
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.ModuleMapping
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleMapping
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
import java.io.File
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
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;
|
||||
@@ -27,7 +26,6 @@ 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;
|
||||
|
||||
@@ -48,7 +46,6 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,192 +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.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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* 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() })
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
/**
|
||||
* 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 classesFqNamesBySources(files: Iterable<File>): Collection<FqName> =
|
||||
files.flatMapTo(HashSet()) { sourceToClassesMap.getFqNames(it) }
|
||||
|
||||
fun getSubtypesOf(className: FqName): Sequence<FqName> =
|
||||
subtypesMap[className].asSequence()
|
||||
|
||||
fun getSourceFileIfClass(fqName: FqName): File? =
|
||||
classFqNameToSourceMap[fqName]
|
||||
|
||||
open 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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -36,13 +36,11 @@ import java.io.DataInput
|
||||
import java.io.DataOutput
|
||||
import java.io.File
|
||||
|
||||
open class IncrementalJsCache(cachesDir: File) : AbstractIncrementalCache<FqName>(cachesDir) {
|
||||
open class IncrementalJsCache(cachesDir: File) : IncrementalCacheCommon<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))
|
||||
|
||||
@@ -23,17 +23,14 @@ 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
|
||||
@@ -45,9 +42,9 @@ import java.util.*
|
||||
val KOTLIN_CACHE_DIRECTORY_NAME = "kotlin"
|
||||
|
||||
open class IncrementalJvmCache(
|
||||
private val targetDataRoot: File,
|
||||
targetOutputDir: File?
|
||||
) : AbstractIncrementalCache<JvmClassName>(File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)), IncrementalCache {
|
||||
private val targetDataRoot: File,
|
||||
targetOutputDir: File?
|
||||
) : IncrementalCacheCommon<JvmClassName>(File(targetDataRoot, KOTLIN_CACHE_DIRECTORY_NAME)), IncrementalCache {
|
||||
companion object {
|
||||
private val PROTO_MAP = "proto"
|
||||
private val CONSTANTS_MAP = "constants"
|
||||
@@ -83,16 +80,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)
|
||||
@@ -131,7 +128,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,
|
||||
@@ -179,15 +176,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 {
|
||||
@@ -212,7 +209,8 @@ open class IncrementalJvmCache(
|
||||
|
||||
if (notRemovedParts.isEmpty()) {
|
||||
multifileFacadeToParts.remove(facade)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
multifileFacadeToParts[facade] = notRemovedParts
|
||||
}
|
||||
}
|
||||
@@ -266,7 +264,7 @@ open class IncrementalJvmCache(
|
||||
|
||||
override fun clean() {
|
||||
super.clean()
|
||||
localCacheVersionManager(targetDataRoot, IncrementalCompilation.isEnabledForJvm()).clean()
|
||||
normalCacheVersion(targetDataRoot).clean()
|
||||
}
|
||||
|
||||
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
|
||||
@@ -291,11 +289,9 @@ 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
|
||||
@@ -303,10 +299,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
|
||||
@@ -322,16 +318,15 @@ 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
|
||||
)
|
||||
}
|
||||
|
||||
@@ -344,13 +339,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?
|
||||
@@ -372,7 +367,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
|
||||
@@ -381,7 +376,8 @@ open class IncrementalJvmCache(
|
||||
val newMap = getConstantsMap(kotlinClass.fileContents)
|
||||
if (newMap.isNotEmpty()) {
|
||||
storage[key] = newMap
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
storage.remove(key)
|
||||
}
|
||||
|
||||
@@ -395,7 +391,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) {
|
||||
@@ -408,22 +404,21 @@ 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)
|
||||
@@ -432,14 +427,13 @@ 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)
|
||||
@@ -448,21 +442,20 @@ 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) {
|
||||
@@ -470,8 +463,7 @@ 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()
|
||||
@@ -479,13 +471,7 @@ 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)) {
|
||||
@@ -512,35 +498,30 @@ 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) {
|
||||
@@ -560,10 +541,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)!!
|
||||
@@ -575,24 +556,23 @@ 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(", ")
|
||||
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")
|
||||
}
|
||||
|
||||
val value = get(key)?.let(dumpValue) ?: "null"
|
||||
append("$key -> $value")
|
||||
append("}")
|
||||
}
|
||||
append("}")
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
fun <T : Comparable<T>> Collection<T>.dumpCollection(): String =
|
||||
"[${sorted().joinToString(", ", transform = Any::toString)}]"
|
||||
@TestOnly fun <T : Comparable<T>> Collection<T>.dumpCollection(): String =
|
||||
"[${sorted().joinToString(", ", transform = Any::toString)}]"
|
||||
|
||||
@@ -16,30 +16,20 @@
|
||||
|
||||
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.deserialization.builtins.BuiltInSerializerProtocol
|
||||
|
||||
// It uses BuiltInSerializerProtocol for annotations serialization
|
||||
class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSerializerProtocol) {
|
||||
override val metadataVersion: BinaryVersion
|
||||
get() = JvmMetadataVersion.INVALID_VERSION
|
||||
|
||||
override fun serializeClass(
|
||||
descriptor: ClassDescriptor,
|
||||
proto: ProtoBuf.Class.Builder,
|
||||
versionRequirementTable: MutableVersionRequirementTable
|
||||
) {
|
||||
super.serializeClass(descriptor, proto, versionRequirementTable)
|
||||
override fun serializeClass(descriptor: ClassDescriptor, proto: ProtoBuf.Class.Builder) {
|
||||
super.serializeClass(descriptor, proto)
|
||||
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
|
||||
proto.setExtension(JavaClassProtoBuf.isPackagePrivateClass, true)
|
||||
}
|
||||
@@ -63,12 +53,8 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
|
||||
}
|
||||
}
|
||||
|
||||
override fun serializeProperty(
|
||||
descriptor: PropertyDescriptor,
|
||||
proto: ProtoBuf.Property.Builder,
|
||||
versionRequirementTable: MutableVersionRequirementTable
|
||||
) {
|
||||
super.serializeProperty(descriptor, proto, versionRequirementTable)
|
||||
override fun serializeProperty(descriptor: PropertyDescriptor, proto: ProtoBuf.Property.Builder) {
|
||||
super.serializeProperty(descriptor, proto)
|
||||
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
|
||||
proto.setExtension(JavaClassProtoBuf.isPackagePrivateField, true)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ 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
|
||||
@@ -95,15 +94,8 @@ fun JavaClassDescriptor.convertToProto(): SerializedJavaClassWithSource {
|
||||
val file = javaSourceFile.sure { "convertToProto should only be called for source based classes" }
|
||||
|
||||
val extension = JavaClassesSerializerExtension()
|
||||
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 serializer = DescriptorSerializer.createTopLevel(extension)
|
||||
val classProto = serializer.classProto(this).build()
|
||||
|
||||
val (stringTable, qualifiedNameTable) = extension.stringTable.buildProto()
|
||||
|
||||
|
||||
@@ -177,7 +177,10 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
||||
}
|
||||
|
||||
if (!checkEqualsClassVersionRequirement(old, new)) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) return false
|
||||
}
|
||||
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
|
||||
if (old.hasVersionRequirementTable()) {
|
||||
@@ -248,7 +251,7 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
ENUM_ENTRY_LIST,
|
||||
SEALED_SUBCLASS_FQ_NAME_LIST,
|
||||
TYPE_TABLE,
|
||||
VERSION_REQUIREMENT_LIST,
|
||||
VERSION_REQUIREMENT,
|
||||
VERSION_REQUIREMENT_TABLE,
|
||||
JVM_EXT_CLASS_MODULE_NAME,
|
||||
JVM_EXT_CLASS_LOCAL_VARIABLE_LIST,
|
||||
@@ -299,7 +302,10 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
if (!checkEquals(old.typeTable, new.typeTable)) result.add(ProtoBufClassKind.TYPE_TABLE)
|
||||
}
|
||||
|
||||
if (!checkEqualsClassVersionRequirement(old, new)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_LIST)
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT)
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) result.add(ProtoBufClassKind.VERSION_REQUIREMENT)
|
||||
}
|
||||
|
||||
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
|
||||
if (old.hasVersionRequirementTable()) {
|
||||
@@ -398,7 +404,10 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
if (!checkEquals(old.typeTable, new.typeTable)) return false
|
||||
}
|
||||
|
||||
if (!checkEqualsFunctionVersionRequirement(old, new)) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) return false
|
||||
}
|
||||
|
||||
if (old.hasContract() != new.hasContract()) return false
|
||||
if (old.hasContract()) {
|
||||
@@ -501,18 +510,16 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
if (old.setterFlags != new.setterFlags) return false
|
||||
}
|
||||
|
||||
if (!checkEqualsPropertyVersionRequirement(old, new)) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) 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
|
||||
}
|
||||
@@ -591,7 +598,10 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
|
||||
if (!checkEqualsTypeAliasAnnotation(old, new)) return false
|
||||
|
||||
if (!checkEqualsTypeAliasVersionRequirement(old, new)) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -773,7 +783,10 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR
|
||||
|
||||
if (!checkEqualsConstructorValueParameter(old, new)) return false
|
||||
|
||||
if (!checkEqualsConstructorVersionRequirement(old, new)) return false
|
||||
if (old.hasVersionRequirement() != new.hasVersionRequirement()) return false
|
||||
if (old.hasVersionRequirement()) {
|
||||
if (old.versionRequirement != new.versionRequirement) return false
|
||||
}
|
||||
|
||||
if (old.hasExtension(JvmProtoBuf.constructorSignature) != new.hasExtension(JvmProtoBuf.constructorSignature)) return false
|
||||
if (old.hasExtension(JvmProtoBuf.constructorSignature)) {
|
||||
@@ -977,16 +990,6 @@ 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
|
||||
}
|
||||
|
||||
@@ -1249,16 +1252,6 @@ 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
|
||||
|
||||
@@ -1279,16 +1272,6 @@ 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
|
||||
|
||||
@@ -1299,16 +1282,6 @@ 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
|
||||
|
||||
@@ -1329,16 +1302,6 @@ 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
|
||||
|
||||
@@ -1399,16 +1362,6 @@ 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
|
||||
|
||||
@@ -1599,8 +1552,8 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
|
||||
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
for(i in 0..versionRequirementCount - 1) {
|
||||
hashCode = 31 * hashCode + getVersionRequirement(i)
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
if (hasVersionRequirementTable()) {
|
||||
@@ -1679,8 +1632,8 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
|
||||
hashCode = 31 * hashCode + typeTable.hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
for(i in 0..versionRequirementCount - 1) {
|
||||
hashCode = 31 * hashCode + getVersionRequirement(i)
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
if (hasContract()) {
|
||||
@@ -1763,18 +1716,14 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int)
|
||||
hashCode = 31 * hashCode + setterFlags
|
||||
}
|
||||
|
||||
for(i in 0..versionRequirementCount - 1) {
|
||||
hashCode = 31 * hashCode + getVersionRequirement(i)
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
@@ -1839,8 +1788,8 @@ fun ProtoBuf.TypeAlias.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int
|
||||
hashCode = 31 * hashCode + getAnnotation(i).hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
for(i in 0..versionRequirementCount - 1) {
|
||||
hashCode = 31 * hashCode + getVersionRequirement(i)
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
return hashCode
|
||||
@@ -1997,8 +1946,8 @@ fun ProtoBuf.Constructor.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (I
|
||||
hashCode = 31 * hashCode + getValueParameter(i).hashCode(stringIndexes, fqNameIndexes)
|
||||
}
|
||||
|
||||
for(i in 0..versionRequirementCount - 1) {
|
||||
hashCode = 31 * hashCode + getVersionRequirement(i)
|
||||
if (hasVersionRequirement()) {
|
||||
hashCode = 31 * hashCode + versionRequirement
|
||||
}
|
||||
|
||||
if (hasExtension(JvmProtoBuf.constructorSignature)) {
|
||||
@@ -2171,14 +2120,6 @@ 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
|
||||
}
|
||||
|
||||
|
||||
@@ -34,14 +34,11 @@ 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>
|
||||
@@ -56,7 +53,6 @@ fun makeModuleFile(
|
||||
sourcesToCompile.map { it.absoluteFile },
|
||||
javaSourceRoots,
|
||||
classpath,
|
||||
commonSources.map { it.absoluteFile },
|
||||
null,
|
||||
"java-production",
|
||||
isTest,
|
||||
@@ -85,10 +81,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 {
|
||||
@@ -123,8 +119,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>()
|
||||
@@ -134,7 +130,6 @@ 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" }
|
||||
@@ -178,10 +173,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>()
|
||||
|
||||
@@ -200,7 +195,7 @@ fun mapClassesFqNamesToFiles(
|
||||
|
||||
fun withSubtypes(
|
||||
typeFqName: FqName,
|
||||
caches: Iterable<IncrementalCacheCommon>
|
||||
caches: Iterable<IncrementalCacheCommon<*>>
|
||||
): Set<FqName> {
|
||||
val types = LinkedList(listOf(typeFqName))
|
||||
val subtypes = hashSetOf<FqName>()
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
||||
@@ -223,7 +223,7 @@ class DifferenceCalculatorForClass(
|
||||
ProtoBufClassKind.TYPE_TABLE -> {
|
||||
// TODO
|
||||
}
|
||||
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT_LIST,
|
||||
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT,
|
||||
ProtoCompareGenerated.ProtoBufClassKind.VERSION_REQUIREMENT_TABLE -> {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
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) {
|
||||
@@ -33,12 +34,5 @@ internal class FileToIdMap(file: File) : BasicMap<File, Int>(file, FileKeyDescri
|
||||
storage.remove(file)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
fun toMap(): Map<File, Int> = storage.keys.keysToMap { storage[it]!! }
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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) }
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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"
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
)
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* 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()
|
||||
@@ -34,18 +34,16 @@ class KotlinModuleXmlBuilder {
|
||||
}
|
||||
|
||||
fun addModule(
|
||||
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 {
|
||||
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 {
|
||||
assert(!done) { "Already done" }
|
||||
|
||||
p.println("<!-- Module script for ${if (isTests) "tests" else "production"} -->")
|
||||
@@ -64,10 +62,6 @@ class KotlinModuleXmlBuilder {
|
||||
p.println("<", SOURCES, " ", PATH, "=\"", getEscapedPath(sourceFile), "\"/>")
|
||||
}
|
||||
|
||||
for (commonSourceFile in commonSourceFiles) {
|
||||
p.println("<", COMMON_SOURCES, " ", PATH, "=\"", getEscapedPath(commonSourceFile), "\"/>")
|
||||
}
|
||||
|
||||
processJavaSourceRoots(javaSourceRoots)
|
||||
processClasspath(classpathRoots, directoriesToFilterOut)
|
||||
|
||||
@@ -84,7 +78,7 @@ class KotlinModuleXmlBuilder {
|
||||
directoriesToFilterOut: Set<File>) {
|
||||
p.println("<!-- Classpath -->")
|
||||
for (file in files) {
|
||||
val isOutput = directoriesToFilterOut.contains(file) && !IncrementalCompilation.isEnabledForJvm()
|
||||
val isOutput = directoriesToFilterOut.contains(file) && !IncrementalCompilation.isEnabled()
|
||||
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
|
||||
|
||||
@@ -1,84 +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 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))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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))
|
||||
}
|
||||
}
|
||||
@@ -27,11 +27,10 @@ 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 in arrayOf(SIMPLE_LOG, JS_JPS_LOG, DATA_CONTAINER_LOG)
|
||||
file.name.let { it == SIMPLE_LOG || it == DATA_CONTAINER_LOG }
|
||||
}
|
||||
|
||||
fun findBuildLog(dir: File): File? {
|
||||
@@ -40,7 +39,6 @@ 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
|
||||
|
||||
@@ -17,11 +17,7 @@
|
||||
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
|
||||
@@ -29,7 +25,6 @@ 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.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
|
||||
@@ -37,10 +32,14 @@ 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.*
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.File
|
||||
import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
import java.util.*
|
||||
import java.util.zip.CRC32
|
||||
import java.util.zip.GZIPInputStream
|
||||
import kotlin.comparisons.compareBy
|
||||
|
||||
// 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"
|
||||
@@ -187,39 +186,6 @@ private fun metaJsToString(metaJsFile: File): String {
|
||||
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)
|
||||
@@ -234,13 +200,6 @@ private fun fileToStringRepresentation(file: File): String {
|
||||
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()
|
||||
}
|
||||
|
||||
@@ -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> {
|
||||
@@ -80,9 +80,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 +122,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() }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,6 @@ public final class DebugJvmProtoBuf {
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.methodSignature);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.lambdaClassOriginName);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.propertySignature);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.flags);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.typeAnnotation);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.isRaw);
|
||||
registry.add(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.typeParameterAnnotation);
|
||||
@@ -4559,22 +4558,6 @@ public final class DebugJvmProtoBuf {
|
||||
.newFileScopedGeneratedExtension(
|
||||
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmPropertySignature.class,
|
||||
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmPropertySignature.getDefaultInstance());
|
||||
public static final int FLAGS_FIELD_NUMBER = 101;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
|
||||
*
|
||||
* <pre>
|
||||
**
|
||||
*isMovedFromInterfaceCompanion true if this property is declared in an interface companion, and the field is stored in the interface
|
||||
* </pre>
|
||||
*/
|
||||
public static final
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
|
||||
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
|
||||
java.lang.Integer> flags = org.jetbrains.kotlin.protobuf.GeneratedMessage
|
||||
.newFileScopedGeneratedExtension(
|
||||
java.lang.Integer.class,
|
||||
null);
|
||||
public static final int TYPE_ANNOTATION_FIELD_NUMBER = 100;
|
||||
/**
|
||||
* <code>extend .org.jetbrains.kotlin.metadata.Type { ... }</code>
|
||||
@@ -4743,27 +4726,25 @@ public final class DebugJvmProtoBuf {
|
||||
"perty_signature\022\'.org.jetbrains.kotlin.m" +
|
||||
"etadata.Property\030d \001(\01327.org.jetbrains.k" +
|
||||
"otlin.metadata.jvm.JvmPropertySignature:" +
|
||||
"9\n\005flags\022\'.org.jetbrains.kotlin.metadata" +
|
||||
".Property\030e \001(\005:\0010:g\n\017type_annotation\022#." +
|
||||
"org.jetbrains.kotlin.metadata.Type\030d \003(\013",
|
||||
"2).org.jetbrains.kotlin.metadata.Annotat" +
|
||||
"ion:3\n\006is_raw\022#.org.jetbrains.kotlin.met" +
|
||||
"adata.Type\030e \001(\010:z\n\031type_parameter_annot" +
|
||||
"ation\022,.org.jetbrains.kotlin.metadata.Ty" +
|
||||
"peParameter\030d \003(\0132).org.jetbrains.kotlin" +
|
||||
".metadata.Annotation:E\n\021class_module_nam" +
|
||||
"e\022$.org.jetbrains.kotlin.metadata.Class\030" +
|
||||
"e \001(\005B\004\230\265\030\001:k\n\024class_local_variable\022$.or" +
|
||||
"g.jetbrains.kotlin.metadata.Class\030f \003(\0132" +
|
||||
"\'.org.jetbrains.kotlin.metadata.Property",
|
||||
":P\n\034anonymous_object_origin_name\022$.org.j" +
|
||||
"etbrains.kotlin.metadata.Class\030g \001(\005B\004\230\265" +
|
||||
"\030\001:I\n\023package_module_name\022&.org.jetbrain" +
|
||||
"s.kotlin.metadata.Package\030e \001(\005B\004\230\265\030\001:o\n" +
|
||||
"\026package_local_variable\022&.org.jetbrains." +
|
||||
"kotlin.metadata.Package\030f \003(\0132\'.org.jetb" +
|
||||
"rains.kotlin.metadata.PropertyB\022B\020DebugJ" +
|
||||
"vmProtoBuf"
|
||||
"g\n\017type_annotation\022#.org.jetbrains.kotli" +
|
||||
"n.metadata.Type\030d \003(\0132).org.jetbrains.ko" +
|
||||
"tlin.metadata.Annotation:3\n\006is_raw\022#.org",
|
||||
".jetbrains.kotlin.metadata.Type\030e \001(\010:z\n" +
|
||||
"\031type_parameter_annotation\022,.org.jetbrai" +
|
||||
"ns.kotlin.metadata.TypeParameter\030d \003(\0132)" +
|
||||
".org.jetbrains.kotlin.metadata.Annotatio" +
|
||||
"n:E\n\021class_module_name\022$.org.jetbrains.k" +
|
||||
"otlin.metadata.Class\030e \001(\005B\004\230\265\030\001:k\n\024clas" +
|
||||
"s_local_variable\022$.org.jetbrains.kotlin." +
|
||||
"metadata.Class\030f \003(\0132\'.org.jetbrains.kot" +
|
||||
"lin.metadata.Property:P\n\034anonymous_objec" +
|
||||
"t_origin_name\022$.org.jetbrains.kotlin.met",
|
||||
"adata.Class\030g \001(\005B\004\230\265\030\001:I\n\023package_modul" +
|
||||
"e_name\022&.org.jetbrains.kotlin.metadata.P" +
|
||||
"ackage\030e \001(\005B\004\230\265\030\001:o\n\026package_local_vari" +
|
||||
"able\022&.org.jetbrains.kotlin.metadata.Pac" +
|
||||
"kage\030f \003(\0132\'.org.jetbrains.kotlin.metada" +
|
||||
"ta.PropertyB\022B\020DebugJvmProtoBuf"
|
||||
};
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
@@ -4813,15 +4794,14 @@ public final class DebugJvmProtoBuf {
|
||||
methodSignature.internalInit(descriptor.getExtensions().get(1));
|
||||
lambdaClassOriginName.internalInit(descriptor.getExtensions().get(2));
|
||||
propertySignature.internalInit(descriptor.getExtensions().get(3));
|
||||
flags.internalInit(descriptor.getExtensions().get(4));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(5));
|
||||
isRaw.internalInit(descriptor.getExtensions().get(6));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(7));
|
||||
classModuleName.internalInit(descriptor.getExtensions().get(8));
|
||||
classLocalVariable.internalInit(descriptor.getExtensions().get(9));
|
||||
anonymousObjectOriginName.internalInit(descriptor.getExtensions().get(10));
|
||||
packageModuleName.internalInit(descriptor.getExtensions().get(11));
|
||||
packageLocalVariable.internalInit(descriptor.getExtensions().get(12));
|
||||
typeAnnotation.internalInit(descriptor.getExtensions().get(4));
|
||||
isRaw.internalInit(descriptor.getExtensions().get(5));
|
||||
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(6));
|
||||
classModuleName.internalInit(descriptor.getExtensions().get(7));
|
||||
classLocalVariable.internalInit(descriptor.getExtensions().get(8));
|
||||
anonymousObjectOriginName.internalInit(descriptor.getExtensions().get(9));
|
||||
packageModuleName.internalInit(descriptor.getExtensions().get(10));
|
||||
packageLocalVariable.internalInit(descriptor.getExtensions().get(11));
|
||||
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry =
|
||||
org.jetbrains.kotlin.protobuf.ExtensionRegistry.newInstance();
|
||||
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.stringIdInTable);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
168
build.gradle.kts
168
build.gradle.kts
@@ -5,31 +5,39 @@ 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 proguard.gradle.ProGuardTask
|
||||
|
||||
buildscript {
|
||||
extra["defaultSnapshotVersion"] = "1.3-SNAPSHOT"
|
||||
extra["defaultSnapshotVersion"] = "1.2-SNAPSHOT"
|
||||
|
||||
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.3.0-dev-322", onlySuccessBootstrap = false))
|
||||
kotlinBootstrapFrom(BootstrapOption.TeamCity("1.2.50-dev-310", onlySuccessBootstrap = false))
|
||||
|
||||
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
|
||||
|
||||
val repos = listOfNotNull(
|
||||
mirrorRepo,
|
||||
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
|
||||
"https://dl.bintray.com/jetbrains/markdown" // for org.jetbrains:markdown
|
||||
)
|
||||
|
||||
extra["repos"] = repos
|
||||
|
||||
repositories {
|
||||
bootstrapKotlinRepo?.let(::maven)
|
||||
maven("https://plugins.gradle.org/m2")
|
||||
for (repo in repos) {
|
||||
maven(url = repo)
|
||||
}
|
||||
|
||||
// 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(kotlin("gradle-plugin", bootstrapKotlinVersion))
|
||||
classpath(kotlinDep("gradle-plugin", bootstrapKotlinVersion))
|
||||
classpath("net.sf.proguard:proguard-gradle:5.3.3")
|
||||
}
|
||||
}
|
||||
@@ -40,15 +48,6 @@ plugins {
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
pill {
|
||||
excludedDirs(
|
||||
"out",
|
||||
"buildSrc/build",
|
||||
"buildSrc/prepare-deps/android-dx/build",
|
||||
"buildSrc/prepare-deps/intellij-sdk/build"
|
||||
)
|
||||
}
|
||||
|
||||
buildScan {
|
||||
setTermsOfServiceUrl("https://gradle.com/terms-of-service")
|
||||
setTermsOfServiceAgree("yes")
|
||||
@@ -65,7 +64,7 @@ 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.3")
|
||||
val kotlinLanguageVersion by extra("1.2")
|
||||
|
||||
allprojects {
|
||||
group = "org.jetbrains.kotlin"
|
||||
@@ -74,9 +73,19 @@ 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"))
|
||||
}
|
||||
|
||||
@@ -102,6 +111,15 @@ 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")
|
||||
@@ -110,7 +128,6 @@ 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"
|
||||
@@ -145,19 +162,31 @@ extra["intellijSeparateSdks"] = intellijSeparateSdks
|
||||
extra["IntellijCoreDependencies"] =
|
||||
listOf("annotations",
|
||||
"asm-all",
|
||||
"guava",
|
||||
"guava-21.0",
|
||||
"jdom",
|
||||
"jna",
|
||||
"log4j",
|
||||
"picocontainer",
|
||||
"snappy-in-java",
|
||||
"snappy-in-java-0.5.1",
|
||||
"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:psi",
|
||||
@@ -169,7 +198,6 @@ extra["compilerModules"] = arrayOf(
|
||||
":compiler:daemon",
|
||||
":compiler:ir.tree",
|
||||
":compiler:ir.psi2ir",
|
||||
":compiler:ir.backend.common",
|
||||
":compiler:backend.js",
|
||||
":compiler:backend-common",
|
||||
":compiler:backend",
|
||||
@@ -204,7 +232,6 @@ val coreLibProjects = listOf(
|
||||
":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"
|
||||
@@ -235,6 +262,11 @@ apply {
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.allprojectsRecursive(body: Project.() -> Unit) {
|
||||
this.body()
|
||||
this.subprojects { allprojectsRecursive(body) }
|
||||
}
|
||||
|
||||
fun Task.listConfigurationContents(configName: String) {
|
||||
doFirst {
|
||||
project.configurations.findByName(configName)?.let {
|
||||
@@ -258,24 +290,19 @@ allprojects {
|
||||
// therefore it is disabled by default
|
||||
// buildDir = File(commonBuildDir, project.name)
|
||||
|
||||
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
|
||||
|
||||
val repos: List<String> by rootProject.extra
|
||||
repositories {
|
||||
intellijSdkRepo(project)
|
||||
androidDxJarRepo(project)
|
||||
mirrorRepo?.let(::maven)
|
||||
bootstrapKotlinRepo?.let(::maven)
|
||||
jcenter()
|
||||
|
||||
for (repo in repos) {
|
||||
maven(repo)
|
||||
}
|
||||
}
|
||||
|
||||
configureJvmProject(javaHome!!, jvmTarget!!)
|
||||
|
||||
val commonCompilerArgs = listOfNotNull(
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xread-deserialized-contracts",
|
||||
"-Xprogressive".takeIf { hasProperty("test.progressive.mode") }, // TODO: change to "-progressive" after bootstrap
|
||||
"-XXLanguage:-ReleaseCoroutines"
|
||||
)
|
||||
val commonCompilerArgs = listOf("-Xallow-kotlin-package", "-Xread-deserialized-contracts")
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
kotlinOptions {
|
||||
@@ -324,40 +351,12 @@ allprojects {
|
||||
fun FileCollection.printClassPath(role: String) =
|
||||
println("${project.path} $role classpath:\n ${joinToString("\n ") { it.toProjectRootRelativePathOrSelf() } }")
|
||||
|
||||
try { javaPluginConvention() } catch (_: UnknownDomainObjectException) { null }?.let { javaConvention ->
|
||||
try { the<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))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,6 +389,7 @@ tasks {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: copied from TeamCityBuild.xml (with ultimate-related modification), consider removing after migrating from it
|
||||
"cleanupArtifacts" {
|
||||
doLast {
|
||||
delete(ideaPluginDir)
|
||||
@@ -402,7 +402,6 @@ tasks {
|
||||
(coreLibProjects + listOf(
|
||||
":kotlin-stdlib:samples",
|
||||
":kotlin-test:kotlin-test-js:kotlin-test-js-it",
|
||||
":kotlinx-metadata-jvm",
|
||||
":tools:binary-compatibility-validator"
|
||||
)).forEach {
|
||||
dependsOn(it + ":check")
|
||||
@@ -445,10 +444,6 @@ tasks {
|
||||
dependsOn(":compiler:incremental-compilation-impl:test")
|
||||
}
|
||||
|
||||
"toolsTest" {
|
||||
dependsOn(":tools:kotlinp:test")
|
||||
}
|
||||
|
||||
"examplesTest" {
|
||||
dependsOn("dist")
|
||||
(project(":examples").subprojects + project(":kotlin-gradle-subplugin-example")).forEach { p ->
|
||||
@@ -458,16 +453,10 @@ tasks {
|
||||
|
||||
"distTest" {
|
||||
dependsOn("compilerTest")
|
||||
dependsOn("toolsTest")
|
||||
dependsOn("gradlePluginTest")
|
||||
dependsOn("examplesTest")
|
||||
}
|
||||
|
||||
"specTest" {
|
||||
dependsOn("dist")
|
||||
dependsOn(":compiler:tests-spec:test")
|
||||
}
|
||||
|
||||
"androidCodegenTest" {
|
||||
dependsOn(":compiler:android-tests:test")
|
||||
}
|
||||
@@ -559,8 +548,6 @@ 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")
|
||||
}
|
||||
@@ -593,26 +580,13 @@ val zipPlugin by task<Zip> {
|
||||
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(ideaPluginDir) { exclude("lib/kotlin-plugin.jar") }
|
||||
from(cidrKotlinPlugin) { into("lib") }
|
||||
}
|
||||
|
||||
val zipCidrPlugin by task<Zip> {
|
||||
val destPath = project.findProperty("pluginZipPath") as String?
|
||||
?: "$distDir/artifacts/kotlin-plugin-$kotlinVersion-CIDR.zip"
|
||||
?: "$distDir/artifacts/kotlin-plugin-$kotlinVersion-CIDR"
|
||||
val destFile = File(destPath)
|
||||
|
||||
destinationDir = destFile.parentFile
|
||||
@@ -678,7 +652,7 @@ tasks.create("findShadowJarsInClasspath").doLast {
|
||||
for (task in project.tasks) {
|
||||
when (task) {
|
||||
is ShadowJar -> {
|
||||
shadowJars.add(fileFrom(task.archivePath))
|
||||
shadowJars.add(File(task.archivePath))
|
||||
}
|
||||
is ProGuardTask -> {
|
||||
shadowJars.addAll(task.outputs.files.toList())
|
||||
|
||||
@@ -33,9 +33,9 @@ plugins {
|
||||
|
||||
gradlePlugin {
|
||||
(plugins) {
|
||||
"pill-configurable" {
|
||||
id = "pill-configurable"
|
||||
implementationClass = "org.jetbrains.kotlin.pill.PillConfigurablePlugin"
|
||||
"jps-compatible-base" {
|
||||
id = "jps-compatible-base"
|
||||
implementationClass = "org.jetbrains.kotlin.pill.JpsCompatibleBasePlugin"
|
||||
}
|
||||
"jps-compatible" {
|
||||
id = "jps-compatible"
|
||||
@@ -59,12 +59,7 @@ 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"] = if (extra["versions.intellijSdk"]?.toString()?.endsWith("SNAPSHOT") == true)
|
||||
"snapshots"
|
||||
else
|
||||
"releases"
|
||||
|
||||
extra["intellijReleaseType"] = "releases" // or "snapshots"
|
||||
extra["versions.androidDxSources"] = "5.0.0_r2"
|
||||
|
||||
extra["customDepsOrg"] = "kotlin.build.custom.deps"
|
||||
@@ -73,7 +68,7 @@ repositories {
|
||||
extra["buildSrcKotlinRepo"]?.let {
|
||||
maven(url = it)
|
||||
}
|
||||
maven(url = "https://repo.gradle.org/gradle/ext-releases-local") // for native-platform
|
||||
maven(url = "https://repo.gradle.org/gradle/libs-releases-local") // for native-platform
|
||||
jcenter()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
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
|
||||
@@ -1,9 +0,0 @@
|
||||
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
|
||||
@@ -1,9 +0,0 @@
|
||||
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
|
||||
@@ -26,9 +26,6 @@ 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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,8 @@ 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)
|
||||
val platformBaseVersion = intellijVersion.substringBefore('.', "").takeIf { it.isNotEmpty() }
|
||||
?: error("Invalid IDEA version $intellijVersion")
|
||||
|
||||
logger.info("intellijUltimateEnabled: $intellijUltimateEnabled")
|
||||
|
||||
@@ -61,18 +57,19 @@ 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") }
|
||||
maven { setUrl("https://plugins.jetbrains.com/maven") }
|
||||
ivy {
|
||||
artifactPattern("https://raw.github.com/JetBrains/intellij-community/[revision]/lib/src/[artifact].zip")
|
||||
}
|
||||
}
|
||||
|
||||
val intellij by configurations.creating
|
||||
val intellijUltimate by configurations.creating
|
||||
val sources by configurations.creating
|
||||
val `asm-shaded-sources` by configurations.creating
|
||||
val `jps-standalone` by configurations.creating
|
||||
val `jps-build-test` by configurations.creating
|
||||
val `intellij-core` by configurations.creating
|
||||
@@ -96,6 +93,7 @@ dependencies {
|
||||
}
|
||||
}
|
||||
sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar")
|
||||
`asm-shaded-sources`("asmsources:asm-src:$platformBaseVersion@zip")
|
||||
`jps-standalone`("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion")
|
||||
`jps-build-test`("com.jetbrains.intellij.idea:jps-build-test:$intellijVersion")
|
||||
`intellij-core`("com.jetbrains.intellij.idea:intellij-core:$intellijVersion")
|
||||
@@ -152,7 +150,14 @@ val unzipIntellijCore by tasks.creating { configureExtractFromConfigurationTask(
|
||||
|
||||
val unzipJpsStandalone by tasks.creating { configureExtractFromConfigurationTask(`jps-standalone`) { zipTree(it.singleFile) } }
|
||||
|
||||
val copyAsmShadedSources by tasks.creating(Copy::class.java) {
|
||||
from(`asm-shaded-sources`)
|
||||
rename(".zip", ".jar")
|
||||
destinationDir = File(repoDir, `asm-shaded-sources`.name)
|
||||
}
|
||||
|
||||
val copyIntellijSdkSources by tasks.creating(ShadowJar::class.java) {
|
||||
from(copyAsmShadedSources)
|
||||
from(sources)
|
||||
baseName = "ideaIC"
|
||||
version = intellijVersion
|
||||
@@ -183,7 +188,7 @@ fun writeIvyXml(moduleName: String, fileName: String, jarFiles: FileCollection,
|
||||
}
|
||||
|
||||
val prepareIvyXmls by tasks.creating {
|
||||
dependsOn(unzipIntellijCore, unzipJpsStandalone, copyIntellijSdkSources, copyJpsBuildTest)
|
||||
dependsOn(unzipIntellijCore, unzipJpsStandalone, copyIntellijSdkSources, copyJpsBuildTest, copyAsmShadedSources)
|
||||
|
||||
val intellijSdkDir = File(repoDir, intellij.name)
|
||||
val intellijUltimateSdkDir = File(repoDir, intellijUltimate.name)
|
||||
@@ -200,7 +205,7 @@ val prepareIvyXmls by tasks.creating {
|
||||
outputs.file(File(repoDir, "${intellijUltimate.name}.ivy.xml"))
|
||||
}
|
||||
|
||||
val flatDeps = listOf(`intellij-core`, `jps-standalone`, `jps-build-test`)
|
||||
val flatDeps = listOf(`intellij-core`, `jps-standalone`, `jps-build-test`, `asm-shaded-sources`)
|
||||
flatDeps.forEach {
|
||||
inputs.dir(File(repoDir, it.name))
|
||||
outputs.file(File(repoDir, "${it.name}.ivy.xml"))
|
||||
|
||||
@@ -1,267 +0,0 @@
|
||||
|
||||
@file:Suppress("PropertyName")
|
||||
|
||||
import org.gradle.api.publish.ivy.internal.artifact.DefaultIvyArtifact
|
||||
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
|
||||
val intellijReleaseType: String by rootProject.extra
|
||||
val intellijVersion = rootProject.extra["versions.intellijSdk"] as String
|
||||
val androidStudioRelease = rootProject.findProperty("versions.androidStudioRelease") as String?
|
||||
val androidStudioBuild = rootProject.findProperty("versions.androidStudioBuild") as String?
|
||||
val intellijSeparateSdks: Boolean by rootProject.extra
|
||||
val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks
|
||||
val installIntellijUltimate = intellijUltimateEnabled
|
||||
|
||||
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")
|
||||
logger.info("androidStudioRelease: $androidStudioRelease")
|
||||
logger.info("androidStudioBuild: $androidStudioBuild")
|
||||
|
||||
logger.info("intellijSeparateSdks: $intellijSeparateSdks")
|
||||
logger.info("installIntellijCommunity: $installIntellijCommunity")
|
||||
logger.info("installIntellijUltimate: $installIntellijUltimate")
|
||||
|
||||
val studioOs by lazy {
|
||||
when {
|
||||
OperatingSystem.current().isWindows -> "windows"
|
||||
OperatingSystem.current().isMacOsX -> "mac"
|
||||
OperatingSystem.current().isLinux -> "linux"
|
||||
else -> {
|
||||
logger.error("Unknown operating system for android tools: ${OperatingSystem.current().name}")
|
||||
""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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") }
|
||||
maven { setUrl("https://plugins.jetbrains.com/maven") }
|
||||
}
|
||||
|
||||
val intellij by configurations.creating
|
||||
val intellijUltimate by configurations.creating
|
||||
val sources by configurations.creating
|
||||
val `jps-standalone` by configurations.creating
|
||||
val `jps-build-test` by configurations.creating
|
||||
val `intellij-core` by configurations.creating
|
||||
val `plugins-NodeJS` by configurations.creating
|
||||
|
||||
val customDepsRepoDir = File(buildDir, "repo")
|
||||
val customDepsOrg: String by rootProject.extra
|
||||
val customDepsRevision = intellijVersion
|
||||
val customDepsRepoModulesDir = File(customDepsRepoDir, "$customDepsOrg/$customDepsRevision")
|
||||
val repoDir = customDepsRepoModulesDir
|
||||
|
||||
dependencies {
|
||||
if (androidStudioRelease != null) {
|
||||
intellij("google:android-studio-ide:$androidStudioBuild")
|
||||
} else {
|
||||
if (installIntellijCommunity) {
|
||||
intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion")
|
||||
}
|
||||
if (installIntellijUltimate) {
|
||||
intellijUltimate("com.jetbrains.intellij.idea:ideaIU:$intellijVersion")
|
||||
}
|
||||
}
|
||||
sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar")
|
||||
`jps-standalone`("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion")
|
||||
`jps-build-test`("com.jetbrains.intellij.idea:jps-build-test:$intellijVersion")
|
||||
`intellij-core`("com.jetbrains.intellij.idea:intellij-core:$intellijVersion")
|
||||
if (intellijUltimateEnabled) {
|
||||
`plugins-NodeJS`("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip")
|
||||
}
|
||||
}
|
||||
|
||||
fun Task.configureExtractFromConfigurationTask(sourceConfig: Configuration,
|
||||
pathRemap: (String) -> String = { it },
|
||||
extractor: (Configuration) -> Any) {
|
||||
dependsOn(sourceConfig)
|
||||
inputs.files(sourceConfig)
|
||||
val targetDir = File(repoDir, sourceConfig.name)
|
||||
outputs.dirs(targetDir)
|
||||
doFirst {
|
||||
project.copy {
|
||||
from(extractor(sourceConfig))
|
||||
into(targetDir)
|
||||
eachFile {
|
||||
path = pathRemap(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun removePathPrefix(path: String): String {
|
||||
if (androidStudioRelease == null) return path
|
||||
val slashes = if (studioOs == "mac") 2 else 1
|
||||
var result = path
|
||||
repeat(slashes) {
|
||||
result = result.substringAfter('/')
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
val unzipIntellijSdk by tasks.creating {
|
||||
configureExtractFromConfigurationTask(intellij, pathRemap = { removePathPrefix(it) }) {
|
||||
zipTree(it.singleFile).matching {
|
||||
exclude("**/plugins/Kotlin/**")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val unzipIntellijUltimateSdk by tasks.creating {
|
||||
configureExtractFromConfigurationTask(intellijUltimate) {
|
||||
zipTree(it.singleFile).matching {
|
||||
exclude("plugins/Kotlin/**")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val unzipIntellijCore by tasks.creating { configureExtractFromConfigurationTask(`intellij-core`) { zipTree(it.singleFile) } }
|
||||
|
||||
val unzipJpsStandalone by tasks.creating { configureExtractFromConfigurationTask(`jps-standalone`) { zipTree(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 } }
|
||||
|
||||
val unzipNodeJSPlugin by tasks.creating { configureExtractFromConfigurationTask(`plugins-NodeJS`) { zipTree(it.singleFile) } }
|
||||
|
||||
fun writeIvyXml(moduleName: String, fileName: String, jarFiles: FileCollection, baseDir: File, sourcesJar: File?) {
|
||||
with(IvyDescriptorFileGenerator(DefaultIvyPublicationIdentity(customDepsOrg, moduleName, intellijVersion))) {
|
||||
addConfiguration(DefaultIvyConfiguration("default"))
|
||||
addConfiguration(DefaultIvyConfiguration("sources"))
|
||||
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" })
|
||||
}
|
||||
}
|
||||
if (sourcesJar != null) {
|
||||
val sourcesArtifactName = sourcesJar.name.removeSuffix(".jar").substringBefore("-")
|
||||
addArtifact(DefaultIvyArtifact(sourcesJar, sourcesArtifactName, "jar", "sources", "sources").also { it.conf = "sources" })
|
||||
}
|
||||
writeTo(File(customDepsRepoModulesDir, "$fileName.ivy.xml"))
|
||||
}
|
||||
}
|
||||
|
||||
val prepareIvyXmls by tasks.creating {
|
||||
dependsOn(unzipIntellijCore, unzipJpsStandalone, copyIntellijSdkSources, copyJpsBuildTest)
|
||||
|
||||
val intellijSdkDir = File(repoDir, intellij.name)
|
||||
val intellijUltimateSdkDir = File(repoDir, intellijUltimate.name)
|
||||
|
||||
if (installIntellijCommunity) {
|
||||
dependsOn(unzipIntellijSdk)
|
||||
inputs.dir(intellijSdkDir)
|
||||
outputs.file(File(repoDir, "${intellij.name}.ivy.xml"))
|
||||
}
|
||||
|
||||
if (installIntellijUltimate) {
|
||||
dependsOn(unzipIntellijUltimateSdk)
|
||||
inputs.dir(intellijUltimateSdkDir)
|
||||
outputs.file(File(repoDir, "${intellijUltimate.name}.ivy.xml"))
|
||||
}
|
||||
|
||||
val flatDeps = listOf(`intellij-core`, `jps-standalone`, `jps-build-test`)
|
||||
flatDeps.forEach {
|
||||
inputs.dir(File(repoDir, it.name))
|
||||
outputs.file(File(repoDir, "${it.name}.ivy.xml"))
|
||||
}
|
||||
inputs.dir(File(repoDir, sources.name))
|
||||
|
||||
if (intellijUltimateEnabled) {
|
||||
dependsOn(unzipNodeJSPlugin)
|
||||
inputs.dir(File(repoDir, `plugins-NodeJS`.name))
|
||||
outputs.file(File(repoDir, "${`plugins-NodeJS`.name}.ivy.xml"))
|
||||
}
|
||||
|
||||
doFirst {
|
||||
val sourcesFile = if (sources.isEmpty) null else File(repoDir, "${sources.name}/${sources.singleFile.name}")
|
||||
|
||||
if (installIntellijCommunity) {
|
||||
val libDir = File(intellijSdkDir, "lib")
|
||||
writeIvyXml(intellij.name,
|
||||
intellij.name,
|
||||
fileTree(libDir).filter {
|
||||
it.parentFile == libDir && !it.name.startsWith("kotlin-")
|
||||
},
|
||||
libDir,
|
||||
sourcesFile)
|
||||
|
||||
File(intellijSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
|
||||
writeIvyXml(it.name, "intellij.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile)
|
||||
}
|
||||
}
|
||||
|
||||
if (installIntellijUltimate) {
|
||||
val libDir = File(intellijUltimateSdkDir, "lib")
|
||||
writeIvyXml(intellij.name, // important! the module name should be "intellij"
|
||||
intellijUltimate.name,
|
||||
fileTree(libDir).filter {
|
||||
it.parentFile == libDir && !it.name.startsWith("kotlin-")
|
||||
},
|
||||
libDir,
|
||||
sourcesFile)
|
||||
|
||||
File(intellijUltimateSdkDir, "plugins").listFiles { it: File -> it.isDirectory }.forEach {
|
||||
writeIvyXml(it.name, "intellijUltimate.plugin.${it.name}", files("$it/lib/"), File(it, "lib"), sourcesFile)
|
||||
}
|
||||
}
|
||||
|
||||
flatDeps.forEach {
|
||||
writeIvyXml(it.name, it.name, files("$repoDir/${it.name}"), File(repoDir, it.name), sourcesFile)
|
||||
}
|
||||
|
||||
if (intellijUltimateEnabled) {
|
||||
val nodeJsBaseDir = "${`plugins-NodeJS`.name}/NodeJS/lib"
|
||||
writeIvyXml("NodeJS", `plugins-NodeJS`.name, files("$repoDir/$nodeJsBaseDir"), File(repoDir, nodeJsBaseDir), sourcesFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val build by tasks.creating {
|
||||
dependsOn(prepareIvyXmls)
|
||||
}
|
||||
|
||||
val clean by tasks.creating(Delete::class) {
|
||||
delete(customDepsRepoModulesDir)
|
||||
delete(buildDir)
|
||||
}
|
||||
@@ -4,7 +4,6 @@ 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")
|
||||
|
||||
@@ -15,12 +15,11 @@ 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, teamCityBuild, projectExtId = teamCityProject, onlySuccessBootstrap = false)
|
||||
teamCityVersion != null -> BootstrapOption.TeamCity(teamCityVersion, projectExtId = teamCityProject, onlySuccessBootstrap = false)
|
||||
customVersion != null -> BootstrapOption.Custom(kotlinVersion = customVersion, repo = customRepo)
|
||||
else -> defaultSource
|
||||
}
|
||||
@@ -48,15 +47,14 @@ sealed class BootstrapOption {
|
||||
|
||||
/** Get bootstrap from teamcity maven artifacts of the specified build configuration
|
||||
*
|
||||
* [kotlinVersion] the version of maven artifacts
|
||||
* [buildNumber] build number of a teamcity build, by default the same as [kotlinVersion],
|
||||
* [kotlinVersion] build number and the version of maven artifacts
|
||||
* [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 buildNumber: String? = null, val projectExtId: String? = null, val onlySuccessBootstrap: Boolean = true) : BootstrapOption() {
|
||||
class TeamCity(val kotlinVersion: String, 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:${buildNumber ?: kotlinVersion},$query/artifacts/content/maven/"
|
||||
project.bootstrapKotlinRepo = "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:${projectExtId ?: "Kotlin_dev_Compiler"}),number:$kotlinVersion,$query/artifacts/content/maven/"
|
||||
project.bootstrapKotlinVersion = kotlinVersion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// usages in build scripts are not tracked properly
|
||||
@file:Suppress("unused")
|
||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
||||
|
||||
import groovy.lang.Closure
|
||||
import org.gradle.api.Project
|
||||
@@ -7,11 +6,11 @@ import org.gradle.api.Task
|
||||
import org.gradle.api.file.CopySourceSpec
|
||||
import org.gradle.api.file.SourceDirectorySet
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.api.tasks.JavaExec
|
||||
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
|
||||
@@ -22,7 +21,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()
|
||||
@@ -30,30 +29,31 @@ inline fun <T : Any> Project.withJavaPlugin(crossinline body: () -> T?): T? {
|
||||
return res
|
||||
}
|
||||
|
||||
fun Project.getCompiledClasses(): SourceSetOutput? = withJavaPlugin { mainSourceSet.output }
|
||||
fun Project.getCompiledClasses(): SourceSetOutput? = withJavaPlugin {
|
||||
the<JavaPluginConvention>().sourceSets.getByName("main").output
|
||||
}
|
||||
|
||||
fun Project.getSources(): SourceDirectorySet? = withJavaPlugin { mainSourceSet.allSource }
|
||||
fun Project.getSources(): SourceDirectorySet? = withJavaPlugin {
|
||||
the<JavaPluginConvention>().sourceSets.getByName("main").allSource
|
||||
}
|
||||
|
||||
fun Project.getResourceFiles(): SourceDirectorySet? = withJavaPlugin { mainSourceSet.resources }
|
||||
fun Project.getResourceFiles(): SourceDirectorySet? = withJavaPlugin {
|
||||
the<JavaPluginConvention>().sourceSets.getByName("main").resources
|
||||
}
|
||||
|
||||
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) }
|
||||
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) })
|
||||
|
||||
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, sourceSet: SourceSet? = null) = smartJavaExec {
|
||||
classpath = (sourceSet ?: testSourceSet).runtimeClasspath
|
||||
fun Project.generator(fqName: String) = task<JavaExec> {
|
||||
classpath = the<JavaPluginConvention>().sourceSets["test"].runtimeClasspath
|
||||
main = fqName
|
||||
workingDir = rootDir
|
||||
}
|
||||
@@ -65,5 +65,3 @@ fun Project.getBooleanProperty(name: String): Boolean? = this.findProperty(name)
|
||||
}
|
||||
|
||||
inline fun CopySourceSpec.from(crossinline filesProvider: () -> Any?): CopySourceSpec = from(Callable { filesProvider() })
|
||||
|
||||
fun Project.javaPluginConvention(): JavaPluginConvention = the()
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
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)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ fun Project.classesDirsArtifact(): FileCollection {
|
||||
|
||||
val classesDirsCfg = configurations.getOrCreate("classes-dirs")
|
||||
|
||||
val classesDirs = mainSourceSet.output.classesDirs
|
||||
val classesDirs = the<JavaPluginConvention>().sourceSets["main"].output.classesDirs
|
||||
|
||||
val classesTask = tasks["classes"]
|
||||
|
||||
@@ -44,7 +44,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(testSourceSet.output)
|
||||
from(project.the<JavaPluginConvention>().sourceSets.getByName("test").output)
|
||||
}
|
||||
classifier = "tests"
|
||||
body()
|
||||
@@ -55,22 +55,15 @@ fun Project.testsJar(body: Jar.() -> Unit = {}): Jar {
|
||||
fun Project.noDefaultJar() {
|
||||
tasks.findByName("jar")?.let { defaultJarTask ->
|
||||
defaultJarTask.enabled = false
|
||||
defaultJarTask.actions = emptyList()
|
||||
configurations.forEach { cfg ->
|
||||
cfg.artifacts.removeAll {
|
||||
(it as? ArchivePublishArtifact)?.archiveTask?.let { it == defaultJarTask } ?: false
|
||||
}
|
||||
configurations.findByName("archives")?.artifacts?.removeAll {
|
||||
(it as? ArchivePublishArtifact)?.archiveTask?.let { it == defaultJarTask } ?: false
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun<T> Project.runtimeJarArtifactBy(task: Task, artifactRef: T, 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 {
|
||||
@@ -79,7 +72,7 @@ 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(project.the<BasePluginConvention>().archivesBaseName)
|
||||
setupPublicJar()
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
body()
|
||||
project.runtimeJarArtifactBy(this, this)
|
||||
@@ -95,7 +88,7 @@ fun Project.sourcesJar(sourceSet: String? = "main", body: Jar.() -> Unit = {}):
|
||||
try {
|
||||
if (sourceSet != null) {
|
||||
project.pluginManager.withPlugin("java-base") {
|
||||
from(project.javaPluginConvention().sourceSets[sourceSet].allSource)
|
||||
from(project.the<JavaPluginConvention>().sourceSets[sourceSet].allSource)
|
||||
}
|
||||
}
|
||||
} catch (e: UnknownDomainObjectException) {
|
||||
@@ -188,15 +181,12 @@ private fun Project.runtimeJarTaskIfExists(): Task? =
|
||||
|
||||
fun ConfigurationContainer.getOrCreate(name: String): Configuration = findByName(name) ?: create(name)
|
||||
|
||||
fun Jar.setupPublicJar(baseName: String, classifier: String = "") {
|
||||
val buildNumber = project.rootProject.extra["buildNumber"] as String
|
||||
this.baseName = baseName
|
||||
this.version = buildNumber
|
||||
fun Jar.setupPublicJar(classifier: String = "") {
|
||||
this.classifier = classifier
|
||||
manifest.attributes.apply {
|
||||
put("Implementation-Vendor", "JetBrains")
|
||||
put("Implementation-Title", baseName)
|
||||
put("Implementation-Version", buildNumber)
|
||||
put("Implementation-Title", project.the<BasePluginConvention>().archivesBaseName)
|
||||
put("Implementation-Version", project.rootProject.extra["buildNumber"])
|
||||
put("Build-Jdk", System.getProperty("java.version"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,15 +50,14 @@ fun Project.preloadedDeps(vararg artifactBaseNames: String, baseDir: File = File
|
||||
}
|
||||
|
||||
fun Project.ideaUltimatePreloadedDeps(vararg artifactBaseNames: String, subdir: String? = null): ConfigurableFileCollection {
|
||||
val ultimateDepsDir = fileFrom(rootDir, "ultimate", "dependencies")
|
||||
val ultimateDepsDir = File(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"
|
||||
|
||||
@Deprecated("Depend on the default configuration instead", ReplaceWith("project(name)"))
|
||||
fun DependencyHandler.projectDist(name: String): ProjectDependency = project(name)
|
||||
fun DependencyHandler.projectDist(name: String): ProjectDependency = project(name, configuration = "distJar").apply { isTransitive = false }
|
||||
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")
|
||||
@@ -113,14 +112,6 @@ fun AbstractCopyTask.fromEmbeddedComponents() {
|
||||
if (this is ShadowJar) {
|
||||
from(embeddedComponents)
|
||||
} else {
|
||||
dependsOn(embeddedComponents)
|
||||
from {
|
||||
embeddedComponents.map { file ->
|
||||
if (file.isDirectory)
|
||||
project.files(file)
|
||||
else
|
||||
project.zipTree(file)
|
||||
}
|
||||
}
|
||||
embeddedComponents.forEach { from(if (it.isDirectory) it else project.zipTree(it)) }
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ 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"
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ 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")))
|
||||
@@ -54,11 +55,11 @@ fun Project.configureInstrumentation() {
|
||||
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
|
||||
|
||||
dependencies {
|
||||
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all") }
|
||||
instrumentationClasspathCfg(intellijDep()) { includeJars("javac2", "jdom", "asm-all", "jgoodies-forms") }
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
sourceSets.all { sourceSetParam ->
|
||||
the<JavaPluginConvention>().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>
|
||||
|
||||
@@ -149,7 +150,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.mainSourceSet.allSource.sourceDirectories }
|
||||
.map { p -> p.dependencyProject.the<JavaPluginConvention>().sourceSets.getByName("main").allSource.sourceDirectories }
|
||||
val instrumentationClasspath =
|
||||
depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
|
||||
logger.info("Using following dependency source dirs: $it")
|
||||
|
||||
@@ -1,180 +0,0 @@
|
||||
@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
|
||||
var output: File? = null
|
||||
|
||||
@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")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,17 +43,12 @@ fun RepositoryHandler.intellijSdkRepo(project: Project): IvyArtifactRepository =
|
||||
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module].ivy.xml")
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij.plugin.[module].ivy.xml")
|
||||
ivyPattern("${baseDir.canonicalPath}/[organisation]/[revision]/plugins-[module].ivy.xml")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/lib/[artifact](-[classifier]).jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/intellij/plugins/[module]/lib/[artifact](-[classifier]).jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/plugins-[module]/[module]/lib/[artifact](-[classifier]).jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/[artifact].jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/[module]/[artifact](-[revision])(-[classifier]).jar")
|
||||
artifactPattern("${baseDir.canonicalPath}/[organisation]/[revision]/sources/[artifact]-[revision]-[classifier].[ext]")
|
||||
|
||||
metadataSources {
|
||||
ivyDescriptor()
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.intellijDep(module: String = "intellij") = "kotlin.build.custom.deps:$module:${rootProject.extra["versions.intellijSdk"]}"
|
||||
@@ -123,7 +118,7 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
|
||||
return task<JavaExec>(name) {
|
||||
val ideaSandboxConfigDir = File(ideaSandboxDir, "config")
|
||||
|
||||
classpath = mainSourceSet.runtimeClasspath
|
||||
classpath = the<JavaPluginConvention>().sourceSets["main"].runtimeClasspath
|
||||
|
||||
main = "com.intellij.idea.Main"
|
||||
|
||||
@@ -141,7 +136,9 @@ fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File,
|
||||
"-Dapple.laf.useScreenMenuBar=true",
|
||||
"-Dapple.awt.graphics.UseQuartz=true",
|
||||
"-Dsun.io.useCanonCaches=false",
|
||||
"-Dplugin.path=${ideaPluginDir.absolutePath}"
|
||||
"-Dplugin.path=${ideaPluginDir.absolutePath}",
|
||||
"-Dkotlin.internal.mode.enabled=true",
|
||||
"-Didea.additional.classpath=../idea-kotlin-runtime/kotlin-runtime.jar,../idea-kotlin-runtime/kotlin-reflect.jar"
|
||||
)
|
||||
|
||||
if (rootProject.findProperty("versions.androidStudioRelease") != null) {
|
||||
|
||||
@@ -133,7 +133,7 @@ fun MutableCollection<JdkId>.discoverJdksOnUnix(project: Project) {
|
||||
val installedJdks = File(loc).listFiles { dir ->
|
||||
dir.isDirectory &&
|
||||
unixConventionalJdkDirRex.containsMatchIn(dir.name) &&
|
||||
fileFrom(dir, "bin", "java").isFile
|
||||
File(dir, "bin", "java").isFile
|
||||
} ?: continue
|
||||
for (dir in installedJdks) {
|
||||
val versionMatch = javaVersionRegex.find(dir.name)
|
||||
@@ -172,7 +172,7 @@ fun MutableCollection<JdkId>.discoverJdksOnWindows(project: Project) {
|
||||
else {
|
||||
javaHome.takeIf { it.isNotEmpty() }
|
||||
?.let { File(it) }
|
||||
?.takeIf { it.isDirectory && fileFrom(it, "bin", "java.exe").isFile }
|
||||
?.takeIf { it.isDirectory && File(it, "bin", "java.exe").isFile }
|
||||
?.let {
|
||||
addIfBetter(project, versionMatch.value, jdkKey, it)
|
||||
}
|
||||
|
||||
@@ -4,27 +4,12 @@ package org.jetbrains.kotlin.pill
|
||||
import org.gradle.api.artifacts.*
|
||||
|
||||
class DependencyMapper(
|
||||
val predicate: (ResolvedDependency) -> Boolean,
|
||||
val group: String,
|
||||
val module: String,
|
||||
vararg val configurations: String,
|
||||
val mapping: (ResolvedDependency) -> MappedDependency?
|
||||
) {
|
||||
constructor(
|
||||
group: String,
|
||||
module: String,
|
||||
vararg configurations: String,
|
||||
version: String? = null,
|
||||
mapping: (ResolvedDependency) -> MappedDependency?
|
||||
) : this(
|
||||
{ dep ->
|
||||
dep.moduleGroup == group
|
||||
&& dep.moduleName == module
|
||||
&& (version == null || dep.moduleVersion == version)
|
||||
},
|
||||
configurations = *configurations,
|
||||
mapping = mapping
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
class MappedDependency(val main: PDependency?, val deferred: List<PDependency> = emptyList())
|
||||
class MappedDependency(val main: PDependency, val deferred: List<PDependency> = emptyList())
|
||||
|
||||
class ParserContext(val dependencyMappers: List<DependencyMapper>, val variant: PillExtension.Variant)
|
||||
class ParserContext(val dependencyMappers: List<DependencyMapper>)
|
||||
@@ -1,39 +0,0 @@
|
||||
@file:Suppress("PackageDirectoryMismatch")
|
||||
package org.jetbrains.kotlin.pill
|
||||
|
||||
import java.io.File
|
||||
import org.gradle.api.Project
|
||||
|
||||
open class PillExtension {
|
||||
enum class Variant {
|
||||
// Default variant (./gradlew pill)
|
||||
BASE() { override val includes = setOf(BASE) },
|
||||
|
||||
// Full variant (./gradlew pill -Dpill.variant=full)
|
||||
FULL() { override val includes = setOf(BASE, FULL) },
|
||||
|
||||
// Do not import the project to JPS model, but set some options for it
|
||||
NONE() { override val includes = emptySet<Variant>() },
|
||||
|
||||
// 'BASE' if the "jps-compatible" plugin is applied, 'NONE' otherwise
|
||||
DEFAULT() { override val includes = emptySet<Variant>() };
|
||||
|
||||
abstract val includes: Set<Variant>
|
||||
}
|
||||
|
||||
open var variant: Variant = Variant.DEFAULT
|
||||
|
||||
open var importAsLibrary: Boolean = false
|
||||
|
||||
open var excludedDirs: List<File> = emptyList()
|
||||
|
||||
fun Project.excludedDirs(vararg dirs: String) {
|
||||
excludedDirs = excludedDirs + dirs.map { File(projectDir, it) }
|
||||
}
|
||||
|
||||
open var libraryPath: File? = null
|
||||
set(v) {
|
||||
importAsLibrary = true
|
||||
field = v
|
||||
}
|
||||
}
|
||||
@@ -77,15 +77,8 @@ sealed class ArtifactElement {
|
||||
override fun render(context: PathContext) = xml("element", "id" to "module-output", "name" to moduleName)
|
||||
}
|
||||
|
||||
data class FileCopy(val source: File, val outputFileName: String? = null) : ArtifactElement() {
|
||||
override fun render(context: PathContext): xml {
|
||||
val args = mutableListOf("id" to "file-copy", "path" to context(source))
|
||||
if (outputFileName != null) {
|
||||
args += "output-file-name" to outputFileName
|
||||
}
|
||||
|
||||
return xml("element", *args.toTypedArray())
|
||||
}
|
||||
data class FileCopy(val source: File) : ArtifactElement() {
|
||||
override fun render(context: PathContext) = xml("element", "id" to "file-copy", "path" to context(source))
|
||||
}
|
||||
|
||||
data class DirectoryCopy(val source: File) : ArtifactElement() {
|
||||
@@ -145,15 +138,6 @@ fun generateKotlinPluginArtifactFile(rootProject: Project): PFile {
|
||||
}
|
||||
}
|
||||
|
||||
fun fileCopySnapshotAware(file: File): FileCopy {
|
||||
val SHAPSHOT_JAR_SUFFIX = "-SNAPSHOT.jar"
|
||||
if (file.name.endsWith(SHAPSHOT_JAR_SUFFIX)) {
|
||||
return FileCopy(file, file.name.dropLast(SHAPSHOT_JAR_SUFFIX.length).substringBeforeLast("-") + ".jar")
|
||||
}
|
||||
|
||||
return FileCopy(file)
|
||||
}
|
||||
|
||||
when (sourcePath) {
|
||||
is Jar -> {
|
||||
val targetDir = ("lib/" + task.destinationDir.toRelativeString(gradleArtifactDir)).withoutSlash()
|
||||
@@ -169,10 +153,7 @@ fun generateKotlinPluginArtifactFile(rootProject: Project): PFile {
|
||||
.findByName(EmbeddedComponents.CONFIGURATION_NAME)?.resolvedConfiguration
|
||||
|
||||
if (embeddedComponents != null) {
|
||||
val configuration = CollectedConfiguration(embeddedComponents, Scope.COMPILE)
|
||||
for (dependencyInfo in listOf(configuration).collectDependencies()) {
|
||||
val dependency = (dependencyInfo as? DependencyInfo.ResolvedDependencyInfo)?.dependency ?: continue
|
||||
|
||||
for ((_, _, dependency) in listOf(embeddedComponents to Scope.COMPILE).collectDependencies()) {
|
||||
if (dependency.configuration == "runtimeElements") {
|
||||
archiveForJar.add(ModuleOutput(dependency.moduleName + ".src"))
|
||||
} else if (dependency.configuration == "tests-jar" || dependency.configuration == "jpsTest") {
|
||||
@@ -188,7 +169,7 @@ fun generateKotlinPluginArtifactFile(rootProject: Project): PFile {
|
||||
is Configuration -> {
|
||||
require(sourcePath.name == "sideJars") { "Configurations other than 'sideJars' are not supported" }
|
||||
for (file in sourcePath.resolve()) {
|
||||
root.getDirectory("lib").add(fileCopySnapshotAware(file))
|
||||
root.getDirectory("lib").add(FileCopy(file))
|
||||
}
|
||||
}
|
||||
else -> error("${task.name} Unexpected task type ${task.javaClass.name}")
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@file:Suppress("PackageDirectoryMismatch")
|
||||
package org.jetbrains.kotlin.pill
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.*
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.api.plugins.JavaPlugin
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.plugins.ide.idea.IdeaPlugin
|
||||
import org.gradle.api.file.SourceDirectorySet
|
||||
import org.gradle.api.internal.HasConvention
|
||||
import org.gradle.api.internal.file.copy.CopySpecInternal
|
||||
import org.gradle.api.internal.file.copy.SingleParentCopySpec
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
import org.jetbrains.kotlin.pill.POrderRoot.*
|
||||
import org.jetbrains.kotlin.pill.PSourceRoot.*
|
||||
import org.jetbrains.kotlin.pill.PillExtension.*
|
||||
import java.io.File
|
||||
import java.util.LinkedList
|
||||
|
||||
@@ -51,34 +41,13 @@ data class PContentRoot(
|
||||
|
||||
data class PSourceRoot(
|
||||
val path: File,
|
||||
val kind: Kind,
|
||||
val kotlinOptions: PSourceRootKotlinOptions?
|
||||
val kind: Kind
|
||||
) {
|
||||
enum class Kind { PRODUCTION, TEST, RESOURCES, TEST_RESOURCES }
|
||||
}
|
||||
enum class Kind {
|
||||
PRODUCTION, TEST, RESOURCES, TEST_RESOURCES;
|
||||
|
||||
data class PSourceRootKotlinOptions(
|
||||
val noStdlib: Boolean?,
|
||||
val noReflect: Boolean?,
|
||||
val moduleName: String?,
|
||||
val apiVersion: String?,
|
||||
val languageVersion: String?,
|
||||
val jvmTarget: String?,
|
||||
val addCompilerBuiltIns: Boolean?,
|
||||
val loadBuiltInsFromDependencies: Boolean?,
|
||||
val extraArguments: List<String>
|
||||
) {
|
||||
fun intersect(other: PSourceRootKotlinOptions) = PSourceRootKotlinOptions(
|
||||
if (noStdlib == other.noStdlib) noStdlib else null,
|
||||
if (noReflect == other.noReflect) noReflect else null,
|
||||
if (moduleName == other.moduleName) moduleName else null,
|
||||
if (apiVersion == other.apiVersion) apiVersion else null,
|
||||
if (languageVersion == other.languageVersion) languageVersion else null,
|
||||
if (jvmTarget == other.jvmTarget) jvmTarget else null,
|
||||
if (addCompilerBuiltIns == other.addCompilerBuiltIns) addCompilerBuiltIns else null,
|
||||
if (loadBuiltInsFromDependencies == other.loadBuiltInsFromDependencies) loadBuiltInsFromDependencies else null,
|
||||
extraArguments.intersect(other.extraArguments).toList()
|
||||
)
|
||||
val isResources get() = this == RESOURCES || this == TEST_RESOURCES
|
||||
}
|
||||
}
|
||||
|
||||
data class POrderRoot(
|
||||
@@ -114,16 +83,9 @@ fun parse(project: Project, libraries: List<PLibrary>, context: ParserContext):
|
||||
error("$project is not a root project")
|
||||
}
|
||||
|
||||
fun Project.matchesSelectedVariant(): Boolean {
|
||||
val extension = this.extensions.findByType(PillExtension::class.java) ?: return true
|
||||
val projectVariant = extension.variant.takeUnless { it == Variant.DEFAULT } ?: Variant.BASE
|
||||
return projectVariant in context.variant.includes
|
||||
}
|
||||
|
||||
val (includedProjects, excludedProjects) = project.allprojects
|
||||
.partition { it.plugins.hasPlugin(JpsCompatiblePlugin::class.java) && it.matchesSelectedVariant() }
|
||||
|
||||
val modules = includedProjects.flatMap { parseModules(it, excludedProjects) }
|
||||
val modules = project.allprojects
|
||||
.filter { it.plugins.hasPlugin(JpsCompatiblePlugin::class.java) }
|
||||
.flatMap { parseModules(it) }
|
||||
|
||||
return PProject("Kotlin", project.projectDir, modules, libraries)
|
||||
}
|
||||
@@ -146,7 +108,12 @@ private val TEST_CONFIGURATION_MAPPING = mapOf(
|
||||
listOf("jpsTest") to Scope.TEST
|
||||
)
|
||||
|
||||
private fun ParserContext.parseModules(project: Project, excludedProjects: List<Project>): List<PModule> {
|
||||
private val SOURCE_SET_MAPPING = mapOf(
|
||||
"main" to Kind.PRODUCTION,
|
||||
"test" to Kind.TEST
|
||||
)
|
||||
|
||||
private fun ParserContext.parseModules(project: Project): List<PModule> {
|
||||
val (productionContentRoots, testContentRoots) = parseContentRoots(project).partition { !it.forTests }
|
||||
|
||||
val modules = mutableListOf<PModule>()
|
||||
@@ -154,10 +121,7 @@ private fun ParserContext.parseModules(project: Project, excludedProjects: List<
|
||||
fun getJavaExcludedDirs() = project.plugins.findPlugin(IdeaPlugin::class.java)
|
||||
?.model?.module?.excludeDirs?.toList() ?: emptyList()
|
||||
|
||||
fun getPillExcludedDirs() = project.extensions.getByType(PillExtension::class.java).excludedDirs
|
||||
|
||||
val allExcludedDirs = getPillExcludedDirs() + getJavaExcludedDirs() + project.buildDir +
|
||||
(if (project == project.rootProject) excludedProjects.map { it.buildDir } else emptyList())
|
||||
val allExcludedDirs = getJavaExcludedDirs() + project.buildDir
|
||||
|
||||
var productionSourcesModule: PModule? = null
|
||||
|
||||
@@ -198,8 +162,8 @@ private fun ParserContext.parseModules(project: Project, excludedProjects: List<
|
||||
}
|
||||
}
|
||||
|
||||
val mainModuleFileRelativePath = when (project) {
|
||||
project.rootProject -> File(project.rootProject.projectDir, project.name + ".iml")
|
||||
val mainModuleFileRelativePath = when {
|
||||
project == project.rootProject -> File(project.rootProject.projectDir, project.name + ".iml")
|
||||
else -> getModuleFile()
|
||||
}
|
||||
|
||||
@@ -235,59 +199,48 @@ private fun parseSourceRoots(project: Project): List<PSourceRoot> {
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val kotlinTasksBySourceSet = project.tasks
|
||||
.filter { it.name.startsWith("compile") && it.name.endsWith("Kotlin") }
|
||||
.associateBy { it.invokeInternal("getSourceSetName") }
|
||||
|
||||
val sourceRoots = mutableListOf<PSourceRoot>()
|
||||
|
||||
for (sourceSet in project.sourceSets) {
|
||||
val kotlinCompileTask = kotlinTasksBySourceSet[sourceSet.name]
|
||||
val kind = if (sourceSet.name == SourceSet.TEST_SOURCE_SET_NAME) Kind.TEST else Kind.PRODUCTION
|
||||
project.configure<JavaPluginConvention> {
|
||||
for ((sourceSetName, kind) in SOURCE_SET_MAPPING) {
|
||||
val sourceSet = sourceSets.findByName(sourceSetName) ?: continue
|
||||
|
||||
fun Any.getKotlin(): SourceDirectorySet {
|
||||
val kotlinMethod = javaClass.getMethod("getKotlin")
|
||||
val oldIsAccessible = kotlinMethod.isAccessible
|
||||
try {
|
||||
kotlinMethod.isAccessible = true
|
||||
return kotlinMethod(this) as SourceDirectorySet
|
||||
} finally {
|
||||
kotlinMethod.isAccessible = oldIsAccessible
|
||||
}
|
||||
}
|
||||
|
||||
val kotlinSourceDirectories = (sourceSet as HasConvention).convention
|
||||
.plugins["kotlin"]?.getKotlin()?.srcDirs
|
||||
?: emptySet()
|
||||
|
||||
val directories = (sourceSet.java.sourceDirectories.files + kotlinSourceDirectories).toList()
|
||||
.filter { it.exists() }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?: continue
|
||||
|
||||
val kotlinOptions = kotlinCompileTask?.let { getKotlinOptions(it) }
|
||||
|
||||
for (resourceRoot in sourceSet.resources.sourceDirectories.files) {
|
||||
if (!resourceRoot.exists() || resourceRoot in directories) {
|
||||
continue
|
||||
fun Any.getKotlin(): SourceDirectorySet {
|
||||
val kotlinMethod = javaClass.getMethod("getKotlin")
|
||||
val oldIsAccessible = kotlinMethod.isAccessible
|
||||
try {
|
||||
kotlinMethod.isAccessible = true
|
||||
return kotlinMethod(this) as SourceDirectorySet
|
||||
} finally {
|
||||
kotlinMethod.isAccessible = oldIsAccessible
|
||||
}
|
||||
}
|
||||
|
||||
val resourceRootKind = when (kind) {
|
||||
Kind.PRODUCTION -> Kind.RESOURCES
|
||||
Kind.TEST -> Kind.TEST_RESOURCES
|
||||
else -> error("Invalid source root kind $kind")
|
||||
val kotlinSourceDirectories = (sourceSet as HasConvention).convention
|
||||
.plugins["kotlin"]?.getKotlin()?.srcDirs
|
||||
?: emptySet()
|
||||
|
||||
val directories = (sourceSet.java.sourceDirectories.files + kotlinSourceDirectories).toList()
|
||||
.filter { it.exists() }
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?: continue
|
||||
|
||||
for (resourceRoot in sourceSet.resources.sourceDirectories.files) {
|
||||
if (!resourceRoot.exists() || resourceRoot in directories) {
|
||||
continue
|
||||
}
|
||||
|
||||
val resourceRootKind = when (kind) {
|
||||
Kind.PRODUCTION -> Kind.RESOURCES
|
||||
Kind.TEST -> Kind.TEST_RESOURCES
|
||||
else -> error("Invalid source root kind $kind")
|
||||
}
|
||||
|
||||
sourceRoots += PSourceRoot(resourceRoot, resourceRootKind)
|
||||
}
|
||||
|
||||
sourceRoots += PSourceRoot(resourceRoot, resourceRootKind, kotlinOptions)
|
||||
}
|
||||
|
||||
for (directory in directories) {
|
||||
sourceRoots += PSourceRoot(directory, kind, kotlinOptions)
|
||||
}
|
||||
|
||||
for (root in parseResourceRootsProcessedByProcessResourcesTask(project, sourceSet)) {
|
||||
if (sourceRoots.none { it.path == root.path }) {
|
||||
sourceRoots += root
|
||||
for (directory in directories) {
|
||||
sourceRoots += PSourceRoot(directory, kind)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,70 +248,6 @@ private fun parseSourceRoots(project: Project): List<PSourceRoot> {
|
||||
return sourceRoots
|
||||
}
|
||||
|
||||
private fun parseResourceRootsProcessedByProcessResourcesTask(project: Project, sourceSet: SourceSet): List<PSourceRoot> {
|
||||
val isMainSourceSet = sourceSet.name == SourceSet.MAIN_SOURCE_SET_NAME
|
||||
val isTestSourceSet = sourceSet.name == SourceSet.TEST_SOURCE_SET_NAME
|
||||
|
||||
val resourceRootKind = if (isTestSourceSet) PSourceRoot.Kind.TEST_RESOURCES else PSourceRoot.Kind.RESOURCES
|
||||
val taskNameBase = "processResources"
|
||||
val taskName = if (isMainSourceSet) taskNameBase else sourceSet.name + taskNameBase.capitalize()
|
||||
val task = project.tasks.findByName(taskName) as? ProcessResources ?: return emptyList()
|
||||
|
||||
val roots = mutableListOf<File>()
|
||||
fun collectRoots(spec: CopySpecInternal) {
|
||||
if (spec is SingleParentCopySpec && spec.children.none()) {
|
||||
roots += spec.sourcePaths.map { File(project.projectDir, it.toString()) }.filter { it.exists() }
|
||||
return
|
||||
}
|
||||
|
||||
spec.children.forEach(::collectRoots)
|
||||
}
|
||||
collectRoots(task.rootSpec)
|
||||
|
||||
return roots.map { PSourceRoot(it, resourceRootKind, null) }
|
||||
}
|
||||
|
||||
private fun getKotlinOptions(kotlinCompileTask: Any): PSourceRootKotlinOptions? {
|
||||
val compileArguments = kotlinCompileTask.invokeInternal("getSerializedCompilerArguments") as List<String>
|
||||
fun parseBoolean(name: String) = compileArguments.contains("-$name")
|
||||
fun parseString(name: String) = compileArguments.dropWhile { it != "-$name" }.drop(1).firstOrNull()
|
||||
|
||||
val addCompilerBuiltins = "Xadd-compiler-builtins"
|
||||
val loadBuiltinsFromDependencies = "Xload-builtins-from-dependencies"
|
||||
|
||||
fun isOptionForScriptingCompilerPlugin(option: String)
|
||||
= option.startsWith("-Xplugin=") && option.contains("kotlin-scripting-compiler")
|
||||
|
||||
val extraArguments = compileArguments.filter {
|
||||
it.startsWith("-X") && !isOptionForScriptingCompilerPlugin(it)
|
||||
&& it != "-$addCompilerBuiltins" && it != "-$loadBuiltinsFromDependencies"
|
||||
}
|
||||
|
||||
return PSourceRootKotlinOptions(
|
||||
parseBoolean("no-stdlib"),
|
||||
parseBoolean("no-reflect"),
|
||||
parseString("module-name"),
|
||||
parseString("api-version"),
|
||||
parseString("language-version"),
|
||||
parseString("jvm-target"),
|
||||
parseBoolean(addCompilerBuiltins),
|
||||
parseBoolean(loadBuiltinsFromDependencies),
|
||||
extraArguments
|
||||
)
|
||||
}
|
||||
|
||||
private fun Any.invokeInternal(name: String, instance: Any = this): Any? {
|
||||
val method = javaClass.methods.single { it.name.startsWith(name) && it.parameterTypes.isEmpty() }
|
||||
|
||||
val oldIsAccessible = method.isAccessible
|
||||
try {
|
||||
method.isAccessible = true
|
||||
return method.invoke(instance)
|
||||
} finally {
|
||||
method.isAccessible = oldIsAccessible
|
||||
}
|
||||
}
|
||||
|
||||
private fun ParserContext.parseDependencies(project: Project, forTests: Boolean): List<POrderRoot> {
|
||||
val configurationMapping = if (forTests) TEST_CONFIGURATION_MAPPING else CONFIGURATION_MAPPING
|
||||
|
||||
@@ -366,42 +255,33 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
|
||||
val mainRoots = mutableListOf<POrderRoot>()
|
||||
val deferredRoots = mutableListOf<POrderRoot>()
|
||||
|
||||
fun collectConfigurations(): List<CollectedConfiguration> {
|
||||
val configurations = mutableListOf<CollectedConfiguration>()
|
||||
fun collectConfigurations(): List<Pair<ResolvedConfiguration, Scope>> {
|
||||
val configurations = mutableListOf<Pair<ResolvedConfiguration, Scope>>()
|
||||
|
||||
for ((configurationNames, scope) in configurationMapping) {
|
||||
for (configurationName in configurationNames) {
|
||||
val configuration = findByName(configurationName)?.also { it.resolve() } ?: continue
|
||||
|
||||
val extraDependencies = resolveExtraDependencies(configuration)
|
||||
configurations += CollectedConfiguration(configuration.resolvedConfiguration, scope, extraDependencies)
|
||||
configurations += Pair(configuration.resolvedConfiguration, scope)
|
||||
}
|
||||
}
|
||||
|
||||
return configurations
|
||||
}
|
||||
|
||||
nextDependency@ for (dependencyInfo in collectConfigurations().collectDependencies()) {
|
||||
val scope = dependencyInfo.scope
|
||||
|
||||
if (dependencyInfo is DependencyInfo.CustomDependencyInfo) {
|
||||
val files = dependencyInfo.files
|
||||
val library = PLibrary(files.firstOrNull()?.nameWithoutExtension ?: "unnamed", classes = files)
|
||||
|
||||
mainRoots += POrderRoot(PDependency.ModuleLibrary(library), scope)
|
||||
continue
|
||||
}
|
||||
|
||||
val dependency = (dependencyInfo as DependencyInfo.ResolvedDependencyInfo).dependency
|
||||
|
||||
nextDependency@ for ((configuration, scope, dependency) in collectConfigurations().collectDependencies()) {
|
||||
for (mapper in dependencyMappers) {
|
||||
if (dependency.configuration in mapper.configurations && mapper.predicate(dependency)) {
|
||||
if (dependency.moduleGroup == mapper.group
|
||||
&& dependency.moduleName == mapper.module
|
||||
&& dependency.configuration in mapper.configurations
|
||||
) {
|
||||
val mappedDependency = mapper.mapping(dependency)
|
||||
|
||||
if (mappedDependency != null) {
|
||||
val mainDependency = mappedDependency.main
|
||||
if (mainDependency != null) {
|
||||
mainRoots += POrderRoot(mainDependency, scope)
|
||||
val orderRoot = POrderRoot(mappedDependency.main, scope)
|
||||
if (mappedDependency.main is PDependency.Module) {
|
||||
mainRoots += orderRoot
|
||||
} else {
|
||||
mainRoots += orderRoot
|
||||
}
|
||||
|
||||
for (deferredDep in mappedDependency.deferred) {
|
||||
@@ -413,10 +293,10 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
|
||||
}
|
||||
}
|
||||
|
||||
mainRoots += if (dependency.configuration == "runtimeElements" && scope != Scope.TEST) {
|
||||
POrderRoot(PDependency.Module(dependency.moduleName + ".src"), scope)
|
||||
if (dependency.configuration == "runtimeElements" && scope != Scope.TEST) {
|
||||
mainRoots += POrderRoot(PDependency.Module(dependency.moduleName + ".src"), scope)
|
||||
} else if (dependency.configuration == "tests-jar" || dependency.configuration == "jpsTest") {
|
||||
POrderRoot(
|
||||
mainRoots += POrderRoot(
|
||||
PDependency.Module(dependency.moduleName + ".test"),
|
||||
scope,
|
||||
isProductionOnTestDependency = true
|
||||
@@ -424,7 +304,7 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
|
||||
} else {
|
||||
val classes = dependency.moduleArtifacts.map { it.file }
|
||||
val library = PLibrary(dependency.moduleName, classes)
|
||||
POrderRoot(PDependency.ModuleLibrary(library), scope)
|
||||
mainRoots += POrderRoot(PDependency.ModuleLibrary(library), scope)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,23 +312,9 @@ private fun ParserContext.parseDependencies(project: Project, forTests: Boolean)
|
||||
}
|
||||
}
|
||||
|
||||
private fun resolveExtraDependencies(configuration: Configuration): List<File> {
|
||||
return configuration.dependencies
|
||||
.filterIsInstance<SelfResolvingDependency>()
|
||||
.map { it.resolve() }
|
||||
.filter { isGradleApiDependency(it) }
|
||||
.flatMap { it }
|
||||
}
|
||||
|
||||
private fun isGradleApiDependency(files: Iterable<File>): Boolean {
|
||||
return listOf("gradle-api", "groovy-all").all { dep ->
|
||||
files.any { it.extension == "jar" && it.name.startsWith("$dep-") }
|
||||
}
|
||||
}
|
||||
|
||||
private fun removeDuplicates(roots: List<POrderRoot>): List<POrderRoot> {
|
||||
val dependenciesByScope = roots.groupBy { it.scope }.mapValues { it.value.mapTo(mutableSetOf()) { it.dependency } }
|
||||
fun dependenciesFor(scope: Scope) = dependenciesByScope[scope] ?: emptySet<PDependency>()
|
||||
fun depenciesFor(scope: Scope) = dependenciesByScope[scope] ?: emptySet<PDependency>()
|
||||
|
||||
val result = mutableSetOf<POrderRoot>()
|
||||
for (root in roots.distinct()) {
|
||||
@@ -459,16 +325,16 @@ private fun removeDuplicates(roots: List<POrderRoot>): List<POrderRoot> {
|
||||
continue
|
||||
}
|
||||
|
||||
if ((scope == Scope.PROVIDED || scope == Scope.RUNTIME) && dependency in dependenciesFor(Scope.COMPILE)) {
|
||||
if ((scope == Scope.PROVIDED || scope == Scope.RUNTIME) && dependency in depenciesFor(Scope.COMPILE)) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (scope == Scope.PROVIDED && dependency in dependenciesFor(Scope.RUNTIME)) {
|
||||
if (scope == Scope.PROVIDED && dependency in depenciesFor(Scope.RUNTIME)) {
|
||||
result += POrderRoot(dependency, Scope.COMPILE)
|
||||
continue
|
||||
}
|
||||
|
||||
if (scope == Scope.RUNTIME && dependency in dependenciesFor(Scope.PROVIDED)) {
|
||||
if (scope == Scope.RUNTIME && dependency in depenciesFor(Scope.PROVIDED)) {
|
||||
result += POrderRoot(dependency, Scope.COMPILE)
|
||||
continue
|
||||
}
|
||||
@@ -479,29 +345,17 @@ private fun removeDuplicates(roots: List<POrderRoot>): List<POrderRoot> {
|
||||
return result.toList()
|
||||
}
|
||||
|
||||
data class CollectedConfiguration(
|
||||
val configuration: ResolvedConfiguration,
|
||||
val scope: Scope,
|
||||
val extraDependencies: List<File> = emptyList())
|
||||
data class DependencyInfo(val configuration: ResolvedConfiguration, val scope: Scope, val dependency: ResolvedDependency)
|
||||
|
||||
sealed class DependencyInfo(val scope: Scope) {
|
||||
class ResolvedDependencyInfo(scope: Scope, val dependency: ResolvedDependency) : DependencyInfo(scope)
|
||||
class CustomDependencyInfo(scope: Scope, val files: List<File>) : DependencyInfo(scope)
|
||||
}
|
||||
|
||||
fun List<CollectedConfiguration>.collectDependencies(): List<DependencyInfo> {
|
||||
fun List<Pair<ResolvedConfiguration, Scope>>.collectDependencies(): List<DependencyInfo> {
|
||||
val dependencies = mutableListOf<DependencyInfo>()
|
||||
|
||||
val unprocessed = LinkedList<DependencyInfo>()
|
||||
val existing = mutableSetOf<Pair<Scope, ResolvedDependency>>()
|
||||
|
||||
for ((configuration, scope, extraDependencies) in this) {
|
||||
for ((configuration, scope) in this) {
|
||||
for (dependency in configuration.firstLevelModuleDependencies) {
|
||||
unprocessed += DependencyInfo.ResolvedDependencyInfo(scope, dependency)
|
||||
}
|
||||
|
||||
if (!extraDependencies.isEmpty()) {
|
||||
unprocessed += DependencyInfo.CustomDependencyInfo(scope, extraDependencies)
|
||||
unprocessed += DependencyInfo(configuration, scope, dependency)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,26 +363,17 @@ fun List<CollectedConfiguration>.collectDependencies(): List<DependencyInfo> {
|
||||
val info = unprocessed.removeAt(0)
|
||||
dependencies += info
|
||||
|
||||
info as? DependencyInfo.ResolvedDependencyInfo ?: continue
|
||||
|
||||
val data = Pair(info.scope, info.dependency)
|
||||
existing += data
|
||||
|
||||
for (child in info.dependency.children) {
|
||||
if (Pair(info.scope, child) in existing) {
|
||||
if (child.moduleGroup != "org.jetbrains.kotlin" && Pair(info.scope, child) in existing) {
|
||||
continue
|
||||
}
|
||||
|
||||
unprocessed += DependencyInfo.ResolvedDependencyInfo(info.scope, child)
|
||||
unprocessed += DependencyInfo(info.configuration, info.scope, child)
|
||||
}
|
||||
}
|
||||
|
||||
return dependencies
|
||||
}
|
||||
|
||||
private val Project.sourceSets: SourceSetContainer
|
||||
get() {
|
||||
lateinit var result: SourceSetContainer
|
||||
project.configure<JavaPluginConvention> { result = sourceSets }
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,6 @@ package org.jetbrains.kotlin.pill
|
||||
import org.gradle.api.Project
|
||||
import java.io.File
|
||||
|
||||
private val USER_HOME_DIR_PATH = System.getProperty("user.home").withSlash()
|
||||
|
||||
private fun replacePrefix(path: String, prefix: String, variableName: String): String {
|
||||
if (path.startsWith(prefix)) {
|
||||
return "$" + variableName + "$/" + path.drop(prefix.length)
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
private fun simplifyUserHomeDirPath(path: String): String {
|
||||
return replacePrefix(path, USER_HOME_DIR_PATH, "USER_HOME")
|
||||
}
|
||||
|
||||
interface PathContext {
|
||||
operator fun invoke(file: File): String
|
||||
|
||||
@@ -31,22 +17,25 @@ interface PathContext {
|
||||
}
|
||||
}
|
||||
|
||||
class ProjectContext private constructor(private val projectDir: File) : PathContext {
|
||||
class ProjectContext private constructor(val projectDir: File) : PathContext {
|
||||
constructor(project: PProject) : this(project.rootDirectory)
|
||||
constructor(project: Project) : this(project.projectDir)
|
||||
|
||||
override fun invoke(file: File): String {
|
||||
return simplifyUserHomeDirPath(replacePrefix(file.absolutePath, projectDir.absolutePath.withSlash(), "PROJECT_DIR"))
|
||||
return file.absolutePath.replace(projectDir.absolutePath, "\$PROJECT_DIR\$")
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleContext(val project: PProject, val module: PModule) : PathContext {
|
||||
override fun invoke(file: File): String {
|
||||
if (!file.startsWith(project.rootDirectory)) {
|
||||
return simplifyUserHomeDirPath(file.absolutePath)
|
||||
return file.absolutePath
|
||||
}
|
||||
|
||||
return "\$MODULE_DIR\$/" + file.toRelativeString(module.moduleFile.parentFile)
|
||||
return "\$MODULE_DIR\$/" +
|
||||
project.rootDirectory.toRelativeString(module.moduleFile.parentFile).withSlash() +
|
||||
module.rootDirectory.toRelativeString(project.rootDirectory).withSlash() +
|
||||
file.toRelativeString(module.rootDirectory)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
@file:Suppress("PackageDirectoryMismatch")
|
||||
package org.jetbrains.kotlin.pill
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
@@ -11,15 +10,16 @@ import shadow.org.jdom2.output.Format
|
||||
import shadow.org.jdom2.output.XMLOutputter
|
||||
import java.io.File
|
||||
|
||||
class PillConfigurablePlugin : Plugin<Project> {
|
||||
class JpsCompatibleBasePlugin : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
project.configurations.create(EmbeddedComponents.CONFIGURATION_NAME)
|
||||
project.extensions.create("pill", PillExtension::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
class JpsCompatiblePlugin : Plugin<Project> {
|
||||
companion object {
|
||||
private const val JPS_LIBRARY_PATH = "jpsLibraryPath"
|
||||
|
||||
private fun mapper(module: String, vararg configurations: String): DependencyMapper {
|
||||
return DependencyMapper("org.jetbrains.kotlin", module, *configurations) { MappedDependency(PDependency.Library(module)) }
|
||||
}
|
||||
@@ -36,47 +36,32 @@ class JpsCompatiblePlugin : Plugin<Project> {
|
||||
listOf(PDependency.Library("annotations-13.0"))
|
||||
)
|
||||
},
|
||||
DependencyMapper("org.jetbrains", "annotations", "default", version = "13.0") {
|
||||
MappedDependency(
|
||||
null,
|
||||
listOf(PDependency.Library("annotations-13.0"))
|
||||
)
|
||||
},
|
||||
DependencyMapper("org.jetbrains.kotlin", "kotlin-reflect-api", "runtimeElements") {
|
||||
MappedDependency(PDependency.Library("kotlin-reflect"))
|
||||
},
|
||||
DependencyMapper("org.jetbrains.kotlin", "kotlin-compiler-embeddable", "runtimeJar") { null },
|
||||
DependencyMapper("org.jetbrains.kotlin", "kotlin-stdlib-js", "distJar") { null },
|
||||
DependencyMapper("org.jetbrains.kotlin", "kotlin-compiler", "runtimeJar") { null },
|
||||
DependencyMapper("org.jetbrains.kotlin", "compiler", "runtimeElements") { null },
|
||||
DependencyMapper("kotlin.build.custom.deps", "android", "default") { dep ->
|
||||
val (sdkCommon, otherJars) = dep.moduleArtifacts.map { it.file }.partition { it.name == "sdk-common.jar" }
|
||||
val mainLibrary = PDependency.ModuleLibrary(PLibrary(dep.moduleName, otherJars))
|
||||
val deferredLibrary = PDependency.ModuleLibrary(PLibrary(dep.moduleName + "-deferred", sdkCommon))
|
||||
MappedDependency(mainLibrary, listOf(deferredLibrary))
|
||||
}
|
||||
DependencyMapper("org.jetbrains.kotlin", "compiler", "runtimeElements") { null }
|
||||
)
|
||||
}
|
||||
|
||||
fun getProjectLibraries(rootProject: Project): List<PLibrary> {
|
||||
val distLibDir = File(rootProject.extra["distLibDir"].toString())
|
||||
fun distJar(name: String) = File(rootProject.projectDir, "dist/kotlinc/lib/$name.jar")
|
||||
fun projectFile(path: String) = File(rootProject.projectDir, path)
|
||||
|
||||
val libraries = rootProject.allprojects
|
||||
.mapNotNull { library ->
|
||||
val libraryExtension = library.extensions.findByType(PillExtension::class.java)
|
||||
?.takeIf { it.importAsLibrary }
|
||||
?: return@mapNotNull null
|
||||
|
||||
val libraryPath = libraryExtension.libraryPath ?: distLibDir
|
||||
.filter { it.extra.has(JPS_LIBRARY_PATH) }
|
||||
.map { library ->
|
||||
val libraryPath = library.extra.get(JPS_LIBRARY_PATH).toString()
|
||||
val archivesBaseName = library.convention.findPlugin(BasePluginConvention::class.java)?.archivesBaseName ?: library.name
|
||||
|
||||
fun List<File>.filterExisting() = filter { it.exists() }
|
||||
|
||||
PLibrary(
|
||||
library.name,
|
||||
classes = listOf(File(libraryPath, "$archivesBaseName.jar")).filterExisting(),
|
||||
sources = listOf(File(libraryPath, "$archivesBaseName-sources.jar")).filterExisting()
|
||||
classes = listOf(File(libraryPath, archivesBaseName + ".jar")).filterExisting(),
|
||||
sources = listOf(File(libraryPath, archivesBaseName + "-sources.jar")).filterExisting()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -85,18 +70,15 @@ class JpsCompatiblePlugin : Plugin<Project> {
|
||||
}
|
||||
|
||||
override fun apply(project: Project) {
|
||||
project.plugins.apply(PillConfigurablePlugin::class.java)
|
||||
project.plugins.apply(JpsCompatibleBasePlugin::class.java)
|
||||
// 'jpsTest' does not require the 'tests-jar' artifact
|
||||
project.configurations.create("jpsTest")
|
||||
|
||||
if (project == project.rootProject) {
|
||||
project.tasks.create("pill") {
|
||||
doLast { pill(project) }
|
||||
|
||||
if (System.getProperty("pill.android.tests", "false") == "true") {
|
||||
TaskUtils.useAndroidSdk(this)
|
||||
TaskUtils.useAndroidJar(this)
|
||||
}
|
||||
TaskUtils.useAndroidSdk(this)
|
||||
TaskUtils.useAndroidJar(this)
|
||||
}
|
||||
|
||||
project.tasks.create("unpill") {
|
||||
@@ -109,37 +91,20 @@ class JpsCompatiblePlugin : Plugin<Project> {
|
||||
private lateinit var platformVersion: String
|
||||
private lateinit var platformBaseNumber: String
|
||||
private lateinit var platformDir: File
|
||||
private var isAndroidStudioPlatform: Boolean = false
|
||||
|
||||
private fun initEnvironment(project: Project) {
|
||||
projectDir = project.projectDir
|
||||
platformVersion = project.extensions.extraProperties.get("versions.intellijSdk").toString()
|
||||
platformBaseNumber = platformVersion.substringBefore(".", "").takeIf { it.isNotEmpty() }
|
||||
?: platformVersion.substringBefore("-", "").takeIf { it.isNotEmpty() }
|
||||
?: error("Invalid platform version: $platformVersion")
|
||||
?: error("Invalid platform version: $platformVersion")
|
||||
platformDir = IntellijRootUtils.getIntellijRootDir(project)
|
||||
isAndroidStudioPlatform = project.extensions.extraProperties.has("versions.androidStudioRelease")
|
||||
}
|
||||
|
||||
private fun pill(rootProject: Project) {
|
||||
initEnvironment(rootProject)
|
||||
|
||||
val variantOptionValue = System.getProperty("pill.variant", "base").toUpperCase()
|
||||
val variant = PillExtension.Variant.values().firstOrNull { it.name == variantOptionValue }
|
||||
?: run {
|
||||
rootProject.logger.error("Invalid variant name: $variantOptionValue")
|
||||
return
|
||||
}
|
||||
|
||||
rootProject.logger.lifecycle("Pill: Setting up project for the '${variant.name.toLowerCase()}' variant...")
|
||||
|
||||
if (variant == PillExtension.Variant.NONE || variant == PillExtension.Variant.DEFAULT) {
|
||||
rootProject.logger.error("'none' and 'default' should not be passed as a Pill variant property value")
|
||||
return
|
||||
}
|
||||
|
||||
val projectLibraries = getProjectLibraries(rootProject)
|
||||
val parserContext = ParserContext(getDependencyMappers(projectLibraries), variant)
|
||||
val parserContext = ParserContext(getDependencyMappers(projectLibraries))
|
||||
|
||||
val jpsProject = parse(rootProject, projectLibraries, parserContext)
|
||||
.mapLibraries(this::attachPlatformSources, this::attachAsmSources)
|
||||
@@ -180,19 +145,12 @@ class JpsCompatiblePlugin : Plugin<Project> {
|
||||
val runConfigurationsDir = File(projectDir, "buildSrc/src/main/resources/runConfigurations")
|
||||
val targetDir = File(projectDir, ".idea/runConfigurations")
|
||||
val platformDirProjectRelative = "\$PROJECT_DIR\$/" + platformDir.toRelativeString(projectDir)
|
||||
val additionalIdeaArgs = if (isAndroidStudioPlatform) "-Didea.platform.prefix=AndroidStudio" else ""
|
||||
|
||||
targetDir.mkdirs()
|
||||
|
||||
fun substitute(text: String): String {
|
||||
return text
|
||||
.replace("\$IDEA_HOME_PATH\$", platformDirProjectRelative)
|
||||
.replace("\$ADDITIONAL_IDEA_ARGS\$", additionalIdeaArgs)
|
||||
}
|
||||
|
||||
runConfigurationsDir.listFiles()
|
||||
.filter { it.extension == "xml" }
|
||||
.map { it.name to substitute(it.readText()) }
|
||||
.map { it.name to it.readText().replace("\$IDEA_HOME_PATH\$", platformDirProjectRelative) }
|
||||
.forEach { File(targetDir, it.first).writeText(it.second) }
|
||||
}
|
||||
|
||||
@@ -244,9 +202,8 @@ class JpsCompatiblePlugin : Plugin<Project> {
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotEmpty() }
|
||||
|
||||
fun addOrReplaceOptionValue(name: String, value: Any?) {
|
||||
val optionsWithoutNewValue = options.filter { !it.startsWith("-D$name=") }
|
||||
options = if (value == null) optionsWithoutNewValue else (optionsWithoutNewValue + listOf("-D$name=$value"))
|
||||
fun addOrReplaceOptionValue(name: String, value: Any) {
|
||||
options = options.filter { !it.startsWith("-D$name=") } + listOf("-D$name=$value")
|
||||
}
|
||||
|
||||
val robolectricClasspath = project.rootProject
|
||||
@@ -254,25 +211,16 @@ class JpsCompatiblePlugin : Plugin<Project> {
|
||||
.configurations.getByName("robolectricClasspath")
|
||||
.files.joinToString(File.pathSeparator)
|
||||
|
||||
if (options.none { it == "-ea" }) {
|
||||
options += "-ea"
|
||||
}
|
||||
val androidJarPath = project.configurations.getByName("androidJar").singleFile
|
||||
val androidSdkPath = project.configurations.getByName("androidSdk").singleFile
|
||||
|
||||
addOrReplaceOptionValue("idea.home.path", platformDirProjectRelative)
|
||||
addOrReplaceOptionValue("ideaSdk.androidPlugin.path", platformDirProjectRelative + "/plugins/android/lib")
|
||||
addOrReplaceOptionValue("robolectric.classpath", robolectricClasspath)
|
||||
addOrReplaceOptionValue("use.pill", "true")
|
||||
|
||||
val isAndroidStudioBunch = project.findProperty("versions.androidStudioRelease") != null
|
||||
addOrReplaceOptionValue("idea.platform.prefix", if (isAndroidStudioBunch) "AndroidStudio" else null)
|
||||
|
||||
val androidJarPath = project.configurations.findByName("androidJar")?.singleFile
|
||||
val androidSdkPath = project.configurations.findByName("androidSdk")?.singleFile
|
||||
|
||||
if (androidJarPath != null && androidSdkPath != null) {
|
||||
addOrReplaceOptionValue("android.sdk", "\$PROJECT_DIR\$/" + androidSdkPath.toRelativeString(projectDir))
|
||||
addOrReplaceOptionValue("android.jar", "\$PROJECT_DIR\$/" + androidJarPath.toRelativeString(projectDir))
|
||||
}
|
||||
addOrReplaceOptionValue("android.sdk", "\$PROJECT_DIR\$/" + androidSdkPath.toRelativeString(projectDir))
|
||||
addOrReplaceOptionValue("android.jar", "\$PROJECT_DIR\$/" + androidJarPath.toRelativeString(projectDir))
|
||||
|
||||
vmParams.setAttribute("value", options.joinToString(" "))
|
||||
}
|
||||
|
||||
@@ -54,59 +54,11 @@ private fun renderModule(project: PProject, module: PModule) = PFile(
|
||||
xml("component", "name" to "TestModuleProperties", "production-module" to moduleForProductionSources.name)
|
||||
}
|
||||
|
||||
val kotlinCompileOptionsList = module.contentRoots.flatMap { it.sourceRoots }.mapNotNull { it.kotlinOptions }
|
||||
var kotlinCompileOptions = kotlinCompileOptionsList.firstOrNull()
|
||||
for (otherOptions in kotlinCompileOptionsList.drop(1)) {
|
||||
kotlinCompileOptions = kotlinCompileOptions?.intersect(otherOptions)
|
||||
}
|
||||
|
||||
val pathContext = ModuleContext(project, module)
|
||||
|
||||
val platformVersion = (kotlinCompileOptions?.jvmTarget ?: "1.8")
|
||||
val classesDirectory = File(project.rootDirectory, "out/production/${module.name}")
|
||||
|
||||
if (kotlinCompileOptions != null) {
|
||||
xml("component", "name" to "FacetManager") {
|
||||
xml("facet", "type" to "kotlin-language", "name" to "Kotlin") {
|
||||
xml("configuration", "version" to 3, "platform" to "JVM $platformVersion", "useProjectSettings" to "false") {
|
||||
xml("compilerSettings") {
|
||||
xml(
|
||||
"option",
|
||||
"name" to "additionalArguments",
|
||||
"value" to kotlinCompileOptions.extraArguments.joinToString(" ")
|
||||
)
|
||||
}
|
||||
xml("compilerArguments") {
|
||||
xml("option", "name" to "destination", "value" to pathContext(classesDirectory))
|
||||
|
||||
fun Any?.option(name: String) {
|
||||
if (this != null) xml("option", "name" to name, "value" to this.toString())
|
||||
}
|
||||
|
||||
kotlinCompileOptions.noStdlib.option("noStdlib")
|
||||
kotlinCompileOptions.noReflect.option("noReflect")
|
||||
kotlinCompileOptions.moduleName.option("moduleName")
|
||||
xml("option", "name" to "jvmTarget", "value" to platformVersion)
|
||||
kotlinCompileOptions.addCompilerBuiltIns.option("addCompilerBuiltIns")
|
||||
kotlinCompileOptions.loadBuiltInsFromDependencies.option("loadBuiltInsFromDependencies")
|
||||
kotlinCompileOptions.languageVersion.option("languageVersion")
|
||||
kotlinCompileOptions.apiVersion.option("apiVersion")
|
||||
|
||||
xml("option", "name" to "pluginOptions") { xml("array") }
|
||||
xml("option", "name" to "pluginClasspaths") { xml("array") }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xml("component",
|
||||
"name" to "NewModuleRootManager",
|
||||
"LANGUAGE_LEVEL" to "JDK_${platformVersion.replace('.', '_')}",
|
||||
"inherit-compiler-output" to "true"
|
||||
) {
|
||||
xml("component", "name" to "NewModuleRootManager", "inherit-compiler-output" to "true") {
|
||||
xml("exclude-output")
|
||||
|
||||
val pathContext = ModuleContext(project, module)
|
||||
|
||||
for (contentRoot in module.contentRoots) {
|
||||
xml("content", pathContext.url(contentRoot.path)) {
|
||||
for (sourceRoot in contentRoot.sourceRoots) {
|
||||
@@ -130,39 +82,35 @@ private fun renderModule(project: PProject, module: PModule) = PFile(
|
||||
|
||||
xml("orderEntry", "type" to "inheritedJdk")
|
||||
|
||||
xml("orderEntry", "type" to "sourceFolder", "forTests" to "false")
|
||||
|
||||
for (orderRoot in module.orderRoots) {
|
||||
val dependency = orderRoot.dependency
|
||||
|
||||
val args = when (dependency) {
|
||||
is PDependency.ModuleLibrary -> mutableListOf(
|
||||
var args = when (dependency) {
|
||||
is PDependency.ModuleLibrary -> arrayOf(
|
||||
"type" to "module-library"
|
||||
)
|
||||
is PDependency.Module -> mutableListOf(
|
||||
is PDependency.Module -> arrayOf(
|
||||
"type" to "module",
|
||||
"module-name" to dependency.name
|
||||
)
|
||||
is PDependency.Library -> mutableListOf(
|
||||
is PDependency.Library -> arrayOf(
|
||||
"type" to "library",
|
||||
"name" to dependency.name,
|
||||
"level" to "project"
|
||||
)
|
||||
}
|
||||
|
||||
if (orderRoot.scope != POrderRoot.Scope.COMPILE) {
|
||||
args.add(1, "scope" to orderRoot.scope.toString())
|
||||
else -> error("Unsupported dependency type: $dependency")
|
||||
}
|
||||
|
||||
if (dependency is PDependency.Module && orderRoot.isProductionOnTestDependency) {
|
||||
args += ("production-on-test" to "")
|
||||
}
|
||||
|
||||
args += ("scope" to orderRoot.scope.toString())
|
||||
if (orderRoot.isExported) {
|
||||
args += ("exported" to "")
|
||||
}
|
||||
|
||||
xml("orderEntry", *args.toTypedArray()) {
|
||||
xml("orderEntry", *args) {
|
||||
if (dependency is PDependency.ModuleLibrary) {
|
||||
add(renderLibraryToXml(dependency.library, pathContext, named = false))
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import shadow.org.jdom2.Element
|
||||
import shadow.org.jdom2.output.Format
|
||||
import shadow.org.jdom2.output.XMLOutputter
|
||||
|
||||
class xml(val name: String, private vararg val args: Pair<String, Any>, block: xml.() -> Unit = {}) {
|
||||
class xml(val name: String, vararg val args: Pair<String, Any>, block: xml.() -> Unit = {}) {
|
||||
private companion object {
|
||||
fun makeXml(name: String, vararg args: Pair<String, Any>, block: xml.() -> Unit = {}): xml {
|
||||
return xml(name, *args, block = block)
|
||||
|
||||
@@ -1,6 +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.
|
||||
* 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 com.jakewharton.dex.*
|
||||
@@ -19,10 +30,6 @@ open class DexMethodCount : DefaultTask() {
|
||||
val byClass: Map<String, Int>
|
||||
)
|
||||
|
||||
init {
|
||||
outputs.upToDateWhen { !shouldPrintTeamCityStatistics } // always execute when teamCityStatistics output is required
|
||||
}
|
||||
|
||||
@InputFile
|
||||
lateinit var jarFile: File
|
||||
|
||||
@@ -35,9 +42,6 @@ open class DexMethodCount : DefaultTask() {
|
||||
@Optional
|
||||
var teamCityStatistics: Boolean? = null
|
||||
|
||||
private val shouldPrintTeamCityStatistics = teamCityStatistics ?: project.hasProperty("teamcity")
|
||||
|
||||
|
||||
@Input
|
||||
@Optional
|
||||
var artifactName: String? = null
|
||||
@@ -50,12 +54,8 @@ open class DexMethodCount : DefaultTask() {
|
||||
dependsOn(jar)
|
||||
}
|
||||
|
||||
@Internal // plain output properties are not supported, mark as internal to suppress warning from validateTaskProperties
|
||||
lateinit var counts: Counts
|
||||
|
||||
@get:OutputFile
|
||||
val detailOutputFile: File get() = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
|
||||
|
||||
@TaskAction
|
||||
fun invoke() {
|
||||
val methods = dexMethods(jarFile)
|
||||
@@ -96,7 +96,7 @@ open class DexMethodCount : DefaultTask() {
|
||||
}
|
||||
|
||||
private fun printTCStats(counts: Counts) {
|
||||
if (shouldPrintTeamCityStatistics) {
|
||||
if (teamCityStatistics ?: project.hasProperty("teamcity")) {
|
||||
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='${counts.total}']")
|
||||
counts.totalOwnPackages?.let { value ->
|
||||
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}_OwnPackages' value='$value']")
|
||||
@@ -108,7 +108,8 @@ open class DexMethodCount : DefaultTask() {
|
||||
}
|
||||
|
||||
private fun outputDetails(counts: Counts) {
|
||||
detailOutputFile.printWriter().use { writer ->
|
||||
val detailFile = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
|
||||
detailFile.printWriter().use { writer ->
|
||||
writer.println("${counts.total.padRight()}\tTotal methods")
|
||||
ownPackages?.let { packages ->
|
||||
writer.println("${counts.totalOwnPackages?.padRight()}\tTotal methods from packages ${packages.joinToString { "$it.*" }}")
|
||||
|
||||
@@ -85,16 +85,6 @@ open class PublishedKotlinModule : Plugin<Project> {
|
||||
dependencies.removeIf {
|
||||
InvokerHelper.getMetaClass(it).getProperty(it, "scope") == "test"
|
||||
}
|
||||
|
||||
dependencies
|
||||
.find {
|
||||
InvokerHelper.getMetaClass(it).getProperty(it, "groupId") == "org.jetbrains.kotlin"
|
||||
&& InvokerHelper.getMetaClass(it).getProperty(it, "artifactId") == "kotlin-stdlib"
|
||||
}
|
||||
?.also {
|
||||
InvokerHelper.getMetaClass(it).setProperty(it, "exclusions", emptyList<Any>())
|
||||
logger.warn("WARNING! Removed exclusions from kotlin-stdlib dependency of ${this.artifactId} artifact's maven metadata, check kotlin-stdlib dependency of ${project.path} project")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ import org.gradle.api.*
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import org.gradle.language.jvm.tasks.ProcessResources
|
||||
|
||||
//import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
|
||||
|
||||
inline fun Project.sourceSets(crossinline body: SourceSetsBuilder.() -> Unit) =
|
||||
@@ -13,11 +11,14 @@ inline fun Project.sourceSets(crossinline body: SourceSetsBuilder.() -> Unit) =
|
||||
|
||||
class SourceSetsBuilder(val project: Project) {
|
||||
|
||||
inline operator fun String.invoke(crossinline body: SourceSet.() -> Unit): SourceSet {
|
||||
inline operator fun String.invoke(crossinline body: SourceSet.() -> Unit) {
|
||||
val sourceSetName = this
|
||||
return project.sourceSets.maybeCreate(sourceSetName).apply {
|
||||
none()
|
||||
body()
|
||||
project.configure<JavaPluginConvention>
|
||||
{
|
||||
sourceSets.matching { it.name == sourceSetName }.forEach {
|
||||
none()
|
||||
it.body()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,20 +28,18 @@ fun SourceSet.none() {
|
||||
resources.setSrcDirs(emptyList<String>())
|
||||
}
|
||||
|
||||
val SourceSet.projectDefault: Project.() -> Unit
|
||||
get() = {
|
||||
when (this@projectDefault.name) {
|
||||
"main" -> {
|
||||
java.srcDirs("src")
|
||||
val processResources = tasks.getByName(processResourcesTaskName) as ProcessResources
|
||||
processResources.from("resources") { include("**") }
|
||||
processResources.from("src") { include("META-INF/**", "**/*.properties") }
|
||||
}
|
||||
"test" -> {
|
||||
java.srcDirs("test", "tests")
|
||||
}
|
||||
fun SourceSet.projectDefault() {
|
||||
when (name) {
|
||||
"main" -> {
|
||||
java.srcDirs("src")
|
||||
resources.srcDir("resources").apply { include("**") }
|
||||
resources.srcDir("src").apply { include("META-INF/**", "**/*.properties") }
|
||||
}
|
||||
"test" -> {
|
||||
java.srcDirs("test", "tests")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: adding KotlinSourceSet dep to the plugin breaks the build unexpectedly, resolve and uncomment
|
||||
//val SourceSet.kotlin: SourceDirectorySet
|
||||
@@ -56,14 +55,8 @@ val SourceSet.projectDefault: Project.() -> Unit
|
||||
|
||||
fun Project.getSourceSetsFrom(projectPath: String): SourceSetContainer {
|
||||
evaluationDependsOn(projectPath)
|
||||
return project(projectPath).sourceSets
|
||||
return project(projectPath).the<JavaPluginConvention>().sourceSets
|
||||
}
|
||||
|
||||
val Project.sourceSets: SourceSetContainer
|
||||
get() = javaPluginConvention().sourceSets
|
||||
|
||||
val Project.mainSourceSet: SourceSet
|
||||
get() = sourceSets.getByName("main")
|
||||
|
||||
val Project.testSourceSet: SourceSet
|
||||
get() = sourceSets.getByName("test")
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.io.BufferedOutputStream
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.util.jar.JarFile
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
/**
|
||||
@@ -48,8 +47,8 @@ fun stripMetadata(logger: Logger, classNamePattern: String, inFile: File, outFil
|
||||
error("Size increased for ${entry.name}: was ${inBytes.size} bytes, became ${outBytes.size} bytes")
|
||||
}
|
||||
|
||||
val newEntry = ZipEntry(entry.name)
|
||||
outJar.putNextEntry(newEntry)
|
||||
entry.compressedSize = -1L
|
||||
outJar.putNextEntry(entry)
|
||||
outJar.write(outBytes)
|
||||
outJar.closeEntry()
|
||||
}
|
||||
|
||||
@@ -14,58 +14,44 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
// usages in build scripts are not tracked properly
|
||||
@file:Suppress("unused")
|
||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
||||
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter
|
||||
import org.gradle.api.plugins.JavaPluginConvention
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import org.gradle.kotlin.dsl.project
|
||||
import org.gradle.kotlin.dsl.task
|
||||
import org.gradle.kotlin.dsl.the
|
||||
import org.gradle.kotlin.dsl.*
|
||||
import java.lang.Character.isLowerCase
|
||||
import java.lang.Character.isUpperCase
|
||||
|
||||
fun Project.projectTest(taskName: String = "test", body: Test.() -> Unit = {}): Test = getOrCreateTask(taskName) {
|
||||
doFirst {
|
||||
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: emptySet()
|
||||
val patterns = filter.includePatterns + commandLineIncludePatterns
|
||||
val patterns = filter.includePatterns + ((filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: emptySet())
|
||||
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
|
||||
patterns.forEach { pattern ->
|
||||
var isClassPattern = false
|
||||
val maybeMethodName = pattern.substringAfterLast('.')
|
||||
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
|
||||
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase))
|
||||
pattern.substringBeforeLast('.')
|
||||
} else {
|
||||
isClassPattern = true
|
||||
else
|
||||
pattern
|
||||
}
|
||||
|
||||
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
|
||||
return@forEach
|
||||
}
|
||||
|
||||
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
|
||||
val classFileName = "$classFileNameWithoutExtension.class"
|
||||
|
||||
if (isClassPattern) {
|
||||
val innerClassPattern = "$pattern$*"
|
||||
if (pattern in commandLineIncludePatterns) {
|
||||
commandLineIncludePatterns.add(innerClassPattern)
|
||||
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
|
||||
} else {
|
||||
filter.includePatterns.add(innerClassPattern)
|
||||
}
|
||||
}
|
||||
val classFileName = classFileNameWithoutExtension + ".class"
|
||||
|
||||
include {
|
||||
val path = it.path
|
||||
if (it.isDirectory) {
|
||||
classFileNameWithoutExtension.startsWith(path)
|
||||
} else {
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
|
||||
path == classFileName || (path.endsWith(".class") && path.startsWith(classFileNameWithoutExtension + "$"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,22 +67,14 @@ fun Project.projectTest(taskName: String = "test", body: Test.() -> Unit = {}):
|
||||
|
||||
dependsOn(":test-instrumenter:jar")
|
||||
|
||||
jvmArgs(
|
||||
"-ea",
|
||||
"-XX:+HeapDumpOnOutOfMemoryError",
|
||||
"-Xmx1600m",
|
||||
"-XX:+UseCodeCacheFlushing",
|
||||
"-XX:ReservedCodeCacheSize=128m",
|
||||
"-Djna.nosys=true"
|
||||
)
|
||||
|
||||
jvmArgs("-ea", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx1600m", "-XX:+UseCodeCacheFlushing", "-XX:ReservedCodeCacheSize=128m", "-Djna.nosys=true")
|
||||
maxHeapSize = "1600m"
|
||||
systemProperty("idea.is.unit.test", "true")
|
||||
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
|
||||
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
|
||||
environment("PROJECT_CLASSES_DIRS", testSourceSet.output.classesDirs.asPath)
|
||||
environment("PROJECT_CLASSES_DIRS", the<JavaPluginConvention>().sourceSets.getByName("test").output.classesDirs.asPath)
|
||||
environment("PROJECT_BUILD_DIR", buildDir)
|
||||
systemProperty("jps.kotlin.home", rootProject.extra["distKotlinHomeDir"]!!)
|
||||
systemProperty("jps.kotlin.home", rootProject.extra["distKotlinHomeDir"])
|
||||
systemProperty("kotlin.ni", if (rootProject.hasProperty("newInferenceTests")) "true" else "false")
|
||||
body()
|
||||
}
|
||||
@@ -104,7 +82,7 @@ fun Project.projectTest(taskName: String = "test", body: Test.() -> Unit = {}):
|
||||
private inline fun String.isFirstChar(f: (Char) -> Boolean) = isNotEmpty() && f(first())
|
||||
|
||||
inline fun <reified T : Task> Project.getOrCreateTask(taskName: String, body: T.() -> Unit): T =
|
||||
(tasks.findByName(taskName)?.let { it as T } ?: task<T>(taskName)).apply { body() }
|
||||
(tasks.findByName(taskName)?.let { it as T } ?: task<T>(taskName)).apply { body() }
|
||||
|
||||
object TaskUtils {
|
||||
fun useAndroidSdk(task: Task) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<option name="MAIN_CLASS_NAME" value="" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="package" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Duse.pill=true -Didea.home.path=$IDEA_HOME_PATH$" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Didea.home.path=$IDEA_HOME_PATH$" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
|
||||
@@ -9,16 +9,16 @@
|
||||
</extension>
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin" />
|
||||
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin.codegen" />
|
||||
<option name="MAIN_CLASS_NAME" value="" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="package" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Duse.pill=true -Didea.home.path=$IDEA_HOME_PATH$" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Didea.home.path=$IDEA_HOME_PATH$" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<patterns />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<log_file alias="idea.log" path="$PROJECT_DIR$/ideaSDK/system-idea/log/idea.log" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
|
||||
<module name="idea-runner" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx1250m -XX:ReservedCodeCacheSize=240m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=$PROJECT_DIR$/local/ideaSandbox -Didea.config.path=$PROJECT_DIR$/local/ideaSandbox/config -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin $ADDITIONAL_IDEA_ARGS$" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx1250m -XX:ReservedCodeCacheSize=240m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=$IDEA_HOME_PATH$/system -Didea.config.path=$IDEA_HOME_PATH$/config -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Dkotlin.internal.mode.enabled=true" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$IDEA_HOME_PATH$" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="" />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<log_file alias="idea.log" path="$PROJECT_DIR$/ideaSDK/system-idea/log/idea.log" />
|
||||
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
|
||||
<module name="idea-runner" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx1250m -XX:ReservedCodeCacheSize=240m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=$PROJECT_DIR$/local/ideaSandbox -Didea.config.path=$PROJECT_DIR$/local/ideaSandbox/config -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Didea.ProcessCanceledException=disabled $ADDITIONAL_IDEA_ARGS$" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx1250m -XX:ReservedCodeCacheSize=240m -XX:+HeapDumpOnOutOfMemoryError -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=$IDEA_HOME_PATH$/system -Didea.config.path=$IDEA_HOME_PATH$/config -Dapple.laf.useScreenMenuBar=true -Dapple.awt.graphics.UseQuartz=true -Dsun.io.useCanonCaches=false -Dplugin.path=$PROJECT_DIR$/out/artifacts/Kotlin -Dkotlin.internal.mode.enabled=true -Didea.ProcessCanceledException=disabled" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$IDEA_HOME_PATH$" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="" />
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
<option name="MAIN_CLASS_NAME" value="" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="package" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -Djna.nosys=true -Duse.pill=true -Dkotlin.js.skipMinificationTest=false" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1250m -XX:+UseCodeCacheFlushing -Djna.nosys=true -Dkotlin.js.skipMinificationTest=false" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
<value defaultName="moduleWithDependencies" />
|
||||
</option>
|
||||
<patterns />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="[JPS] JVM Backend Tests" type="JUnit" factoryName="JUnit">
|
||||
<module name="compiler.test" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="org.jetbrains.kotlin.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PACKAGE_NAME" value="org.jetbrains.kotlin.codegen" />
|
||||
<option name="MAIN_CLASS_NAME" value="" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="package" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Duse.pill=true -Didea.home.path=$IDEA_HOME_PATH$" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
</option>
|
||||
<patterns />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Profile " />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -13,7 +13,7 @@
|
||||
<option name="MAIN_CLASS_NAME" value="" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="package" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Duse.pill=true -Dkotlin.colors.enabled=false -Didea.home.path=$IDEA_HOME_PATH$" />
|
||||
<option name="VM_PARAMETERS" value="-ea -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCodeCacheFlushing -XX:ReservedCodeCacheSize=128m -Djna.nosys=true -Dkotlin.colors.enabled=false -Didea.home.path=$IDEA_HOME_PATH$" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
|
||||
29
common.xml
Normal file
29
common.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<project name="Commons">
|
||||
<condition property="isWindows">
|
||||
<os family="windows"/>
|
||||
</condition>
|
||||
|
||||
<condition property="isMac">
|
||||
<os family="mac"/>
|
||||
</condition>
|
||||
|
||||
<condition property="isLinux">
|
||||
<and>
|
||||
<os family="unix"/>
|
||||
<not>
|
||||
<os family="mac"/>
|
||||
</not>
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
<property name="dependencies" value="${basedir}/dependencies"/>
|
||||
|
||||
<property name="output" value="${basedir}/dist"/>
|
||||
<property name="js.stdlib.output.dir" value="${output}/js"/>
|
||||
|
||||
|
||||
<target name="make-dependency-dirs">
|
||||
<mkdir dir="${dependencies}"/>
|
||||
<mkdir dir="${dependencies}/download"/>
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,6 +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.
|
||||
* 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.android.tests
|
||||
@@ -10,13 +21,15 @@ import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.io.FileUtilRt
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import org.jetbrains.kotlin.cli.common.output.writeAllTo
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection
|
||||
import org.jetbrains.kotlin.cli.common.output.outputUtils.writeAllTo
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestCase
|
||||
import org.jetbrains.kotlin.codegen.CodegenTestFiles
|
||||
import org.jetbrains.kotlin.codegen.GenerationUtils
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
@@ -47,7 +60,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
}
|
||||
|
||||
private fun prepareAndroidModule() {
|
||||
println("Copying kotlin-stdlib.jar and kotlin-reflect.jar in android module...")
|
||||
println("Copying kotlin-runtime.jar and kotlin-reflect.jar in android module...")
|
||||
copyKotlinRuntimeJars()
|
||||
|
||||
println("Check 'libs' folder in tested android module...")
|
||||
@@ -60,7 +73,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
private fun copyKotlinRuntimeJars() {
|
||||
FileUtil.copy(
|
||||
ForTestCompileRuntime.runtimeJarForTests(),
|
||||
File(pathManager.libsFolderInAndroidTmpFolder + "/kotlin-stdlib.jar")
|
||||
File(pathManager.libsFolderInAndroidTmpFolder + "/kotlin-runtime.jar")
|
||||
)
|
||||
FileUtil.copy(
|
||||
ForTestCompileRuntime.reflectJarForTests(),
|
||||
@@ -198,10 +211,6 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
val fullFileText = FileUtil.loadFile(file, true)
|
||||
//TODO support JvmPackageName
|
||||
if (fullFileText.contains("@file:JvmPackageName(")) continue
|
||||
// TODO: Support coroutines tests
|
||||
if (fullFileText.contains("// WITH_COROUTINES")) continue
|
||||
// TODO: Support jvm assertions
|
||||
if (fullFileText.contains("// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm")) continue
|
||||
|
||||
if (hasBoxMethod(fullFileText)) {
|
||||
val testFiles = createTestFiles(file, fullFileText)
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.android.tests;
|
||||
|
||||
import java.util.HashSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class SpecialFiles {
|
||||
private static final Set<String> excludedFiles = new HashSet<>();
|
||||
private static final Set<String> excludedFiles = Sets.newHashSet();
|
||||
|
||||
static {
|
||||
fillExcludedFiles();
|
||||
|
||||
@@ -18,6 +18,7 @@ dependencies {
|
||||
sourceSets {
|
||||
"main" {
|
||||
projectDefault()
|
||||
java.srcDir("../ir/backend.common/src")
|
||||
}
|
||||
"test" {}
|
||||
}
|
||||
|
||||
@@ -1,6 +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.
|
||||
* 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.backend.common
|
||||
@@ -20,7 +31,6 @@ import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.isUsedAsExpression
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectedActualResolver
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
@@ -49,8 +59,7 @@ object CodegenUtil {
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun getNonPrivateTraitMethods(descriptor: ClassDescriptor, copy: Boolean = true): Map<FunctionDescriptor, FunctionDescriptor> {
|
||||
fun getNonPrivateTraitMethods(descriptor: ClassDescriptor): Map<FunctionDescriptor, FunctionDescriptor> {
|
||||
val result = linkedMapOf<FunctionDescriptor, FunctionDescriptor>()
|
||||
for (declaration in DescriptorUtils.getAllDescriptors(descriptor.defaultType.memberScope)) {
|
||||
if (declaration !is CallableMemberDescriptor) continue
|
||||
@@ -64,39 +73,29 @@ object CodegenUtil {
|
||||
|
||||
// inheritedMember can be abstract here. In order for FunctionCodegen to generate the method body, we're creating a copy here
|
||||
// with traitMember's modality
|
||||
result.putAll(
|
||||
if (copy)
|
||||
copyFunctions(
|
||||
declaration, traitMember, declaration.containingDeclaration, traitMember.modality,
|
||||
Visibilities.PUBLIC, CallableMemberDescriptor.Kind.DECLARATION, true
|
||||
)
|
||||
else mapMembers(declaration, traitMember)
|
||||
)
|
||||
result.putAll(copyFunctions(declaration, traitMember, declaration.containingDeclaration, traitMember.modality,
|
||||
Visibilities.PUBLIC, CallableMemberDescriptor.Kind.DECLARATION, true))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
fun copyFunctions(
|
||||
inheritedMember: CallableMemberDescriptor,
|
||||
traitMember: CallableMemberDescriptor,
|
||||
newOwner: DeclarationDescriptor,
|
||||
modality: Modality,
|
||||
visibility: Visibility,
|
||||
kind: CallableMemberDescriptor.Kind,
|
||||
copyOverrides: Boolean
|
||||
): Map<FunctionDescriptor, FunctionDescriptor> =
|
||||
mapMembers(inheritedMember.copy(newOwner, modality, visibility, kind, copyOverrides), traitMember)
|
||||
|
||||
private fun mapMembers(
|
||||
inherited: CallableMemberDescriptor,
|
||||
traitMember: CallableMemberDescriptor
|
||||
): LinkedHashMap<FunctionDescriptor, FunctionDescriptor> {
|
||||
inheritedMember: CallableMemberDescriptor,
|
||||
traitMember: CallableMemberDescriptor,
|
||||
newOwner: DeclarationDescriptor,
|
||||
modality: Modality,
|
||||
visibility: Visibility,
|
||||
kind: CallableMemberDescriptor.Kind,
|
||||
copyOverrides: Boolean
|
||||
): Map<FunctionDescriptor, FunctionDescriptor> {
|
||||
val copy = inheritedMember.copy(newOwner, modality, visibility, kind, copyOverrides)
|
||||
val result = linkedMapOf<FunctionDescriptor, FunctionDescriptor>()
|
||||
if (traitMember is SimpleFunctionDescriptor) {
|
||||
result[traitMember] = inherited as FunctionDescriptor
|
||||
} else if (traitMember is PropertyDescriptor) {
|
||||
result[traitMember] = copy as FunctionDescriptor
|
||||
}
|
||||
else if (traitMember is PropertyDescriptor) {
|
||||
for (traitAccessor in traitMember.accessors) {
|
||||
for (inheritedAccessor in (inherited as PropertyDescriptor).accessors) {
|
||||
for (inheritedAccessor in (copy as PropertyDescriptor).accessors) {
|
||||
if (inheritedAccessor::class.java == traitAccessor::class.java) { // same accessor kind
|
||||
result.put(traitAccessor, inheritedAccessor)
|
||||
}
|
||||
@@ -109,8 +108,9 @@ object CodegenUtil {
|
||||
@JvmStatic
|
||||
fun getSuperClassBySuperTypeListEntry(specifier: KtSuperTypeListEntry, bindingContext: BindingContext): ClassDescriptor? {
|
||||
val superType = bindingContext.get(BindingContext.TYPE, specifier.typeReference!!)
|
||||
?: error("superType should not be null: ${specifier.text}")
|
||||
|
||||
return superType?.constructor?.declarationDescriptor as? ClassDescriptor
|
||||
return superType.constructor.declarationDescriptor as? ClassDescriptor
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -167,24 +167,9 @@ object CodegenUtil {
|
||||
return KtPsiFactory(project, markGenerated = false).createExpression(fakeFunctionCall) as KtCallExpression
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns declarations in the given [file] which should be generated by the back-end. This includes all declarations
|
||||
* minus all expected declarations (except annotation classes annotated with @OptionalExpectation).
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getDeclarationsToGenerate(file: KtFile, bindingContext: BindingContext): List<KtDeclaration> =
|
||||
file.declarations.filter(fun(declaration: KtDeclaration): Boolean {
|
||||
if (!declaration.hasExpectModifier()) return true
|
||||
|
||||
if (declaration is KtClass) {
|
||||
val descriptor = bindingContext.get(BindingContext.CLASS, declaration)
|
||||
if (descriptor != null && ExpectedActualDeclarationChecker.shouldGenerateExpectClass(descriptor)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
fun getActualDeclarations(file: KtFile): List<KtDeclaration> =
|
||||
file.declarations.filterNot(KtDeclaration::hasExpectModifier)
|
||||
|
||||
@JvmStatic
|
||||
fun findExpectedFunctionForActual(descriptor: FunctionDescriptor): FunctionDescriptor? {
|
||||
@@ -219,11 +204,3 @@ object CodegenUtil {
|
||||
return descriptor.valueParameters
|
||||
}
|
||||
}
|
||||
|
||||
fun DeclarationDescriptor.isTopLevelInPackage(name: String, packageName: String): Boolean {
|
||||
if (name != this.name.asString()) return false
|
||||
|
||||
val containingDeclaration = containingDeclaration as? PackageFragmentDescriptor ?: return false
|
||||
val packageFqName = containingDeclaration.fqName.asString()
|
||||
return packageName == packageFqName
|
||||
}
|
||||
@@ -33,22 +33,32 @@ import org.jetbrains.kotlin.resolve.BindingContextUtils
|
||||
* TODO: data class with zero components gets no toString/equals/hashCode methods. This is inconsistent and should be
|
||||
* changed here with the platform backends adopted.
|
||||
*/
|
||||
abstract class DataClassMethodGenerator(
|
||||
declaration: KtClassOrObject,
|
||||
bindingContext: BindingContext
|
||||
) : FunctionsFromAnyGenerator(declaration, bindingContext) {
|
||||
abstract class DataClassMethodGenerator(protected val declaration: KtClassOrObject, private val bindingContext: BindingContext) {
|
||||
protected val classDescriptor: ClassDescriptor = BindingContextUtils.getNotNull(bindingContext, BindingContext.CLASS, declaration)
|
||||
|
||||
override fun generate() {
|
||||
fun generate() {
|
||||
generateComponentFunctionsForDataClasses()
|
||||
|
||||
generateCopyFunctionForDataClasses(primaryConstructorParameters)
|
||||
|
||||
super.generate()
|
||||
val properties = dataProperties
|
||||
if (properties.isNotEmpty()) {
|
||||
generateDataClassToStringIfNeeded(properties)
|
||||
generateDataClassHashCodeIfNeeded(properties)
|
||||
generateDataClassEqualsIfNeeded(properties)
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract fun generateComponentFunction(function: FunctionDescriptor, parameter: ValueParameterDescriptor)
|
||||
|
||||
protected abstract fun generateCopyFunction(function: FunctionDescriptor, constructorParameters: List<KtParameter>)
|
||||
|
||||
protected abstract fun generateToStringMethod(function: FunctionDescriptor, properties: List<PropertyDescriptor>)
|
||||
|
||||
protected abstract fun generateHashCodeMethod(function: FunctionDescriptor, properties: List<PropertyDescriptor>)
|
||||
|
||||
protected abstract fun generateEqualsMethod(function: FunctionDescriptor, properties: List<PropertyDescriptor>)
|
||||
|
||||
private fun generateComponentFunctionsForDataClasses() {
|
||||
// primary constructor should exist for data classes
|
||||
// but when generating light-classes still need to check we have one
|
||||
@@ -66,4 +76,32 @@ abstract class DataClassMethodGenerator(
|
||||
val copyFunction = bindingContext.get(BindingContext.DATA_CLASS_COPY_FUNCTION, classDescriptor) ?: return
|
||||
generateCopyFunction(copyFunction, constructorParameters)
|
||||
}
|
||||
|
||||
private fun generateDataClassToStringIfNeeded(properties: List<PropertyDescriptor>) {
|
||||
val function = getMemberToGenerate(classDescriptor, "toString",
|
||||
KotlinBuiltIns::isString, List<ValueParameterDescriptor>::isEmpty) ?: return
|
||||
generateToStringMethod(function, properties)
|
||||
}
|
||||
|
||||
private fun generateDataClassHashCodeIfNeeded(properties: List<PropertyDescriptor>) {
|
||||
val function = getMemberToGenerate(classDescriptor, "hashCode",
|
||||
KotlinBuiltIns::isInt, List<ValueParameterDescriptor>::isEmpty) ?: return
|
||||
generateHashCodeMethod(function, properties)
|
||||
}
|
||||
|
||||
private fun generateDataClassEqualsIfNeeded(properties: List<PropertyDescriptor>) {
|
||||
val function = getMemberToGenerate(classDescriptor, "equals",
|
||||
KotlinBuiltIns::isBoolean) { parameters ->
|
||||
parameters.size == 1 && KotlinBuiltIns.isNullableAny(parameters.first().type)
|
||||
} ?: return
|
||||
generateEqualsMethod(function, properties)
|
||||
}
|
||||
|
||||
private val dataProperties: List<PropertyDescriptor>
|
||||
get() = primaryConstructorParameters
|
||||
.filter { it.hasValOrVar() }
|
||||
.map { bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, it)!! }
|
||||
|
||||
private val primaryConstructorParameters: List<KtParameter>
|
||||
get() = (declaration as? KtClass)?.primaryConstructorParameters.orEmpty()
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* 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.backend.common
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.psi.KtClass
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtParameter
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.BindingContextUtils
|
||||
|
||||
abstract class FunctionsFromAnyGenerator(protected val declaration: KtClassOrObject, protected val bindingContext: BindingContext) {
|
||||
protected val classDescriptor: ClassDescriptor = BindingContextUtils.getNotNull(bindingContext, BindingContext.CLASS, declaration)
|
||||
|
||||
open fun generate() {
|
||||
val properties = primaryConstructorProperties
|
||||
if (properties.isNotEmpty()) {
|
||||
generateToStringIfNeeded(properties)
|
||||
generateHashCodeIfNeeded(properties)
|
||||
generateEqualsIfNeeded(properties)
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract fun generateToStringMethod(function: FunctionDescriptor, properties: List<PropertyDescriptor>)
|
||||
|
||||
protected abstract fun generateHashCodeMethod(function: FunctionDescriptor, properties: List<PropertyDescriptor>)
|
||||
|
||||
protected abstract fun generateEqualsMethod(function: FunctionDescriptor, properties: List<PropertyDescriptor>)
|
||||
|
||||
private fun generateToStringIfNeeded(properties: List<PropertyDescriptor>) {
|
||||
val function = CodegenUtil.getMemberToGenerate(
|
||||
classDescriptor, "toString",
|
||||
KotlinBuiltIns::isString, List<ValueParameterDescriptor>::isEmpty
|
||||
) ?: return
|
||||
generateToStringMethod(function, properties)
|
||||
}
|
||||
|
||||
private fun generateHashCodeIfNeeded(properties: List<PropertyDescriptor>) {
|
||||
val function = CodegenUtil.getMemberToGenerate(
|
||||
classDescriptor, "hashCode",
|
||||
KotlinBuiltIns::isInt, List<ValueParameterDescriptor>::isEmpty
|
||||
) ?: return
|
||||
generateHashCodeMethod(function, properties)
|
||||
}
|
||||
|
||||
private fun generateEqualsIfNeeded(properties: List<PropertyDescriptor>) {
|
||||
val function = CodegenUtil.getMemberToGenerate(
|
||||
classDescriptor, "equals",
|
||||
KotlinBuiltIns::isBoolean
|
||||
) { parameters ->
|
||||
parameters.size == 1 && KotlinBuiltIns.isNullableAny(parameters.first().type)
|
||||
} ?: return
|
||||
generateEqualsMethod(function, properties)
|
||||
}
|
||||
|
||||
protected val primaryConstructorProperties: List<PropertyDescriptor>
|
||||
get() = primaryConstructorParameters
|
||||
.filter { it.hasValOrVar() }
|
||||
.map { bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, it)!! }
|
||||
|
||||
protected val primaryConstructorParameters: List<KtParameter>
|
||||
get() = (declaration as? KtClass)?.primaryConstructorParameters.orEmpty()
|
||||
}
|
||||
@@ -56,7 +56,7 @@ fun <Function : FunctionHandle, Signature> generateBridges(
|
||||
|
||||
val implementation = findConcreteSuperDeclaration(function)
|
||||
|
||||
val bridgesToGenerate = findAllReachableDeclarations(function).mapTo(LinkedHashSet<Signature>(), signature)
|
||||
val bridgesToGenerate = findAllReachableDeclarations(function).mapTo(HashSet<Signature>(), signature)
|
||||
|
||||
if (fake) {
|
||||
// If it's a concrete fake override, some of the bridges may be inherited from the super-classes. Specifically, bridges for all
|
||||
@@ -85,7 +85,7 @@ fun <Function : FunctionHandle> findAllReachableDeclarations(function: Function)
|
||||
}
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
DFS.dfs(listOf(function), { it.getOverridden() as Iterable<Function> }, collector)
|
||||
return LinkedHashSet(collector.result())
|
||||
return HashSet(collector.result())
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,24 +1,67 @@
|
||||
/*
|
||||
* 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.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.common
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
import org.jetbrains.kotlin.config.coroutinesIntrinsicsPackageFqName
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyGetterDescriptor
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.DescriptorEquivalenceForOverrides
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.COROUTINES_INTRINSICS_PACKAGE_FQ_NAME
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.COROUTINE_CONTEXT_1_2_20_FQ_NAME
|
||||
import org.jetbrains.kotlin.resolve.calls.checkers.COROUTINE_CONTEXT_FQ_NAME
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.module
|
||||
|
||||
val SUSPEND_COROUTINE_OR_RETURN_NAME = Name.identifier("suspendCoroutineOrReturn")
|
||||
val INTERCEPTED_NAME = Name.identifier("intercepted")
|
||||
val COROUTINE_SUSPENDED_NAME = Name.identifier("COROUTINE_SUSPENDED")
|
||||
|
||||
fun FunctionDescriptor.isBuiltInIntercepted(languageVersionSettings: LanguageVersionSettings): Boolean =
|
||||
!languageVersionSettings.supportsFeature(LanguageFeature.ReleaseCoroutines) &&
|
||||
isTopLevelInPackage("intercepted", languageVersionSettings.coroutinesIntrinsicsPackageFqName().asString())
|
||||
val SUSPEND_COROUTINE_UNINTERCEPTED_OR_RETURN_NAME = Name.identifier("suspendCoroutineUninterceptedOrReturn")
|
||||
|
||||
fun FunctionDescriptor.isBuiltInSuspendCoroutineUninterceptedOrReturn(languageVersionSettings: LanguageVersionSettings): Boolean =
|
||||
isTopLevelInPackage(
|
||||
"suspendCoroutineUninterceptedOrReturn",
|
||||
languageVersionSettings.coroutinesIntrinsicsPackageFqName().asString()
|
||||
fun FunctionDescriptor.isBuiltInIntercepted(): Boolean {
|
||||
if (name != INTERCEPTED_NAME) return false
|
||||
val original =
|
||||
module.getPackage(COROUTINES_INTRINSICS_PACKAGE_FQ_NAME).memberScope
|
||||
.getContributedFunctions(INTERCEPTED_NAME, NoLookupLocation.FROM_BACKEND)
|
||||
.singleOrNull() as CallableDescriptor
|
||||
return DescriptorEquivalenceForOverrides.areEquivalent(original, this)
|
||||
}
|
||||
|
||||
fun FunctionDescriptor.isBuiltInSuspendCoroutineOrReturn(): Boolean {
|
||||
if (name != SUSPEND_COROUTINE_OR_RETURN_NAME) return false
|
||||
|
||||
val originalDeclaration = getBuiltInSuspendCoroutineOrReturn() ?: return false
|
||||
|
||||
return DescriptorEquivalenceForOverrides.areEquivalent(
|
||||
originalDeclaration, this
|
||||
)
|
||||
}
|
||||
|
||||
fun FunctionDescriptor.getBuiltInSuspendCoroutineOrReturn() =
|
||||
module.getPackage(COROUTINES_INTRINSICS_PACKAGE_FQ_NAME).memberScope
|
||||
.getContributedFunctions(SUSPEND_COROUTINE_OR_RETURN_NAME, NoLookupLocation.FROM_BACKEND)
|
||||
.singleOrNull()
|
||||
|
||||
fun FunctionDescriptor.isBuiltInSuspendCoroutineUninterceptedOrReturn(): Boolean {
|
||||
if (name != SUSPEND_COROUTINE_UNINTERCEPTED_OR_RETURN_NAME) return false
|
||||
val original = module.getPackage(COROUTINES_INTRINSICS_PACKAGE_FQ_NAME).memberScope
|
||||
.getContributedFunctions(SUSPEND_COROUTINE_UNINTERCEPTED_OR_RETURN_NAME, NoLookupLocation.FROM_BACKEND)
|
||||
.singleOrNull() as CallableDescriptor
|
||||
return DescriptorEquivalenceForOverrides.areEquivalent(original, this)
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user