Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to sbt 1.3.13 #1319

Merged
merged 13 commits into from
Sep 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,34 @@ jobs:

steps:
- uses: actions/checkout@v1

- name: "Running shasum for cache invalidation"
run: |
shasum build.sbt \
project/plugins.sbt \
project/build.properties > gha.cache.tmp

- name: Loading ivy cache
uses: actions/cache@v1
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-ivy-${{ hashFiles('**/*.sbt') }}
key: ${{ runner.os }}-ivy-${{ hashFiles('gha.cache.tmp') }}
restore-keys: |
${{ runner.os }}-ivy-

- name: Loading coursier cache
uses: actions/cache@v1
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-coursier-${{ hashFiles('gha.cache.tmp') }}
restore-keys: |
${{ runner.os }}-coursier-

- name: Set up Azul JDK 1.8 and SBT
uses: olafurpg/setup-scala@v7
with:
java-version: zulu@1.8

- name: Validate
run: sbt "^validate"

Expand Down
44 changes: 5 additions & 39 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name := "sbt-native-packager"
organization := "com.typesafe.sbt"
homepage := Some(url("https://github.com/sbt/sbt-native-packager"))

Global / scalaVersion := "2.12.7"
Global / onChangedBuildSource := ReloadOnSourceChanges
Global / scalaVersion := "2.12.12"

// crossBuildingSettings
crossSbtVersions := Vector("0.13.17", "1.1.6")
Expand Down Expand Up @@ -58,42 +59,7 @@ mimaPreviousArtifacts := {
val m = organization.value %% moduleName.value % "1.3.15"
val sbtBinV = (sbtBinaryVersion in pluginCrossBuild).value
val scalaBinV = (scalaBinaryVersion in update).value
Set(Defaults.sbtPluginExtra(m cross CrossVersion.Disabled(), sbtBinV, scalaBinV))
}
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
List(
// added via #1179
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmKeys.rpmEpoch"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"com.typesafe.sbt.packager.rpm.RpmKeys.com$typesafe$sbt$packager$rpm$RpmKeys$_setter_$rpmEpoch_="
),
ProblemFilters.exclude[MissingTypesProblem]("com.typesafe.sbt.packager.rpm.RpmMetadata$"),
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmMetadata.apply"),
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmMetadata.copy"),
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmMetadata.this"),
// added via #1251
ProblemFilters.exclude[ReversedMissingMethodProblem](
"com.typesafe.sbt.packager.universal.UniversalKeys.com$typesafe$sbt$packager$universal$UniversalKeys$_setter_$containerBuildImage_="
),
ProblemFilters
.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.universal.UniversalKeys.containerBuildImage"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"com.typesafe.sbt.packager.graalvmnativeimage.GraalVMNativeImageKeys.graalVMNativeImageGraalVersion"
),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"com.typesafe.sbt.packager.graalvmnativeimage.GraalVMNativeImageKeys.com$typesafe$sbt$packager$graalvmnativeimage$GraalVMNativeImageKeys$_setter_$graalVMNativeImageGraalVersion_="
),
// added via #1279
ProblemFilters.exclude[ReversedMissingMethodProblem](
"com.typesafe.sbt.packager.docker.DockerKeys.com$typesafe$sbt$packager$docker$DockerKeys$_setter_$dockerAutoremoveMultiStageIntermediateImages_="
),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"com.typesafe.sbt.packager.docker.DockerKeys.dockerAutoremoveMultiStageIntermediateImages"
),
ProblemFilters
.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.docker.DockerPlugin.publishLocalDocker")
)
Set(Defaults.sbtPluginExtra(m cross CrossVersion.disabled, sbtBinV, scalaBinV))
}

