Skip to content

Commit 2971323

Browse files
committed
Move library scripts to lib/scripts in distributable
1 parent 8721a55 commit 2971323

11 files changed

+68
-58
lines changed

Diff for: build.gradle.kts

+24-14
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,27 @@ val copyGradleScripts by tasks.registering(Copy::class) {
132132
}
133133
from(layout.projectDirectory.dir("components/scripts/gradle")) {
134134
include("gradle-init-scripts/**")
135-
into("lib/")
135+
into("lib/scripts/")
136136
}
137137
from(layout.projectDirectory.dir("components/scripts")) {
138138
include("README.md")
139139
include("mapping.example")
140140
include("network.settings")
141-
include("lib/**")
142-
exclude("lib/cli-parsers")
143141
filter { line: String -> line.replace("<HEAD>", releaseVersion.get()) }
144142
filter { line: String -> line.replace("<SUMMARY_VERSION>", buildScanSummaryVersion) }
145143
}
144+
from(layout.projectDirectory.dir("components/scripts/lib")) {
145+
include("**")
146+
exclude("cli-parsers")
147+
filter { line: String -> line.replace("<HEAD>", releaseVersion.get()) }
148+
filter { line: String -> line.replace("<SUMMARY_VERSION>", buildScanSummaryVersion) }
149+
into("lib/scripts/")
150+
}
146151
from(generateBashCliParsers.map { it.outputDir.file("lib/cli-parsers/gradle") }) {
147-
into("lib/")
152+
into("lib/scripts/")
148153
}
149154
from(commonComponents) {
150-
into("lib/build-scan-clients/")
155+
into("lib/scripts/build-scan-clients/")
151156
}
152157
into(layout.buildDirectory.dir("scripts/gradle"))
153158
}
@@ -176,19 +181,24 @@ val copyMavenScripts by tasks.registering(Copy::class) {
176181
include("README.md")
177182
include("mapping.example")
178183
include("network.settings")
179-
include("lib/**")
180-
exclude("lib/cli-parsers")
181184
filter { line: String -> line.replace("<HEAD>", releaseVersion.get()) }
182185
filter { line: String -> line.replace("<SUMMARY_VERSION>", buildScanSummaryVersion) }
183186
}
187+
from(layout.projectDirectory.dir("components/scripts/lib")) {
188+
include("**")
189+
exclude("cli-parsers")
190+
filter { line: String -> line.replace("<HEAD>", releaseVersion.get()) }
191+
filter { line: String -> line.replace("<SUMMARY_VERSION>", buildScanSummaryVersion) }
192+
into("lib/scripts/")
193+
}
184194
from(generateBashCliParsers.map { it.outputDir.file("lib/cli-parsers/maven") }) {
185-
into("lib/")
195+
into("lib/scripts/")
186196
}
187197
from(commonComponents) {
188-
into("lib/build-scan-clients/")
198+
into("lib/scripts/build-scan-clients/")
189199
}
190200
from(mavenComponents) {
191-
into("lib/maven-libs/")
201+
into("lib/scripts/maven-libs/")
192202
}
193203
into(layout.buildDirectory.dir("scripts/maven"))
194204
}
@@ -237,8 +247,8 @@ val shellcheckGradleScripts by tasks.registering(Shellcheck::class) {
237247
description = "Perform quality checks on Gradle build validation scripts using Shellcheck."
238248
sourceFiles = copyGradleScripts.get().outputs.files.asFileTree.matching {
239249
include("**/*.sh")
240-
// scripts in lib/ are checked when Shellcheck checks the top-level scripts because the top-level scripts include (source) the scripts in lib/
241-
exclude("lib/")
250+
// scripts in lib/scripts/ are checked when Shellcheck checks the top-level scripts because the top-level scripts include (source) the scripts in lib/
251+
exclude("lib/scripts/")
242252
}
243253
// scripts in lib/ are still inputs to this task (we want shellcheck to run if they change) even though we don't include them explicitly in sourceFiles
244254
inputs.files(copyGradleScripts.get().outputs.files.asFileTree.matching {
@@ -258,8 +268,8 @@ val shellcheckMavenScripts by tasks.registering(Shellcheck::class) {
258268
description = "Perform quality checks on Maven build validation scripts using Shellcheck."
259269
sourceFiles = copyMavenScripts.get().outputs.files.asFileTree.matching {
260270
include("**/*.sh")
261-
// scripts in lib/ are checked when Shellcheck checks the top-level scripts because the top-level scripts include (source) the scripts in lib/
262-
exclude("lib/")
271+
// scripts in lib/scripts/ are checked when Shellcheck checks the top-level scripts because the top-level scripts include (source) the scripts in lib/
272+
exclude("lib/scripts/")
263273
}
264274
// scripts in lib/ are still inputs to this task (we want shellcheck to run if they change) even though we don't include them explicitly in sourceFiles
265275
inputs.files(copyMavenScripts.get().outputs.files.asFileTree.matching {

Diff for: components/scripts/gradle/01-validate-incremental-building.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ readonly SCRIPT_NAME
1919
# shellcheck disable=SC2164 # it is highly unlikely cd will fail here because we're cding to the location of this script
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo .)")"; pwd)"
2121
readonly SCRIPT_DIR
22-
readonly LIB_DIR="${SCRIPT_DIR}/lib"
22+
readonly LIB_DIR="${SCRIPT_DIR}/lib/scripts"
2323
readonly INIT_SCRIPTS_DIR="${LIB_DIR}/gradle-init-scripts"
2424

2525
# Include and parse the command line arguments
26-
# shellcheck source=lib/01-cli-parser.sh
26+
# shellcheck source=lib/scripts/01-cli-parser.sh
2727
source "${LIB_DIR}/${EXP_NO}-cli-parser.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/${EXP_NO}-cli-parser.sh'\033[0m"; exit 100; }
28-
# shellcheck source=lib/libs.sh
28+
# shellcheck source=lib/scripts/libs.sh
2929
source "${LIB_DIR}/libs.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/libs.sh'\033[0m"; exit 100; }
3030

3131
# These will be set by the config functions (see lib/config.sh)

Diff for: components/scripts/gradle/02-validate-local-build-caching-same-location.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ readonly SCRIPT_NAME
1919
# shellcheck disable=SC2164 # it is highly unlikely cd will fail here because we're cding to the location of this script
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo .)")"; pwd)"
2121
readonly SCRIPT_DIR
22-
readonly LIB_DIR="${SCRIPT_DIR}/lib"
22+
readonly LIB_DIR="${SCRIPT_DIR}/lib/scripts"
2323
readonly INIT_SCRIPTS_DIR="${LIB_DIR}/gradle-init-scripts"
2424

