Skip to content

Commit

Permalink
Allow LIB_DIR, customUrl and curlOpts to be set for get dependency logic
Browse files Browse the repository at this point in the history
Signed-off-by: Lan Xia <[email protected]>
  • Loading branch information
llxia committed Dec 6, 2023
1 parent 21c9cfc commit c7cf199
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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); \
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_tools.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<property name="src" location="../src" />
<property name="build" location="../bin" />
<property name="json.jar" location="../lib/json-simple.jar" />
<property name="json.jar" location="${LIB_DIR}/json-simple.jar" />
<property name="LIB" value="json_simple"/>
<import file="./getDependencies.xml"/>

Expand Down
19 changes: 16 additions & 3 deletions scripts/getDependencies.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/getDependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

<target name="getDependentLibs" unless="skipDependency">
<exec executable="perl" failonerror="true">
<arg line="${TEST_ROOT}/TKG/scripts/getDependencies.pl -path ${TEST_ROOT}/TKG/lib -task default -dependencyList ${LIB}"/>
<arg line="${TEST_ROOT}/TKG/scripts/getDependencies.pl -path ${LIB_DIR} -task default -dependencyList ${LIB}"/>
</exec>
</target>
</project>
9 changes: 8 additions & 1 deletion settings.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit c7cf199

Please sign in to comment.