This repository was archived by the owner on Aug 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathxModuleAnalyzer-NET.sh
More file actions
38 lines (29 loc) · 1.5 KB
/
xModuleAnalyzer-NET.sh
File metadata and controls
38 lines (29 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# For use with linux actions in https://github.com/whitesource-ft/ws-examples/tree/main/Prioritize/DotNet/Multi-Module
# Modify SEARCHDIR & RELEASEDIR before running
SEARCHDIR=$(pwd)
RELEASEDIR='/bin/'
# Finds all the .csproject file in the SEARCHDIR excluding names with build, test, host, & migration
for csproject in $(find $SEARCHDIR -type f \( -wholename "*.csproj" ! -wholename "*build*" ! -wholename "*test*" ! -wholename "*host*" ! -wholename "*migration*" \))
do
# For each .csproject found it takes the basename
# example: fastapp.csproject becomes fastapp
echo "Found" $csproject
CSPROJ=$(basename $csproject .csproj)
# For each basename of the .csproject, find a dll with the same name in the release directory excluding names with build, test, host, & migration
find ./ -type f \( -wholename "$RELEASEDIR$CSPROJ.dll" ! -wholename "*build*" ! -wholename "*test*" ! -wholename "*host*" ! -wholename "*migration*" \) -print >> multi-module.txt
done
# Writes all the found .dlls to a multi-module.txt file in the same directory
file="./multi-module.txt"
dlls=`cat $file`
for DLL in $dlls;
do
# For each dll in the above list, print out the variables that will be used for the prioritize scan
echo "appPath:" $DLL
DIR="$(echo "$DLL" | awk -F "$RELEASEDIR" '{print $1}')"
echo "directory:" $DIR
PROJECT=$(basename $DLL .dll)
echo "PROJECT:" $PROJECT
# Run a WSS prioritize scan for each DLL in the multi-module.txt file
java -jar wss-unified-agent.jar -appPath "$DLL" -d "$DIR" -project "$PROJECT"
done