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

Feature multi project support #1875

Merged

Conversation

GrafBlutwurst
Copy link
Contributor

@GrafBlutwurst GrafBlutwurst commented Jan 11, 2021

This is a much simpler attemt to get support for multiple projects within a mono repo based on the feedback here:

#1093 (comment)

Currently it's still missing tests since I haven't had a good idea how to do those without unnecessary codebloat.

@codecov
Copy link

codecov bot commented Jan 11, 2021

Codecov Report

Merging #1875 (c072e70) into master (e9b5f32) will increase coverage by 0.05%.
The diff coverage is 83.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1875      +/-   ##
==========================================
+ Coverage   75.44%   75.49%   +0.05%     
==========================================
  Files         128      129       +1     
  Lines        2158     2179      +21     
  Branches       55       57       +2     
==========================================
+ Hits         1628     1645      +17     
- Misses        530      534       +4     
Impacted Files Coverage Δ
.../scala/org/scalasteward/core/io/WorkspaceAlg.scala 30.00% <0.00%> (-7.50%) ⬇️
.../org/scalasteward/core/repoconfig/RepoConfig.scala 100.00% <ø> (ø)
...lasteward/core/buildtool/BuildToolDispatcher.scala 80.00% <75.00%> (-1.82%) ⬇️
...org/scalasteward/core/buildtool/mill/MillAlg.scala 90.90% <80.00%> (+0.90%) ⬆️
...g/scalasteward/core/buildtool/maven/MavenAlg.scala 87.50% <100.00%> (+2.88%) ⬆️
...a/org/scalasteward/core/buildtool/sbt/SbtAlg.scala 94.28% <100.00%> (+0.34%) ⬆️
...scalasteward/core/repoconfig/BuildRootConfig.scala 100.00% <100.00%> (ø)
...a/org/scalasteward/core/scalafmt/ScalafmtAlg.scala 66.66% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9b5f32...c072e70. Read the comment docs.

@GrafBlutwurst GrafBlutwurst changed the title WIP: Feature multi project support Feature multi project support Jan 13, 2021
trait BuildToolDispatcher[F[_]] extends BuildToolAlg[F] {
def runMigrationsForAllBuildRoots(repo: Repo, migrations: Nel[Migration]): F[Unit]
def getDependenciesForAllBuildRoots(repo: Repo): F[List[Scope.Dependencies]]
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it unfortunate that BuildToolDispatcher has now methods that work with Repo and BuildRoot but the only methods used outside of BuildToolDispatcher are the ones with Repo. Have you tried to add a second type parameter to BuildToolAlg as mentioned in my comment:

BuildToolDispatcher and the build tool traits like SbtAlg inherit from BuildToolAlg which uses Repo for its methods. Since SbtAlg, MavenAlg, and MillAlg should now operate on BuildRoots instead of Repo but BuildToolDispatcher should still use Repo we need to add a new type parameter to the BuildToolAlg, i.e. BuildToolAlg[F, R] where R would be either a Repo or a BuildRoot.

?

I think with this change, the above additions aren't necessary and the BuildToolDispatcher's callsites (in EditAlg and RepoCacheAlg) also do not need to be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right that might work, I totally didn't see that part of the comment somehow. I'll change this asap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched over, yeah that is a much nicer approach. Technically it should be possible to have contravariant typeclasses on BuildToolAlg that would allow the dispatcher to work easily both for Repo and BuildRoot I didn't do that since I'm a bit pressed for time now but if you see any value in that I'll happily change it to that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now, thanks. I think there is no need for more changes since the dispatcher is only used with Repo for now.

@fthomas fthomas added this to the 0.9.0 milestone Jan 15, 2021
@fthomas fthomas added the enhancement New feature or request label Jan 15, 2021
Copy link
Member

@fthomas fthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @GrafBlutwurst!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support monorepos with scala subfolders Support nonstandard project layout.
2 participants