Page tree
Skip to end of metadata
Go to start of metadata

Upgrading dependencies can be extremely time consuming and error prone with as many project as we have. A good solution for now is to use regular expressions.

Contents

Replacing normal project dependency versions

This regular expression uses "group values" in its replacement string. The $# identifiers select the parts of the initial regular expression in parenthesis.

Replace "ihmc-commons" with your library name.

(us\.ihmc[ \t\x0B\S]*:[ \t\x0B\S]*ihmc-commons[ \t\x0B:"a-zA-Z),-]*)([0-9\.]+)("|')
(org\.apache\.commons[ \t\x0B\S]*:[ \t\x0B\S]*commons-lang3[ \t\x0B:"a-zA-Z),-]*)([0-9\.]+)("|')
$1<version>$3

Replacing Gradle plugin versions

(us\.ihmc[ \t\x0B\S\.]*ihmc-build[ \t\x0B:"a-zA-Z)]*)([0-9\.]+)("|')
$1<version>$3

Replacing GAV Dependency Syntax

compile[ \t\x0B]+group[ \t\x0B]*:[ \t\x0B]*(?:"|')([\w\.-]+)(?:"|')[ \t\x0B]*,[ \t\x0B]*name[ \t\x0B]*:[ \t\x0B]*(?:"|')([\w\.-]+)(?:"|')[ \t\x0B]*,[ \t\x0B]*version[ \t\x0B]*:[ \t\x0B]*(?:"|')([\w\.-]+)(?:"|')
compile\("$1:$2:$3"\)
OR (maybe)
api\("$1:$2:$3"\)


# Replacing "compile ihmc.sourceSetProject("blah")"


# detecting kts dependencies
ependencies[ \t\x0B\S]*\{
# detecting "::" syntax
\"[\s\:\-\w\.]+\"
(compile|implementation|api|runtime)[ \t\x0B]*\([ \t\x0B]*\"[\s\-\w\.]+:[\s\:\-\w\.]+\"

# replacing compile("::") with api("::")
(compile|implementation|api|runtime)([ \t\x0B]*\([ \t\x0B]*\"[\s\-\w\.]+:[\s\:\-\w\.]+\")
api$2

# replacing compile "::" with api("::")
(compile|implementation|api|runtime)[ \t\x0B]*(\"[\s\-\w\.]+:[\s\:\-\w\.]+\")
api($2)

Upgrading JUnit 5

IHMCCIPlugin.kt
ihmc-ci/buildSrc/build.gradle.kts
ihmc-build/build.gradle.kts

Proofing for Gradle 6

buildscript \{
pluginManagement \{\n   plugins \{\n      id\(\"us\.ihmc\.ihmc\-build\"\) version \"0\.23\.0\"\n   \}\n\}\n\nbuildscript \{


Miscellaneous other regular expressions of little value

Replace:

(us\.ihmc[ \t\x0B\S\.]*libraryname[ \t\x0B:"a-zA-Z)]*)([0-9\.]+)("|')

with:

$1<version>$3


Examples:


(us\.ihmc[ \t\x0B\S\.]*ihmc-ci[ \t\x0B:"a-zA-Z)]*)([0-9\.]+)("|')

(us\.ihmc[ \t\x0B\S\.]*simulation-construction-set[ \t\x0B:"a-zA-Z)]*)([0-9\.]+)("|')