File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name := " codepropertygraph"
2+
3+ // parsed by project/Versions.scala, updated by updateDependencies.sh
4+ val overflowdbVersion = " 1.19"
5+
26inThisBuild(
37 List (
48 organization := " io.shiftleft" ,
Original file line number Diff line number Diff line change 11name := " codepropertygraph-domain-classes"
22
3- libraryDependencies += " io.shiftleft" %% " overflowdb-traversal" % " 1.19 "
3+ libraryDependencies += " io.shiftleft" %% " overflowdb-traversal" % Versions .overflowdb
44dependsOn(Projects .schema)
55
66lazy val mergeSchemaTask = taskKey[File ](" Merge schemas" )
Original file line number Diff line number Diff line change 1- object Versions {
2- val scalatest = " 3.1.1"
3- val antlr = " 4.7.2"
4- }
5-
61object GitLFSUtils {
72 def isGitLFSEnabled (): Boolean = {
83 import scala .sys .process ._
Original file line number Diff line number Diff line change 1+ /* reads version declarations from /build.sbt so that we can declare them in one place */
2+ object Versions {
3+ val overflowdb = parseVersion(" overflowdbVersion" )
4+ val scalatest = " 3.1.1"
5+ val antlr = " 4.7.2"
6+
7+ private def parseVersion (key : String ): String = {
8+ val versionRegexp = s """ .*val $key[ ]+=[ ]?"(.*?)" """ .r
9+ val versions : List [String ] = scala.io.Source
10+ .fromFile(" build.sbt" )
11+ .getLines
12+ .filter(_.contains(s " val $key" ))
13+ .collect { case versionRegexp(version) => version }
14+ .toList
15+ assert(
16+ versions.size == 1 ,
17+ s """ unable to extract $key from build.sbt, expected exactly one line like `val $key= "0.0.0-SNAPSHOT"`. """ )
18+ versions.head
19+ }
20+
21+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ NON_INTERACTIVE_OPTION=$1
3+ DEPENDENCY=$2
4+
5+ function update {
6+ local NAME=$1
7+ local REPO=$2
8+
9+ local HIGHEST_TAG=` git ls-remote --tags $REPO | awk -F" /" ' {print $3}' | grep ' ^v[0-9]*\.[0-9]*' | grep -v {} | sort --version-sort | tail -n1`
10+ # drop initial v from git tag
11+ local VERSION=${HIGHEST_TAG: 1}
12+ local SEARCH=" val ${NAME} Version\([ ]*\)= .*"
13+ local REPLACE=" val ${NAME} Version\1= \" $VERSION \" "
14+
15+ if [ " $NON_INTERACTIVE_OPTION " == " --non-interactive" ]; then
16+ echo " non-interactive mode, auto-updating the ${NAME} dependency"
17+ sed -i " s/$SEARCH /$REPLACE /" build.sbt
18+ else
19+ echo " set version for $NAME to $VERSION ? [Y/n]"
20+ read ANSWER
21+ if [ -z $ANSWER ] || [ " y" == $ANSWER ] || [ " Y" == $ANSWER ]; then
22+ sed -i " s/$SEARCH /$REPLACE /" build.sbt
23+ fi
24+ fi
25+ }
26+
27+ if [ " $DEPENDENCY " == " " ]; then
28+ update overflowdb git@github.com:ShiftLeftSecurity/overflowdb.git
29+ else
30+ DEPENDENCY=" ${DEPENDENCY# --only=} "
31+ if [ " $DEPENDENCY " == " overflowdb" ]; then
32+ update overflowdb git@github.com:ShiftLeftSecurity/overflowdb.git
33+ else
34+ echo " Unknown dependency: $DEPENDENCY . Aborting."
35+ fi
36+ fi
You can’t perform that action at this time.
0 commit comments