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

add [sbt-test] [java-codegen-app] #35

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions src/sbt-test/sbt-guardrail/java-codegen-app/build.sbt
@@ -0,0 +1,28 @@

enablePlugins(GuardrailPlugin)

name := "sbt-guardrail-java-test-app"

version := "1.0." + System.currentTimeMillis

scalaVersion := "2.12.10"

scalacOptions += "-Xexperimental"

guardrailTasks in Compile := List(
JavaClient(file("petstore.json"), pkg="com.example.clients.petstore")
)

// workaround for SBT issue
sullis marked this conversation as resolved.
Show resolved Hide resolved
unmanagedSourceDirectories in Compile += (sourceManaged in Compile).value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be managedSourceDirectories in Compile?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have context on why this construct was chosen, but as managed seems to be the way to go, considering the linked issue, probably yes.

As this is just in the scripted tests, I wonder what the actual impact is -- maybe accumulating cruft when folks run the scripted tests locally?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I questioned it is because I saw it from the linked issue and it confused me as I was trying to figure out what to do in my own project. I wanted to make sure there wasn't a reason for doing it this way

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I saw your contribution to the thread -- I must admit I don't really understand the distinction myself. I'm really only drawn into sbt-guardrail when something actively breaks, as there's still much to do in the primary repo.

Looking at sbt/sbt#4654, it seems as though managedSourceDirectories really is the correct thing to do, though due to the simplicity of these tests (not integrating with any other plugins) I don't think there's a huge material difference to these tests.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I hadn't realized this was test code, but as long as the tests are passing it doesn't matter. For reference, "managed" means it's generated code whereas "unmanaged" is just regular user-written code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, it should be changed for correctness, thanks for bringing it up!


val jacksonVersion = "2.10.1"

libraryDependencies ++= Seq(
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion,
"com.fasterxml.jackson.datatype" % "jackson-datatype-jdk8" % jacksonVersion,
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % jacksonVersion,
"org.asynchttpclient" % "async-http-client" % "2.10.4",
"javax.xml.bind" % "jaxb-api" % "2.3.1",
"org.scalatest" %% "scalatest" % "3.0.8" % "test"
)