Skip to content

Commit e961d2a

Browse files
committed
[bugfix] Fix issues in the Windows version of the quick build script
1 parent 11eefe8 commit e961d2a

3 files changed

Lines changed: 25 additions & 11 deletions

File tree

build.bat

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@REM
2626

2727
@echo off
28-
setlocal enabledelayedexpansion
28+
setlocal
2929

3030
set "TARGET=useage"
3131
set "DEBUG=false"
@@ -118,16 +118,21 @@ if "%TARGET%"=="clean" (
118118
) else if "%TARGET%"=="dependency-security-check" (
119119
set "CMD=%BASE_CMD% dependency-check:check"
120120
) else if "%TARGET%"=="format-poms" (
121+
setlocal enabledelayedexpansion
121122
set "SAXON=%USERPROFILE%\.m2\repository\net\sf\saxon\Saxon-HE\9.9.1-8\Saxon-HE-9.9.1-8.jar"
122-
for /r %%POM in (pom.xml) do (
123-
echo | set /p dummyName="Formatting %%POM ..."
124-
java -jar "%SAXON%" -s:%%POM -xsl:format-pom.xslt -o:%%POM
125-
echo OK
123+
for /r %%P in (pom.xml) do (
124+
if exist "%%P" (
125+
set "POM=%%P"
126+
echo | set /p dummyName="Formatting !POM! ..."
127+
java -jar "!SAXON!" -s:!POM! -xsl:format-pom.xslt -o:!POM!
128+
echo OK
126129

127-
echo | set /p dummyName="Checking for duplicate license entries in %%POM ... "
128-
java -cp "%SAXON%" net.sf.saxon.Query -q:check-pom-license-uniqueness.xq pom-file-uri=file:%%POM
129-
echo OK
130+
echo | set /p dummyName="Checking for duplicate license entries in !POM! ... "
131+
java -cp "!SAXON!" net.sf.saxon.Query -q:check-pom-license-uniqueness.xq pom-file-path=!POM!
132+
echo OK
133+
)
130134
)
135+
endlocal
131136
goto end
132137
) else (
133138
echo Invalid target: %TARGET%

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ if [ "${TARGET}" == "format-poms" ]; then
182182
echo "OK"
183183

184184
echo -n "Checking for duplicate license entries in ${pom} ... "
185-
CMD="java -cp ${SAXON} net.sf.saxon.Query -q:check-pom-license-uniqueness.xq pom-file-uri=file:${pom}"
185+
CMD="java -cp ${SAXON} net.sf.saxon.Query -q:check-pom-license-uniqueness.xq pom-file-path=${pom}"
186186
$CMD
187187
echo "OK"
188188

check-pom-license-uniqueness.xq

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,18 @@ declare namespace pom = "http://maven.apache.org/POM/4.0.0";
3131
declare option output:omit-xml-declaration "yes";
3232

3333

34-
(: Must be set externally with the URI to the pom.xml file :)
35-
declare variable $pom-file-uri as xs:string external;
34+
(: Must be set externally with the file-system path to the pom.xml file :)
35+
declare variable $pom-file-path as xs:string external;
3636

37+
declare %private function local:path-to-uri($path as xs:string) as xs:string {
38+
if (starts-with($path, "/"))
39+
then
40+
"file://" || $path
41+
else
42+
"file:///" || replace($path, "\\", "/")
43+
};
44+
45+
let $pom-file-uri := local:path-to-uri($pom-file-path)
3746
let $pom := doc($pom-file-uri)
3847
return
3948
(

0 commit comments

Comments
 (0)