2525
# Include and parse the command line arguments
26-
# shellcheck source=lib/02-cli-parser.sh
26+
# shellcheck source=lib/scripts/02-cli-parser.sh
2727
source "${LIB_DIR}/${EXP_NO}-cli-parser.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/${EXP_NO}-cli-parser.sh'\033[0m"; exit 100; }
28-
# shellcheck source=lib/libs.sh
28+
# shellcheck source=lib/scripts/libs.sh
2929
source "${LIB_DIR}/libs.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/libs.sh'\033[0m"; exit 100; }
3030

3131
# These will be set by the config functions (see lib/config.sh)

Diff for: components/scripts/gradle/03-validate-local-build-caching-different-locations.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ readonly SCRIPT_NAME
1919
# shellcheck disable=SC2164 # it is highly unlikely cd will fail here because we're cding to the location of this script
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo .)")"; pwd)"
2121
readonly SCRIPT_DIR
22-
readonly LIB_DIR="${SCRIPT_DIR}/lib"
22+
readonly LIB_DIR="${SCRIPT_DIR}/lib/scripts"
2323
readonly INIT_SCRIPTS_DIR="${LIB_DIR}/gradle-init-scripts"
2424

2525
# Include and parse the command line arguments
26-
# shellcheck source=lib/03-cli-parser.sh
26+
# shellcheck source=lib/scripts/03-cli-parser.sh
2727
source "${LIB_DIR}/${EXP_NO}-cli-parser.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/${EXP_NO}-cli-parser.sh'\033[0m"; exit 100; }
28-
# shellcheck source=lib/libs.sh
28+
# shellcheck source=lib/scripts/libs.sh
2929
source "${LIB_DIR}/libs.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/libs.sh'\033[0m"; exit 100; }
3030

