Skip to content

Commit faf8517

Browse files
committed
fix gradle builds by using the appropriate developmentOnly or implementation
1 parent 5b39d5c commit faf8517

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

scripts/pit/lib/lib-patch-v25.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ applyv25patches() {
6565
for __file in `getPomFiles`; do
6666
addMavenDep "$__file" "commons-io" "commons-io" "compile"
6767
done
68-
addGradleDep "commons-io" "commons-io"
68+
addGradleDep "commons-io" "commons-io" developmentOnly
6969
;;
7070
esac
7171

@@ -545,7 +545,7 @@ addDevModeIfNeeded() {
545545
if [ -f "build.gradle" ]; then
546546
if ! grep -q "vaadin-dev" build.gradle 2>/dev/null; then
547547
[ -z "$TEST" ] && log "Adding vaadin-dev dependency to Gradle project"
548-
addGradleDep "com.vaadin" "vaadin-dev"
548+
addGradleDep "com.vaadin" "vaadin-dev" developmentOnly
549549
else
550550
[ -z "$TEST" ] && log "vaadin-dev dependency already present in Gradle project"
551551
fi
@@ -597,7 +597,7 @@ addHillaStarterIfNeeded() {
597597
if [ -f "build.gradle" ]; then
598598
if ! grep -q "hilla-spring-boot-starter" build.gradle 2>/dev/null; then
599599
[ -z "$TEST" ] && log "Adding Hilla Spring Boot Starter dependency to Gradle project"
600-
addGradleDep "com.vaadin" "hilla-spring-boot-starter"
600+
addGradleDep "com.vaadin" "hilla-spring-boot-starter" implementation
601601
else
602602
[ -z "$TEST" ] && log "Hilla Spring Boot Starter dependency already present in Gradle project"
603603
fi
@@ -610,26 +610,28 @@ addHillaStarterIfNeeded() {
610610
## Adds a Gradle dependency to build.gradle
611611
## $1 groupId
612612
## $2 artifactId
613+
## $3 scope (optional: developmentOnly or implementation, defaults to implementation)
613614
addGradleDep() {
614615
local groupId=$1
615616
local artifactId=$2
617+
local scope=${3:-implementation}
616618
local buildFile="build.gradle"
617619

618620
[ ! -f "$buildFile" ] && return 0
619621

620622
# Check if vaadin-spring-boot-starter is present to add after it
621623
if grep -q "implementation.*com\.vaadin:vaadin-spring-boot-starter" "$buildFile"; then
622-
[ -z "$TEST" ] && warn "Adding implementation '$groupId:$artifactId' after vaadin-spring-boot-starter in $buildFile" || cmd "## Adding implementation '$groupId:$artifactId' after vaadin-spring-boot-starter in $buildFile"
624+
[ -z "$TEST" ] && warn "Adding $scope '$groupId:$artifactId' after vaadin-spring-boot-starter in $buildFile" || cmd "## Adding $scope '$groupId:$artifactId' after vaadin-spring-boot-starter in $buildFile"
623625

624-
_cmd="perl -pi -e \"s|(\\s*implementation[\\s'\\\"\\\(]+com\\.vaadin:vaadin-spring-boot-starter['\\\"].*)|\\1\\n developmentOnly '$groupId:$artifactId'|\" \"$buildFile\""
626+
_cmd="perl -pi -e \"s|(\\s*implementation[\\s'\\\"\\\(]+com\\.vaadin:vaadin-spring-boot-starter['\\\"].*)|\\1\\n $scope '$groupId:$artifactId'|\" \"$buildFile\""
625627
cmd "$_cmd"
626628
[ -n "$TEST" ] || eval "$_cmd"
627629
else
628630
# Fallback: add in dependencies block
629631
if grep -q "dependencies\\s*{" "$buildFile"; then
630-
[ -z "$TEST" ] && warn "Adding implementation '$groupId:$artifactId' to dependencies in $buildFile" || cmd "## Adding implementation '$groupId:$artifactId' to dependencies in $buildFile"
632+
[ -z "$TEST" ] && warn "Adding $scope '$groupId:$artifactId' to dependencies in $buildFile" || cmd "## Adding $scope '$groupId:$artifactId' to dependencies in $buildFile"
631633

632-
_cmd="perl -pi -e \"s|(dependencies\\s*{)|\\1\\n implementation '$groupId:$artifactId'|\" \"$buildFile\""
634+
_cmd="perl -pi -e \"s|(dependencies\\s*{)|\\1\\n $scope '$groupId:$artifactId'|\" \"$buildFile\""
633635
cmd "$_cmd"
634636
[ -n "$TEST" ] || eval "$_cmd"
635637
fi

0 commit comments

Comments
 (0)