Skip to content

Commit

Permalink
Merge branch 'master' into update/docker-client-8.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
muuki88 authored Jul 30, 2024
2 parents 69a98e2 + 2bfdef1 commit 829e156
Show file tree
Hide file tree
Showing 83 changed files with 392 additions and 309 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.8.3
fb3b1e158c70f5b76207764dc42b128cb878b3be
31 changes: 31 additions & 0 deletions .github/workflows/publish-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Site
on:
push:
tags: ["*"]
jobs:
publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

# setup build environment
- uses: coursier/cache-action@v5
- uses: olafurpg/setup-scala@v12

# this setup is all for the github pages deployment to work
- name: install sphinx
run: |
pip3 install --user sphinx sphinx_rtd_theme
which sphinx-build
- name: setup git
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
- name: Publish Site
run: sbt ghpagesPushSite
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 0 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,6 @@ jobs:
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

# this setup is all for the github pages deployment to work
- name: install sphinx
run: |
pip3 install --user sphinx sphinx_rtd_theme
which sphinx-build
- name: setup git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- run: sbt ghpagesPushSite

# generate a github release
- name: Generate release changelog
id: changelog
Expand Down
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Version https://scalameta.org/scalafmt/docs/configuration.html#version
version = 3.8.1
version = 3.8.3
# Dialect https://scalameta.org/scalafmt/docs/configuration.html#scala-dialects
runner.dialect = scala212

Expand Down
9 changes: 7 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ libraryDependencies ++= Seq(
"org.apache.ant" % "ant" % "1.10.14",
// workaround for the command line size limit
"com.github.eldis" % "tool-launcher" % "0.2.2",
"org.scalatest" %% "scalatest" % "3.0.9" % Test
"org.scalatest" %% "scalatest" % "3.2.19" % Test
)

// sbt dependent libraries
Expand Down Expand Up @@ -53,7 +53,12 @@ libraryDependencies ++= {
// configure github page
enablePlugins(SphinxPlugin, SiteScaladocPlugin, GhpagesPlugin, SbtPlugin)

git.remoteRepo := "[email protected]:sbt/sbt-native-packager.git"
git.remoteRepo := {
sys.env.get("GITHUB_TOKEN") match {
case Some(token) => s"https://x-access-token:$token@github.com/sbt/sbt-native-packager"
case None => "[email protected]:sbt/sbt-native-packager.git"
}
}

// scripted test settings
scriptedLaunchOpts += "-Dproject.version=" + version.value
Expand Down
10 changes: 1 addition & 9 deletions integration-tests-ansible/test-project-play-rpm/build.sbt
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
scalaVersion in ThisBuild := "2.11.6"

scalacOptions in ThisBuild ++= Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-Xfuture",
"-Xlint"
)
scalacOptions in ThisBuild ++= Seq("-deprecation", "-encoding", "UTF-8", "-feature", "-unchecked", "-Xfuture", "-Xlint")

name := "test-project-play-rpm"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ addApp () {
}

shellEscape () {
printf "'%s'" "$(printf %s "$1" | sed "s/'/'\\\\''/")"
printf "'%s'" "$(printf %s "$1" | sed "s/'/'\\\\''/g")"
}

