Skip to content

Commit

Permalink
publish only openlawCore-scala to gh packages
Browse files Browse the repository at this point in the history
  • Loading branch information
fforbeck committed Aug 2, 2021
1 parent 91c012a commit 35b194d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 51 deletions.
67 changes: 20 additions & 47 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject}
import sbtrelease.ReleasePlugin.autoImport.releaseCrossBuild
import ReleaseTransformations._
import sbt.Keys.name

import scala.language.postfixOps
import sbt.{file, _}
import sbtghpackages.GitHubPackagesPlugin.autoImport.githubRepository

lazy val username = "openlaw"
lazy val repo = "openlaw-core"

githubOwner := "openlawteam"

githubRepository := "openlaw-core"

githubTokenSource := TokenSource
.Environment("TOKEN")

credentials +=
Credentials(
"GitHub Packages",
"maven.pkg.github.com",
sys.env.getOrElse("USERNAME", "INVALID_USERNAME"),
sys.env.getOrElse("TOKEN", "INVALID_GITHUBTOKEN")
)

licenses += ("Apache-2.0", url("https://opensource.org/licenses/Apache-2.0"))

githubOwner := "openlawteam"
githubRepository := "openlaw-core"
githubTokenSource := TokenSource.GitConfig("github.token") || TokenSource
.Environment("GITHUB_TOKEN") || TokenSource
.Environment("TOKEN")

/*
The Scala and SBT versions must be matched to the version of scala-builder used
as the base image of the container. We try to standardize across projects and
Expand All @@ -53,13 +34,12 @@ lazy val scalaCheckV = "1.14.0"
lazy val scalaTestV = "3.2.0-SNAP10"

lazy val repositories = Seq(
"GitHub Packages" at "https://maven.pkg.github.com/openlawteam",
Resolver.jcenterRepo,
Resolver.githubPackages("openlawteam"),
"central" at "https://repo1.maven.org/maven2/",
"maven central" at "https://mvnrepository.com/repos/central",
Resolver.mavenLocal
)

lazy val commonSettings = Seq(
organization := "org.openlaw",
name := "openlaw-core",
Expand Down Expand Up @@ -87,19 +67,6 @@ lazy val releaseSettings = releaseProcess := Seq[ReleaseStep](
//pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured
)

publishArtifact in (Test, packageBin) := true
releaseCrossBuild := true
publishMavenStyle := true
publishTo := Some(
"GitHub Packages OpenLaw Core" at "https://maven.pkg.github.com/openlawteam/openlaw-core"
)

publishConfiguration in ThisBuild := publishConfiguration.value.withOverwrite(
true
)
publishLocalConfiguration in ThisBuild := publishLocalConfiguration.value
.withOverwrite(true)

val rules = Seq(
Wart.AnyVal,
Wart.ArrayEquals,
Expand Down Expand Up @@ -163,6 +130,7 @@ lazy val openlawCore = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure) // the project does not have separate sources for JVM and JS
.in(file("shared"))
.disablePlugins(plugins.IvyPlugin)
.jvmSettings(
libraryDependencies ++= Seq(
//circe is used to serialize / deserialize json
Expand All @@ -188,7 +156,20 @@ lazy val openlawCore = crossProject(JSPlatform, JVMPlatform)
"org.scalatest" %% "scalatest" % scalaTestV % Test,
//Play json is used in tests to make it easier to prepare json in the tests. It shouldn't be used in the library
"com.typesafe.play" %% "play-json" % playJsonV % Test
)
),
publishTo := Some(
"GitHub Packages OpenLaw Core" at "https://maven.pkg.github.com/openlawteam/openlaw-core"
),
publishMavenStyle := true,
parallelExecution in Test := false,
releaseCrossBuild := true,
publishArtifact in (Test, packageBin) := false,
publishArtifact in (Test, packageDoc) := false,
githubOwner := "openlawteam",
githubRepository := "openlaw-core",
githubTokenSource := TokenSource.GitConfig("github.token") || TokenSource
.Environment("GITHUB_TOKEN") || TokenSource
.Environment("TOKEN")
)
.jsSettings(
libraryDependencies ++= Seq(
Expand Down Expand Up @@ -219,15 +200,8 @@ lazy val openlawCore = crossProject(JSPlatform, JVMPlatform)
"com.typesafe.play" %%% "play-json" % playJsonV % Test
)
)
.settings(parallelExecution in Test := false)
.settings(commonSettings: _*)
.settings(
publishTo := Some(
"GitHub Packages OpenLaw Core" at "https://maven.pkg.github.com/openlawteam/openlaw-core"
)
)
.settings(releaseSettings: _*)
.settings(publishMavenStyle := true)
.enablePlugins(WartRemover)

lazy val version = git.gitDescribedVersion
Expand All @@ -254,8 +228,7 @@ lazy val openlawCoreJvm = openlawCore.jvm
lazy val openlawCoreJs = openlawCore.js

git.useGitDescribe := true

val root = (project in file("."))
.dependsOn(openlawCoreJvm, openlawCoreJs)
.aggregate(openlawCoreJvm, openlawCoreJs)
.dependsOn(openlawCoreJvm)
.aggregate(openlawCoreJvm)
.enablePlugins(GitVersioning)
5 changes: 1 addition & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
logLevel := Level.Warn

resolvers += "Typesafe Repository" at "https://repo.typesafe.com/typesafe/releases/"
resolvers += Resolver.sonatypeRepo("public")
resolvers += "Github Repository" at "https://maven.pkg.github.com/openlawteam"

addSbtPlugin("org.lyranthe.sbt" % "partial-unification" % "1.1.0")
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.4.2")
Expand All @@ -20,6 +20,3 @@ addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")
/* Code coverage */
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "1.3.15")

/* Github Packages */
addSbtPlugin("com.codecommit" % "sbt-github-packages" % "0.5.3")

0 comments on commit 35b194d

Please sign in to comment.