3131
# These will be set by the config functions (see lib/config.sh)

Diff for: components/scripts/gradle/04-validate-remote-build-caching-ci-ci.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ readonly SCRIPT_NAME
1919
# shellcheck disable=SC2164 # it is highly unlikely cd will fail here because we're cding to the location of this script
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo .)")"; pwd)"
2121
readonly SCRIPT_DIR
22-
readonly LIB_DIR="${SCRIPT_DIR}/lib"
22+
readonly LIB_DIR="${SCRIPT_DIR}/lib/scripts"
2323

2424
# Include and parse the command line arguments
25-
# shellcheck source=lib/04-cli-parser.sh
25+
# shellcheck source=lib/scripts/04-cli-parser.sh
2626
source "${LIB_DIR}/${EXP_NO}-cli-parser.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/${EXP_NO}-cli-parser.sh'\033[0m"; exit 100; }
27-
# shellcheck source=lib/libs.sh
27+
# shellcheck source=lib/scripts/libs.sh
2828
# shellcheck disable=SC2154 # the libs include scripts that reference CLI arguments that this script does not create
2929
source "${LIB_DIR}/libs.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/libs.sh'\033[0m"; exit 100; }
3030

Diff for: components/scripts/gradle/05-validate-remote-build-caching-ci-local.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ readonly SCRIPT_NAME
1919
# shellcheck disable=SC2164 # it is highly unlikely cd will fail here because we're cding to the location of this script
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo .)")"; pwd)"
2121
readonly SCRIPT_DIR
22-
readonly LIB_DIR="${SCRIPT_DIR}/lib"
22+
readonly LIB_DIR="${SCRIPT_DIR}/lib/scripts"
2323
readonly INIT_SCRIPTS_DIR="${LIB_DIR}/gradle-init-scripts"
2424

2525
# Include and parse the command line arguments
26-
# shellcheck source=lib/05-cli-parser.sh
26+
# shellcheck source=lib/scripts/05-cli-parser.sh
2727
source "${LIB_DIR}/${EXP_NO}-cli-parser.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/${EXP_NO}-cli-parser.sh'\033[0m"; exit 100; }
28-
# shellcheck source=lib/libs.sh
28+
# shellcheck source=lib/scripts/libs.sh
2929
source "${LIB_DIR}/libs.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/libs.sh'\033[0m"; exit 100; }
3030

3131
# These will be set by the config functions (see lib/config.sh)

Diff for: components/scripts/lib/libs.sh

+17-17
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,53 @@ failed_to_load_lib() {
1212
exit "${_UNEXPECTED_ERROR}"
1313
}
1414

15-
# shellcheck source=lib/logging.sh
15+
# shellcheck source=lib/scripts/logging.sh
1616
source "${LIB_DIR}/logging.sh" || failed_to_load_lib logging.sh
1717

18-
# shellcheck source=lib/build-scan-offline.sh
18+
# shellcheck source=lib/scripts/build-scan-offline.sh
1919
source "${LIB_DIR}/build-scan-offline.sh" || failed_to_load_lib build-scan-offline.sh
2020

