Added a support for release builds

This commit is contained in:
Deve 2017-03-05 22:02:50 +01:00
parent be67fb1df9
commit eeb7c8f5de
3 changed files with 26 additions and 5 deletions

View File

@ -5,8 +5,7 @@
android:versionName="1.0"> android:versionName="1.0">
<!-- This .apk has no Java code itself, so set hasCode to false. --> <!-- This .apk has no Java code itself, so set hasCode to false. -->
<application android:debuggable="true" <application android:label="@string/app_name"
android:label="@string/app_name"
android:icon="@drawable/icon" android:icon="@drawable/icon"
android:hasCode="false" android:hasCode="false"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

View File

@ -70,6 +70,10 @@ If you want to prepare a package for particular architecture, you can choose it
by setting the COMPILE_ARCH environmental variable. At this stage, supported by setting the COMPILE_ARCH environmental variable. At this stage, supported
architectures are "armv7", "x86" and "aarch64". The default is "armv7". architectures are "armv7", "x86" and "aarch64". The default is "armv7".
You can choose build type by setting BUILD_TYPE environment variable to "debug"
or "release". The default is debug build. Note that if you choose release build,
you have to manually sign the apk with your key and run zipalign.
Basically if all dependencies are installed in the system, it should be enough Basically if all dependencies are installed in the system, it should be enough
to just run: to just run:

View File

@ -65,11 +65,11 @@ if [ -f "$DIRNAME/obj/compile_arch" ]; then
fi fi
fi fi
# Update variables for selected architecture
if [ -z "$COMPILE_ARCH" ]; then if [ -z "$COMPILE_ARCH" ]; then
COMPILE_ARCH="armv7" COMPILE_ARCH="armv7"
fi fi
# Update variables for selected architecture
if [ "$COMPILE_ARCH" = "armv7" ]; then if [ "$COMPILE_ARCH" = "armv7" ]; then
export NDK_PLATFORM=$NDK_PLATFORM_ARMV7 export NDK_PLATFORM=$NDK_PLATFORM_ARMV7
export NDK_ABI=$NDK_ABI_ARMV7 export NDK_ABI=$NDK_ABI_ARMV7
@ -91,6 +91,23 @@ else
exit exit
fi fi
# Update variables for selected build type
if [ -z "$BUILD_TYPE" ]; then
BUILD_TYPE="debug"
fi
if [ "$BUILD_TYPE" = "debug" ] || [ "$BUILD_TYPE" = "Debug" ]; then
export BUILD_TYPE="debug"
export IS_DEBUG_BUILD=1
elif [ "$BUILD_TYPE" = "release" ] || [ "$BUILD_TYPE" = "Release" ]; then
export BUILD_TYPE="release"
export IS_DEBUG_BUILD=0
else
echo "Unsupported BUILD_TYPE: $BUILD_TYPE. Possible values are: " \
"debug, release"
exit
fi
# Check if we have access to the Android NDK and SDK # Check if we have access to the Android NDK and SDK
if [ -z "$NDK_PATH" ]; then if [ -z "$NDK_PATH" ]; then
export NDK_PATH="$NDK_PATH_DEFAULT" export NDK_PATH="$NDK_PATH_DEFAULT"
@ -278,11 +295,12 @@ ${NDK_PATH}/ndk-build $@ \
APP_ABI="$NDK_ABI" \ APP_ABI="$NDK_ABI" \
APP_PLATFORM="$NDK_PLATFORM" \ APP_PLATFORM="$NDK_PLATFORM" \
APP_CPPFLAGS="$NDK_CPPFLAGS" \ APP_CPPFLAGS="$NDK_CPPFLAGS" \
APP_STL=gnustl_static APP_STL=gnustl_static \
NDK_DEBUG=$IS_DEBUG_BUILD
check_error check_error
# Build apk # Build apk
echo "Building APK" echo "Building APK"
ant debug -Dsdk.dir="$SDK_PATH" -Dtarget=$NDK_PLATFORM ant $BUILD_TYPE -Dsdk.dir="$SDK_PATH" -Dtarget=$NDK_PLATFORM
check_error check_error