diff --git a/buildSrc/src/main/kotlin/JFlexExec.kt b/buildSrc/src/main/kotlin/JFlexExec.kt index dca469daa..7522ae73c 100644 --- a/buildSrc/src/main/kotlin/JFlexExec.kt +++ b/buildSrc/src/main/kotlin/JFlexExec.kt @@ -26,22 +26,29 @@ import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.FileCollection import org.gradle.api.file.FileSystemOperations import org.gradle.api.file.RegularFileProperty +import org.gradle.api.tasks.CacheableTask +import org.gradle.api.tasks.Classpath import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.Internal import org.gradle.api.tasks.JavaExec import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.OutputFile +import org.gradle.api.tasks.PathSensitive +import org.gradle.api.tasks.PathSensitivity +@CacheableTask abstract class JFlexExec : JavaExec() { @get:InputFile + @get:PathSensitive(PathSensitivity.RELATIVE) abstract val sourceFile: RegularFileProperty - @get:InputFiles + @get:Classpath abstract val jflex: ConfigurableFileCollection @get:InputFile + @get:PathSensitive(PathSensitivity.RELATIVE) abstract val skeletonFile: RegularFileProperty @get:OutputDirectory diff --git a/buildSrc/src/main/kotlin/ParserExec.kt b/buildSrc/src/main/kotlin/ParserExec.kt index adb38256d..ad00c9014 100644 --- a/buildSrc/src/main/kotlin/ParserExec.kt +++ b/buildSrc/src/main/kotlin/ParserExec.kt @@ -24,26 +24,29 @@ import org.gradle.api.file.ConfigurableFileCollection import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.FileSystemOperations import org.gradle.api.file.RegularFileProperty +import org.gradle.api.tasks.CacheableTask +import org.gradle.api.tasks.Classpath import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.Internal import org.gradle.api.tasks.JavaExec import org.gradle.api.tasks.OutputDirectory +import org.gradle.api.tasks.PathSensitive +import org.gradle.api.tasks.PathSensitivity +@CacheableTask abstract class ParserExec : JavaExec() { @get:InputFile + @get:PathSensitive(PathSensitivity.RELATIVE) abstract val sourceFile: RegularFileProperty - @get:InputFiles + @get:Classpath abstract val grammarKit: ConfigurableFileCollection - @get:OutputDirectory + @get:Internal abstract val destinationRootDirectory: DirectoryProperty - @get:OutputDirectory - abstract val destinationDirectory: DirectoryProperty - @get:OutputDirectory abstract val psiDirectory: DirectoryProperty diff --git a/buildSrc/src/main/kotlin/util.kt b/buildSrc/src/main/kotlin/util.kt index 7a6623b23..d36de248f 100644 --- a/buildSrc/src/main/kotlin/util.kt +++ b/buildSrc/src/main/kotlin/util.kt @@ -24,6 +24,7 @@ import org.gradle.api.JavaVersion import org.gradle.api.Project import org.gradle.api.tasks.JavaExec import org.gradle.api.tasks.TaskContainer +import org.gradle.api.tasks.TaskProvider import org.gradle.kotlin.dsl.RegisteringDomainObjectDelegateProviderWithTypeAndAction import org.gradle.kotlin.dsl.getValue import org.gradle.kotlin.dsl.provideDelegate @@ -39,8 +40,8 @@ fun Project.lexer(flex: String, pack: String): TaskDelegate { return tasks.registering(JFlexExec::class) { sourceFile.set(layout.projectDirectory.file("src/main/grammars/$flex.flex")) - destinationDirectory.set(layout.buildDirectory.dir("gen/$pack")) - destinationFile.set(layout.buildDirectory.file("gen/$pack/$flex.java")) + destinationDirectory.set(layout.buildDirectory.dir("gen/$pack/lexer")) + destinationFile.set(layout.buildDirectory.file("gen/$pack/lexer/$flex.java")) logFile.set(layout.buildDirectory.file("logs/generate$flex.log")) val jflex by project.configurations @@ -61,7 +62,6 @@ fun Project.parser(bnf: String, pack: String): TaskDelegate { val dest = destRoot.map { it.dir(pack) } sourceFile.set(project.layout.projectDirectory.file("src/main/grammars/$bnf.bnf")) destinationRootDirectory.set(destRoot) - destinationDirectory.set(dest) psiDirectory.set(dest.map { it.dir("psi") }) parserDirectory.set(dest.map { it.dir("parser") }) logFile.set(layout.buildDirectory.file("logs/generate$bnf.log"))