From c7cf1991fe1534bfc64f62aedddd0386dcfe764f Mon Sep 17 00:00:00 2001 From: Lan Xia Date: Fri, 17 Nov 2023 15:03:34 -0500 Subject: [PATCH] Allow LIB_DIR, customUrl and curlOpts to be set for get dependency logic Signed-off-by: Lan Xia --- makefile | 2 +- scripts/build_tools.xml | 2 +- scripts/getDependencies.pl | 19 ++++++++++++++++--- scripts/getDependencies.xml | 2 +- settings.mk | 9 ++++++++- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/makefile b/makefile index 9a62bf16..5865c582 100644 --- a/makefile +++ b/makefile @@ -88,7 +88,7 @@ endif # compile tools ####################################### include moveDmp.mk -COMPILE_TOOLS_CMD=ant -f .$(D)scripts$(D)build_tools.xml -DTEST_JDK_HOME=$(TEST_JDK_HOME) -DTEST_ROOT=$(TEST_ROOT) +COMPILE_TOOLS_CMD=ant -f .$(D)scripts$(D)build_tools.xml -DTEST_JDK_HOME=$(TEST_JDK_HOME) -DTEST_ROOT=$(TEST_ROOT) -DLIB_DIR=$(LIB_DIR) compileTools: $(RM) -r $(COMPILATION_OUTPUT); \ diff --git a/scripts/build_tools.xml b/scripts/build_tools.xml index 39f529bc..d89b6115 100644 --- a/scripts/build_tools.xml +++ b/scripts/build_tools.xml @@ -21,7 +21,7 @@ - + diff --git a/scripts/getDependencies.pl b/scripts/getDependencies.pl index b0296af2..fc250099 100644 --- a/scripts/getDependencies.pl +++ b/scripts/getDependencies.pl @@ -27,10 +27,14 @@ # define task my $task = "default"; my $dependencyList = "all"; +my $customUrl = ""; +my $curlOpts = ""; GetOptions ("path=s" => \$path, "task=s" => \$task, - "dependencyList=s" => \$dependencyList) + "dependencyList=s" => \$dependencyList, + "customUrl=s" => \$customUrl, + "curlOpts=s" => \$curlOpts) or die("Error in command line arguments\n"); if (not defined $path) { @@ -188,6 +192,15 @@ my $filename = $path . $sep . $fn; my $shaurl = $jars_info[$i]{shaurl}; my $shafn = $jars_info[$i]{shafn}; + + # if customUrl is provided, use customUrl and reset $url and $shaurl + if ($customUrl ne "") { + $url = "$customUrl/$fn"; + if (defined $shaurl && $shaurl ne '') { + $shaurl = "$customUrl/$shafn"; + } + } + my $shaalg = $jars_info[$i]{shaalg}; if (!$shaalg) { $shaalg = "sha1"; @@ -279,9 +292,9 @@ sub downloadFile { # .txt SHA files are in ISO8859-1 # note _ENCODE_FILE_NEW flag is set for zos if ('.txt' eq substr $filename, -length('.txt')) { - $output = qx{_ENCODE_FILE_NEW=ISO8859-1 curl -k -o $filename $url 2>&1}; + $output = qx{_ENCODE_FILE_NEW=ISO8859-1 curl $curlOpts -k -o $filename $url 2>&1}; } else { - $output = qx{_ENCODE_FILE_NEW=UNTAGGED curl -k -o $filename $url 2>&1}; + $output = qx{_ENCODE_FILE_NEW=UNTAGGED curl $curlOpts -k -o $filename $url 2>&1}; } my $returnCode = $?; if ($returnCode == 0) { diff --git a/scripts/getDependencies.xml b/scripts/getDependencies.xml index 27fbdbac..803a58e1 100644 --- a/scripts/getDependencies.xml +++ b/scripts/getDependencies.xml @@ -99,7 +99,7 @@ - + \ No newline at end of file diff --git a/settings.mk b/settings.mk index 6b616ff3..b45e9042 100644 --- a/settings.mk +++ b/settings.mk @@ -171,7 +171,14 @@ endif ####################################### # common dir and jars ####################################### -LIB_DIR=$(TEST_ROOT)$(D)TKG$(D)lib +ifndef LIB_DIR + LIB_DIR:=$(TEST_ROOT)$(D)TKG$(D)lib +endif +ifeq ($(CYGWIN),1) + LIB_DIR:=$(shell cygpath -w $(LIB_DIR)) +endif +LIB_DIR:=$(subst \,/,$(LIB_DIR)) + TESTNG=$(LIB_DIR)$(D)testng.jar$(P)$(LIB_DIR)$(D)jcommander.jar RESOURCES_DIR=$(JVM_TEST_ROOT)$(D)TestConfig$(D)resources