0

i have a scala js sbt project, i developped in this project new user interface components.

the person p1 has a project with the same structure (same build.properties & plugins.sbt), how can he access to my user interface components.

Should i add some specification in build.sbt ?

  • Why do you want to use the build tool for this? You have git! Just let p1 create a branch, push it and p2 can look at it, cherry-pick, merge into her/his own branch. – cbley May 29 '20 at 11:19
  • it more about sharing libraries, should i add something in build .sbt ? – zyad elkhadir May 29 '20 at 11:24
  • What do you mean by sharing? If code is in the project it is shared. If you add `libraryDependency` to the build and it compiles for you, it will compile for everyone else. – Mateusz Kubuszok May 29 '20 at 11:29

1 Answers1

1

If you want to share some project settings, you can create a sbt plugin - it will allow you to have some common settings, add dependencies to other sbt plugins and even override their configuration. See for example sbt-softwaremill as a example of plugin that is used to share some commons between projects.

It won't magically update all configs, because:

  • build.properties is evaluated before the sbt code is run
  • you have to add this plugin to plugins.sbt
  • you have to create project structure in each project

Any more config sharing than that is theoretically possible by e.g. using git submodules and commiting symlinks to repo, but that would be pretty wrong - any change to one project would result in a change in another project, and you have them separated for a reason - if both projects were the same you would have one project in the first place.

And if you are need to share the code itself, you can build the code, publish it to an artifactory and add dependency in another project.

But that's only if you really have two projects, and it's entirely possible that you just need to have one git project with different branches, where ever developer would work on their own branch and then merge changes to common branch, bacause that's the point of using git.

Mateusz Kubuszok
  • 24,995
  • 4
  • 42
  • 64
  • In build. sbt i just should add sbtPlugin := true and for other projects just add in project/plugins.sbt addSbtPlugin("...."). the other projects should be in same repository ? – zyad elkhadir May 29 '20 at 11:57
  • Plugin development for sbt 1.x requires Scala 2.12, `sbtPlugin := true`. Best practices are on docs: https://www.scala-sbt.org/1.x/docs/Plugins-Best-Practices.html . Once you build and deploy plugin to artifactory it can be used in project (of you don'y have artifactory then everyone who needs to use it would have to build and publish it locally). – Mateusz Kubuszok May 29 '20 at 12:36