-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
32 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 1 addition & 10 deletions
11
src/main/groovy/org/jetbrains/grammarkit/tasks/BaseTask.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 11 additions & 16 deletions
27
src/main/groovy/org/jetbrains/grammarkit/tasks/GenerateParser.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,34 @@ | ||
package org.jetbrains.grammarkit.tasks | ||
|
||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.Optional | ||
|
||
class GenerateParser extends BaseTask { | ||
@Input def source | ||
@Input @Optional def targetRoot | ||
@Input | ||
def source | ||
@Input | ||
def targetRoot | ||
// would be nice to obtain these from the GC | ||
@Input def pathToParser | ||
@Input def pathToPsiRoot | ||
@Input | ||
def pathToParser | ||
@Input | ||
def pathToPsiRoot | ||
|
||
GenerateParser() { | ||
setMain("org.intellij.grammar.Main"); | ||
project.afterEvaluate { | ||
def bnfFile = project.file(source) | ||
inputs.file bnfFile | ||
def effectiveTargetRoot = getEffectiveTargetRoot() | ||
def parserFile = project.file("$effectiveTargetRoot$pathToParser") | ||
def parserFile = project.file("$targetRoot$pathToParser") | ||
outputs.file parserFile | ||
def psiDir = project.file("$effectiveTargetRoot$pathToPsiRoot") | ||
def psiDir = project.file("$targetRoot$pathToPsiRoot") | ||
outputs.dir psiDir | ||
|
||
args = [project.file(effectiveTargetRoot), bnfFile] | ||
args = [project.file(targetRoot), bnfFile] | ||
|
||
classpath project.configurations.compile + project.configurations.compileOnly | ||
|
||
purgeFiles(parserFile, psiDir) | ||
} | ||
} | ||
|
||
String getEffectiveTargetRoot() { | ||
if (targetRoot != null) { | ||
return targetRoot; | ||
} | ||
return getExtension().grammarKitTargetRoot; | ||
} | ||
} | ||
|