21-
# shellcheck source=lib/build-scan-parse.sh
21+
# shellcheck source=lib/scripts/build-scan-parse.sh
2222
source "${LIB_DIR}/build-scan-parse.sh" || failed_to_load_lib build-scan-parse.sh
2323

24-
# shellcheck source=lib/build-scan-online.sh
24+
# shellcheck source=lib/scripts/build-scan-online.sh
2525
source "${LIB_DIR}/build-scan-online.sh" || failed_to_load_lib build-scan-online.sh
2626

27-
# shellcheck source=lib/color.sh
27+
# shellcheck source=lib/scripts/color.sh
2828
source "${LIB_DIR}/color.sh" || failed_to_load_lib color.sh
2929

30-
# shellcheck source=lib/config.sh
30+
# shellcheck source=lib/scripts/config.sh
3131
source "${LIB_DIR}/config.sh" || failed_to_load_lib config.sh
3232

33-
# shellcheck source=lib/exit-code.sh
33+
# shellcheck source=lib/scripts/exit-code.sh
3434
source "${LIB_DIR}/exit-code.sh" || failed_to_load_lib exit-code.sh
3535

36-
# shellcheck source=lib/git.sh
36+
# shellcheck source=lib/scripts/git.sh
3737
source "${LIB_DIR}/git.sh" || failed_to_load_lib git.sh
3838

39-
# shellcheck source=lib/gradle.sh
39+
# shellcheck source=lib/scripts/gradle.sh
4040
source "${LIB_DIR}/gradle.sh" || failed_to_load_lib gradle.sh
4141

42-
# shellcheck source=lib/help.sh
42+
# shellcheck source=lib/scripts/help.sh
4343
source "${LIB_DIR}/help.sh" || failed_to_load_lib help.sh
4444

45-
# shellcheck source=lib/summary.sh
45+
# shellcheck source=lib/scripts/summary.sh
4646
source "${LIB_DIR}/summary.sh" || failed_to_load_lib summary.sh
4747

48-
# shellcheck source=lib/init.sh
48+
# shellcheck source=lib/scripts/init.sh
4949
source "${LIB_DIR}/init.sh" || failed_to_load_lib init.sh
5050

51-
# shellcheck source=lib/java.sh
51+
# shellcheck source=lib/scripts/java.sh
5252
source "${LIB_DIR}/java.sh" || failed_to_load_lib java.sh
5353

54-
# shellcheck source=lib/maven.sh
54+
# shellcheck source=lib/scripts/maven.sh
5555
source "${LIB_DIR}/maven.sh" || failed_to_load_lib maven.sh
5656

57-
# shellcheck source=lib/paths.sh
57+
# shellcheck source=lib/scripts/paths.sh
5858
source "${LIB_DIR}/paths.sh" || failed_to_load_lib paths.sh
5959

60-
# shellcheck source=lib/project.sh
60+
# shellcheck source=lib/scripts/project.sh
6161
source "${LIB_DIR}/project.sh" || failed_to_load_lib project.sh
6262

63-
# shellcheck source=lib/interactive-mode.sh
63+
# shellcheck source=lib/scripts/interactive-mode.sh
6464
source "${LIB_DIR}/interactive-mode.sh" || failed_to_load_lib interactive-mode.sh

Diff for: components/scripts/maven/01-validate-local-build-caching-same-location.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ readonly SCRIPT_NAME
1919
# shellcheck disable=SC2164 # it is highly unlikely cd will fail here because we're cding to the location of this script
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo .)")"; pwd)"
2121
readonly SCRIPT_DIR
22-
readonly LIB_DIR="${SCRIPT_DIR}/lib"
22+
readonly LIB_DIR="${SCRIPT_DIR}/lib/scripts"
2323

