Skip to content

Commit

Permalink
[android][versioning] use a dotted VERSION_CODE
Browse files Browse the repository at this point in the history
  • Loading branch information
Rechi authored and MartijnKaijser committed Oct 30, 2017
1 parent ded58c5 commit 5dc8ce9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
10 changes: 10 additions & 0 deletions cmake/scripts/android/Install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ configure_file(${CMAKE_SOURCE_DIR}/tools/android/packaging/make_symbols.sh
file(WRITE ${CMAKE_BINARY_DIR}/tools/depends/Makefile.include
"$(PREFIX)/lib/${APP_NAME_LC}/lib${APP_NAME_LC}.so: ;\n")

string(REPLACE "." ";" APP_VERSION_CODE_LIST ${APP_VERSION_CODE})
list(GET APP_VERSION_CODE_LIST 0 major)
list(GET APP_VERSION_CODE_LIST 1 minor)
list(GET APP_VERSION_CODE_LIST 2 patch)
unset(APP_VERSION_CODE_LIST)
math(EXPR APP_VERSION_CODE_ANDROID "(${major} * 100 + ${minor}) * 1000 + ${patch}")
unset(major)
unset(minor)
unset(patch)

set(package_files strings.xml
activity_main.xml
colors.xml
Expand Down
3 changes: 3 additions & 0 deletions cmake/scripts/common/Macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@ macro(core_find_versions)
string(REPLACE " " ";" version_list "${version_list}")
cmake_parse_arguments(APP "" "APP_NAME;COMPANY_NAME;WEBSITE;VERSION_MAJOR;VERSION_MINOR;VERSION_TAG;VERSION_CODE;ADDON_API;APP_PACKAGE" "" ${version_list})

if(NOT ${APP_VERSION_CODE} MATCHES "^[0-9]+\\.[0-9][0-9]?\\.[0-9][0-9]?[0-9]?$")
message(FATAL_ERROR "VERSION_CODE was set to ${APP_VERSION_CODE} in version.txt, but it has to match '^\\d+\\.\\d{1,2}\\.\\d{1,3}$'")
endif()
set(APP_NAME ${APP_APP_NAME}) # inconsistency but APP_APP_NAME looks weird
string(TOLOWER ${APP_APP_NAME} APP_NAME_LC)
string(TOUPPER ${APP_APP_NAME} APP_NAME_UC)
Expand Down
2 changes: 1 addition & 1 deletion tools/android/packaging/xbmc/AndroidManifest.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="@APP_PACKAGE@"
android:installLocation="auto"
android:versionCode="@APP_VERSION_CODE@"
android:versionCode="@APP_VERSION_CODE_ANDROID@"
android:versionName="@APP_VERSION@" >

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="22" />
Expand Down
3 changes: 1 addition & 2 deletions version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ WEBSITE http://kodi.tv
VERSION_MAJOR 18
VERSION_MINOR 0
VERSION_TAG ALPHA1
VERSION_CODE 1790701
VERSION_CODE 17.99.701
ADDON_API 17.9.701
APP_PACKAGE org.xbmc.kodi

0 comments on commit 5dc8ce9

Please sign in to comment.