From 2e4907b65556d48bdf2bca6d60e41c1924e39767 Mon Sep 17 00:00:00 2001 From: Daniele Riccardelli Date: Mon, 28 Sep 2020 13:42:10 +0200 Subject: [PATCH] configure publish settings --- README.md | 10 ++--- build.sbt | 37 +++++++++++++++---- docs/README.md | 10 ++--- project/metals.sbt | 2 +- project/plugins.sbt | 2 + .../declaration_order/project/plugins.sbt | 2 +- src/sbt-test/kara/dirty/project/plugins.sbt | 2 +- src/sbt-test/kara/e2e/project/plugins.sbt | 2 +- src/sbt-test/kara/imports/project/plugins.sbt | 2 +- version.sbt | 7 +--- 10 files changed, 48 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 612efaa..df7134b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # kara -### Automated generation of [Finagle](https://twitter.github.io/finagle/) HTTP/JSON services and [Swagger UI](https://swagger.io/tools/swagger-ui/) from [Thrift](https://thrift.apache.org/) service definitions. +### Generate [Finagle](https://twitter.github.io/finagle/) HTTP/JSON services and [Swagger UI](https://swagger.io/tools/swagger-ui/) from [Thrift](https://thrift.apache.org/) service definitions. ------ @@ -15,7 +15,7 @@ And since a HTTP/JSON API is exposed, you don't necessarily have to deal with th ## Usage -- Add **kara** as a plugin to the sbt project adding a line containing `addSbtPlugin("com.ea" % "kara" % "0.1.0")` in `project/plugins.sbt`. +- Add **kara** as a plugin to the sbt project adding a line containing `addSbtPlugin("com.ea.kara" % "kara" % "0.1.0")` in `project/plugins.sbt`. - In your project settings in `build.sbt`: - configure `karaServices = Seq("fully_qualified_service_1", "fully_qualified_service_2, ...)` to indicate the Thrift services Kara should generate Finagle services and Swagger UI for. Services should be listed in `.` format. - enable the the plugin with `.enablePlugins(Kara)` on the project that lists the Thrift sources and on which `ScroogeSBT` is enabled. @@ -27,7 +27,7 @@ On compilation (`sbt compile`), a Finagle HTTP service named `Http #### project/plugins.sbt ```scala -addSbtPlugin("com.ea" % "kara" % "0.1.0") +addSbtPlugin("com.ea.kara" % "kara" % "0.1.0") ``` #### build.sbt @@ -38,7 +38,7 @@ addSbtPlugin("com.ea" % "kara" % "0.1.0") lazy val thrift = project.in(file("thrift")) .settings( // ... - karaServices := Seq("path.to.Service1", "path.to.Service2") + karaServices := Seq("path.to.ExampleService1", "path.to.ExampleService2") ).enablePlugins(Kara) // ... @@ -62,7 +62,7 @@ Http.server.serve(":8080", karaSvc) ## Swagger UI -`kara` v.`0.1.0` employs Swagger UI v`.3.31.1`. +`kara` v.`0.1.0` employs Swagger UI v.`3.31.1`. ## Testing diff --git a/build.sbt b/build.sbt index efc74d3..ada59d3 100644 --- a/build.sbt +++ b/build.sbt @@ -12,18 +12,40 @@ envVars ++= Map("CI_PROJECT_DIR" -> sys.env.getOrElse("CI_PROJECT_DIR", ".")) lazy val sbtOps = sys.env.get("SBT_OPTS").map(_.split(" ")).getOrElse(Array.empty) +lazy val publishSettings = Seq( + homepage := Some(url("https://github.com/electronicarts/kara")), + organization := "com.ea.kara", + licenses := Seq("The 3-Clause BSD License" -> url("http://opensource.org/licenses/BSD-3-Clause")), + publishMavenStyle := true, + publishTo := sonatypePublishToBundle.value, + scmInfo := Some( + ScmInfo( + url("https://github.com/electronicarts/kara"), + "scm:git:git@github.com:electornicarts/kara.git" + ) + ), + pomExtra := + + + Electronic Arts Inc. + https://ea.com + + +) + lazy val root = (project in file(".")) .enablePlugins(ScriptedPlugin) .settings( + publishSettings, addSbtPlugin("com.twitter" % "scrooge-sbt-plugin" % finagleVersion), libraryDependencies ++= Seq( - "commons-io" % "commons-io" % "2.7", - "org.scalatra.scalate" %% "scalate-core" % "1.9.6", - "com.twitter" %% "finagle-http" % finagleVersion % Test, - "io.circe" %% "circe-yaml" % "0.13.0", - "com.github.pathikrit" %% "better-files" % "3.9.1", - "io.swagger.parser.v3" % "swagger-parser" % "2.0.21" % Test, - "org.scalatest" %% "scalatest" % "3.2.1" % Test + "commons-io" % "commons-io" % "2.7", + "org.scalatra.scalate" %% "scalate-core" % "1.9.6", + "com.twitter" %% "finagle-http" % finagleVersion % Test, + "io.circe" %% "circe-yaml" % "0.13.0", + "com.github.pathikrit" %% "better-files" % "3.9.1", + "io.swagger.parser.v3" % "swagger-parser" % "2.0.21" % Test, + "org.scalatest" %% "scalatest" % "3.2.1" % Test ), scriptedLaunchOpts ++= Seq( "-Xmx1024M", @@ -31,7 +53,6 @@ lazy val root = (project in file(".")) ) ++ sbtOps, scriptedBufferLog := false, name := "kara", - organization := "com.ea", sbtPlugin := true, scalaVersion := "2.12.12" ) diff --git a/docs/README.md b/docs/README.md index 1c766eb..1393a87 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,5 @@ # kara -### Automated generation of [Finagle](https://twitter.github.io/finagle/) HTTP/JSON services and [Swagger UI](https://swagger.io/tools/swagger-ui/) from [Thrift](https://thrift.apache.org/) service definitions. +### Generate [Finagle](https://twitter.github.io/finagle/) HTTP/JSON services and [Swagger UI](https://swagger.io/tools/swagger-ui/) from [Thrift](https://thrift.apache.org/) service definitions. ------ @@ -13,7 +13,7 @@ And since a HTTP/JSON API is exposed, you don't necessarily have to deal with th **NOTE**: while extremely useful during development, **kara** is not intended for production use. ## Usage -- Add **kara** as a plugin to the sbt project adding a line containing `addSbtPlugin("com.ea" % "kara" % "@VERSION@")` in `project/plugins.sbt`. +- Add **kara** as a plugin to the sbt project adding a line containing `addSbtPlugin("com.ea.kara" % "kara" % "@VERSION@")` in `project/plugins.sbt`. - In your project settings in `build.sbt`: - configure `karaServices = Seq("fully_qualified_service_1", "fully_qualified_service_2, ...)` to indicate the Thrift services Kara should generate Finagle services and Swagger UI for. Services should be listed in `.` format. - enable the the plugin with `.enablePlugins(Kara)` on the project that lists the Thrift sources and on which `ScroogeSBT` is enabled. @@ -24,7 +24,7 @@ On compilation (`sbt compile`), a Finagle HTTP service named `Http #### project/plugins.sbt ```scala -addSbtPlugin("com.ea" % "kara" % "@VERSION@") +addSbtPlugin("com.ea.kara" % "kara" % "@VERSION@") ``` #### build.sbt @@ -34,7 +34,7 @@ addSbtPlugin("com.ea" % "kara" % "@VERSION@") lazy val thrift = project.in(file("thrift")) .settings( // ... - karaServices := Seq("path.to.Service1", "path.to.Service2") + karaServices := Seq("path.to.ExampleService1", "path.to.ExampleService2") ).enablePlugins(Kara) // ... @@ -56,7 +56,7 @@ Http.server.serve(":8080", karaSvc) [Scripted tests](./src/sbt-test/kara/) are a great way to see **kara** in action. ## Swagger UI -`kara` v.`@VERSION@` employs Swagger UI v`.3.31.1`. +`kara` v.`@VERSION@` employs Swagger UI v.`3.31.1`. ## Testing **kara** features two modes of testing: diff --git a/project/metals.sbt b/project/metals.sbt index 343a26a..aa04ddb 100644 --- a/project/metals.sbt +++ b/project/metals.sbt @@ -1,4 +1,4 @@ // DO NOT EDIT! This file is auto-generated. // This file enables sbt-bloop to create bloop config files. -addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.3") +addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.4-13-408f4d80") diff --git a/project/plugins.sbt b/project/plugins.sbt index 722a060..75a3865 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,3 +6,5 @@ libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "1.3.6") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.4") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1") diff --git a/src/sbt-test/kara/declaration_order/project/plugins.sbt b/src/sbt-test/kara/declaration_order/project/plugins.sbt index 27445b3..e03f569 100644 --- a/src/sbt-test/kara/declaration_order/project/plugins.sbt +++ b/src/sbt-test/kara/declaration_order/project/plugins.sbt @@ -3,7 +3,7 @@ */ sys.props.get("plugin.version") match { - case Some(x) => addSbtPlugin("com.ea" % "kara" % x) + case Some(x) => addSbtPlugin("com.ea.kara" % "kara" % x) case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } diff --git a/src/sbt-test/kara/dirty/project/plugins.sbt b/src/sbt-test/kara/dirty/project/plugins.sbt index 9fef9e5..67d4ac1 100644 --- a/src/sbt-test/kara/dirty/project/plugins.sbt +++ b/src/sbt-test/kara/dirty/project/plugins.sbt @@ -3,7 +3,7 @@ */ sys.props.get("plugin.version") match { - case Some(x) => addSbtPlugin("com.ea" % "kara" % x) + case Some(x) => addSbtPlugin("com.ea.kara" % "kara" % x) case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } \ No newline at end of file diff --git a/src/sbt-test/kara/e2e/project/plugins.sbt b/src/sbt-test/kara/e2e/project/plugins.sbt index 05dd802..c9c5b8e 100644 --- a/src/sbt-test/kara/e2e/project/plugins.sbt +++ b/src/sbt-test/kara/e2e/project/plugins.sbt @@ -1,5 +1,5 @@ sys.props.get("plugin.version") match { - case Some(x) => addSbtPlugin("com.ea" % "kara" % x) + case Some(x) => addSbtPlugin("com.ea.kara" % "kara" % x) case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } diff --git a/src/sbt-test/kara/imports/project/plugins.sbt b/src/sbt-test/kara/imports/project/plugins.sbt index 5f16ebc..3e81f68 100644 --- a/src/sbt-test/kara/imports/project/plugins.sbt +++ b/src/sbt-test/kara/imports/project/plugins.sbt @@ -3,7 +3,7 @@ */ sys.props.get("plugin.version") match { - case Some(x) => addSbtPlugin("com.ea" % "kara" % x) + case Some(x) => addSbtPlugin("com.ea.kara" % "kara" % x) case _ => sys.error("""|The system property 'plugin.version' is not defined. |Specify this property using the scriptedLaunchOpts -D.""".stripMargin) } diff --git a/version.sbt b/version.sbt index 169042a..2354425 100644 --- a/version.sbt +++ b/version.sbt @@ -2,12 +2,9 @@ * Copyright (C) 2020 Electronic Arts Inc. All rights reserved. */ -// Make 'version' a SNAPSHOT only when publishing on a developer machine, -// or when it's forced in CI via 'kara.isSnapshot' flag. def buildSuffix: String = { - val isSnapshotForced = sys.props.get("kara.isSnapshot").exists(_.toBoolean) - val isNotCI = Option(java.lang.System.getenv("BUILD_NUMBER")).isEmpty - if (isSnapshotForced || isNotCI) "-SNAPSHOT" else "" + val isSnapshot = sys.props.get("kara.isSnapshot").exists(_.toBoolean) + if (isSnapshot) "-SNAPSHOT" else "" } version in ThisBuild := "0.1.0" + buildSuffix