Skip to content

Commit a58a772

Browse files
committed
Preprocessor: cleanup unused code.
1 parent 423a146 commit a58a772

File tree

4 files changed

+1
-109
lines changed

4 files changed

+1
-109
lines changed

compiler/conditional-preprocessor/conditional-preprocessor.iml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<orderEntry type="sourceFolder" forTests="false" />
1010
<orderEntry type="library" name="kotlin-runtime" level="project" />
1111
<orderEntry type="library" name="intellij-core" level="project" />
12-
<orderEntry type="library" name="ant" level="project" />
1312
<orderEntry type="module" module-name="cli" />
1413
<orderEntry type="module" module-name="frontend" />
1514
</component>

compiler/conditional-preprocessor/src/org.jetbrains.kotlin.preprocessor/Preprocessor.kt

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public class Preprocessor(val logger: Logger = SystemOutLogger) {
114114
if (targetFile.exists() && targetFile.isDirectory)
115115
targetFile.deleteRecursively()
116116

117-
// if no modifications copy
117+
// if no modifications copy
118118
if (result is FileProcessingResult.Copy) {
119119
FileUtil.copy(sourceFile, targetFile)
120120
} else if (result is FileProcessingResult.Modify) {
@@ -144,45 +144,6 @@ public class Preprocessor(val logger: Logger = SystemOutLogger) {
144144
}
145145
}
146146

147-
148-
private fun processFileMultiEvaluators(sourceFile: File, evaluators: List<Evaluator>): List<FileProcessingResult> {
149-
if (sourceFile.extension != fileType.defaultExtension)
150-
return evaluators map { FileProcessingResult.Copy }
151-
152-
val sourceText = sourceFile.readText().convertLineSeparators()
153-
val psiFile = jetPsiFactory.createFile(sourceFile.name, sourceText)
154-
println("$psiFile")
155-
156-
val results = hashMapOf<Evaluator, FileProcessingResult>()
157-
158-
val fileAnnotations = psiFile.parseConditionalAnnotations()
159-
evaluators.forEach { evaluator ->
160-
if (!evaluator(fileAnnotations))
161-
results += evaluator to FileProcessingResult.Skip
162-
}
163-
164-
val visitor = CollectModificationsVisitor(evaluators - results.keySet())
165-
psiFile.accept(visitor)
166-
167-
for ((evaluator, list) in visitor.elementModifications) {
168-
val result =
169-
if (list.isNotEmpty())
170-
FileProcessingResult.Modify(sourceText, list)
171-
else
172-
FileProcessingResult.Copy
173-
results += evaluator to result
174-
}
175-
return evaluators.map { results[it]!! }
176-
}
177-
178-
private fun processDirectoryMultiEvaluators(sourceRoot: File, targetRelativeRoot: File, profiles: List<Profile>) {
179-
180-
val (sourceFiles, sourceDirectories) = sourceRoot.listFiles().partition { !it.isDirectory }
181-
182-
// TODO: keep processed file list for each profile
183-
val processedFiles = profiles.toMap({ it }, { hashSetOf<File>()})
184-
185-
}
186147
}
187148

188149
fun String.convertLineSeparators(): String = StringUtil.convertLineSeparators(this)

compiler/conditional-preprocessor/src/org.jetbrains.kotlin.preprocessor/PreprocessorCLI.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,4 @@ fun main(args: Array<String>) {
3333

3434
println("Preprocessing sources in $sourcePath to $targetPath with profile ${profile.name}")
3535
Preprocessor().processSources(sourcePath, profile)
36-
37-
// val pool = Executors.newCachedThreadPool()
38-
//
39-
// profiles.forEach { profile -> pool.submit { Preprocessor().processSources(sourcePath, profile) } }
40-
//
41-
// pool.shutdown()
42-
// pool.awaitTermination(1, TimeUnit.MINUTES)
4336
}

compiler/conditional-preprocessor/src/org.jetbrains.kotlin.preprocessor/PreprocessorTask.kt

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)