2019-02-12 03:13:16 -06:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
|
2019-02-15 06:38:32 -06:00
|
|
|
// buildhost settings - paths and the like
|
|
|
|
apply from: 'liboSettings.gradle'
|
|
|
|
|
2019-02-12 03:13:16 -06:00
|
|
|
android {
|
|
|
|
compileSdkVersion 28
|
|
|
|
defaultConfig {
|
2019-04-16 05:53:38 -05:00
|
|
|
// applicationId defined in liboSettings.gradle
|
2019-02-12 03:13:16 -06:00
|
|
|
minSdkVersion 21
|
|
|
|
targetSdkVersion 28
|
|
|
|
versionCode 1
|
2019-04-16 05:53:38 -05:00
|
|
|
// versionName defined in liboSettings.gradle
|
2019-02-12 03:13:16 -06:00
|
|
|
}
|
|
|
|
buildTypes {
|
|
|
|
debug {
|
2019-04-16 05:53:38 -05:00
|
|
|
resValue "string", "app_name", "${liboAppName} Debug"
|
|
|
|
resValue "string", "vendor", "${liboVendor}"
|
|
|
|
resValue "string", "info_url", "${liboInfoURL}"
|
2019-02-12 03:13:16 -06:00
|
|
|
ndk {
|
|
|
|
//abiFilters "x86", "armeabi-v7a", "armeabi"
|
|
|
|
abiFilters "armeabi-v7a"
|
|
|
|
}
|
2019-02-21 03:16:32 -06:00
|
|
|
debuggable true
|
2019-02-12 03:13:16 -06:00
|
|
|
}
|
|
|
|
release {
|
2019-04-12 11:05:31 -05:00
|
|
|
resValue "string", "app_name", "${liboAppName}"
|
2019-04-16 05:53:38 -05:00
|
|
|
resValue "string", "vendor", "${liboVendor}"
|
|
|
|
resValue "string", "info_url", "${liboInfoURL}"
|
2019-02-12 03:13:16 -06:00
|
|
|
ndk {
|
|
|
|
abiFilters "armeabi-v7a"
|
|
|
|
}
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'),
|
2019-03-22 11:24:47 -05:00
|
|
|
'proguard-rules.pro'
|
2019-02-12 03:13:16 -06:00
|
|
|
}
|
|
|
|
}
|
2019-02-15 06:37:18 -06:00
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
// let gradle pack the shared library into apk
|
|
|
|
jniLibs.srcDirs = ['src/main/cpp/lib']
|
|
|
|
}
|
|
|
|
}
|
2019-02-12 03:13:16 -06:00
|
|
|
externalNativeBuild {
|
|
|
|
cmake {
|
|
|
|
path "src/main/cpp/CMakeLists.txt"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-01 14:21:06 -05:00
|
|
|
repositories {
|
|
|
|
flatDir {
|
|
|
|
dirs "${liboWorkdir}/UnpackedTarball/owncloud_android_lib/build/outputs/aar"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-12 03:13:16 -06:00
|
|
|
dependencies {
|
|
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
implementation 'androidx.appcompat:appcompat:1.0.2'
|
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
2019-03-22 11:24:47 -05:00
|
|
|
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
|
|
|
implementation 'com.google.android.material:material:1.1.0-alpha04'
|
2019-04-01 14:21:06 -05:00
|
|
|
implementation(name:'owncloud_android_lib', ext:'aar')
|
2019-02-12 03:13:16 -06:00
|
|
|
}
|
2019-02-15 06:38:32 -06:00
|
|
|
|
|
|
|
task copyUnpackAssets(type: Copy) {
|
|
|
|
description "copies assets that need to be extracted on the device"
|
2019-02-15 09:09:57 -06:00
|
|
|
into 'src/main/assets/unpack'
|
2019-02-15 06:38:32 -06:00
|
|
|
into('program') {
|
|
|
|
from("${liboInstdir}/${liboEtcFolder}/types") {
|
|
|
|
includes = [
|
|
|
|
"offapi.rdb",
|
|
|
|
"oovbaapi.rdb"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
from("${liboInstdir}/${liboUreMiscFolder}") {
|
|
|
|
includes = ["types.rdb"]
|
|
|
|
rename 'types.rdb', 'udkapi.rdb'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
into('user/fonts') {
|
|
|
|
from "${liboInstdir}/share/fonts/truetype"
|
|
|
|
// Note: restrict list of fonts due to size considerations - no technical reason anymore
|
|
|
|
// ToDo: fonts would be good candidate for using Expansion Files instead
|
|
|
|
includes = [
|
|
|
|
"Liberation*.ttf",
|
|
|
|
"Caladea-*.ttf",
|
|
|
|
"Carlito-*.ttf",
|
|
|
|
"Gen*.ttf",
|
|
|
|
"opens___.ttf"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
into('etc/fonts') {
|
2019-02-15 07:27:55 -06:00
|
|
|
from "${liboSrcRoot}/android/source/"
|
2019-02-15 06:38:32 -06:00
|
|
|
includes = ['fonts.conf']
|
|
|
|
filter {
|
|
|
|
String line ->
|
|
|
|
line.replaceAll(
|
|
|
|
'@@APPLICATION_ID@@', new String("${android.defaultConfig.applicationId}")
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task copyAssets(type: Copy) {
|
|
|
|
description "copies assets that can be accessed within the installed apk"
|
|
|
|
into 'src/main/assets'
|
2019-03-28 06:59:31 -05:00
|
|
|
from("${liboSrcRoot}/instdir/") {
|
|
|
|
includes = ["LICENSE.html", "NOTICE"]
|
|
|
|
rename "LICENSE.html", "license.html"
|
2019-02-15 06:38:32 -06:00
|
|
|
rename "NOTICE", "notice.txt"
|
|
|
|
}
|
|
|
|
from("${liboExampleDocument}") {
|
|
|
|
rename ".*", "example.odt"
|
|
|
|
}
|
|
|
|
into('program') {
|
|
|
|
from "${liboInstdir}/program"
|
|
|
|
includes = ['services.rdb', 'services/services.rdb']
|
|
|
|
|
|
|
|
into('resource') {
|
|
|
|
from "${liboInstdir}/${liboSharedResFolder}"
|
|
|
|
includes = ['*en-US.res']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
into('share') {
|
|
|
|
from "${liboInstdir}/share"
|
|
|
|
// Filter data is needed by e.g. the drawingML preset shape import.
|
|
|
|
includes = ['registry/**', 'filter/**']
|
|
|
|
// those two get processed by mobile-config.py
|
|
|
|
excludes = ['registry/main.xcd', 'registry/res/registry_en-US.xcd']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task createFullConfig(type: Copy) {
|
|
|
|
into 'src/main/assets/share/config/soffice.cfg'
|
|
|
|
from "${liboInstdir}/share/config/soffice.cfg"
|
|
|
|
}
|
|
|
|
|
|
|
|
task createStrippedConfig {
|
|
|
|
def preserveDir = file("src/main/assets/share/config/soffice.cfg/empty")
|
|
|
|
outputs.dir "src/main/assets/share/registry/res"
|
|
|
|
outputs.file preserveDir
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
file('src/main/assets/share/registry/res').mkdirs()
|
|
|
|
file("src/main/assets/share/config/soffice.cfg").mkdirs()
|
|
|
|
// just empty file
|
|
|
|
preserveDir.text = ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
task createStrippedConfigMain(type: Exec) {
|
|
|
|
dependsOn 'createStrippedConfig'
|
|
|
|
inputs.files "${liboInstdir}/share/registry/main.xcd", "${liboSrcRoot}/android/mobile-config.py"
|
|
|
|
outputs.file "src/main/assets/share/registry/main.xcd"
|
|
|
|
executable "${liboSrcRoot}/android/mobile-config.py"
|
|
|
|
args = ["${liboInstdir}/share/registry/main.xcd", "src/main/assets/share/registry/main.xcd"]
|
|
|
|
}
|
|
|
|
|
|
|
|
task createStrippedConfigRegistry(type: Exec) {
|
|
|
|
dependsOn 'createStrippedConfig'
|
|
|
|
inputs.files "${liboInstdir}/share/registry/res/registry_en-US.xcd", "${liboSrcRoot}/android/mobile-config.py"
|
|
|
|
outputs.file "src/main/assets/share/registry/res/registry_en-US.xcd"
|
|
|
|
executable "${liboSrcRoot}/android/mobile-config.py"
|
|
|
|
args = ["${liboInstdir}/share/registry/res/registry_en-US.xcd", "src/main/assets/share/registry/res/registry_en-US.xcd"]
|
|
|
|
doFirst {
|
|
|
|
file('src/main/assets/share/registry/res').mkdirs()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task createRCfiles {
|
|
|
|
inputs.file "liboSettings.gradle"
|
|
|
|
dependsOn copyUnpackAssets, copyAssets
|
2019-03-22 11:24:47 -05:00
|
|
|
def sofficerc = file('src/main/assets/unpack/program/sofficerc')
|
2019-02-15 06:38:32 -06:00
|
|
|
def fundamentalrc = file('src/main/assets/program/fundamentalrc')
|
2019-03-22 11:24:47 -05:00
|
|
|
def bootstraprc = file('src/main/assets/program/bootstraprc')
|
|
|
|
def unorc = file('src/main/assets/program/unorc')
|
|
|
|
def versionrc = file('src/main/assets/program/versionrc')
|
2019-02-15 06:38:32 -06:00
|
|
|
|
|
|
|
outputs.files sofficerc, fundamentalrc, unorc, bootstraprc, versionrc
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
sofficerc.text = '''\
|
|
|
|
[Bootstrap]
|
|
|
|
Logo=1
|
|
|
|
NativeProgress=1
|
|
|
|
URE_BOOTSTRAP=file:///assets/program/fundamentalrc
|
|
|
|
HOME=$APP_DATA_DIR/cache
|
|
|
|
OSL_SOCKET_PATH=$APP_DATA_DIR/cache
|
|
|
|
'''.stripIndent()
|
|
|
|
|
2019-03-22 11:24:47 -05:00
|
|
|
fundamentalrc.text = '''\
|
2019-02-15 06:38:32 -06:00
|
|
|
[Bootstrap]
|
|
|
|
LO_LIB_DIR=file://$APP_DATA_DIR/lib/
|
|
|
|
BRAND_BASE_DIR=file:///assets
|
|
|
|
CONFIGURATION_LAYERS=xcsxcu:${BRAND_BASE_DIR}/share/registry res:${BRAND_BASE_DIR}/share/registry
|
|
|
|
URE_BIN_DIR=file:///assets/ure/bin/dir/nothing-here/we-can/exec-anyway
|
|
|
|
'''.stripIndent()
|
|
|
|
|
2019-03-22 11:24:47 -05:00
|
|
|
bootstraprc.text = '''\
|
2019-02-15 06:38:32 -06:00
|
|
|
[Bootstrap]
|
|
|
|
InstallMode=<installmode>
|
2019-03-22 11:24:47 -05:00
|
|
|
ProductKey=LibreOffice ''' + "${liboVersionMajor}.${liboVersionMinor}" + '''
|
2019-02-15 06:38:32 -06:00
|
|
|
UserInstallation=file://$APP_DATA_DIR
|
|
|
|
'''.stripIndent()
|
|
|
|
|
|
|
|
unorc.text = '''\
|
|
|
|
[Bootstrap]
|
|
|
|
URE_INTERNAL_LIB_DIR=file://$APP_DATA_DIR/lib/
|
|
|
|
UNO_TYPES=file://$APP_DATA_DIR/program/udkapi.rdb file://$APP_DATA_DIR/program/offapi.rdb file://$APP_DATA_DIR/program/oovbaapi.rdb
|
|
|
|
UNO_SERVICES=file:///assets/program/services.rdb file:///assets/program/services/services.rdb
|
|
|
|
'''.stripIndent()
|
|
|
|
|
|
|
|
versionrc.text = '''\
|
|
|
|
[Version]
|
|
|
|
AllLanguages=en-US
|
|
|
|
BuildVersion=
|
|
|
|
buildid=''' + "${liboGitFullCommit}" + '''
|
|
|
|
ReferenceOOoMajorMinor=4.1
|
|
|
|
'''.stripIndent()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// creating the UI stuff is cheap, don't bother only applying it for the flavor..
|
|
|
|
preBuild.dependsOn 'createRCfiles',
|
|
|
|
'createStrippedConfigMain',
|
|
|
|
'createStrippedConfigRegistry',
|
|
|
|
'createFullConfig'
|