Skip to content

Commit fd76308

Browse files
Merge pull request #153 from cqse/ts/46176_update_teamscale_upload
TS-46176 Updated teamscale-upload
2 parents 6bab0ec + 4a503db commit fd76308

218 files changed

Lines changed: 12351 additions & 3 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

reportUploadTask/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,15 @@ async function uploadFiles(taskParameters: TaskParameters, dirPatternToUpload: s
232232

233233
function createTeamscaleUploadRunner(taskParameters: TaskParameters, message: string, dirPatternToUpload: string): toolRunner.ToolRunner {
234234
const isWindows = os.type().match(/^Win/);
235-
let teamscaleUploadPath = path.join(__dirname, 'teamscaleUpload/teamscale-upload.exe');
235+
const teamscaleUploadBaseDir = path.join(__dirname, 'teamscaleUpload');
236+
let teamscaleUploadPath = path.join(teamscaleUploadBaseDir, 'teamscale-upload-windows', 'bin', 'teamscale-upload');
236237
if (!isWindows) {
237-
teamscaleUploadPath = path.join(__dirname, 'teamscaleUpload/teamscale-upload');
238+
teamscaleUploadPath = path.join(teamscaleUploadBaseDir, 'teamscale-upload-linux', 'bin', 'teamscale-upload');
238239
// the vsix is a zip which does not preserve permissions
239-
// so our teamscale-upload binary is not executable by default
240+
// so our teamscale-upload and java binaries are not executable by default
240241
fs.chmodSync(teamscaleUploadPath, '777');
242+
const teamscaleUploadJavaPath = path.join(teamscaleUploadBaseDir, 'teamscale-upload-linux', 'bin', 'java');
243+
fs.chmodSync(teamscaleUploadJavaPath, '777');
241244
}
242245

243246
let enableDebugOutput = false;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**Command-line tool to upload external analysis results (coverage, findings, ...) to Teamscale.**
2+
3+
This distribution contains the teamscale-upload tool and a corresponding Java execution environment (JVM) packed into a zip archive.
4+
To use the tool unpack the archive and call the executable (`teamscale-upload/bin/teamscale-upload`).
5+
6+
Run `teamscale-upload/bin/teamscale-upload --help` to see all available options.
15.9 KB
Binary file not shown.
Binary file not shown.
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
#!/usr/bin/env sh
2+
3+
##############################################################################
4+
##
5+
## teamscale-upload start up script for UN*X
6+
##
7+
##############################################################################
8+
9+
# Attempt to set APP_HOME
10+
# Resolve links: $0 may be a link
11+
PRG="$0"
12+
# Need this for relative symlinks.
13+
while [ -h "$PRG" ] ; do
14+
ls=`ls -ld "$PRG"`
15+
link=`expr "$ls" : '.*-> \(.*\)$'`
16+
if expr "$link" : '/.*' > /dev/null; then
17+
PRG="$link"
18+
else
19+
PRG=`dirname "$PRG"`"/$link"
20+
fi
21+
done
22+
SAVED="`pwd`"
23+
cd "`dirname \"$PRG\"`/.." >/dev/null
24+
APP_HOME="`pwd -P`"
25+
cd "$SAVED" >/dev/null
26+
27+
APP_NAME="teamscale-upload"
28+
APP_BASE_NAME=`basename "$0"`
29+
30+
# Add default JVM options here. You can also use JAVA_OPTS and TEAMSCALE_UPLOAD_OPTS to pass JVM options to this script.
31+
DEFAULT_JVM_OPTS='"-XX:-OmitStackTraceInFastThrow"'
32+
33+
# Use the maximum available, or set MAX_FD != -1 to use that value.
34+
MAX_FD="maximum"
35+
36+
warn () {
37+
echo "$*"
38+
}
39+
40+
die () {
41+
echo
42+
echo "$*"
43+
echo
44+
exit 1
45+
}
46+
47+
# OS specific support (must be 'true' or 'false').
48+
cygwin=false
49+
msys=false
50+
darwin=false
51+
nonstop=false
52+
case "`uname`" in
53+
CYGWIN* )
54+
cygwin=true
55+
;;
56+
Darwin* )
57+
darwin=true
58+
;;
59+
MINGW* )
60+
msys=true
61+
;;
62+
NONSTOP* )
63+
nonstop=true
64+
;;
65+
esac
66+
67+
CLASSPATH="$APP_HOME/lib/*"
68+
69+
JAVA_HOME="$APP_HOME"
70+
JAVACMD="$JAVA_HOME/bin/java"
71+
72+
# Increase the maximum file descriptors if we can.
73+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
74+
MAX_FD_LIMIT=`ulimit -H -n`
75+
if [ $? -eq 0 ] ; then
76+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
77+
MAX_FD="$MAX_FD_LIMIT"
78+
fi
79+
ulimit -n $MAX_FD
80+
if [ $? -ne 0 ] ; then
81+
warn "Could not set maximum file descriptor limit: $MAX_FD"
82+
fi
83+
else
84+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
85+
fi
86+
fi
87+
88+
# For Darwin, add options to specify how the application appears in the dock
89+
if $darwin; then
90+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
91+
fi
92+
93+
# For Cygwin, switch paths to Windows format before running java
94+
if $cygwin ; then
95+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
96+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
97+
JAVA_HOME="$APP_HOME"
98+
JAVACMD="$JAVA_HOME/bin/java"
99+
100+
# We build the pattern for arguments to be converted via cygpath
101+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
102+
SEP=""
103+
for dir in $ROOTDIRSRAW ; do
104+
ROOTDIRS="$ROOTDIRS$SEP$dir"
105+
SEP="|"
106+
done
107+
OURCYGPATTERN="(^($ROOTDIRS))"
108+
# Add a user-defined pattern to the cygpath arguments
109+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
110+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
111+
fi
112+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
113+
i=0
114+
for arg in "$@" ; do
115+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
116+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
117+
118+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
119+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
120+
else
121+
eval `echo args$i`="\"$arg\""
122+
fi
123+
i=$((i+1))
124+
done
125+
case $i in
126+
(0) set -- ;;
127+
(1) set -- "$args0" ;;
128+
(2) set -- "$args0" "$args1" ;;
129+
(3) set -- "$args0" "$args1" "$args2" ;;
130+
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
131+
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
132+
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
133+
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
134+
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
135+
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
136+
esac
137+
fi
138+
139+
# Escape application args
140+
save () {
141+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
142+
echo " "
143+
}
144+
APP_ARGS=$(save "$@")
145+
146+
147+
148+
# Collect all arguments for the java command, following the shell quoting and substitution rules
149+
eval set -- $DEFAULT_JVM_OPTS $CDS_JVM_OPTS $JAVA_OPTS $TEAMSCALE_UPLOAD_OPTS -classpath "\"$CLASSPATH\"" com.teamscale.upload.TeamscaleUpload "$APP_ARGS"
150+
151+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
152+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
153+
cd "$(dirname "$0")"
154+
fi
155+
156+
exec "$JAVACMD" "$@"
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
@if "%DEBUG%" == "" @echo off
2+
@rem ##########################################################################
3+
@rem
4+
@rem teamscale-upload startup script for Windows
5+
@rem
6+
@rem ##########################################################################
7+
8+
@rem Set local scope for the variables with windows NT shell
9+
if "%OS%"=="Windows_NT" setlocal
10+
11+
set DIRNAME=%~dp0
12+
if "%DIRNAME%" == "" set DIRNAME=.
13+
14+
set APP_BASE_NAME=%~n0
15+
set APP_HOME=%DIRNAME%..
16+
17+
@rem Add default JVM options here. You can also use JAVA_OPTS and TEAMSCALE_UPLOAD_OPTS to pass JVM options to this script.
18+
set DEFAULT_JVM_OPTS="-XX:-OmitStackTraceInFastThrow"
19+
20+
set JAVA_HOME="%APP_HOME%"
21+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
22+
set JAVA_EXE="%JAVA_EXE:"=%"
23+
24+
if exist %JAVA_EXE% goto init
25+
26+
echo.
27+
echo ERROR: The directory %JAVA_HOME% does not contain a valid Java runtime for your platform.
28+
echo.
29+
echo Please set the JAVA_HOME variable in your environment to match the
30+
echo location of your Java installation.
31+
32+
goto fail
33+
34+
:init
35+
@rem Get command-line arguments, handling Windows variants
36+
37+
if not "%OS%" == "Windows_NT" goto win9xME_args
38+
39+
:win9xME_args
40+
@rem Slurp the command line arguments.
41+
set CMD_LINE_ARGS=
42+
set _SKIP=2
43+
44+
:win9xME_args_slurp
45+
if "x%~1" == "x" goto execute
46+
47+
set CMD_LINE_ARGS=%*
48+
49+
:execute
50+
@rem Setup the command line
51+
52+
set CLASSPATH="%JAVA_HOME:"=%/lib/*"
53+
54+
55+
56+
@rem Execute teamscale-upload
57+
%JAVA_EXE% %DEFAULT_JVM_OPTS% %CDS_JVM_OPTS% %JAVA_OPTS% %TEAMSCALE_UPLOAD_OPTS% -classpath %CLASSPATH% com.teamscale.upload.TeamscaleUpload %CMD_LINE_ARGS%
58+
59+
:end
60+
@rem End local scope for the variables with windows NT shell
61+
if "%ERRORLEVEL%"=="0" goto mainEnd
62+
63+
:fail
64+
rem Set variable TEAMSCALE_UPLOAD_EXIT_CONSOLE if you need the _script_ return code instead of
65+
rem the _cmd.exe /c_ return code!
66+
if not "" == "%TEAMSCALE_UPLOAD_EXIT_CONSOLE%" exit 1
67+
exit /b 1
68+
69+
:mainEnd
70+
if "%OS%"=="Windows_NT" endlocal
71+
72+
:omega
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
############################################################
2+
# Default Logging Configuration File
3+
#
4+
# You can use a different file by specifying a filename
5+
# with the java.util.logging.config.file system property.
6+
# For example, java -Djava.util.logging.config.file=myfile
7+
############################################################
8+
9+
############################################################
10+
# Global properties
11+
############################################################
12+
13+
# "handlers" specifies a comma-separated list of log Handler
14+
# classes. These handlers will be installed during VM startup.
15+
# Note that these classes must be on the system classpath.
16+
# By default we only configure a ConsoleHandler, which will only
17+
# show messages at the INFO and above levels.
18+
handlers= java.util.logging.ConsoleHandler
19+
20+
# To also add the FileHandler, use the following line instead.
21+
#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
22+
23+
# Default global logging level.
24+
# This specifies which kinds of events are logged across
25+
# all loggers. For any given facility this global level
26+
# can be overridden by a facility-specific level
27+
# Note that the ConsoleHandler also has a separate level
28+
# setting to limit messages printed to the console.
29+
.level= INFO
30+
31+
############################################################
32+
# Handler specific properties.
33+
# Describes specific configuration info for Handlers.
34+
############################################################
35+
36+
# default file output is in user's home directory.
37+
java.util.logging.FileHandler.pattern = %h/java%u.log
38+
java.util.logging.FileHandler.limit = 50000
39+
java.util.logging.FileHandler.count = 1
40+
# Default number of locks FileHandler can obtain synchronously.
41+
# This specifies maximum number of attempts to obtain lock file by FileHandler
42+
# implemented by incrementing the unique field %u as per FileHandler API documentation.
43+
java.util.logging.FileHandler.maxLocks = 100
44+
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
45+
46+
# Limit the messages that are printed on the console to INFO and above.
47+
java.util.logging.ConsoleHandler.level = INFO
48+
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
49+
50+
# Example to customize the SimpleFormatter output format
51+
# to print one-line log message like this:
52+
# <level>: <log message> [<date/time>]
53+
#
54+
# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n
55+
56+
############################################################
57+
# Facility-specific properties.
58+
# Provides extra control for each logger.
59+
############################################################
60+
61+
# For example, set the com.xyz.foo logger to only log SEVERE
62+
# messages:
63+
# com.xyz.foo.level = SEVERE

0 commit comments

Comments
 (0)