-
Notifications
You must be signed in to change notification settings - Fork 17
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
1 parent
ee6fa40
commit fb8ba6e
Showing
15 changed files
with
158 additions
and
94 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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
|
||
lazy val parser = project | ||
.in(file("parser")) | ||
.settings( | ||
crossPaths := false, | ||
autoScalaLibrary := false, | ||
libraryDependencies ++= Seq( | ||
"com.github.sbt" % "sbt-avro-compiler-bridge" % sys.props("plugin.version"), | ||
"org.apache.avro" % "avro-compiler" % "1.12.0" | ||
) | ||
) | ||
|
||
lazy val root = project | ||
.in(file(".")) | ||
.enablePlugins(SbtAvro) | ||
.dependsOn(parser % "avro") | ||
.settings( | ||
avroCompilerClass := "com.github.sbt.avro.CustomAvroCompiler" | ||
) |
23 changes: 23 additions & 0 deletions
23
...test/sbt-avro/avscparser/parser/src/main/java/com/github/sbt/avro/CustomAvroCompiler.java
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.github.sbt.avro; | ||
|
||
import org.apache.avro.Schema; | ||
import org.apache.avro.SchemaBuilder; | ||
import org.apache.avro.NameValidator; | ||
|
||
import java.util.Collections; | ||
|
||
public class CustomAvroCompiler extends AvroCompilerBridge { | ||
|
||
@Override | ||
protected Schema.Parser createParser() { | ||
Schema.Parser parser = new Schema.Parser(); | ||
parser.setValidateDefaults(false); | ||
Schema externalSchema = SchemaBuilder | ||
.enumeration("B") | ||
.namespace("com.github.sbt.avro.test") | ||
.symbols("B1"); | ||
parser.addTypes(Collections.singletonList(externalSchema)); | ||
return parser; | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
plugin/src/sbt-test/sbt-avro/avscparser/project/build.properties
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.3.0 |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sys.props.get("plugin.version") match { | ||
case Some(x) => addSbtPlugin("com.github.sbt" % "sbt-avro" % x) | ||
case _ => sys.error("""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
} |
Oops, something went wrong.