// Release configuration
Expand All @@ -119,9 +85,9 @@ releaseProcess := Seq[ReleaseStep](
bintrayOrganization := Some("sbt")
bintrayRepository := "sbt-plugin-releases"

addCommandAlias("scalafmtAll", "; scalafmt ; test:scalafmt ; sbt:scalafmt")
addCommandAlias("scalafmtFormatAll", "; ^scalafmtAll ; scalafmtSbt")
// ci commands
addCommandAlias("validateFormatting", "; scalafmt::test ; test:scalafmt::test ; sbt:scalafmt::test")
addCommandAlias("validateFormatting", "; scalafmtCheckAll ; scalafmtSbtCheck")
addCommandAlias("validate", "; clean ; update ; validateFormatting ; test ; mimaReportBinaryIssues")

// List all scripted test separately to schedule them in different travis-ci jobs.
Expand Down
48 changes: 29 additions & 19 deletions project/ChangelogPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,29 @@ object ChangelogPlugin extends AutoPlugin {

private case class GithubChangeLogParameters(token: String)

private val githubChangeLogParser: Parser[GithubChangeLogParameters] = {
private val githubChangeLogParser: Parser[GithubChangeLogParameters] =
(Space ~ token("--token") ~ Space ~> StringBasic).map(GithubChangeLogParameters)
}

override def projectSettings: Seq[Setting[_]] =
Seq(generateChangelogToken := None, generateChangelog := {
val log = streams.value.log
val parameters = githubChangeLogParser.parsed
Seq("github_changelog_generator", "--user", "sbt", "--project", "sbt-native-packager", "--token", parameters.token) ! log match {
case 0 => log.success("CHANGELOG.md updated successfully")
case n => sys.error(s"Failed updating CHANGELOG.md. Process existed with status code $n")
Seq(
generateChangelogToken := None,
generateChangelog := {
val log = streams.value.log
val parameters = githubChangeLogParser.parsed
Seq(
"github_changelog_generator",
"--user",
"sbt",
"--project",
"sbt-native-packager",
"--token",
parameters.token
) ! log match {
case 0 => log.success("CHANGELOG.md updated successfully")
case n => sys.error(s"Failed updating CHANGELOG.md. Process existed with status code $n")
}
}
})
)

private def generateChangelogStep(state: State): State = {
val extracted = Project.extract(state)
Expand All @@ -101,11 +111,10 @@ object ChangelogPlugin extends AutoPlugin {

vcs(state).add(relativePath) !! log
val vcsAddOutput = (vcs(state).status !!).trim
if (vcsAddOutput.isEmpty) {
if (vcsAddOutput.isEmpty)
state.log.info("CHANGELOG.md hasn't been changed.")
} else {
else
vcs(state).commit("Update changelog", sign, signOff) ! log
}

state
}
Expand All @@ -130,13 +139,14 @@ object ChangelogPlugin extends AutoPlugin {
* @param state
* @return a process logger
*/
private def toProcessLogger(state: State): ProcessLogger = new ProcessLogger {
override def err(s: => String): Unit = state.log.info(s)
override def out(s: => String): Unit = state.log.info(s)
override def buffer[T](f: => T): T = state.log.buffer(f)
}
private def toProcessLogger(state: State): ProcessLogger =
new ProcessLogger {
override def err(s: => String): Unit = state.log.info(s)
override def out(s: => String): Unit = state.log.info(s)
override def buffer[T](f: => T): T = state.log.buffer(f)
}

private def readToken(predefinedToken: Option[String]): String =
private def readToken(predefinedToken: Option[String]): String =
predefinedToken
// https://github.com/github-changelog-generator/github-changelog-generator#github-token
.orElse(sys.env.get("CHANGELOG_GITHUB_TOKEN"))
Expand All @@ -145,6 +155,6 @@ object ChangelogPlugin extends AutoPlugin {
case Some(input) if input.trim.isEmpty => sys.error("No token provided")
case Some(input) => input
case None => sys.error("No token provided")
})
})

}
27 changes: 10 additions & 17 deletions project/ReadmeReleasePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import scala.sys.process._

/**
* == ReadmeRelease Plugin ==
*
*
* Changes the version in the README.md during a release.
*
*/
object ReadmeReleasePlugin extends AutoPlugin {

Expand All @@ -33,22 +32,17 @@ object ReadmeReleasePlugin extends AutoPlugin {

}


private def updateReadmeStep(state: State): State = {
val extracted = Project.extract(state)
val releaseVersion = extracted.get(version)
val base = extracted.get(baseDirectory)
val readmeFile = base / "README.md"

val versionRegex = """(\d{1,2}\.\d{1,2}\.\d{1,2})""".r
val updatedReadmeContent = versionRegex.replaceAllIn(
IO.read(readmeFile),
releaseVersion
)
val updatedReadmeContent = versionRegex.replaceAllIn(IO.read(readmeFile), releaseVersion)

IO.write(readmeFile, updatedReadmeContent)


state
}

Expand All @@ -67,11 +61,10 @@ object ReadmeReleasePlugin extends AutoPlugin {

vcs(state).add(relativePath) !! log
val vcsAddOutput = (vcs(state).status !!).trim
if (vcsAddOutput.isEmpty) {
if (vcsAddOutput.isEmpty)
state.log.info("README.md hasn't been changed.")
} else {
else
vcs(state).commit("Update release version in readme", sign, signOff) ! log
}

state
}
Expand All @@ -96,11 +89,11 @@ object ReadmeReleasePlugin extends AutoPlugin {
* @param state
* @return a process logger
*/
private def toProcessLogger(state: State): ProcessLogger = new ProcessLogger {
override def err(s: => String): Unit = state.log.info(s)
override def out(s: => String): Unit = state.log.info(s)
override def buffer[T](f: => T): T = state.log.buffer(f)
}

private def toProcessLogger(state: State): ProcessLogger =
new ProcessLogger {
override def err(s: => String): Unit = state.log.info(s)
override def out(s: => String): Unit = state.log.info(s)
override def buffer[T](f: => T): T = state.log.buffer(f)
}

}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.2.8
sbt.version=1.3.13
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ libraryDependencies += "jline" % "jline" % "2.11"
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.4")

// For code formatting
addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.15")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")

// binary compatibility checks
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.3.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.7.0")
76 changes: 76 additions & 0 deletions src/main/mima-filters/1.3.15.backward.excludes
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# added via #1179
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmKeys.rpmEpoch")
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmKeys.com$typesafe$sbt$packager$rpm$RpmKeys$_setter_$rpmEpoch_=")
ProblemFilters.exclude[MissingTypesProblem]("com.typesafe.sbt.packager.rpm.RpmMetadata$")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmMetadata.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmMetadata.copy")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmMetadata.this")

