Skip to content

Commit 631c1b2

Browse files
committed
Merge branch 'main' into emojis
2 parents 91064bc + 0706345 commit 631c1b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+608
-228
lines changed

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 3.7.1
1+
version = 3.7.2
22
runner.dialect = scala213
33
assumeStandardLibraryStripMargin = true
44
align.openParenCallSite = false

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Thanks goes to these wonderful people for contributing to Scala Steward:
9494
* [Don Smith III](https://github.com/cactauz)
9595
* [Doug Roper](https://github.com/htmldoug)
9696
* [Eldar Yusupov](https://github.com/eyusupov)
97+
* [Ender Tunç](https://github.com/endertunc)
9798
* [Erik Erlandson](https://github.com/erikerlandson)
9899
* [Erlend Hamnaberg](https://github.com/hamnis)
99100
* [eugeniyk](https://github.com/eugeniyk)
@@ -126,6 +127,7 @@ Thanks goes to these wonderful people for contributing to Scala Steward:
126127
* [Mark van der Tol](https://github.com/markvandertol)
127128
* [MaT1g3R](https://github.com/MaT1g3R)
128129
* [Mat Mannion](https://github.com/matmannion)
130+
* [Matthias Kurz](https://github.com/mkurz)
129131
* [Michael Wizner](https://github.com/mwz)
130132
* [Michel Daviot](https://github.com/tyrcho)
131133
* [miguelpuyol](https://github.com/miguelpuyol)
@@ -139,8 +141,9 @@ Thanks goes to these wonderful people for contributing to Scala Steward:
139141
* [Renato Cavalcanti](https://github.com/renatocaval)
140142
* [Rikito Taniguchi](https://github.com/tanishiking)
141143
* [Robert Stoll](https://github.com/robstoll)
142-
* [Roman Langolf](https://github.com/rolang)
143144
* [Robin Raju](https://github.com/robinraju)
145+
* [Roman Langolf](https://github.com/rolang)
146+
* [Ropiteaux Théo](https://github.com/ropiteaux)
144147
* [Scott Rice](https://github.com/scottrice10)
145148
* [solar](https://github.com/solar)
146149
* [Stanislav Chetvertkov](https://github.com/stanislav-chetvertkov)
@@ -185,6 +188,7 @@ Consider creating PR to add your company to the list and join the community.
185188
* [Lightbend](https://www.lightbend.com/)
186189
* [Mobimeo](https://www.mobimeo.com/)
187190
* [Ocado Technology](https://ocadotechnology.com/)
191+
* [Play Framework](https://www.playframework.com/)
188192
* [PlayQ](https://www.playq.com/)
189193
* [Precog](https://precog.com/)
190194
* [Rewards Network](https://www.rewardsnetwork.com/)

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ lazy val core = myCrossProject("core")
121121
Dependencies.decline,
122122
Dependencies.fs2Core,
123123
Dependencies.fs2Io,
124+
Dependencies.gitignore,
124125
Dependencies.http4sCirce,
125126
Dependencies.http4sClient,
126127
Dependencies.http4sCore,

docs/help.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All command line arguments for the `scala-steward` application.
55
```
66
Usage:
77
scala-steward validate-repo-config
8-
scala-steward --workspace <file> --repos-file <file> [--git-author-name <string>] --git-author-email <string> [--git-author-signing-key <string>] --git-ask-pass <file> [--sign-commits] [--forge-type <forge-type>] [--forge-api-host <uri>] --forge-login <string> [--do-not-fork] [--add-labels] [--ignore-opts-files] [--env-var <name=value>]... [--process-timeout <duration>] [--whitelist <string>]... [--read-only <string>]... [--enable-sandbox | --disable-sandbox] [--max-buffer-size <integer>] [--repo-config <uri>]... [--disable-default-repo-config] [--scalafix-migrations <uri>]... [--disable-default-scalafix-migrations] [--artifact-migrations <uri>]... [--disable-default-artifact-migrations] [--cache-ttl <duration>] [--bitbucket-use-default-reviewers] [--bitbucket-server-use-default-reviewers] [--gitlab-merge-when-pipeline-succeeds] [--gitlab-required-reviewers <integer>] [--azure-repos-organization <string>] [--github-app-id <integer> --github-app-key-file <file>] [--url-checker-test-url <uri>]... [--default-maven-repo <string>] [--refresh-backoff-period <duration>]
8+
scala-steward --workspace <file> --repos-file <file> [--git-author-name <string>] --git-author-email <string> [--git-author-signing-key <string>] --git-ask-pass <file> [--sign-commits] [--forge-type <forge-type>] [--forge-api-host <uri>] --forge-login <string> [--do-not-fork] [--add-labels] [--ignore-opts-files] [--env-var <name=value>]... [--process-timeout <duration>] [--whitelist <string>]... [--read-only <string>]... [--enable-sandbox | --disable-sandbox] [--max-buffer-size <integer>] [--repo-config <uri>]... [--disable-default-repo-config] [--scalafix-migrations <uri>]... [--disable-default-scalafix-migrations] [--artifact-migrations <uri>]... [--disable-default-artifact-migrations] [--cache-ttl <duration>] [--bitbucket-use-default-reviewers] [--bitbucket-server-use-default-reviewers] [--gitlab-merge-when-pipeline-succeeds] [--gitlab-required-reviewers <integer>] [--gitlab-remove-source-branch] [--azure-repos-organization <string>] [--github-app-id <integer> --github-app-key-file <file>] [--url-checker-test-url <uri>]... [--default-maven-repo <string>] [--refresh-backoff-period <duration>]
99
1010
1111
@@ -80,12 +80,14 @@ Options and flags:
8080
Whether to merge a gitlab merge request when the pipeline succeeds
8181
--gitlab-required-reviewers <integer>
8282
When set, the number of required reviewers for a merge request will be set to this number (non-negative integer). Is only used in the context of gitlab-merge-when-pipeline-succeeds being enabled, and requires that the configured access token have the appropriate privileges. Also requires a Gitlab Premium subscription.
83+
--gitlab-remove-source-branch
84+
Flag indicating if a merge request should remove the source branch when merging.
8385
--azure-repos-organization <string>
8486
The Azure organization (required when --forge-type is azure-repos)
8587
--github-app-id <integer>
86-
GitHub application id
88+
GitHub application id. Repos accessible by this app are added to the repos in repos.md. git-ask-pass is still required.
8789
--github-app-key-file <file>
88-
GitHub application key file
90+
GitHub application key file. Repos accessible by this app are added to the repos in repos.md. git-ask-pass is still required.
8991
--url-checker-test-url <uri>
9092
URL for testing the UrlChecker at start-up (can be used multiple times); default: https://github.com
9193
--default-maven-repo <string>

docs/repo-specific-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pullRequests.grouping = [
6666
{ name = "minor_major", "title" = "Minor/major updates", "filter" = [{"version" = "minor"}, {"version" = "major"}] },
6767
{ name = "typelevel", "title" = "Typelevel updates", "filter" = [{"group" = "org.typelevel"}, {"group" = "org.http4s"}] },
6868
{ name = "my_libraries", "filter" = [{"artifact" = "my-library"}, {"artifact" = "my-other-library", "group" = "my-org"}] },
69-
{ name = "all", title = "Dependency updates", "filter" = [{"group" = "*"}] }
69+
{ name = "all", "title" = "Dependency updates", "filter" = [{"group" = "*"}] }
7070
]
7171

7272
# pullRequests.includeMatchedLabels allows to control which labels are added to PRs

modules/core/src/main/scala/org/scalasteward/core/application/Cli.scala

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,28 @@ object Cli {
280280
"When set, the number of required reviewers for a merge request will be set to this number (non-negative integer). Is only used in the context of gitlab-merge-when-pipeline-succeeds being enabled, and requires that the configured access token have the appropriate privileges. Also requires a Gitlab Premium subscription."
281281
).validate("Required reviewers must be non-negative")(_ >= 0).orNone
282282

283+
private val gitlabRemoveSourceBranch: Opts[Boolean] =
284+
flag(
285+
"gitlab-remove-source-branch",
286+
"Flag indicating if a merge request should remove the source branch when merging."
287+
).orFalse
288+
283289
private val gitLabCfg: Opts[GitLabCfg] =
284-
(gitlabMergeWhenPipelineSucceeds, gitlabRequiredReviewers).mapN(GitLabCfg.apply)
290+
(gitlabMergeWhenPipelineSucceeds, gitlabRequiredReviewers, gitlabRemoveSourceBranch).mapN(
291+
GitLabCfg.apply
292+
)
285293

286294
private val githubAppId: Opts[Long] =
287-
option[Long]("github-app-id", "GitHub application id")
295+
option[Long](
296+
"github-app-id",
297+
"GitHub application id. Repos accessible by this app are added to the repos in repos.md. git-ask-pass is still required."
298+
)
288299

289300
private val githubAppKeyFile: Opts[File] =
290-
option[File]("github-app-key-file", "GitHub application key file")
301+
option[File](
302+
"github-app-key-file",
303+
"GitHub application key file. Repos accessible by this app are added to the repos in repos.md. git-ask-pass is still required."
304+
)
291305

292306
private val gitHubApp: Opts[Option[GitHubApp]] =
293307
(githubAppId, githubAppKeyFile).mapN(GitHubApp.apply).orNone

modules/core/src/main/scala/org/scalasteward/core/application/Config.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ object Config {
158158

159159
final case class GitLabCfg(
160160
mergeWhenPipelineSucceeds: Boolean,
161-
requiredReviewers: Option[Int]
161+
requiredReviewers: Option[Int],
162+
removeSourceBranch: Boolean
162163
) extends ForgeSpecificCfg
163164

164165
final case class GiteaCfg(

modules/core/src/main/scala/org/scalasteward/core/buildtool/mill/MillAlg.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ final class MillAlg[F[_]](implicit
7171
private def getMillVersion(buildRootDir: File): F[Option[Version]] =
7272
for {
7373
millVersionFileContent <- fileAlg.readFile(buildRootDir / millVersionName)
74-
version = millVersionFileContent.flatMap(parser.parseMillVersion)
74+
millVersionFileInConfigContent <- fileAlg.readFile(
75+
buildRootDir / ".config" / millVersionNameInConfig
76+
)
77+
version = millVersionFileContent
78+
.orElse(millVersionFileInConfigContent)
79+
.flatMap(parser.parseMillVersion)
7580
} yield version
7681

7782
private def getMillPluginDeps(
@@ -119,4 +124,5 @@ object MillAlg {
119124
update.artifactIds.exists(_.name === millMainArtifactId.name)
120125

121126
val millVersionName = ".mill-version"
127+
val millVersionNameInConfig = "mill-version"
122128
}

modules/core/src/main/scala/org/scalasteward/core/buildtool/sbt/SbtAlg.scala

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,24 @@ final class SbtAlg[F[_]](config: Config)(implicit
5151
version = maybeProperties.flatMap(parser.parseBuildProperties)
5252
} yield version
5353

54+
private def metaBuildsCount(buildRootDir: File): F[Int] =
55+
fs2.Stream
56+
.iterate(buildRootDir / project)(_ / project)
57+
.take(5L) // Use an upper bound for the meta-builds count to prevent DoS attacks.
58+
.evalMap(fileAlg.isDirectory)
59+
.takeWhile(identity)
60+
.compile
61+
.count
62+
.map(_.toInt)
63+
5464
override def getDependencies(buildRoot: BuildRoot): F[List[Scope.Dependencies]] =
5565
for {
5666
buildRootDir <- workspaceAlg.buildRootDir(buildRoot)
5767
maybeSbtVersion <- getSbtVersion(buildRootDir)
58-
lines <- addStewardPluginTemporarily(buildRootDir, maybeSbtVersion).surround {
59-
val commands = Nel.of(crossStewardDependencies, reloadPlugins, stewardDependencies)
68+
metaBuilds <- metaBuildsCount(buildRootDir)
69+
lines <- addStewardPluginTemporarily(buildRootDir, maybeSbtVersion, metaBuilds).surround {
70+
val commands = Nel.of(crossStewardDependencies) ++
71+
List.fill(metaBuilds)(List(reloadPlugins, stewardDependencies)).flatten
6072
sbt(commands, buildRootDir)
6173
}
6274
dependencies = parser.parseDependencies(lines)
@@ -65,7 +77,8 @@ final class SbtAlg[F[_]](config: Config)(implicit
6577

6678
private def addStewardPluginTemporarily(
6779
buildRootDir: File,
68-
maybeSbtVersion: Option[Version]
80+
maybeSbtVersion: Option[Version],
81+
metaBuilds: Int
6982
): Resource[F, Unit] =
7083
for {
7184
_ <- Resource.unit[F]
@@ -74,8 +87,9 @@ final class SbtAlg[F[_]](config: Config)(implicit
7487
case _ => "1_3_11"
7588
}
7689
plugin <- Resource.eval(stewardPlugin(pluginVersion))
77-
_ <- fileAlg.createTemporarily(buildRootDir / project, plugin)
78-
_ <- fileAlg.createTemporarily(buildRootDir / project / project, plugin)
90+
_ <- List
91+
.iterate(buildRootDir / project, metaBuilds + 1)(_ / project)
92+
.collectFold(fileAlg.createTemporarily(_, plugin))
7993
} yield ()
8094

8195
private def stewardPlugin(version: String): F[FileData] = {

modules/core/src/main/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlg.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,25 @@ final class ScalaCliAlg[F[_]](implicit
4141

4242
override def containsBuild(buildRoot: BuildRoot): F[Boolean] = {
4343
val buildRootPath = buildRoot.relativePath.dropWhile(Set('.', '/'))
44+
val extensions = Set(".sc", ".scala")
4445
gitAlg
4546
.findFilesContaining(buildRoot.repo, "//> using lib ")
46-
.map(_.exists(_.startsWith(buildRootPath)))
47+
.map(_.exists(path => path.startsWith(buildRootPath) && extensions.exists(path.endsWith)))
4748
}
4849

4950
override def getDependencies(buildRoot: BuildRoot): F[List[Scope.Dependencies]] =
5051
for {
5152
buildRootDir <- workspaceAlg.buildRootDir(buildRoot)
5253
exportDir = "tmp-sbt-build-for-scala-steward"
53-
exportCmd =
54-
Nel.of("scala-cli", "export", "--sbt", "--output", exportDir, buildRootDir.pathAsString)
54+
exportCmd = Nel.of(
55+
"scala-cli",
56+
"--power",
57+
"export",
58+
"--sbt",
59+
"--output",
60+
exportDir,
61+
buildRootDir.pathAsString
62+
)
5563
slurpOptions = SlurpOptions.ignoreBufferOverflow
5664
_ <- processAlg.execSandboxed(exportCmd, buildRootDir, slurpOptions = slurpOptions)
5765
exportBuildRoot = buildRoot.copy(relativePath = buildRoot.relativePath + s"/$exportDir")

0 commit comments

Comments
 (0)