Skip to content

Commit

Permalink
(multi-os-engine/multi-os-engine#162) Call standalone reflection coll…
Browse files Browse the repository at this point in the history
…ector after running class validator
  • Loading branch information
Noisyfox committed Jan 19, 2022
1 parent 6245a9a commit 7351d35
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/kotlin/org/moe/gradle/tasks/ClassValidate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import org.moe.gradle.options.ProGuardOptions
import org.moe.gradle.utils.FileUtils
import org.moe.gradle.utils.Mode
import org.moe.tools.classvalidator.ClassValidator
import org.moe.tools.classvalidator.ReflectionCollector
import java.io.File
import java.nio.file.Paths

Expand Down Expand Up @@ -82,15 +83,14 @@ open class ClassValidate : AbstractBaseTask() {

val reflectionConfigFile: File
@Internal
get() = getOutputDir().resolve(ClassValidator.OUTPUT_REFLECTION)
get() = getOutputDir().resolve(ReflectionCollector.OUTPUT_REFLECTION)

override fun run() {
// Clean output dir
FileUtils.deleteFileOrFolder(getOutputDir())

// Run class validator
ClassValidator.process(
mainClassName = getAppMainClassName(),
inputFiles = getInputFiles().toSet(),
classpath = getClasspathFiles().toSet()
// Add input to classpath
Expand All @@ -99,6 +99,7 @@ open class ClassValidate : AbstractBaseTask() {
)

// Collect platform reflection settings
// TODO: Move this to a separate task
// val libraryJars: MutableSet<File> = linkedSetOf(moeSDK.coreJar)
// moeExtension.platformJar?.let {
// libraryJars.add(it)
Expand All @@ -122,11 +123,14 @@ open class ClassValidate : AbstractBaseTask() {
//// libraryJars.add(moeSDK.coreJar)
// }
// }
// ReflectionCollector.process(
// inputFiles = libraryJars,
// outputFile = libraryReflectionConfigFile.toPath(),
// classpath = emptySet()
// )
ReflectionCollector.process(
mainClassName = getAppMainClassName(),
inputFiles = setOf(classesOutputDir), // Use the output of the validator as input
outputDir = getOutputDir().absoluteFile.toPath(),
classpath = getClasspathFiles().toSet()
// Add input to classpath
+ setOf(classesOutputDir)
)
}

@get:Internal
Expand Down

0 comments on commit 7351d35

Please sign in to comment.