-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/9/submodule update #12
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
*.class | ||
*.log | ||
repos | ||
project/target | ||
target | ||
.idea |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,30 +2,82 @@ name := "delphi" | |
version := "1.0.0-SNAPSHOT" | ||
scalaVersion := "2.12.4" | ||
|
||
import sys.process._ | ||
import java.io.File | ||
|
||
|
||
lazy val repos = List("delphi-webapi", "delphi-crawler", "delphi-cli", "delphi-management") | ||
lazy val delphiRepos = "repos" | ||
|
||
def cloneAll = Command.command("clone-all") { | ||
state => | ||
Process(s"mkdir -p $delphiRepos").! | ||
val currDir = System.getProperty("user.dir") | ||
for (repo <- repos) { | ||
val bash = "/bin/bash" | ||
val op = "-c" | ||
val clone = s"git clone https://github.com/delphi-hub/$repo" | ||
Process(Seq(bash, op, clone), new File(currDir + "/" + delphiRepos)).! | ||
} | ||
state | ||
} | ||
|
||
|
||
|
||
|
||
|
||
def delete = Command.command("delete") { | ||
state => | ||
val currDir = System.getProperty("user.dir") | ||
val cmd = "rm -rf " + currDir + "/" + delphiRepos | ||
Process(cmd).! | ||
state | ||
} | ||
|
||
|
||
lazy val currentBranch = taskKey[String]("Get current git branch") | ||
|
||
currentBranch := { | ||
Process("git rev-parse --abbrev-ref HEAD").!! | ||
} | ||
|
||
|
||
lazy val pull = taskKey[Unit]("Pull Changes") | ||
|
||
pull := { | ||
val branch = currentBranch.value | ||
for (repo <- repos) { | ||
BuildUtils.pull(repo, branch) | ||
} | ||
|
||
} | ||
|
||
Compile / compile := ((Compile / compile) dependsOn pull).value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The run command by default pull latest changes |
||
|
||
commands += cloneAll | ||
commands += delete | ||
lazy val root = (project in file(".")) | ||
.aggregate(cli, crawler, management, webapi, webapp) | ||
.aggregate(crawler,webapi,cli,management,webapp) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
|
||
lazy val webapi = Project( | ||
id = "webapi", | ||
base = file("repos/delphi-webapi")) | ||
|
||
lazy val cli = Project( | ||
id = "cli", | ||
base = file("delphi-cli")) | ||
id = "cli", | ||
base = file("repos/delphi-cli")) | ||
|
||
lazy val crawler = Project( | ||
id = "crawler", | ||
base = file("delphi-crawler")) | ||
id = "crawler", | ||
base = file("repos/delphi-crawler")) | ||
|
||
lazy val management = Project( | ||
id = "management", | ||
base = file("delphi-management")) | ||
id = "management", | ||
base = file("repos/delphi-management")) | ||
|
||
lazy val webapp = Project( | ||
id = "webapp", | ||
base = file("delphi-webapp")) | ||
|
||
lazy val webapi = Project( | ||
id = "webapi", | ||
base = file("delphi-webapi")) | ||
id = "webapp", | ||
base = file("repos/delphi-webapp")) | ||
|
||
addCommandAlias("run", "; all webapi/run crawler/run webapp/run management/run") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import sys.process._ | ||
import java.io._ | ||
object BuildUtils { | ||
def pull(repo: String, branch: String) = { | ||
val bash="/bin/bash" | ||
val op="-c" | ||
val checkout=s"git checkout $branch" | ||
val gitPull="git pull" | ||
Process(Seq(bash,op,checkout,gitPull),new File(repo)).! | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.1.1 | ||
sbt.version=1.1.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clone is not linked to compile scope. Since it is a one time operation