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

Reorganize into multiple sbt projects #45

Merged
merged 5 commits into from
Jul 29, 2023

Conversation

thanhbv
Copy link
Contributor

@thanhbv thanhbv commented Dec 8, 2022

Pls see the commit messages for details.

Benefits

  • Users who use anorm now don't depend on zio-interop-cats and all its transitive dependencies, eg cats.
  • tranzactio now don't have optional dependencies.
      It is dangerous to ensure that an optional dependency is actually optional.
      For example, if we (in tranzactio's code) import a doobie's class in a class
      in shared code and user use anorm (so they don't add doobie dependency because
      its optional) - then there will be a RuntimeException.

(The only) break change

Users of tranzactio have to change their libraryDependencies:

  • Before:
// Add this if they use doobie
libraryDependencies ++= Seq(
  "io.github.gaelrenoux" %% "tranzactio" % version,
  "org.tpolecat" %% "doobie-core" % doobieVersion,
)
// Add this if they use anorm
libraryDependencies ++= Seq(
  "io.github.gaelrenoux" %% "tranzactio" % version,
  "org.playframework.anorm" %% "anorm" % anormVersion,
)
  • Now:
// Add this if they use doobie
libraryDependencies += "io.github.gaelrenoux" %% "tranzactio-doobie" % version
// Add this if they use anorm
libraryDependencies += "io.github.gaelrenoux" %% "tranzactio-anorm" % version,

@gaelrenoux
Copy link
Owner

I'll take a look. It makes the project more complex, but I agree that bringing all Cats into the dependencies when you're not using it is an issue.

+ tranzactio (core): Only depends on zio and zio-stream
+ tranzactio-anorm: Depends on core and play's anorm
+ tranzactio-doobie: Depends on core, zio-interop-cats, and doobie-core
+ examples: Contains the old src/samples/scala as the test sources.

+ Old test sources `integration.{AnormIT, DoobieIT}` also be moved to examples project because they depend on examples' classes.
+ (The only) break changes: Users of tranzactio have to change their libraryDependencies:
  Before:
```
// Add this if they use doobie
libraryDependencies ++= Seq(
  "io.github.gaelrenoux" %% "tranzactio" % version,
  "org.tpolecat" %% "doobie-core" % doobieVersion,
)
// Add this if they use anorm
libraryDependencies ++= Seq(
  "io.github.gaelrenoux" %% "tranzactio" % version,
  "org.playframework.anorm" %% "anorm" % anormVersion,
)
```
  Now:
```
// Add this if they use doobie
libraryDependencies += "io.github.gaelrenoux" %% "tranzactio-doobie" % version
// Add this if they use anorm
libraryDependencies += "io.github.gaelrenoux" %% "tranzactio-anorm" % version,
```

+ Users who use anorm now don't depend on zio-interop-cats and all its transitive dependencies, eg cats.
+ tranzactio now don't have optional dependencies.
  It is dangerous to ensure that an optional dependency is actually optional.
  For example, if we (in tranzactio's code) import a doobie's class in a class
  in shared code and user use anorm (so they dont add doobie dependency because
  its optional) - then there will be a RuntimeException.
@gaelrenoux
Copy link
Owner

(Rebased on master)

@gaelrenoux gaelrenoux added this to the 5.0.0 milestone Jul 29, 2023
@gaelrenoux gaelrenoux merged commit e05778a into gaelrenoux:master Jul 29, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants