-
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.
Allow modifying generated sources (eg to hook up scalafmt), some gene…
…ral cleanup
- Loading branch information
Showing
16 changed files
with
121 additions
and
58 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.9.8 | ||
sbt.version=1.10.1 |
2 changes: 1 addition & 1 deletion
2
src/sbt-test/sbt-guardrail/java-codegen-app/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 |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.9.8 | ||
sbt.version=1.5.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
> clean | ||
$ absent target/scala-2.12/src_managed/main/com/example/clients/petstore/user/UserClient.java | ||
$ absent target/scala-2.12/src_managed/main/guardrail/com/example/clients/petstore/user/UserClient.java | ||
$ absent target/scala-2.12/classes/com/example/clients/petstore/user/UserClient.class | ||
> compile | ||
$ exists target/scala-2.12/src_managed/main/com/example/clients/petstore/user/UserClient.java | ||
$ exists target/scala-2.12/src_managed/main/guardrail/com/example/clients/petstore/user/UserClient.java | ||
$ exists target/scala-2.12/classes/com/example/clients/petstore/user/UserClient.class | ||
> compile | ||
$ exists target/scala-2.12/src_managed/main/com/example/clients/petstore/user/UserClient.java | ||
$ exists target/scala-2.12/src_managed/main/guardrail/com/example/clients/petstore/user/UserClient.java | ||
$ exists target/scala-2.12/classes/com/example/clients/petstore/user/UserClient.class | ||
> test |
2 changes: 1 addition & 1 deletion
2
src/sbt-test/sbt-guardrail/scala-client-codegen-app/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 |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.9.8 | ||
sbt.version=1.5.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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
> clean | ||
$ absent target/scala-2.12/src_managed/main/com/example/petstore/client/user/UserClient.scala | ||
$ absent target/scala-2.12/src_managed/main/guardrail/com/example/petstore/client/user/UserClient.scala | ||
$ absent target/scala-2.12/classes/com/example/petstore/client/user/UserClient.class | ||
> compile | ||
$ exists target/scala-2.12/src_managed/main/com/example/petstore/client/user/UserClient.scala | ||
$ exists target/scala-2.12/src_managed/main/guardrail/com/example/petstore/client/user/UserClient.scala | ||
$ exists target/scala-2.12/classes/com/example/petstore/client/user/UserClient.class | ||
$ exists target/scala-2.12/src_managed/main/com/example/petstore/server/user/Routes.scala | ||
$ exists target/scala-2.12/src_managed/main/guardrail/com/example/petstore/server/user/Routes.scala | ||
$ exists target/scala-2.12/classes/com/example/petstore/server/user/UserHandler.class | ||
> compile | ||
$ exists target/scala-2.12/src_managed/main/com/example/petstore/client/user/UserClient.scala | ||
$ exists target/scala-2.12/src_managed/main/guardrail/com/example/petstore/client/user/UserClient.scala | ||
$ exists target/scala-2.12/classes/com/example/petstore/client/user/UserClient.class | ||
$ exists target/scala-2.12/src_managed/main/com/example/petstore/server/user/Routes.scala | ||
$ exists target/scala-2.12/src_managed/main/guardrail/com/example/petstore/server/user/Routes.scala | ||
$ exists target/scala-2.12/classes/com/example/petstore/server/user/UserHandler.class | ||
> test |
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 @@ | ||
version = 2.5.2 |
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 @@ | ||
|
||
name := "sbt-guardrail-scala-client-test-app" | ||
|
||
version := "1.0." + System.currentTimeMillis | ||
|
||
scalaVersion := "2.12.18" | ||
|
||
scalacOptions += "-Xexperimental" | ||
|
||
Compile / guardrailTasks := GuardrailHelpers.createGuardrailTasks((Compile / sourceDirectory).value / "openapi") { openApiFile => | ||
List( | ||
ScalaClient(openApiFile.file), | ||
) | ||
} | ||
|
||
Compile / scalafmt / unmanagedSources ++= (Compile / guardrail).value |
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.5.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,12 @@ | ||
{ | ||
val pluginVersion = System.getProperty("plugin.version") | ||
if(pluginVersion == null) | ||
throw new RuntimeException("""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
else addSbtPlugin("dev.guardrail" % "sbt-guardrail" % pluginVersion) | ||
} | ||
|
||
libraryDependencies += "dev.guardrail" %% "guardrail-scala-support" % "1.0.0-M1" | ||
libraryDependencies += "dev.guardrail" %% "guardrail-scala-akka-http" % "1.0.0-M1" | ||
|
||
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") |
43 changes: 43 additions & 0 deletions
43
src/sbt-test/sbt-guardrail/scalafmt/src/main/openapi/com/example/petstore.json
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,43 @@ | ||
{ | ||
"swagger": "2.0", | ||
"host": "petstore.swagger.io", | ||
"basePath": "/v2", | ||
"schemes": [ | ||
"http" | ||
], | ||
"definitions": { | ||
"Order": { | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "integer", | ||
"format": "int64" | ||
}, | ||
"petId": { | ||
"type": "integer", | ||
"format": "int64" | ||
}, | ||
"quantity": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"shipDate": { | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"status": { | ||
"type": "string", | ||
"description": "Order Status", | ||
"x-scala-type": "OrderStatus" | ||
}, | ||
"complete": { | ||
"type": "boolean", | ||
"default": false | ||
} | ||
}, | ||
"xml": { | ||
"name": "Order" | ||
} | ||
} | ||
} | ||
} |
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,10 @@ | ||
> clean | ||
$ absent target/scala-2.12/src_managed/main/guardrail/swagger/definitions/Order.scala | ||
> Compile / guardrail | ||
$ exists target/scala-2.12/src_managed/main/guardrail/swagger/definitions/Order.scala | ||
$ copy-file target/scala-2.12/src_managed/main/guardrail/swagger/definitions/Order.scala created | ||
> Compile / scalafmt | ||
$ newer target/scala-2.12/src_managed/main/guardrail/swagger/definitions/Order.scala created | ||
$ copy-file target/scala-2.12/src_managed/main/guardrail/swagger/definitions/Order.scala formatted | ||
> Compile / guardrail | ||
-$ newer target/scala-2.12/src_managed/main/guardrail/swagger/definitions/Order.scala formatted |