@@ -91,77 +91,6 @@ abstract class AbstractModularizedTest : KtUsefulTestCase() {
91
91
AbstractTypeChecker .RUN_SLOW_ASSERTIONS = true
92
92
}
93
93
94
- private fun loadModule (moduleElement : Element ): ModuleData {
95
- val outputDir = moduleElement.getAttribute(" outputDir" ).value
96
- val moduleName = moduleElement.getAttribute(" name" ).value
97
- val moduleNameQualifier = outputDir.substringAfterLast(" /" )
98
- val javaSourceRoots = mutableListOf<JavaSourceRootData <String >>()
99
- val classpath = mutableListOf<String >()
100
- val sources = mutableListOf<String >()
101
- val friendDirs = mutableListOf<String >()
102
- val optInAnnotations = mutableListOf<String >()
103
- val timestamp = moduleElement.getAttribute(" timestamp" )?.longValue ? : 0
104
- val jdkHome = moduleElement.getAttribute(" jdkHome" )?.value
105
- var modularJdkRoot: String? = null
106
- var isCommon = false
107
-
108
- for (item in moduleElement.children) {
109
- when (item.name) {
110
- " classpath" -> {
111
- val path = item.getAttribute(" path" ).value
112
- if (path != outputDir) {
113
- classpath + = path
114
- }
115
- }
116
- " friendDir" -> {
117
- val path = item.getAttribute(" path" ).value
118
- friendDirs + = path
119
- }
120
- " javaSourceRoots" -> {
121
- javaSourceRoots + =
122
- JavaSourceRootData (
123
- item.getAttribute(" path" ).value,
124
- item.getAttribute(" packagePrefix" )?.value,
125
- )
126
- }
127
- " sources" -> sources + = item.getAttribute(" path" ).value
128
- " commonSources" -> isCommon = true
129
- " modularJdkRoot" -> modularJdkRoot = item.getAttribute(" path" ).value
130
- " useOptIn" -> optInAnnotations + = item.getAttribute(" annotation" ).value
131
- }
132
- }
133
-
134
- return ModuleData (
135
- moduleName,
136
- timestamp,
137
- outputDir,
138
- moduleNameQualifier,
139
- classpath,
140
- sources,
141
- javaSourceRoots,
142
- friendDirs,
143
- optInAnnotations,
144
- modularJdkRoot,
145
- jdkHome,
146
- isCommon,
147
- )
148
- }
149
-
150
- private fun loadModuleDumpFile (file : File ): List <ModuleData > {
151
- val rootElement = JDOMUtil .load(file)
152
- val modules = rootElement.getChildren(" module" )
153
- val arguments = rootElement.getChild(" compilerArguments" )?.let { loadCompilerArguments(it) }
154
- return modules.map { node -> loadModule(node).also { it.arguments = arguments } }
155
- }
156
-
157
- private fun loadCompilerArguments (argumentsRoot : Element ): CommonCompilerArguments ? {
158
- val element = argumentsRoot.children.singleOrNull() ? : return null
159
- return when (element.name) {
160
- " K2JVMCompilerArguments" -> K2JVMCompilerArguments ().also { XmlSerializer .deserializeInto(it, element) }
161
- else -> null
162
- }
163
- }
164
-
165
94
protected abstract fun beforePass (pass : Int )
166
95
protected abstract fun afterPass (pass : Int )
167
96
protected open fun afterAllPasses () {}
@@ -249,3 +178,75 @@ fun substituteCompilerPluginPathForKnownPlugins(path: String): File? {
249
178
else -> null
250
179
}
251
180
}
181
+
182
+ internal fun loadModuleDumpFile (file : File ): List <ModuleData > {
183
+ val rootElement = JDOMUtil .load(file)
184
+ val modules = rootElement.getChildren(" module" )
185
+ val arguments = rootElement.getChild(" compilerArguments" )?.let { loadCompilerArguments(it) }
186
+ return modules.map { node -> loadModule(node).also { it.arguments = arguments } }
187
+ }
188
+
189
+ private fun loadModule (moduleElement : Element ): ModuleData {
190
+ val outputDir = moduleElement.getAttribute(" outputDir" ).value
191
+ val moduleName = moduleElement.getAttribute(" name" ).value
192
+ val moduleNameQualifier = outputDir.substringAfterLast(" /" )
193
+ val javaSourceRoots = mutableListOf<JavaSourceRootData <String >>()
194
+ val classpath = mutableListOf<String >()
195
+ val sources = mutableListOf<String >()
196
+ val friendDirs = mutableListOf<String >()
197
+ val optInAnnotations = mutableListOf<String >()
198
+ val timestamp = moduleElement.getAttribute(" timestamp" )?.longValue ? : 0
199
+ val jdkHome = moduleElement.getAttribute(" jdkHome" )?.value
200
+ var modularJdkRoot: String? = null
201
+ var isCommon = false
202
+
203
+ for (item in moduleElement.children) {
204
+ when (item.name) {
205
+ " classpath" -> {
206
+ val path = item.getAttribute(" path" ).value
207
+ if (path != outputDir) {
208
+ classpath + = path
209
+ }
210
+ }
211
+ " friendDir" -> {
212
+ val path = item.getAttribute(" path" ).value
213
+ friendDirs + = path
214
+ }
215
+ " javaSourceRoots" -> {
216
+ javaSourceRoots + =
217
+ JavaSourceRootData (
218
+ item.getAttribute(" path" ).value,
219
+ item.getAttribute(" packagePrefix" )?.value,
220
+ )
221
+ }
222
+ " sources" -> sources + = item.getAttribute(" path" ).value
223
+ " commonSources" -> isCommon = true
224
+ " modularJdkRoot" -> modularJdkRoot = item.getAttribute(" path" ).value
225
+ " useOptIn" -> optInAnnotations + = item.getAttribute(" annotation" ).value
226
+ }
227
+ }
228
+
229
+ return ModuleData (
230
+ moduleName,
231
+ timestamp,
232
+ outputDir,
233
+ moduleNameQualifier,
234
+ classpath,
235
+ sources,
236
+ javaSourceRoots,
237
+ friendDirs,
238
+ optInAnnotations,
239
+ modularJdkRoot,
240
+ jdkHome,
241
+ isCommon,
242
+ )
243
+ }
244
+
245
+ private fun loadCompilerArguments (argumentsRoot : Element ): CommonCompilerArguments ? {
246
+ val element = argumentsRoot.children.singleOrNull() ? : return null
247
+ return when (element.name) {
248
+ " K2JVMCompilerArguments" -> K2JVMCompilerArguments ().also { XmlSerializer .deserializeInto(it, element) }
249
+ else -> null
250
+ }
251
+ }
252
+
0 commit comments