-
Notifications
You must be signed in to change notification settings - Fork 17
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
Package, publish and unpack avro schema artifact #18
Merged
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f2fdc38
Package, publish and unpack avro schema artifact
10bd51c
Update README
2781614
Merge branch 'master' into package-avro
c641d07
Fix caching and use separate target directory
9fc73fe
Introduce avroDependencyIncludeFilter setting
RustedBones 5efdb45
Merge branch 'master' into package-avro
RustedBones d18acfd
Use target setting
RustedBones 79cad56
Merge branch 'master' into package-avro
RustedBones 6642ac9
Unpack avro sources dependencies in sourceManaged folder
RustedBones ba34024
Merge branch 'master' into package-avro
nevillelyh 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
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,48 @@ | ||
import sbt.Keys.scalaVersion | ||
|
||
lazy val commonSettings = Seq( | ||
organization := "com.cavorite", | ||
publishTo := Some(Opts.resolver.sonatypeReleases), | ||
libraryDependencies ++= Seq( | ||
"org.apache.avro" % "avro" % "1.9.2" | ||
) | ||
) | ||
|
||
lazy val `external`: Project = project | ||
.in(file("external")) | ||
.settings(commonSettings) | ||
.settings( | ||
name := "external", | ||
version := "0.0.1-SNAPSHOT", | ||
crossPaths := false, | ||
autoScalaLibrary := false, | ||
packageAvro / publishArtifact := true | ||
) | ||
|
||
lazy val `transitive`: Project = project | ||
.in(file("transitive")) | ||
.settings(commonSettings) | ||
.settings( | ||
name := "transitive", | ||
version := "0.0.1-SNAPSHOT", | ||
scalaVersion := "2.12.11", | ||
packageAvro / publishArtifact := true, | ||
libraryDependencies ++= Seq( | ||
"com.cavorite" % "external" % "0.0.1-SNAPSHOT" classifier "avro", | ||
) | ||
) | ||
|
||
lazy val root: Project = project | ||
.in(file(".")) | ||
.settings(commonSettings) | ||
.settings( | ||
name := "publishing-test", | ||
scalaVersion := "2.12.11", | ||
avroDependencyIncludeFilter := avroDependencyIncludeFilter.value || | ||
// add avro jar to unpack its json avsc schema | ||
moduleFilter(organization = "org.apache.avro", name = "avro"), | ||
libraryDependencies ++= Seq( | ||
"com.cavorite" %% "transitive" % "0.0.1-SNAPSHOT" classifier "avro", | ||
"org.specs2" %% "specs2-core" % "3.10.0" % "test" | ||
) | ||
) |
6 changes: 6 additions & 0 deletions
6
src/sbt-test/sbt-avro/publishing/external/src/main/avro/avdl.avdl
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,6 @@ | ||
@namespace("com.cavorite.external") | ||
protocol ProtocolAvdl { | ||
record Avdl { | ||
string stringField; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/sbt-test/sbt-avro/publishing/external/src/main/avro/avpr.avpr
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,16 @@ | ||
{ | ||
"namespace": "com.cavorite.external", | ||
"protocol": "ProtocolAvpr", | ||
"types": [ | ||
{ | ||
"name": "Avpr", | ||
"type": "record", | ||
"fields": [ | ||
{ | ||
"name": "stringField", | ||
"type": "string" | ||
} | ||
] | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
src/sbt-test/sbt-avro/publishing/external/src/main/avro/avsc.avsc
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,11 @@ | ||
{ | ||
"name": "Avsc", | ||
"namespace": "com.cavorite.external", | ||
"type": "record", | ||
"fields": [ | ||
{ | ||
"name": "stringField", | ||
"type": "string" | ||
} | ||
] | ||
} |
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.10 |
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,7 @@ | ||
sys.props.get("plugin.version") match { | ||
case Some(x) => addSbtPlugin("com.cavorite" % "sbt-avro" % x) | ||
case _ => sys.error("""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
} | ||
|
||
libraryDependencies += "org.apache.avro" % "avro-compiler" % "1.9.2" |
11 changes: 11 additions & 0 deletions
11
src/sbt-test/sbt-avro/publishing/src/main/scala/com/cavorite/Main.scala
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,11 @@ | ||
import com.cavorite.external | ||
import com.cavorite.transitive | ||
|
||
|
||
object Main extends App { | ||
|
||
external.Avsc.newBuilder().setStringField("external").build() | ||
transitive.Avsc.newBuilder().setStringField("transitive").build() | ||
|
||
println("success") | ||
} |
Oops, something went wrong.
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 a trade-off: Unpack on separate directories to avoid file name conflict between deps and fail avro generation in case
avroUseNamespace
is set. Or unpack all schemas inextractTarget
but risk conflict