Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

Commit

Permalink
Completes work on 0.0.x branch (#22)
Browse files Browse the repository at this point in the history
* Reviews Bintray setup.

Small fixes to complete a 0.0.1 release and publish.

Remove root from publishable list

Skip release of 0.0.1

Improves publishing logic

Setting version to 0.0.2

Setting version to 0.0.3-SNAPSHOT

Setting version to 0.0.3

Setting version to 0.0.4-SNAPSHOT

Fixes binary package name

Enable Sonatype on runtimelib projects

Setting version to 0.0.4

Setting version to 0.0.5-SNAPSHOT

Massive folder rename and build-sbt refactor

Review publishTo for root

Enables release settings on root project

Setting version to 0.0.5

Setting version to 0.0.6-SNAPSHOT

* Disable mvn publish

* Reset to version 0.0.1

* Enable publishing root

* Adds bintray settings to root

* restores package name on binary settings

* Disable root publish

* Adds a dummy bontrayPackageVersion

* Adds dummy metadata for sbt-bintray

* Adds version to default project, removes unnecessary attributes

* Main project should not go to bintray

* main project is a lib

* renamre root to root

* Roo prj needs bintray settings

* I don't know what I?m doing anymore

* remove root from the releasing cirlce

* Root has all plugins

* adds version on root

* Enable bintray settings on all projects

* Makes bintrayPackage explicit for root

* Downgrade sbt-bintray as a workaround

* Bumps to 0.0.2-SNAPSHOT and adds pom extra info

* Setting version to 0.0.2

* Setting version to 0.0.3-SNAPSHOT
  • Loading branch information
ignasi35 authored May 11, 2017
1 parent d81737d commit 070a71d
Show file tree
Hide file tree
Showing 29 changed files with 241 additions and 145 deletions.
249 changes: 107 additions & 142 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,166 +1,131 @@
import bintray.Keys._
import com.typesafe.sbt.SbtScalariform
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import sbt.Keys.{ crossScalaVersions, libraryDependencies, scalacOptions, unmanagedSourceDirectories }

import sbt.ScriptedPlugin
import scala.collection.immutable
import scalariform.formatter.preferences._
import sbt.Keys.{ crossScalaVersions, homepage, libraryDependencies }

import de.heikoseeberger.sbtheader._

// --------------- SETTINGS ---------------

lazy val `root` = (project in file("."))
.enablePlugins(AutomateHeaderPlugin)
lazy val commonSettings =
Seq(
organization := "com.lightbend.lagom",
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html")),
homepage := Some(url("https://github.com/lagom/sbt-lagom-descriptor-generator")),
sonatypeProfileName := "com.lightbend",
// Scala settings
scalaVersion := Version.scala,
crossScalaVersions := List(scalaVersion.value, "2.10.6"),

pomExtra := {
<scm>
<url>https://github.com/lagom/sbt-lagom-descriptor-generator</url>
<connection>scm:git:git@github.com:lagom/sbt-lagom-descriptor-generator.git</connection>
</scm>
<developers>
<developer>
<id>lagom</id>
<name>Lagom Contributors</name>
<url>https://github.com/lagom</url>
</developer>
</developers>
},
pomIncludeRepository := { _ => false }

)

// --------------- ROOT ------------------

lazy val root = (project in file("."))
.enablePlugins(AutomateHeaderPlugin && Sonatype && BintrayPlugin)
.settings(name := "sbt-lagom-descriptor-generator")
.aggregate(
`generator-api`,
`lagom-descriptor-generator-api`,
`openapi-parser`,
`lagom-renderer-javadsl`,
`lagom-renderer-scaladsl`,
`runner`,
`lagom-descriptor-renderer-javadsl`,
`lagom-descriptor-renderer-scaladsl`,
`lagom-descriptor-generator`,
`lagom-descriptor-generator-sbt-plugin`
)
.settings(commonSettings: _*)

lazy val commonSettings = Seq(
organization := "com.lightbend.lagom",
// Scala settings
scalaVersion := Version.scala,
crossScalaVersions := List(scalaVersion.value, "2.10.6"),
headers := headers.value ++ Map(
"scala" -> (
HeaderPattern.cStyleBlockComment,
"""|/*
| * Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com>
| */
|""".stripMargin
),
"java" -> (
HeaderPattern.cStyleBlockComment,
"""|/*
| * Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com>
| */
|""".stripMargin
)
), scalacOptions ++= List(
"-unchecked",
"-deprecation",
"-language:_",
"-target:jvm-1.7", // target "jvm-1.8" was not added until scala 2.11.5 (https://issues.scala-lang.org/browse/SI-8966)
"-encoding", "UTF-8"
),
unmanagedSourceDirectories in Compile := List((scalaSource in Compile).value),
unmanagedSourceDirectories in Test := List((scalaSource in Test).value),
unmanagedSourceDirectories in IntegrationTest := List((scalaSource in Test).value)
)

lazy val commonScalariformSettings: immutable.Seq[Setting[_]] =
SbtScalariform.scalariformSettings ++ Seq(
// Scalariform settings
ScalariformKeys.preferences := ScalariformKeys.preferences.value
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(AlignSingleLineCaseStatements.MaxArrowIndent, 100)
.setPreference(DoubleIndentClassDeclaration, true)
.setPreference(DanglingCloseParenthesis, Force)
.settings(librarySettings: _*)
.settings(
publishLocal := {},
publishArtifact in Compile := false,
publish := {}
).
settings(
// this is required during release because for some reason the version value is not available.
version := version.value,
bintrayPackage := bintrayPackage.value
)

// not used
lazy val bintraySettings = Seq(
// Release + Bintray settings
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html")),
publishMavenStyle := false
) ++
bintrayPublishSettings ++
Seq(
repository in bintray := "sbt-plugins",
bintrayOrganization in bintray := Some("sbt-lagom-descriptor-generator")
)
// --------------- PROJECTS ---------------

lazy val scripteTestsSettings =
scriptedSettings ++
Seq(
scriptedLaunchOpts += {
version apply { v => s"-Dproject.version=$v" }
}.value
)
def RootPlugins = AutomateHeaderPlugin && Sonatype && BintrayPlugin
def RuntimeLibPlugins = AutomateHeaderPlugin && Sonatype && PluginsAccessor.exclude(BintrayPlugin)
def SbtPluginPlugins = AutomateHeaderPlugin && PluginsAccessor.exclude(Sonatype) && BintrayPlugin

// copy/pasted from Lagom's build.sbt
def RuntimeLibPlugins = AutomateHeaderPlugin
//def RuntimeLibPlugins = AutomateHeaderPlugin && Sonatype && PluginsAccessor.exclude(BintrayPlugin)
//def SbtPluginPlugins = AutomateHeaderPlugin && BintrayPlugin && PluginsAccessor.exclude(Sonatype)
lazy val librarySettings = commonSettings ++
Settings.headerLicenseSettings ++
Settings.commonScalariformSettings ++
Settings.bintraySettings ++
Settings.releaseSettings

lazy val sbtPluginSettings = librarySettings ++
Settings.publishMavenStyleSettings ++
Settings.scriptedTestsSettings

lazy val `lagom-descriptor-generator-sbt-plugin` = project
.in(file("lagom-descriptor-generator-sbt-plugin"))
.settings(scripteTestsSettings: _*)
// .enablePlugins(SbtPluginPlugins) // copy/pasted from Lagom's build.sbt
.enablePlugins(SbtPluginPlugins)
.settings(sbtPluginSettings)
.settings(
name := "lagom-descriptor-generator-sbt-plugin",
sbtPlugin := true,
commonScalariformSettings,
commonSettings
).dependsOn(`runner`)

lazy val `runner` = project
.in(file("runner"))
.enablePlugins(RuntimeLibPlugins) // copy/pasted from Lagom's build.sbt
.configs(IntegrationTest)
.settings(
commonSettings,
commonScalariformSettings,
Defaults.itSettings,
libraryDependencies ++= List(
Library.scalaTest % "test,it"
)
)
.dependsOn(
`openapi-parser`,
`lagom-renderer-javadsl`,
`lagom-renderer-scaladsl`
)


lazy val `lagom-renderer-javadsl` = project
.in(file("lagom-renderers") / "javadsl")
.enablePlugins(RuntimeLibPlugins) // copy/pasted from Lagom's build.sbt
.settings(
commonSettings,
commonScalariformSettings,
libraryDependencies ++= List(
Library.scalaTest % "test"
publishTo := {
if (isSnapshot.value) {
// Bintray doesn't support publishing snapshots, publish to Sonatype snapshots instead
Some(Opts.resolver.sonatypeSnapshots)
} else publishTo.value
},
publishMavenStyle := isSnapshot.value
).dependsOn(`lagom-descriptor-generator`)

lazy val `lagom-descriptor-generator` =
(project in file("lagom-descriptor-generator"))
.enablePlugins(RuntimeLibPlugins)
.settings(librarySettings)
.configs(IntegrationTest)
.dependsOn(`openapi-parser`, `lagom-descriptor-renderer-javadsl`, `lagom-descriptor-renderer-scaladsl`)
.settings(
Defaults.itSettings,
libraryDependencies += Library.scalaTest % "test,it"
)
).dependsOn(`generator-api`)

lazy val `lagom-renderer-scaladsl` = project
.in(file("lagom-renderers") / "scaladsl")
.enablePlugins(RuntimeLibPlugins) // copy/pasted from Lagom's build.sbt
.settings(
commonSettings,
commonScalariformSettings,
libraryDependencies ++= List(
Library.scalaTest % "test"
lazy val `lagom-descriptor-renderer-javadsl` =
(project in file("lagom-renderers") / "javadsl")
.enablePlugins(RuntimeLibPlugins)
.settings(librarySettings)
.dependsOn(`lagom-descriptor-generator-api`)
.settings(libraryDependencies += Library.scalaTest % "test")

lazy val `lagom-descriptor-renderer-scaladsl` =
(project in file("lagom-renderers") / "scaladsl")
.enablePlugins(RuntimeLibPlugins)
.settings(librarySettings)
.dependsOn(`lagom-descriptor-generator-api`)
.settings(libraryDependencies += Library.scalaTest % "test")

lazy val `openapi-parser` =

(project in file("spec-parsers") / "openapi")
.enablePlugins(RuntimeLibPlugins)
.settings(librarySettings)
.dependsOn(`lagom-descriptor-generator-api`)
.settings(
libraryDependencies ++= List(Library.swaggerParser, Library.scalaTest % "test")
)
).dependsOn(`generator-api`)

lazy val `openapi-parser` = project
.in(file("spec-parsers") / "openapi")
.enablePlugins(RuntimeLibPlugins) // copy/pasted from Lagom's build.sbt
.settings(
commonSettings,
commonScalariformSettings,
libraryDependencies ++= List(
Library.swaggerParser,
Library.scalaTest % "test"
)
).dependsOn(`generator-api`)
lazy val `lagom-descriptor-generator-api` =
(project in file("lagom-descriptor-generator-api"))
.enablePlugins(RuntimeLibPlugins)
.settings(librarySettings)
.settings(libraryDependencies += Library.scalaTest % "test")

lazy val `generator-api` = project
.in(file("generator-api"))
.enablePlugins(RuntimeLibPlugins) // copy/pasted from Lagom's build.sbt
.settings(
commonSettings,
commonScalariformSettings,
libraryDependencies ++= List(
Library.scalaTest % "test"
)
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>
* Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.spec.sbt

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*
* Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.spec.sbt

import sbt.Keys._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*
* Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com>
*/
package com.lightbend.lagom.spec.render

import com.lightbend.lagom.spec.model._
Expand Down
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import sbt._

object Version {
val scalaTest = "3.0.1"
// scala version must stay on 2.10.6 since this code is meant to be runnable from sbt.
val scala = "2.10.6"
val swaggerParser = "1.0.28"
}
Expand Down
12 changes: 12 additions & 0 deletions project/PluginsAccessor.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package sbt

/**
* Work around sbts private[sbt] on some plugin functions
*/
object PluginsAccessor {

/**
* Exclude a plugin
*/
def exclude(plugin: AutoPlugin): Plugins.Basic = Plugins.Exclude(plugin)
}
Loading

0 comments on commit 070a71d

Please sign in to comment.