目前,我可以在线建造科拉博拉,并把它作为另外的SDK,在我的台内打开一些文件。 但是,如果我把这一原来的建筑放在一边,规模就会太大,因此我计划消除我不需要像编辑模式那样做的特征,因为我只需要观众。 是否有可能仅仅将科拉博拉建成文件浏览器? 感谢您的帮助。
下面我试图通过改变建筑来消除不必要的资源。 校正:
apply plugin: com.android.library
// buildhost settings - paths and the like
apply from: libSettings.gradle
android {
compileSdkVersion 33
buildDir = "${rootProject.getBuildDir()}/lib"
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
versionCode 1
versionName "1.0"
resValue "string", "app_name", "${liboAppName}"
buildConfigField "String", "GIT_COMMIT", ""${liboOVersionHash}""
buildConfigField "boolean", "GOOGLE_PLAY_ENABLED", "${liboGooglePlay}"
externalNativeBuild {
cmake {
arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_STL=c++_shared"
}
}
}
splits {
abi {
enable true
reset ()
include arm64-v8a
}
}
packagingOptions {
// pickFirst "lib/armeabi-v7a/liblo-native-code.so"
pickFirst "lib/arm64-v8a/liblo-native-code.so"
}
lintOptions {
disable MissingTranslation , ExtraTranslation
abortOnError false
}
buildTypes {
debug {
resValue "string", "app_name", "${liboAppName} Debug"
debuggable true
}
release {
minifyEnabled false // FIXME disabled before we get a good proguardRules for callFakeWebsocketOnMessage calling from C++
shrinkResources false // FIXME cannot be enabled when minifyEnabled is turned off
proguardFiles getDefaultProguardFile( proguard-android-optimize.txt ), proguard-rules.pro
}
}
sourceSets {
main {
// let gradle pack the shared library into apk
jniLibs.srcDirs = [ src/main/cpp/lib ]
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
buildStagingDirectory "${rootProject.getBuildDir()}/cmake"
}
}
}
dependencies {
implementation fileTree(dir: libs , include: [ *.jar ])
implementation androidx.appcompat:appcompat:1.0.2
implementation com.google.android.material:material:1.1.0-alpha04
implementation androidx.constraintlayout:constraintlayout:1.1.2
}
task copyUnpackAssets(type: Copy) {
description "copies assets that need to be extracted on the device"
into src/main/assets/unpack
into( program ) {
from("${liboInstdir}/program/types") {
includes = [
"offapi.rdb",
"oovbaapi.rdb"
]
}
from("${liboInstdir}/program") {
includes = ["types.rdb"]
rename types.rdb , udkapi.rdb
}
into( resource ) {
from "${liboInstdir}/program/resource"
// includes = [ ** ]
includes = [ zh_TW , zh_CN ]
}
}
into( etc/coolwsd ) {
from( /android/coolkitconfig.xcu )
includes = [ coolkitconfig.xcu ]
}
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 = [
"EmojiOne*.ttf",
"Liberation*.ttf",
"Caladea-*.ttf",
"Carlito-*.ttf",
"Gen*.ttf",
"opens___.ttf"
]
}
// into( etc/fonts ) {
// from "${liboSrcRoot}/android/source/"
// includes = [ fonts.conf ]
// doFirst {
// // we have changed the filter below; so to always re-generate this
// // file, delete it first - no idea how to set a dependency on
// // build.gradle changes :-(
// file( fonts.conf ).delete()
// }
// filter {
// String line ->
// line.replaceAll(
// @@APPLICATION_ID@@ , new String("${liboApplicationId}")
// )
// }
// }
into( share ) {
from "${liboInstdir}/share"
// liblangtag data is needed for locales like en-CH
include liblangtag/**
}
// into( share ) {
// from "${liboInstdir}/share"
// // extensions - for the dictionaries for hunspell
// includes = [ extensions/dict-de/** , extensions/dict-en/** , extensions/dict-es/** , extensions/dict-fr/** , extensions/dict-pt-BR/** ]
// exclude { FileTreeElement details ->
// !(details.file.isDirectory() ||
// details.file.name.endsWith( .xcu ) ||
// details.file.name.endsWith( .dic ) ||
// details.file.name.endsWith( .aff ) ||
// details.file.name.endsWith( .xml ))
// }
// }
}
task copyAssets(type: Copy) {
description "copies assets that can be accessed within the installed apk"
into src/main/assets
// from("${liboSrcRoot}/instdir/") {
// includes = ["LICENSE.html", "NOTICE"]
// rename "LICENSE.html", "license.html"
// rename "NOTICE", "notice.txt"
// }
// from("${liboExampleDocument}") {
// rename ".*", "example.odt"
// }
into( program ) {
from "${liboInstdir}/program"
includes = [ services.rdb , services/services.rdb ]
}
into( share ) {
from "${liboInstdir}/share"
// Filter data is needed by e.g. the drawingML preset shape import.
includes = [ registry/** , filter/** , gallery/** , palette/** ]
}
}
task createFullConfig(type: Copy) {
description "copies various configuration bits into the apk"
into( src/main/assets/share/config )
from("${liboInstdir}/share/config") {
// includes = [ soffice.cfg/** , images_colibre.zip ]
includes = [ soffice.cfg/** ]
}
}
//task copyBrandTheme(type: Copy) {
// from "${liboBrandingDir}/online-theme"
// into "src/main/assets/share/theme_definitions/online"
//}
//task copyDocTemplates(type: Copy) {
// from "${rootProject.getRootDir()}/templates/untitled.odp",
// "${rootProject.getRootDir()}/templates/untitled.ods",
// "${rootProject.getRootDir()}/templates/untitled.odt"
// into "src/main/assets/templates"
//}
task copyKitConfig(type: Copy) {
from "${file(rootProject.getRootDir()).getParent()}/coolkitconfig-mobile.xcu"
into "src/main/assets/etc/coolwsd"
rename { "coolkitconfig.xcu" }
}
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 createRCfiles {
inputs.file "libSettings.gradle"
dependsOn copyUnpackAssets, copyAssets
def sofficerc = file( src/main/assets/unpack/program/sofficerc )
def fundamentalrc = file( src/main/assets/program/fundamentalrc )
def bootstraprc = file( src/main/assets/program/bootstraprc )
def unorc = file( src/main/assets/program/unorc )
def lounorc = file( src/main/assets/program/lounorc )
def versionrc = file( src/main/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
BRAND_SHARE_SUBDIR=share
URE_BIN_DIR=file:///assets/ure/bin/dir/nothing-here/we-can/exec-anyway
BAK_EXTENSIONS=${$ORIGIN/lounorc:TMP_EXTENSIONS}
BUNDLED_EXTENSIONS=${$ORIGIN/lounorc:BUNDLED_EXTENSIONS}
BUNDLED_EXTENSIONS_USER=${$ORIGIN/lounorc:BUNDLED_EXTENSIONS_USER}
SHARED_EXTENSIONS_USER=${$ORIGIN/lounorc:SHARED_EXTENSIONS_USER}
UNO_SHARED_PACKAGES_CACHE=${$ORIGIN/lounorc:UNO_SHARED_PACKAGES_CACHE}
TMP_EXTENSIONS=${$ORIGIN/lounorc:TMP_EXTENSIONS}
UNO_USER_PACKAGES_CACHE=${$ORIGIN/lounorc:UNO_USER_PACKAGES_CACHE}
.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()
lounorc.text =
[Bootstrap]
PKG_BundledUnoFile=$BUNDLED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc
PKG_SharedUnoFile=$SHARED_EXTENSIONS_USER/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc
PKG_UserUnoFile=$UNO_USER_PACKAGES_CACHE/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc
BAK_EXTENSIONS=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/extensions/bak
BUNDLED_EXTENSIONS=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/share/extensions
BUNDLED_EXTENSIONS_USER=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/extensions/bundled
TMP_EXTENSIONS=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/extensions/tmp
SHARED_EXTENSIONS_USER=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/extensions/shared
UNO_SHARED_PACKAGES=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/share/uno_packages
UNO_SHARED_PACKAGES_CACHE=$UNO_SHARED_PACKAGES/cache
UNO_USER_PACKAGES=${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}/user/uno_packages
UNO_USER_PACKAGES_CACHE=$UNO_USER_PACKAGES/cache
.stripIndent()
versionrc.text =
[Version]
AllLanguages=en-US
BuildVersion=
buildid= + "${liboCoreVersionHash}" +
ReferenceOOoMajorMinor=4.1
.stripIndent()
}
}
clean.doFirst {
delete "src/main/assets"
delete "src/debug/assets"
delete "src/release/assets"
}
// creating the UI stuff is cheap, don t bother only applying it for the flavor..
preBuild.dependsOn createRCfiles ,
createFullConfig
// copyBrandTheme
task generateCoolDebugAssets {
doLast {
exec {
commandLine make , -C , "${rootProject.getBuildDir()}/../../browser", clean
}
exec {
commandLine make , -C , "${rootProject.getBuildDir()}/../../browser", "DIST_FOLDER=${project.getProjectDir()}/src/debug/assets/dist", BUNDLE=DEBUG
}
}
}
task generateCoolReleaseAssets {
doLast {
exec {
commandLine make , -C , "${rootProject.getBuildDir()}/../../browser", clean
}
exec {
commandLine make , -C , "${rootProject.getBuildDir()}/../../browser", "DIST_FOLDER=${project.getProjectDir()}/src/release/assets/dist", BUNDLE=RELEASE
}
}
}
afterEvaluate {
// if (!file("${liboBrandingDir}").exists()) {
// copyBrandTheme.enabled = true
// }
// generateDebugAssets.dependsOn copyDocTemplates, copyKitConfig, generateCoolDebugAssets
// generateReleaseAssets.dependsOn copyDocTemplates, copyKitConfig, generateCoolReleaseAssets
generateDebugAssets.dependsOn copyKitConfig, generateCoolDebugAssets
generateReleaseAssets.dependsOn copyKitConfig, generateCoolReleaseAssets
}
当我通过AAR看到时,最大的档案是校准文件,但我不知道如何缩小这一范围。 我只需要看到该文件,因此我希望,我或许可以取消编辑模式,只使用观众来减少图书馆的规模。