addResidual () {
Expand Down
24 changes: 14 additions & 10 deletions src/main/scala-sbt-0.13/com/typesafe/sbt/packager/Compat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ object Compat {
/**
* Used in:
*
* - [[com.typesafe.sbt.packager.windows.WindowsPlugin]]
* - [[com.typesafe.sbt.packager.rpm.RpmHelper]]
* - [[com.typesafe.sbt.packager.docker.DockerPlugin]]
* - [[com.typesafe.sbt.packager.debian.DebianNativePackaging]]
* - [[com.typesafe.sbt.packager.rpm.RpmPlugin]]
* - [[com.typesafe.sbt.packager.windows.WindowsPlugin]]
* - [[com.typesafe.sbt.packager.rpm.RpmHelper]]
* - [[com.typesafe.sbt.packager.docker.DockerPlugin]]
* - [[com.typesafe.sbt.packager.debian.DebianNativePackaging]]
* - [[com.typesafe.sbt.packager.rpm.RpmPlugin]]
*
* @param log
* @return turns a Logger into a ProcessLogger
* @return
* turns a Logger into a ProcessLogger
*/
implicit def log2ProcessLogger(log: Logger): sys.process.ProcessLogger =
new BufferedLogger(new FullLogger(log)) with sys.process.ProcessLogger {
Expand All @@ -27,17 +28,20 @@ object Compat {
/**
* Used in
*
* - [[com.typesafe.sbt.packager.docker.DockerPlugin]]
* - [[com.typesafe.sbt.packager.docker.DockerPlugin]]
*
* @param logger The sbt.ProcessLogger that should be wrapped
* @return A scala ProcessLogger
* @param logger
* The sbt.ProcessLogger that should be wrapped
* @return
* A scala ProcessLogger
*/
implicit def sbtProcessLogger2ScalaProcessLogger(logger: sbt.ProcessLogger): sys.process.ProcessLogger =
ProcessLogger(msg => logger.info(msg), err => logger.error(err))

/**
* Use in the scripted `universal/multiproject-classifiers` test.
* @param artifact polyfill new methods
* @param artifact
* polyfill new methods
*/
implicit class CompatArtifact(artifact: Artifact) {
def withClassifier(classifier: Option[String]): Artifact =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ object MappingsHelper {
* return a Seq of mappings which effect is to add a whole directory in the generated package
*
* @example
* {{{
* {{{
* mappings in Universal ++= directory(baseDirectory.value / "extra")
* }}}
* }}}
*
* @param sourceDir
* @return mappings
* @return
* mappings
*/
def directory(sourceDir: File): Seq[(File, String)] =
Option(sourceDir.getParentFile)
Expand All @@ -25,27 +26,29 @@ object MappingsHelper {
* It lightens the build file if one wants to give a string instead of file.
*
* @example
* {{{
* {{{
* mappings in Universal ++= directory("extra")
* }}}
* }}}
*
* @param sourceDir
* @return mappings
* @return
* mappings
*/
def directory(sourceDir: String): Seq[(File, String)] =
directory(file(sourceDir))

/**
* return a Seq of mappings which effect is to add the content of directory in the generated package,
* excluding the directory itself.
* return a Seq of mappings which effect is to add the content of directory in the generated package, excluding the
* directory itself.
*
* @example
* {{{
* {{{
* mappings in Universal ++= sourceDir(baseDirectory.value / "extra")
* }}}
* }}}
*
* @param sourceDir
* @return mappings
* @return
* mappings
*/
def contentOf(sourceDir: File): Seq[(File, String)] =
(sourceDir.*** --- sourceDir) pair relativeTo(sourceDir)
Expand All @@ -54,50 +57,57 @@ object MappingsHelper {
* It lightens the build file if one wants to give a string instead of file.
*
* @example
* {{{
* {{{
* mappings in Universal ++= sourceDir("extra")
* }}}
* }}}
*
* @param sourceDir as string representation
* @return mappings
* @param sourceDir
* as string representation
* @return
* mappings
*/
def contentOf(sourceDir: String): Seq[(File, String)] =
contentOf(file(sourceDir))

/**
* Create mappings from your classpath. For example if you want to add additional
* dependencies, like test or model.
* 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
* {{{
* @example
* Add all test artifacts to a separated test folder
* {{{
* mappings in Universal ++= fromClasspath((managedClasspath in Test).value, target = "test")
* }}}
* }}}
*
* @param entries
* @param target
* @return a list of mappings
* @return
* a list of mappings
*/
def fromClasspath(entries: Seq[Attributed[File]], target: String): Seq[(File, String)] =
fromClasspath(entries, target, _ => true)

/**
* Create mappings from your classpath. For example if you want to add additional
* dependencies, like test or model. You can also filter the artifacts that should
* be mapped to mappings.
* Create mappings from your classpath. For example if you want to add additional dependencies, like test or model.
* You can also filter the artifacts that should be mapped to mappings.
*
* @example Filter all osgi bundles
* {{{
* @example
* Filter all osgi bundles
* {{{
* mappings in Universal ++= fromClasspath(
* (managedClasspath in Runtime).value,
* "osgi",
* artifact => artifact.`type` == "bundle"
* )
* }}}
* }}}
*
* @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
* @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]],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ object SettingsHelper {
) ++ addPackage(config, packageTask, extension, classifier) ++ addResolver(config)

/**
* SBT looks in the `otherResolvers` setting for resolvers defined in `publishTo`.
* If a user scopes a `publishTo`, e.g.
* SBT looks in the `otherResolvers` setting for resolvers defined in `publishTo`. If a user scopes a `publishTo`,
* e.g.
*
* {{{
* // publish the rpm to the target folder
Expand All @@ -82,7 +82,8 @@ object SettingsHelper {
*
* then the resolver must also be present in the `otherResolvers`
*
* @param config the ivy configuration to look for resolvers
* @param config
* the ivy configuration to look for resolvers
*/
private def addResolver(config: Configuration): Seq[Setting[_]] =
Seq(otherResolvers ++= (publishTo in config).value.toSeq)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ object DockerPlugin extends AutoPlugin {
* FROM command
*/
private final def makeFromAs(dockerBaseImage: String, name: String): CmdLike =
Cmd("FROM", dockerBaseImage, "as", name)
Cmd("FROM", dockerBaseImage, "AS", name)

/**
* @param label
Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/ash/add-app-settings/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ TaskKey[Unit]("scriptCheck") := {

TaskKey[Unit]("runCheck") := {
val cwd = (stagingDirectory in Universal).value
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath)
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath)
val output = (sys.process.Process(cmd, cwd).!!).replaceAll("\n", "")

assert(output.contains("info"), s"Application did not receive residual arg 'info'")
assert(output.contains("help"), s"Application did not receive residual arg 'help'")
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
object MainApp extends App {
object MainApp extends App {
println(args.mkString("|"))
}
20 changes: 18 additions & 2 deletions src/sbt-test/ash/command-line-settings/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,26 @@ TaskKey[Unit]("checkResidual") := {
}

TaskKey[Unit]("checkComplexResidual") := {
val args = Seq("-J-Dfoo=bar", "arg1", "--", "-J-Dfoo=bar", "arg 2", "--", "\"", "$foo", "'", "%s", "-y", "bla", "\\'", "\\\"")
val args = Seq(
"-J-Dfoo=bar",
"arg1",
"--",
"-J-Dfoo=bar",
"arg 2",
"--",
"\"",
"$foo",
"'",
"%s",
"-y",
"bla",
"\\'",
"\\\"",
"''"
)
val cwd = (stagingDirectory in Universal).value
val cmd = Seq((cwd / "bin" / packageName.value).getAbsolutePath) ++ args
val expected = """arg1|-J-Dfoo=bar|arg 2|--|"|$foo|'|%s|-y|bla|\'|\""""
val expected = """arg1|-J-Dfoo=bar|arg 2|--|"|$foo|'|%s|-y|bla|\'|\"|''"""

val output = (sys.process.Process(cmd, cwd).!!).split("\n").last
assert(output == expected, s"Application did not receive residual args '$expected' (got '$output')")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object MainApp extends App {
object MainApp extends App {
println(sys.props.collect { case (k, v) => s"$k=$v" } mkString "\n")
println(args.mkString("|"))
}
5 changes: 3 additions & 2 deletions src/sbt-test/ash/override-templates/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ TaskKey[Unit]("runCheckAsh") := {
val cwd = (stagingDirectory in Universal).value
val source =
scala.io.Source.fromFile((cwd / "bin" / packageName.value).getAbsolutePath)
val contents = try source.getLines mkString "\n"
finally source.close()
val contents =
try source.getLines mkString "\n"
finally source.close()
assert(
contents contains "this is the custom bash template",
"Bash template didn't contain the right text: \n" + contents
Expand Down
Loading

0 comments on commit 829e156

Please sign in to comment.