Skip to content

Commit 359cc3f

Browse files
committed
Set up publishing to Entrepot
1 parent 7918416 commit 359cc3f

File tree

5 files changed

+141
-71
lines changed

5 files changed

+141
-71
lines changed

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,29 @@ A Query Monad implementation for Anorm.
88

99
The project is using [SBT](http://www.scala-sbt.org/), so to build it from sources the following command can be used.
1010

11-
sbt publishLocal
11+
```shell
12+
sbt +publishLocal
13+
```
1214

13-
[![CircleCI](https://travis-ci.org/zengularity/query-monad.svg?style=svg)](https://travis-ci.org/zengularity/query-monad)
14-
[![Zen Entrepot](http://zen-entrepot.nestincloud.io/entrepot/shields/releases/com/zengularity/query-monad_2.12.svg)](https://zen-entrepot.nestincloud.io/entrepot/pom/releases/com/zengularity/query-monad_2.12)
15+
[![Build Status](https://travis-ci.org/zengularity/query-monad.svg?branch=master)](https://travis-ci.org/zengularity/query-monad)
16+
[![Zen Entrepot](http://zen-entrepot.nestincloud.io/entrepot/shields/snapshots/com/zengularity/query-monad-core_2.12.svg)](https://zen-entrepot.nestincloud.io/entrepot/pom/snapshots/com/zengularity/query-monad-core_2.12)
17+
[![Zen Entrepot](http://zen-entrepot.nestincloud.io/entrepot/shields/releases/com/zengularity/query-monad-core_2.12.svg)](https://zen-entrepot.nestincloud.io/entrepot/pom/releases/com/zengularity/query-monad-core_2.12)
1518

1619
## Contributing
1720

1821
Please take a look at the [Contribution guide](.github/CONTRIBUTING.md)
22+
23+
## Publishing
24+
25+
To publish a snapshot or a release on [Zengularity Entrepot](https://github.com/zengularity/entrepot):
26+
27+
- set the environment variable `REPO_PATH`;
28+
- run the SBT command `+publish`.
29+
30+
For example:
31+
```shell
32+
export REPO_PATH=/path/to/entrepot/snapshots/
33+
sbt +publish
34+
```
35+
36+
Then in Entrepot, the changes must be commited and pushed.

build.sbt

Lines changed: 12 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,8 @@
1-
name := "query-monad-code"
2-
3-
version := "1.0-SNAPSHOT"
1+
ThisBuild / organization := "com.zengularity"
42

53
ThisBuild / scalaVersion := "2.12.7"
64
ThisBuild / crossScalaVersions := Seq("2.11.12", "2.12.7")
75

8-
def scalacOptionsVersion(scalaVersion: String) = {
9-
val defaultOptions = Seq(
10-
"-deprecation", // Emit warning and location for usages of deprecated APIs.
11-
"-encoding",
12-
"utf-8", // Specify character encoding used by source files.
13-
"-explaintypes", // Explain type errors in more detail.
14-
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
15-
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
16-
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
17-
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
18-
"-Xlint",
19-
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
20-
"-Ypartial-unification", // Enable partial unification in type constructor inference
21-
"-Ywarn-dead-code", // Warn when dead code is identified.
22-
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
23-
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
24-
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
25-
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
26-
"-Ywarn-numeric-widen", // Warn when numerics are widened.
27-
"-Ywarn-unused", // Warn if unused.
28-
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused.
29-
)
30-
val v211Options = Seq(
31-
"-Xsource:2.12" // See https://github.com/scala/scala/releases/tag/v2.11.11
32-
)
33-
val v212Options = Seq(
34-
"-Ywarn-extra-implicit" // Warn when more than one implicit parameter section is defined.
35-
)
36-
37-
CrossVersion.partialVersion(scalaVersion) match {
38-
case Some((2L, 11L)) => defaultOptions ++ v211Options
39-
case _ => defaultOptions ++ v212Options
40-
}
41-
}
42-
43-
// Common values
44-
def commonSettings = Seq(
45-
organization := "com.zengularity",
46-
crossPaths := false,
47-
scalacOptions ++= scalacOptionsVersion(scalaVersion.value),
48-
scalacOptions in (Compile, console) ~= (_.filterNot(
49-
Set(
50-
"-Ywarn-unused:imports",
51-
"-Xfatal-warnings"
52-
)
53-
)),
54-
scalacOptions in (Test, compile) ~= (_.filterNot(
55-
Set(
56-
"-Ywarn-unused:imports",
57-
"-Xfatal-warnings",
58-
"-Yrangepos"
59-
)
60-
)),
61-
resolvers ++= Seq[Resolver](
62-
Resolver.sonatypeRepo("releases")
63-
)
64-
)
65-
666
// Scalafmt
677
ThisBuild / scalafmtOnCompile := true
688

@@ -73,12 +13,14 @@ wartremoverErrors ++= Warts.unsafe
7313
// Projects definitions
7414
//
7515

16+
val nameRoot = "query-monad"
17+
7618
// Core + Modules
7719

7820
lazy val core = (project in file("core"))
7921
.settings(
80-
commonSettings ++ Seq(
81-
name := "query-core",
22+
Settings.commonLibSettings ++ Seq(
23+
name := s"$nameRoot-core",
8224
libraryDependencies ++= Seq(
8325
Dependencies.acolyte % Test,
8426
Dependencies.anorm % Test,
@@ -89,9 +31,9 @@ lazy val core = (project in file("core"))
8931
)
9032

9133
lazy val playSqlModule = (project in file("modules/play-sql"))
92-
.settings(commonSettings)
34+
.settings(Settings.commonLibSettings)
9335
.settings(
94-
name := "query-play-sql",
36+
name := s"$nameRoot-play-sql",
9537
libraryDependencies ++= Seq(
9638
jdbc,
9739
evolutions % Test,
@@ -111,7 +53,8 @@ lazy val playSqlModule = (project in file("modules/play-sql"))
11153
lazy val sampleAppExample = (project in file("examples/sample-app"))
11254
.enablePlugins(PlayScala)
11355
.settings(
114-
commonSettings ++ Seq(
56+
Settings.commonExamplesSettings ++ Seq(
57+
name := s"$nameRoot-example-sample-app",
11558
name := "sample-app-example",
11659
libraryDependencies ++= Seq(
11760
Dependencies.anorm,
@@ -123,9 +66,9 @@ lazy val sampleAppExample = (project in file("examples/sample-app"))
12366

12467
lazy val todoAppExample = (project in file("examples/todo-app"))
12568
.enablePlugins(PlayScala)
126-
.settings(commonSettings)
69+
.settings(Settings.commonExamplesSettings)
12770
.settings(
128-
name := "todo-app-example",
71+
name := s"$nameRoot-example-todo-app",
12972
libraryDependencies ++= Seq(
13073
evolutions,
13174
Dependencies.anorm,
@@ -143,3 +86,4 @@ lazy val todoAppExample = (project in file("examples/todo-app"))
14386
lazy val root: Project = project
14487
.in(file("."))
14588
.aggregate(core, playSqlModule, sampleAppExample, todoAppExample)
89+
.settings(Publish.skipSettings)

project/Publish.scala

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import java.io.File
2+
3+
import sbt.Keys._
4+
import sbt._
5+
6+
object Publish {
7+
8+
def skipSettings: Seq[Def.Setting[_]] =
9+
Seq(
10+
publish / skip := true
11+
)
12+
13+
def settings: Seq[Def.Setting[_]] =
14+
Seq(
15+
publishTo := {
16+
import Resolver.mavenStylePatterns
17+
18+
sys.env
19+
.get("REPO_PATH")
20+
.map(path => Resolver.file("repo", new File(path)))
21+
},
22+
licenses := Seq(
23+
"MIT License" -> url(
24+
"https://github.com/zengularity/query-monad/blob/master/LICENSE"
25+
)
26+
),
27+
pomIncludeRepository := { _ =>
28+
false
29+
},
30+
autoAPIMappings := true,
31+
homepage := Some(url("https://github.com/zengularity/query-monad")), // TODO
32+
apiURL := Some(url("https://github.com/zengularity/query-monad")), // TODO
33+
scmInfo := Some(
34+
ScmInfo(url("https://github.com/zengularity/query-monad"),
35+
"git@github.com:zengularity/query-monad.git")
36+
)
37+
)
38+
}

project/Settings.scala

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import sbt.Keys._
2+
import sbt.{Def, _}
3+
4+
object Settings {
5+
6+
def commonLibSettings: Seq[Def.Setting[_]] =
7+
commonSettings ++ Publish.settings
8+
9+
def commonExamplesSettings: Seq[Def.Setting[_]] =
10+
commonSettings ++ Publish.skipSettings
11+
12+
private def commonSettings =
13+
Seq(
14+
organization := "com.zengularity",
15+
crossPaths := false,
16+
scalacOptions ++= scalacOptionsVersion(scalaVersion.value),
17+
scalacOptions in (Compile, console) ~= (_.filterNot(
18+
Set(
19+
"-Ywarn-unused:imports",
20+
"-Xfatal-warnings"
21+
)
22+
)),
23+
scalacOptions in (Test, compile) ~= (_.filterNot(
24+
Set(
25+
"-Ywarn-unused:imports",
26+
"-Xfatal-warnings",
27+
"-Yrangepos"
28+
)
29+
)),
30+
resolvers ++= Seq[Resolver](
31+
Resolver.sonatypeRepo("releases")
32+
)
33+
)
34+
35+
private def scalacOptionsVersion(scalaVersion: String) = {
36+
val defaultOptions = Seq(
37+
"-deprecation", // Emit warning and location for usages of deprecated APIs.
38+
"-encoding",
39+
"utf-8", // Specify character encoding used by source files.
40+
"-explaintypes", // Explain type errors in more detail.
41+
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
42+
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
43+
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
44+
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
45+
"-Xlint",
46+
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
47+
"-Ypartial-unification", // Enable partial unification in type constructor inference
48+
"-Ywarn-dead-code", // Warn when dead code is identified.
49+
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
50+
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
51+
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
52+
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
53+
"-Ywarn-numeric-widen", // Warn when numerics are widened.
54+
"-Ywarn-unused", // Warn if unused.
55+
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused.
56+
)
57+
val v2_11_Options = Seq(
58+
"-Xsource:2.12" // See https://github.com/scala/scala/releases/tag/v2.11.11
59+
)
60+
val v2_12_Options = Seq(
61+
"-Ywarn-extra-implicit" // Warn when more than one implicit parameter section is defined.
62+
)
63+
64+
CrossVersion.partialVersion(scalaVersion) match {
65+
case Some((2L, 11L)) => defaultOptions ++ v2_11_Options
66+
case _ => defaultOptions ++ v2_12_Options
67+
}
68+
}
69+
}

version.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ThisBuild / version := "0.0.1-SNAPSHOT"

0 commit comments

Comments
 (0)