Various fixes to the build scripts (*.bat & *.sh)
build.readme.md: mention how to build the native libs when on windows Fix target name: rename target to keepass2android-app *.BAT build-scripts: make script fail when a command fails If a command was failing, the script continued to run and didn't fail. The build errors could be hidden. This will make them apparent build-java.bat: - prefix call to gradlew.bat with 'call' Otherwise, the batch file stops at the first gradlew call. - don't build PluginQR as its output is not used, and the build fails with newer Android SDK/NDK build-xamarin.bat: - use VS2019 path, download NuGet dependencies - Call vcvarsall.bat only if not yet done - build also APK - Tested with VS Community 2019 - When calling it multiple times, the PATH env var contains duplicate values and in the end will be too long, leading to vcvarsall.bat failing, and hence build-xamarin.bat too build-java.sh: - don't unset ANDROID_NDK_HOME & ANDROID_NDK Fixes build issues on github actions - add missing KP2AKdbLibrary - add executable bit to src/java/KP2AKdbLibrary/gradlew - support build with msbuild & force use of xabuild when on linux - don't build PluginQR as its output is not used, and the build fails with newer Android SDK/NDK build-xamarin.sh: - put the config (Debug or Release) in a variable build-apk.sh: - fix project name to keepass2android-app.csproj - support build with msbuild & force use of xabuild when on linux Needed for github actions, and will also support building on macos with msbuild - put the config (Debug or Release) in a variable - Add missing /p:Configuration= /p:Platform=AnyCPU which is needed when building nonet on macos (because nonet uses "Release") remove PluginQR
This commit is contained in:
@@ -3,12 +3,26 @@ set -e
|
|||||||
|
|
||||||
pushd ../keepass2android
|
pushd ../keepass2android
|
||||||
|
|
||||||
|
# Determine if we use msbuild or xabuild to build.
|
||||||
|
if which msbuild > /dev/null; then
|
||||||
|
if [ $(uname) == "Linux" ]; then
|
||||||
|
# For now, when running on Linux, we can't use msbuild but have to use xabuild (provided by https://github.com/xamarin/xamarin-android)
|
||||||
|
BUILDER=xabuild
|
||||||
|
else
|
||||||
|
BUILDER=msbuild
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
BUILDER=xabuild
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONFIG=Debug
|
||||||
|
|
||||||
# check if ANDROID_HOME is defined
|
# check if ANDROID_HOME is defined
|
||||||
if [ -z ${ANDROID_HOME+x} ];
|
if [ -z ${ANDROID_HOME+x} ];
|
||||||
then
|
then
|
||||||
xabuild keepass2android.csproj /t:SignAndroidPackage "$@"
|
$BUILDER keepass2android-app.csproj /t:SignAndroidPackage /p:Configuration="$CONFIG" /p:Platform=AnyCPU "$@"
|
||||||
else
|
else
|
||||||
xabuild keepass2android.csproj /p:AndroidSdkDirectory=$ANDROID_HOME /t:SignAndroidPackage "$@"
|
$BUILDER keepass2android-app.csproj /p:AndroidSdkDirectory=$ANDROID_HOME /t:SignAndroidPackage /p:Configuration="$CONFIG" /p:Platform=AnyCPU "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|||||||
@@ -1,20 +1,15 @@
|
|||||||
cd ..\java\JavaFileStorageTest-AS
|
cd ..\java\JavaFileStorageTest-AS
|
||||||
./gradlew clean assemble
|
call ./gradlew clean assemble || exit /b
|
||||||
cd ..\..\build-scripts
|
cd ..\..\build-scripts
|
||||||
|
|
||||||
cd ..\java\KP2ASoftkeyboard_AS
|
cd ..\java\KP2ASoftkeyboard_AS
|
||||||
./gradlew clean assemble
|
call ./gradlew clean assemble || exit /b
|
||||||
cd ..\..\build-scripts
|
cd ..\..\build-scripts
|
||||||
|
|
||||||
cd ..\java\Keepass2AndroidPluginSDK2
|
cd ..\java\Keepass2AndroidPluginSDK2
|
||||||
./gradlew clean assemble
|
call ./gradlew clean assemble || exit /b
|
||||||
cd ..\..\build-scripts
|
cd ..\..\build-scripts
|
||||||
|
|
||||||
cd ..\java\KP2AKdbLibrary
|
cd ..\java\KP2AKdbLibrary
|
||||||
./gradlew clean assemble
|
call ./gradlew clean assemble || exit /b
|
||||||
cd ..\..\build-scripts
|
|
||||||
|
|
||||||
cd ..\java\PluginQR
|
|
||||||
./gradlew clean assemble
|
|
||||||
|
|
||||||
cd ..\..\build-scripts
|
cd ..\..\build-scripts
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
unset ANDROID_NDK_HOME ANDROID_NDK
|
#unset ANDROID_NDK_HOME ANDROID_NDK
|
||||||
|
|
||||||
pushd ../java/
|
pushd ../java/
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ pushd Keepass2AndroidPluginSDK2
|
|||||||
./gradlew assemble
|
./gradlew assemble
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd PluginQR
|
pushd KP2AKdbLibrary
|
||||||
./gradlew assemble
|
./gradlew assemble
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,17 @@ cd ..\..\keepass2android
|
|||||||
call UseManifestDebug.bat
|
call UseManifestDebug.bat
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
|
IF NOT "%VSCMD_VCVARSALL_INIT%" == "1" (
|
||||||
|
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
|
||||||
|
)
|
||||||
|
|
||||||
msbuild KeePass.sln /target:keepass2android /p:BuildProjectReferences=true /p:Configuration="Debug" /p:Platform="Any CPU"
|
REM Download NuGet dependencies
|
||||||
|
msbuild KeePass.sln -t:restore -p:RestorePackagesConfig=true || exit /b
|
||||||
|
|
||||||
cd build-scripts
|
REM Build
|
||||||
|
set CONFIG=Debug
|
||||||
|
msbuild KeePass.sln /target:keepass2android-app /p:BuildProjectReferences=true /p:Configuration="%CONFIG%" /p:Platform="Any CPU" /p:AndroidBuildApplicationPackage=True || exit /b
|
||||||
|
|
||||||
|
cd build-scripts
|
||||||
|
|
||||||
|
echo apk can be found in src\keepass2android\bin\%CONFIG%
|
||||||
|
|||||||
@@ -20,12 +20,26 @@ popd
|
|||||||
|
|
||||||
# call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
|
# call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
|
||||||
|
|
||||||
|
# Determine if we use msbuild or xabuild to build.
|
||||||
|
if which msbuild > /dev/null; then
|
||||||
|
if [ $(uname) == "Linux" ]; then
|
||||||
|
# For now, when running on Linux, we can't use msbuild but have to use xabuild (provided by https://github.com/xamarin/xamarin-android)
|
||||||
|
BUILDER=xabuild
|
||||||
|
else
|
||||||
|
BUILDER=msbuild
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
BUILDER=xabuild
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONFIG=Debug
|
||||||
|
|
||||||
# check if ANDROID_HOME is defined
|
# check if ANDROID_HOME is defined
|
||||||
if [ -z ${ANDROID_HOME+x} ];
|
if [ -z ${ANDROID_HOME+x} ];
|
||||||
then
|
then
|
||||||
xabuild KeePass.sln /target:keepass2android /p:BuildProjectReferences=true /p:Configuration="Debug" /p:Platform="Any CPU" "$@"
|
$BUILDER KeePass.sln /target:keepass2android-app /p:BuildProjectReferences=true /p:Configuration="$CONFIG" /p:Platform="Any CPU" "$@"
|
||||||
else
|
else
|
||||||
xabuild KeePass.sln /target:keepass2android /p:AndroidSdkDirectory=$ANDROID_HOME /p:BuildProjectReferences=true /p:Configuration="Debug" /p:Platform="Any CPU" "$@"
|
$BUILDER KeePass.sln /target:keepass2android-app /p:AndroidSdkDirectory=$ANDROID_HOME /p:BuildProjectReferences=true /p:Configuration="$CONFIG" /p:Platform="Any CPU" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|||||||
@@ -15,7 +15,12 @@ To build KP2A from scratch, make sure that you have Xamarin's Mono for Android i
|
|||||||
## Build
|
## Build
|
||||||
|
|
||||||
### On Windows
|
### On Windows
|
||||||
|
From within the `src` directory, build the native lib with:
|
||||||
|
```bat
|
||||||
|
cd java/argon2
|
||||||
|
%ANDROID_NDK_ROOT%/ndk-build.cmd
|
||||||
|
```
|
||||||
|
Then, from within the `src` directory run:
|
||||||
```bat
|
```bat
|
||||||
cd build-scripts
|
cd build-scripts
|
||||||
build-java.bat
|
build-java.bat
|
||||||
|
|||||||
0
src/java/KP2AKdbLibrary/gradlew
vendored
Normal file → Executable file
0
src/java/KP2AKdbLibrary/gradlew
vendored
Normal file → Executable file
Reference in New Issue
Block a user