2424
# Include and parse the command line arguments
25-
# shellcheck source=lib/01-cli-parser.sh
25+
# shellcheck source=lib/scripts/01-cli-parser.sh
2626
source "${LIB_DIR}/${EXP_NO}-cli-parser.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/${EXP_NO}-cli-parser.sh'\033[0m"; exit 100; }
27-
# shellcheck source=lib/libs.sh
27+
# shellcheck source=lib/scripts/libs.sh
2828
source "${LIB_DIR}/libs.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/libs.sh'\033[0m"; exit 100; }
2929

3030
# These will be set by the config functions (see lib/config.sh)

Diff for: components/scripts/maven/02-validate-local-build-caching-different-locations.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ readonly SCRIPT_NAME
1919
# shellcheck disable=SC2164 # it is highly unlikely cd will fail here because we're cding to the location of this script
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo .)")"; pwd)"
2121
readonly SCRIPT_DIR
22-
readonly LIB_DIR="${SCRIPT_DIR}/lib"
22+
readonly LIB_DIR="${SCRIPT_DIR}/lib/scripts"
2323

2424
# Include and parse the command line arguments
25-
# shellcheck source=lib/02-cli-parser.sh
25+
# shellcheck source=lib/scripts/02-cli-parser.sh
2626
source "${LIB_DIR}/${EXP_NO}-cli-parser.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/${EXP_NO}-cli-parser.sh'\033[0m"; exit 100; }
27-
# shellcheck source=lib/libs.sh
27+
# shellcheck source=lib/scripts/libs.sh
2828
source "${LIB_DIR}/libs.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/libs.sh'\033[0m"; exit 100; }
2929

3030
# These will be set by the config functions (see lib/config.sh)

Diff for: components/scripts/maven/03-validate-remote-build-caching-ci-ci.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ readonly SCRIPT_NAME
1919
# shellcheck disable=SC2164 # it is highly unlikely cd will fail here because we're cding to the location of this script
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo .)")"; pwd)"
2121
readonly SCRIPT_DIR
22-
readonly LIB_DIR="${SCRIPT_DIR}/lib"
22+
readonly LIB_DIR="${SCRIPT_DIR}/lib/scripts"
2323

2424
# Include and parse the command line arguments
25-
# shellcheck source=lib/03-cli-parser.sh
25+
# shellcheck source=lib/scripts/03-cli-parser.sh
2626
source "${LIB_DIR}/${EXP_NO}-cli-parser.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/${EXP_NO}-cli-parser.sh'\033[0m"; exit 100; }
27-
# shellcheck source=lib/libs.sh
27+
# shellcheck source=lib/scripts/libs.sh
2828
# shellcheck disable=SC2154 # the libs include scripts that reference CLI arguments that this script does not create
2929
source "${LIB_DIR}/libs.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/libs.sh'\033[0m"; exit 100; }
3030

Diff for: components/scripts/maven/04-validate-remote-build-caching-ci-local.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ readonly SCRIPT_NAME
1919
# shellcheck disable=SC2164 # it is highly unlikely cd will fail here because we're cding to the location of this script
2020
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo .)")"; pwd)"
2121
readonly SCRIPT_DIR
22-
readonly LIB_DIR="${SCRIPT_DIR}/lib"
22+
readonly LIB_DIR="${SCRIPT_DIR}/lib/scripts"
2323

2424
# Include and parse the command line arguments
25-
# shellcheck source=lib/04-cli-parser.sh
25+
# shellcheck source=lib/scripts/04-cli-parser.sh
2626
source "${LIB_DIR}/${EXP_NO}-cli-parser.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/${EXP_NO}-cli-parser.sh'\033[0m"; exit 100; }
27-
# shellcheck source=lib/libs.sh
27+
# shellcheck source=lib/scripts/libs.sh
2828
source "${LIB_DIR}/libs.sh" || { echo -e "\033[00;31m\033[1mERROR: Couldn't find '${LIB_DIR}/libs.sh'\033[0m"; exit 100; }
2929

3030
# These will be set by the config functions (see lib/config.sh)

0 commit comments

Comments
 (0)