Skip to content

Commit

Permalink
Merge pull request #161 from IamCornholio/fix/antlr-grammar-generation
Browse files Browse the repository at this point in the history
Remove generated antlr code. Add build task dependency
  • Loading branch information
markphilpot committed Aug 15, 2016
2 parents 7ac8176 + 73e534f commit f9ca3ac
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 4,404 deletions.
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'antlr'

sourceCompatibility = 1.6
targetCompatibility = 1.6
Expand All @@ -28,13 +29,22 @@ jar {
dependencies {
compile 'org.antlr:antlr4-runtime:4.5.1'
compile 'org.slf4j:slf4j-api:1.7.12'
antlr "org.antlr:antlr4:4.5.1"
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile 'org.codehaus.groovy:groovy-all:2.4.4'
testCompile 'cglib:cglib-nodep:3.1'
testCompile 'org.objenesis:objenesis:2.1'
}

compileJava.source file("build/generated-src"), sourceSets.main.java

generateGrammarSource {
maxHeapSize = "64m"
arguments += ["-visitor"]
outputDirectory = file("${project.buildDir}/generated-src/antlr/main/graphql/parser/antlr")
}

task sourcesJar(type: Jar) {
dependsOn classes
classifier 'sources'
Expand Down Expand Up @@ -123,6 +133,11 @@ bintray {
}
}

// all publish tasks depend on the build task
tasks.withType(PublishToMavenRepository) {
dependsOn build
}


task wrapper(type: Wrapper) {
gradleVersion = '2.11'
Expand Down
7 changes: 5 additions & 2 deletions src/main/grammar/Graphql.g4 → src/main/antlr/Graphql.g4
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
grammar Graphql;

@header {
package graphql.parser.antlr;
}
// Document

document : definition+;
Expand Down Expand Up @@ -134,11 +137,11 @@ fragment EscapedChar : '\\' (["\\/bfnrt] | Unicode) ;
fragment Unicode : 'u' Hex Hex Hex Hex ;
fragment Hex : [0-9a-fA-F] ;
Ignored: (Whitspace|Comma|LineTerminator|Comment) -> skip;
Ignored: (Whitespace|Comma|LineTerminator|Comment) -> skip;
fragment Comment: '#' ~[\n\r\u2028\u2029]*;
fragment LineTerminator: [\n\r\u2028\u2029];
fragment Whitspace : [\t\u000b\f\u0020\u00a0];
fragment Whitespace : [\t\u000b\f\u0020\u00a0];
fragment Comma : ',';
44 changes: 0 additions & 44 deletions src/main/java/graphql/parser/antlr/Graphql.tokens

This file was deleted.

0 comments on commit f9ca3ac

Please sign in to comment.