-
Notifications
You must be signed in to change notification settings - Fork 24
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
[WIP] Courier key type #61
Open
kchen-coursera
wants to merge
10
commits into
master
Choose a base branch
from
courier-keyType
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d2d31da
Bumped version to 2.1 due to new Key feature
kchen-coursera e854539
added Key declaration
kchen-coursera d719be9
parsing key as record data schema
kchen-coursera f37c98c
bumped to 2.1.0
kchen-coursera 4a92aea
fixed accidentally bumping scala version
kchen-coursera a022fcd
got publish-local working
kchen-coursera dadcfa4
running into some parseNamedType error
kchen-coursera cb3d8a1
fixed parseNamedType error
kchen-coursera d4bc528
wip
kchen-coursera 67f795a
updated key name in plugin
kchen-coursera File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
courierVersion=2.0.10 | ||
courierVersion=2.1.0 | ||
scalaMajorVersion=2.11 |
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
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
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
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 |
---|---|---|
|
@@ -57,6 +57,7 @@ | |
import org.coursera.courier.grammar.CourierParser.ImportDeclarationContext; | ||
import org.coursera.courier.grammar.CourierParser.ImportDeclarationsContext; | ||
import org.coursera.courier.grammar.CourierParser.JsonValueContext; | ||
import org.coursera.courier.grammar.CourierParser.KeyDeclarationContext; | ||
import org.coursera.courier.grammar.CourierParser.MapDeclarationContext; | ||
import org.coursera.courier.grammar.CourierParser.NamedTypeDeclarationContext; | ||
import org.coursera.courier.grammar.CourierParser.ObjectEntryContext; | ||
|
@@ -164,6 +165,7 @@ public void parse(Reader reader) { | |
parser.addErrorListener(errorRecorder); | ||
|
||
DocumentContext antlrDocument = parser.document(); | ||
// System.out.println("\n!!!!!!!!\n"+antlrDocument.toStringTree()+"\n!!!!!!!!\n"); | ||
parse(antlrDocument); | ||
|
||
if (errorRecorder.errors.size() > 0) { | ||
|
@@ -326,6 +328,8 @@ private NamedDataSchema parseNamedType( | |
return parseFixed(namedType, namedType.fixedDeclaration()); | ||
} else if (namedType.enumDeclaration() != null) { | ||
return parseEnum(namedType, namedType.enumDeclaration()); | ||
} else if (namedType.keyDeclaration() != null) { | ||
return parseKey(namedType, namedType.keyDeclaration()); | ||
} else { | ||
throw new ParseException(namedType, | ||
"Unrecognized named type parse node: " + namedType.getText()); | ||
|
@@ -469,9 +473,24 @@ private UnionDataSchema parseUnion( | |
return schema; | ||
} | ||
|
||
private RecordDataSchema parseRecord( | ||
private RecordDataSchema parseKey( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We likely have to copy |
||
NamedTypeDeclarationContext context, | ||
RecordDeclarationContext record) throws ParseException { | ||
KeyDeclarationContext key) throws ParseException { | ||
Name name = toName(key.name); | ||
RecordDataSchema schema = new RecordDataSchema(name, RecordDataSchema.RecordType.RECORD); | ||
|
||
bindNameToSchema(name, schema); | ||
FieldsAndIncludes fieldsAndIncludes = parseFields(schema, key.keyDecl); | ||
schema.setFields(fieldsAndIncludes.fields, errorMessageBuilder()); | ||
validateDefaults(schema); | ||
schema.setInclude(fieldsAndIncludes.includes); | ||
setProperties(context, schema); | ||
return schema; | ||
} | ||
|
||
private RecordDataSchema parseRecord( | ||
NamedTypeDeclarationContext context, | ||
RecordDeclarationContext record) throws ParseException { | ||
Name name = toName(record.name); | ||
RecordDataSchema schema = new RecordDataSchema(name, RecordDataSchema.RecordType.RECORD); | ||
|
||
|
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,9 +1,9 @@ | ||
#!/bin/bash | ||
sbt fullpublish-mavenlocal # publish courier to maven local so that the gradle build for gradle-plugin can depend on it | ||
sbt fullpublish-ivylocal | ||
(cd gradle-plugin; ./gradlew install) | ||
if hash mvn 2>/dev/null; then | ||
(cd maven-plugin; mvn clean install) | ||
else | ||
echo "mvn not install, skipping publish for maven-plugin" | ||
fi | ||
#(cd gradle-plugin; ./gradlew install) | ||
#if hash mvn 2>/dev/null; then | ||
# (cd maven-plugin; mvn clean install) | ||
#else | ||
# echo "mvn not install, skipping publish for maven-plugin" | ||
#fi |
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 +1 @@ | ||
version in ThisBuild := "2.0.10" | ||
version in ThisBuild := "2.1.0" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is important to ensure that all local changes are published for testing