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

sbt-project-switcher doesn't work for git submodule projects #2

Closed
Kevin-Lee opened this issue Aug 24, 2019 · 0 comments

Comments

@Kevin-Lee
Copy link
Contributor

@Kevin-Lee Kevin-Lee commented Aug 24, 2019

sbt-project-switcher (pjs) is not working for the project containing submodule projects.

If I use pjs there, I get this.

sbt:test-project-switcher> pjs
  hedgehog
  example
  core
  tpsCore
  tpsCli
  justFp
  sbt-test
  runner
  tpsData
  tpsWeb
  root
> test
  12/12
> 

Now select hedgehog, one of the submodule projects.

> hedgehog
  1/12
> hed

Then I get this.

[error] Not a valid project ID: hedgehog
[error] project hedgehog
[error]

Here is a project example having submodule projects as its dependency libraries.
The project has the folder structure like this

├── build.sbt
├── cli
├── core
├── data
├── web
└── submodule
   ├── just-fp
   └── scala-hedgehog
      ├── core
      ├── example
      ├── runner
      └── sbt-test

This is its build.sbt.

ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := "2.12.9"
ThisBuild / version      := "0.1.0"
ThisBuild / crossScalaVersions := Seq("2.11.12", "2.12.8")

ThisBuild / resolvers += Resolver.url("bintray-scala-hedgehog",
      url("https://dl.bintray.com/hedgehogqa/scala-hedgehog")
    )(Resolver.ivyStylePatterns)


lazy val root = (project in file("."))
  .settings(
    name := "test-project-switcher",
  )
  .dependsOn(tpsCore)
  .dependsOn(tpsData)
  .dependsOn(tpsCli)
  .dependsOn(tpsWeb)

lazy val tpsCore = (project in file("core"))
  .settings(
    name := "tps-core"
  )
  .dependsOn(ProjectRef(file("submodule/scala-hedgehog"), "core") % Test)
  .dependsOn(ProjectRef(file("submodule/scala-hedgehog"), "runner") % Test)
  .dependsOn(ProjectRef(file("submodule/scala-hedgehog"), "test") % Test)
  .dependsOn(RootProject(file("submodule/just-fp")))

lazy val tpsData = (project in file("data"))
  .settings(
    name := "tps-data"
  )
  .dependsOn(tpsCore)

lazy val tpsCli = (project in file("cli"))
  .settings(
    name := "tps-cli"
  )
  .dependsOn(tpsCore)
  .dependsOn(tpsData)

lazy val tpsWeb = (project in file("web"))
  .settings(
    name := "tps-web"
  )
  .dependsOn(tpsCore)
  .dependsOn(tpsData)

and this is the git's submodule config file, .gitmodules.

[submodule "submodule/scala-hedgehog"]
	path = submodule/scala-hedgehog
	url = git@github.com:hedgehogqa/scala-hedgehog.git
[submodule "submodule/just-fp"]
	path = submodule/just-fp
	url = git@github.com:Kevin-Lee/just-fp.git

If you want to test it, get both config files and you need to run the following command in the project root folder to initialise git submodule projects.

git submodule update --init 
Kevin-Lee added a commit to Kevin-Lee/sbt-project-switcher that referenced this issue Aug 24, 2019
@todokr todokr closed this in e96a1ec Sep 16, 2019
todokr added a commit that referenced this issue Sep 16, 2019
Fix #2 - Add support for Git submodule projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.