::****************** May need to be changed for your project*********************
@set name=JN-AN-1200-ZigBee-RF4CE-Application-Template
::****************** Change end*********************

@set release=%1
@set releaseType=%2

@if /I "%1" == "" goto prompt
@if /I "%2" == "" goto prompt

goto go

:prompt

@set /p release=Enter Release version:
@set /p releaseType=Is this an Internal, Review or Public release (i/r/p):

:go

@set tagExtension=
@if /I "%releaseType%" == "i" (set tagExtension=-Internal)
@if /I "%releaseType%" == "r" (set tagExtension=-Review)
@if /I "%releaseType%" == "p" (set tagExtension=-Public)

::* Assume PDF unless for review *
@set docFormat=.pdf
@if /I "%releaseType%" == "r" (set docFormat=.docx)

@echo Generating distribution

::****************** May need to be changed for your project*********************
@set svnRepo=https://www.collabnet.nxp.com/svn/lprf_apps/Application_Notes/%name%
@set svnRepoTag=%svnRepo%/Tags/Release_%release%%tagExtension%
@set zipDir=%name%
::****************** Change end*********************

@echo Tag trunk for release...
@svn copy -m "Tagging %name%-%release%" %svnRepo%/Trunk %svnRepoTag%

@echo Creating release from local dir
@mkdir %zipDir%
@mkdir %zipDir%\Doc
@svn -q export %svnRepoTag%/.cproject             %zipDir%/.cproject
@svn -q export %svnRepoTag%/.project              %zipDir%/.project
@svn -q export %svnRepoTag%/Doc/%name%%docFormat% %zipDir%/Doc/%name%%docFormat%
@svn -q export %svnRepoTag%/Common                %zipDir%/Common
@svn -q export %svnRepoTag%/Receiver              %zipDir%/Receiver
@svn -q export %svnRepoTag%/Remote                %zipDir%/Remote

@echo Creating distribution zip file
@call "C:\Program Files\7-Zip\7z.exe" a %name%-%release%.zip %zipDir%

@echo Updating zip files in svn
svn import -m "Importing %name%-%release%.zip" %name%-%release%.zip	%svnRepo%/Release/Tags/%name%-%release%.zip

@echo Remove local zip file and folder
@del /S /F %name%-%release%.zip
@rmdir /S /Q %zipDir%

@echo Complete


