Commit 4b4a289f authored by George Nash's avatar George Nash Committed by Rick Bell

IOT-582 Android build generate universal APK

Two major modifications:
1) The aar file no longer adds the TARGET_ARCH to the
name of the file. The aar file contains all of the
architectures that were built upto that point. This
has been the case for quite a while so the architecture
in the name only indicated the build that created the
aar file not the contents of the aar file.

2) When APK files are built it will try to build all
possible architectures as well as the universal APK
file.

Bug: https://jira.iotivity.org/browse/IOT-582
Change-Id: I11f5db9f4cb8c634afe4417b280e5feec6c3d7e9
Signed-off-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
parent 0f2ae826
......@@ -196,6 +196,58 @@ def build_android(flag, extra_option_str):
}
call_scons(build_options, extra_option_str)
def build_android_universal(flag, extra_option_str):
print('''
*******************************************************************************
Starting Android Universal build
This Will take a very long time to complete. It will build the android
build for the following architectures.
- armeabi
- armeabi-v7a
- arm64-v8a
- x86
- x86_64
If you do not need to build a universal APK or you can target a specific
architecture we recommend you build android for that specific target.
*******************************************************************************
''')
print ("*********** Build for android armeabi *************")
build_options = {
'TARGET_OS':'android',
'TARGET_ARCH':'armeabi',
'RELEASE':flag,
}
call_scons(build_options, extra_option_str)
print ("*********** Build for android x86 *************")
build_options = {
'TARGET_OS':'android',
'TARGET_ARCH':'x86',
'RELEASE':flag,
}
call_scons(build_options, extra_option_str)
print ("*********** Build for android armeabi-v7a *************")
build_options = {
'TARGET_OS':'android',
'TARGET_ARCH':'armeabi-v7a',
'RELEASE':flag,
}
call_scons(build_options, extra_option_str)
print ("*********** Build for android x86_64 *************")
build_options = {
'TARGET_OS':'android',
'TARGET_ARCH':'x86_64',
'RELEASE':flag,
}
call_scons(build_options, extra_option_str)
print ("*********** Build for android arm64-v8a *************")
build_options = {
'TARGET_OS':'android',
'TARGET_ARCH':'arm64-v8a',
'RELEASE':flag,
}
call_scons(build_options, extra_option_str)
print ("*********** Finishing Android universal build *************")
def build_android_secured(flag, extra_option_str):
build_android(flag, extra_option_str + " SECURED=1")
......@@ -605,6 +657,14 @@ elif arg_num == 2:
build_android("true", "")
build_android("false", "")
elif str(sys.argv[1]) == "android_universal":
# only build the release version due to long amount of time to build.
build_android_universal("true", "")
elif str(sys.argv[1]) == "android_universal_unsecured":
# only build the release version due to long amount of time to build.
build_android_universal("true", "SECURED=0")
elif str(sys.argv[1]) == "android_unsecured":
build_android_unsecured("true", "")
build_android_unsecured("false", "")
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -19,6 +19,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -27,7 +47,7 @@ repositories {
}
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -19,6 +19,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -27,7 +47,7 @@ repositories {
}
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -19,6 +19,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -27,7 +47,7 @@ repositories {
}
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -19,6 +19,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -27,7 +47,7 @@ repositories {
}
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -30,7 +50,7 @@ repositories {
try {
dependencies {
compile files('libs/android-support-v4.jar')
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -20,6 +20,26 @@ android {
lintOptions {
abortOnError false
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI),
0) * 1000000 + defaultConfig.versionCode
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
universalApk true
}
}
}
repositories {
flatDir {
......@@ -29,7 +49,7 @@ repositories {
try {
dependencies {
compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
compile ":iotivity-base-${RELEASE}@aar"
}
} catch (all) {
print "${ERROR_MSG}"
......
......@@ -63,7 +63,7 @@ android {
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${archivesBaseName}-${TARGET_ARCH}-${RELEASE}.aar"
def fileName = "${archivesBaseName}-${RELEASE}.aar"
output.outputFile = new File(outputFile.parent, fileName)
}