forked from RWS/dxa-web-application-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-from-archetype.cmd
42 lines (33 loc) · 1.38 KB
/
generate-from-archetype.cmd
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
39
40
41
42
@echo off
rem Builds the web application,
rem generates archetype using it,
rem builds a new application from archetype (using archetype already installed to Maven Repo!),
rem checks if the artifacts are exactly the same analyzing the size of dxa-webapp folders.
rem Script is used during Jenkins job.
setlocal
call mvn -f dxa-webapp\pom.xml clean package
cd dxa-webapp\target
mv dxa-webapp.war dxa-webapp-original.war
For /F "tokens=1* delims==" %%A IN (maven-archiver\pom.properties) DO (
IF "%%A"=="version" set version=%%B
)
mkdir dxa-webapp-from-archetype
cd dxa-webapp-from-archetype
call mvn archetype:generate -B -DarchetypeCatalog=local -DarchetypeGroupId=com.sdl.dxa -DarchetypeArtifactId=dxa-webapp-archetype -DarchetypeVersion=%version% -DgroupId=org.example -DartifactId=dxa-webapp -Dversion=%version% -Dpackage=org.example
endlocal
rem jenkins step!
call mvn -f dxa-webapp\target\dxa-webapp-from-archetype\dxa-webapp\pom.xml clean package
@echo off
setlocal
cd dxa-webapp\target
mv dxa-webapp-from-archetype\dxa-webapp\target\dxa-webapp.war dxa-webapp.war
set size=0
cd dxa-webapp
for /r %%x in (*) do set /a size += %%~zx
set size1=0
cd ..\dxa-webapp-from-archetype\dxa-webapp\target\dxa-webapp
for /r %%x in (*) do set /a size1 += %%~zx
if NOT %size% == %size1% (
echo "Sizes of original (%size% Bytes) and generated (%size1% Bytes) webapps differ! Exiting."
exit /b 1)
endlocal