diff --git a/appveyor.yml b/appveyor.yml index 9e58a07..3c93642 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,6 +2,8 @@ skip_tags: true skip_branch_with_pr: true +version: 1.25.0.{build}-SNAPSHOT + # MVS Project configuration image: Visual Studio 2013 platform: Any CPU @@ -19,11 +21,10 @@ install: # Build and test build_script: - - .\build.cmd cleanbuild - -# Publish the JAR file as an artifact -after_build: - - ps: Get-ChildItem target\winp-*.jar | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + - .\build.cmd cleanbuild Release %APPVEYOR_BUILD_VERSION% + - ps: Get-ChildItem target\winp-$env:APPVEYOR_BUILD_VERSION.jar | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + - .\build.cmd cleanbuild Debug %APPVEYOR_BUILD_VERSION%-Debug + - ps: Get-ChildItem target\winp-$env:APPVEYOR_BUILD_VERSION-Debug.jar | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } on_finish: # TODO: enable once there are tests, implement aggregator somehow diff --git a/build.cmd b/build.cmd index f6b4c44..d5fafa2 100644 --- a/build.cmd +++ b/build.cmd @@ -4,6 +4,23 @@ set PATH=%PATH%;%ProgramFiles(x86)%\MSBuild\12.0\Bin\; set BUIDROOT=%cd% :getopts +if "%2"=="" ( + set configuration="Release" +) else ( + set configuration=%2% +) + +if "%3"=="" ( + echo No target version specified, will determine it from POM + REM TODO: Apply some MADSKILLZ to do it without the temporary file? + call mvn -q -Dexec.executable="cmd.exe" -Dexec.args="/c echo ${project.version}" --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec > version.txt + for /f "delims=" %%x in (version.txt) do set version=%%x +) else ( + echo Setting MVN project version to the externally defined %3% + set version=%3% +) +echo Target version is %version% + if "%1"=="" (goto :default) else (goto :%1) goto :exit @@ -11,41 +28,35 @@ goto :exit goto :cleanbuild :cleanbuild -echo "### Cleaning the build directory" +echo ### Cleaning the %configuration% build directory cd %BUIDROOT%\native -msbuild winp.vcxproj /t:Clean /p:Configuration=Release /verbosity:minimal /nologo /p:Platform="Win32" -if %errorlevel% neq 0 exit /b %errorlevel% -msbuild winp.vcxproj /t:Clean /p:Configuration=Release /verbosity:minimal /nologo /p:Platform="x64" -if %errorlevel% neq 0 exit /b %errorlevel% -msbuild winp.vcxproj /t:Clean /p:Configuration=Debug /verbosity:minimal /nologo /p:Platform="Win32" +msbuild winp.vcxproj /t:Clean /p:Configuration=%configuration% /verbosity:minimal /nologo /p:Platform="Win32" if %errorlevel% neq 0 exit /b %errorlevel% -msbuild winp.vcxproj /t:Clean /p:Configuration=Debug /verbosity:minimal /nologo /p:Platform="x64" +msbuild winp.vcxproj /t:Clean /p:Configuration=%configuration% /verbosity:minimal /nologo /p:Platform="x64" if %errorlevel% neq 0 exit /b %errorlevel% goto :build :build -echo "### Building project configurations" +echo ### Building the %configuration% configuration cd %BUIDROOT%\native REM /verbosity:minimal -msbuild winp.vcxproj /p:Configuration=Release /nologo /p:Platform="Win32" +msbuild winp.vcxproj /p:Configuration=%configuration% /nologo /p:Platform="Win32" if %errorlevel% neq 0 exit /b %errorlevel% -msbuild winp.vcxproj /p:Configuration=Release /nologo /p:Platform="x64" -if %errorlevel% neq 0 exit /b %errorlevel% -msbuild winp.vcxproj /p:Configuration=Debug /nologo /p:Platform="Win32" -if %errorlevel% neq 0 exit /b %errorlevel% -msbuild winp.vcxproj /p:Configuration=Debug /nologo /p:Platform="x64" +msbuild winp.vcxproj /p:Configuration=%configuration% /nologo /p:Platform="x64" if %errorlevel% neq 0 exit /b %errorlevel% -echo "### Updating WinP resource files" +echo ### Updating WinP resource files for the %configuration% build cd %BUIDROOT% -COPY native\Release\winp.dll src\main\resources\winp.dll +COPY native\%configuration%\winp.dll src\main\resources\winp.dll if %errorlevel% neq 0 exit /b %errorlevel% -COPY native\x64\Release\winp.dll src\main\resources\winp.x64.dll +COPY native\x64\%configuration%\winp.dll src\main\resources\winp.x64.dll if %errorlevel% neq 0 exit /b %errorlevel% -echo "### Build and Test winp.jar" +echo ### Build and Test winp.jar for %version% cd %BUIDROOT% -mvn --batch-mode clean package verify +call mvn -q --batch-mode versions:set -DnewVersion=%version% +if %errorlevel% neq 0 exit /b %errorlevel% +call mvn --batch-mode clean package verify if %errorlevel% neq 0 exit /b %errorlevel% goto :exit diff --git a/pom.xml b/pom.xml index 60c17b0..e7b4e50 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,7 @@ maven-jar-plugin + 3.0.2 @@ -38,6 +39,7 @@ maven-surefire-plugin + 2.20 never @@ -69,6 +71,7 @@ maven-javadoc-plugin + 2.10.4