# added via #1251
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.universal.UniversalKeys.com$typesafe$sbt$packager$universal$UniversalKeys$_setter_$containerBuildImage_=")
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.universal.UniversalKeys.containerBuildImage")
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.graalvmnativeimage.GraalVMNativeImageKeys.graalVMNativeImageGraalVersion")
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.graalvmnativeimage.GraalVMNativeImageKeys.com$typesafe$sbt$packager$graalvmnativeimage$GraalVMNativeImageKeys$_setter_$graalVMNativeImageGraalVersion_=")
# added via #1279
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.docker.DockerKeys.com$typesafe$sbt$packager$docker$DockerKeys$_setter_$dockerAutoremoveMultiStageIntermediateImages_=")
ProblemFilters.exclude[ReversedMissingMethodProblem]("com.typesafe.sbt.packager.docker.DockerKeys.dockerAutoremoveMultiStageIntermediateImages")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.docker.DockerPlugin.publishLocalDocker")

# added via #1319
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.universal.UniversalDeployPlugin.requires")
muuki88 marked this conversation as resolved.
Show resolved Hide resolved
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.universal.UniversalPlugin.requires")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.windows.WindowsDeployPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.windows.WindowsProductInfo.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.windows.AddDirectoryToPath.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.windows.WindowsFeature.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.windows.AddShortCuts.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.windows.NamespaceDefinitions.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.windows.ComponentFile.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.windows.WindowsPlugin.requires")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.debian.PackageInfo.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.debian.DebianControlScriptReplacements.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.debian.DebianPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.debian.DebianDeployPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.debian.PackageMetaData.apply")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmDependencies.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmDeployPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmSpec.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.rpm.RpmDescription.apply")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.JavaServerAppPackaging.requires")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.jar.ClasspathJarPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.jar.LauncherJarPlugin.requires")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.systemloader.SystemdPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.systemloader.SystemVPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.systemloader.UpstartPlugin.requires")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.scripts.MultipleMains.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.scripts.BashStartScriptPlugin.trigger")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.scripts.BashStartScriptPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.scripts.BashStartScriptPlugin.scriptTargetFolder")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.scripts.BatStartScriptPlugin.trigger")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.scripts.BatStartScriptPlugin.requires")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.scripts.BatStartScriptPlugin.scriptTargetFolder")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.scripts.ExplicitMainWithAdditional.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.archetypes.scripts.SingleMain.apply")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.validation.ValidationWarning.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.validation.ValidationError.apply")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.linux.LinuxFileMetaData.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.linux.LinuxPackageMapping.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.linux.LinuxPlugin.requires")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.jdkpackager.JDKPackagerDeployPlugin.requires")

ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.docker.DockerAlias.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.docker.Dockerfile.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.docker.ExecCmd.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.docker.CombinedCmd.apply")
ProblemFilters.exclude[DirectMissingMethodProblem]("com.typesafe.sbt.packager.docker.Cmd.apply")
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ object MappingsHelper {
* Create mappings from your classpath. For example if you want to add additional
* dependencies, like test or model.
*
*
* @example Add all test artifacts to a separated test folder
* {{{
* mappings in Universal ++= fromClasspath((managedClasspath in Test).value, target = "test")
Expand All @@ -95,16 +94,17 @@ object MappingsHelper {
* )
* }}}
*
*
* @param entries from where mappings should be created from
* @param target folder, e.g. `model`. Must not end with a slash
* @param includeArtifact function to determine if an artifact should result in a mapping
* @param includeOnNoArtifact default is false. When there's no Artifact meta data remove it
*/
def fromClasspath(entries: Seq[Attributed[File]],
target: String,
includeArtifact: Artifact => Boolean,
includeOnNoArtifact: Boolean = false): Seq[(File, String)] =
def fromClasspath(
entries: Seq[Attributed[File]],
target: String,
includeArtifact: Artifact => Boolean,
includeOnNoArtifact: Boolean = false
): Seq[(File, String)] =
entries.filter(attr => attr.get(sbt.Keys.artifact.key) map includeArtifact getOrElse includeOnNoArtifact).map {
attribute =>
val file = attribute.data
Expand All @@ -114,8 +114,7 @@ object MappingsHelper {
/**
* Get the mappings for the given files relative to the given directories.
*/
def relative(files: Seq[File], dirs: Seq[File]): Seq[(File, String)] = {
def relative(files: Seq[File], dirs: Seq[File]): Seq[(File, String)] =
(files --- dirs) pair (relativeTo(dirs) | Path.flat)
}

}
Loading