jurt.jar and unoil.jar are kept as effectively empty jars, each with a Class-Path: ridl.jar in their meta-inf/manifest.mf, so that 3rd-party code loading them (with or without also loading ridl.jar) will still have access to their content. Conceptually, the UNOIDL entities in unoil.jar (corresponding to module offapi) are not part of the URE, but are now made available by URE's ridl.jar. This should probably not cause problems in practice. At least for now, we seal exactly those packages in ridl.jar that were originally sealed in jurt.jar. Ideally, all of ridl.jar could be sealed now, but that would be mildly incompatible, as it would prevent 3rd-party code from introducing additional UNOIDL entities in the relevant namespaces (even if that is something we do not want 3rd-party code to do anyway). However, some JunitTest_jurt_* define classes in those sealed packages. In the past they got away with that by using gb_JunitTest_use_jar_classset,*,jurt. Instead they now need to gb_JunitTest_use_jar_classset,*,ridl and drop the gb_JunitTest_use_jar,*,ridl. But the former only makes available the classes that are specified in ridljar/Jar_ridl.mk with gb_Jar_add_sourcefiles, not the UNOIDL entities specified via gb_Jar_add_packagedirs. But the tests need the udkapi UNOIDL entities, so introduce gb_JunitTest_add_classpath to let the tests get them explicitly. (Curiously, JunitTest_jurt_uno and JnitTest_jurt_util use gb_JunitTest_use_jar_classset,*,jurt but don't seem to acutally need it; lets leave that for a follow-up clean up.) As a follow-up clean up, relevant files could be moved from jurt/ to ridljar/. Change-Id: I836f4e7bb47fb41f1306e3f223da90dba988eb9a Co-authored-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/84946 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
296 lines
10 KiB
Groovy
296 lines
10 KiB
Groovy
apply plugin: 'com.android.application'
|
|
// buildhost settings - paths and the like
|
|
apply from: 'liboSettings.gradle'
|
|
|
|
project.ext.set("archivesBaseName", "LibreOfficeViewer")
|
|
allprojects {
|
|
repositories {
|
|
jcenter()
|
|
google()
|
|
flatDir {
|
|
dirs "${liboWorkdir}/UnpackedTarball/owncloud_android_lib/build/outputs/aar"
|
|
}
|
|
}
|
|
}
|
|
//build-time dependencies - android plugin for gradle
|
|
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
google()
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:3.1.3'
|
|
}
|
|
}
|
|
|
|
// compile-time dependencies
|
|
dependencies {
|
|
implementation fileTree(dir: "${liboInstdir}/${liboUREJavaFolder}", include: [
|
|
"java_uno.jar",
|
|
"juh.jar",
|
|
"ridl.jar",
|
|
"unoloader.jar"
|
|
])
|
|
implementation(name:'owncloud_android_lib', ext:'aar')
|
|
implementation 'com.android.support:design:27.1.1' // also pulls-in corresponding support libraries
|
|
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 26
|
|
buildToolsVersion "27.0.3"
|
|
compileOptions {
|
|
// silence some java-language features hints
|
|
sourceCompatibility 6
|
|
}
|
|
// uses non-conventional source layout, so need to reconfigure accordingly
|
|
// ToDo move to conventional layout, so stuff can be stripped down.
|
|
sourceSets {
|
|
main.manifest.srcFile 'AndroidManifest.xml'
|
|
main.assets.srcDirs = ['assets']
|
|
main.res.srcDirs = ['res']
|
|
main.java.srcDirs = ['../Bootstrap/src', 'src/java']
|
|
main.jniLibs.srcDirs = ['jniLibs']
|
|
main.jni.srcDirs = [] // don't attempt to build native-lib via gradle
|
|
// the configuration data that might be stripped or not
|
|
fullUI.assets.srcDirs 'assets_fullUI'
|
|
strippedUI.assets.srcDirs 'assets_strippedUI'
|
|
strippedUIEditing.assets.srcDirs 'assets_strippedUI'
|
|
}
|
|
defaultConfig {
|
|
minSdkVersion 16
|
|
targetSdkVersion 26
|
|
vectorDrawables.useSupportLibrary = true
|
|
}
|
|
buildTypes {
|
|
debug {
|
|
// make android studio happy...
|
|
jniDebuggable true
|
|
// would work just fine with external, but setting emulator up is a little more work
|
|
manifestPlaceholders = [installLocation: "auto", extractNativeLibs: "false"]
|
|
}
|
|
release {
|
|
// need to extract native libs (allow to compress them in apk), since otherwise would
|
|
// exceed maximum size for playstore
|
|
manifestPlaceholders = [installLocation: "preferExternal", extractNativeLibs: "true"]
|
|
}
|
|
}
|
|
|
|
flavorDimensions "default"
|
|
productFlavors {
|
|
strippedUI {
|
|
dimension "default"
|
|
buildConfigField 'boolean', 'ALLOW_EDITING', 'false'
|
|
}
|
|
strippedUIEditing {
|
|
dimension "default"
|
|
buildConfigField 'boolean', 'ALLOW_EDITING', 'true'
|
|
versionNameSuffix "-editing"
|
|
}
|
|
fullUI.dimension "default"
|
|
}
|
|
lintOptions {
|
|
// don't error-out on missing translations
|
|
warning 'MissingTranslation'
|
|
}
|
|
}
|
|
|
|
/* remark inherited from makefile:
|
|
Then "assets". Let the directory structure under assets mimic
|
|
that under solver for now.
|
|
|
|
Please note that I have no idea what all of this is really necessary and for
|
|
much of this stuff being copied, no idea whether it makes any sense at all.
|
|
Much of this is copy-pasted from android/qa/sc/Makefile (where a couple of
|
|
unit tests for sc are built, and those do seem to mostly work) and
|
|
android/qa/desktop/Makefile (mmeeks's desktop demo, also works to some
|
|
extent)
|
|
*/
|
|
|
|
// Assets that are unpacked at run-time into the app's data directory. These
|
|
// are files read by non-LO code, fontconfig and freetype for now, that doesn't
|
|
// understand "/assets" paths.
|
|
task copyUnpackAssets(type: Copy) {
|
|
description "copies assets that need to be extracted on the device"
|
|
into 'assets/unpack'
|
|
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') {
|
|
from "./"
|
|
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 'assets'
|
|
from("${liboInstdir}") {
|
|
includes = ["LICENSE", "NOTICE"]
|
|
rename "LICENSE", "license.txt"
|
|
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']
|
|
}
|
|
// separate data files for Chinese and Japanese
|
|
from("${liboWorkdir}/CustomTarget/i18npool/breakiterator/") {
|
|
include '*.data'
|
|
}
|
|
}
|
|
// documents with manual page break trigger attempt to read the ui file
|
|
// would trigger a css::container::NoSuchElementException with osl_File_E_NOENT
|
|
// if not present and since it is not caught would crash the app...
|
|
into('config') {
|
|
from "${liboInstdir}/share/config"
|
|
include '**/pagebreakmenu.ui'
|
|
}
|
|
}
|
|
|
|
task createFullConfig(type: Copy) {
|
|
// grab dir to clear whole hierarchy on clean target
|
|
outputs.dir "assets_fullUI"
|
|
into 'assets_fullUI/share/config/soffice.cfg'
|
|
from "${liboInstdir}/share/config/soffice.cfg"
|
|
}
|
|
|
|
task createStrippedConfig {
|
|
def preserveDir = file("assets_strippedUI/share/config/soffice.cfg/empty")
|
|
outputs.dir "assets_strippedUI"
|
|
outputs.dir "assets_strippedUI/share/registry/res"
|
|
outputs.file preserveDir
|
|
|
|
doLast {
|
|
file('assets_strippedUI/share/registry/res').mkdirs()
|
|
file("assets_strippedUI/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 "assets_strippedUI/share/registry/main.xcd"
|
|
executable "${liboSrcRoot}/android/mobile-config.py"
|
|
args = ["${liboInstdir}/share/registry/main.xcd", "assets_strippedUI/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 "assets_strippedUI/share/registry/res/registry_en-US.xcd"
|
|
executable "${liboSrcRoot}/android/mobile-config.py"
|
|
args = ["${liboInstdir}/share/registry/res/registry_en-US.xcd", "assets_strippedUI/share/registry/res/registry_en-US.xcd"]
|
|
doFirst {
|
|
file('assets_strippedUI/share/registry/res').mkdirs()
|
|
}
|
|
}
|
|
|
|
task createRCfiles {
|
|
inputs.file "liboSettings.gradle"
|
|
dependsOn copyUnpackAssets, copyAssets
|
|
def sofficerc = file('assets/unpack/program/sofficerc')
|
|
def fundamentalrc = file('assets/program/fundamentalrc')
|
|
def bootstraprc = file('assets/program/bootstraprc')
|
|
def unorc = file('assets/program/unorc')
|
|
def versionrc = file('assets/program/versionrc')
|
|
|
|
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()
|
|
|
|
fundamentalrc.text = '''\
|
|
[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()
|
|
|
|
bootstraprc.text = '''\
|
|
[Bootstrap]
|
|
InstallMode=<installmode>
|
|
ProductKey=LibreOffice '''+ "${liboVersionMajor}.${liboVersionMinor}" + '''
|
|
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'
|
|
|
|
clean.dependsOn 'cleanCopyAssets',
|
|
'cleanCreateStrippedConfig',
|
|
'cleanCreateFullConfig'
|