Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove generated antlr code. Add build task dependency #161

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.