Remove LibkiwixApp
The project was used to assemble all android compilation in one multiplatform java archive. This allow use to remove android_sdk and Gradle builder
This commit is contained in:
parent
9c4f359170
commit
72c271a74c
|
@ -33,7 +33,7 @@ else:
|
|||
RELEASE = True
|
||||
|
||||
if PLATFORM_TARGET == "android":
|
||||
TARGETS = ("libkiwix-app",)
|
||||
TARGETS = ("libkiwix",)
|
||||
elif PLATFORM_TARGET.startswith("iOS"):
|
||||
TARGETS = ("libzim", "libkiwix")
|
||||
elif PLATFORM_TARGET.startswith("native_"):
|
||||
|
@ -56,8 +56,6 @@ else:
|
|||
# Filter what to build if we are doing a release.
|
||||
if RELEASE:
|
||||
def release_filter(project):
|
||||
if project == "libkiwix-app":
|
||||
project = "libkiwix"
|
||||
return release_versions.get(project) is not None
|
||||
TARGETS = tuple(filter(release_filter, TARGETS))
|
||||
|
||||
|
@ -109,7 +107,7 @@ if RELEASE:
|
|||
if PLATFORM_TARGET == "flatpak" and "kiwix-desktop" in TARGETS:
|
||||
update_flathub_git()
|
||||
|
||||
if PLATFORM_TARGET == "android" and "libkiwix-app" in TARGETS:
|
||||
if PLATFORM_TARGET == "android" and "libkiwix" in TARGETS:
|
||||
postfix = get_postfix("libkiwix")
|
||||
basename = "kiwixlib-{}".format(postfix)
|
||||
|
||||
|
|
|
@ -134,9 +134,7 @@ def run_kiwix_build(
|
|||
command.append("--hide-progress")
|
||||
command.append("--fast-clone")
|
||||
command.append("--assume-packages-installed")
|
||||
if target == "libkiwix-app" and platform.startswith("android_"):
|
||||
command.extend(["--target-platform", "android", "--android-arch", platform[8:]])
|
||||
elif platform == "android":
|
||||
if platform == "android":
|
||||
command.extend(["--target-platform", "android"])
|
||||
for arch in ("arm", "arm64", "x86", "x86_64"):
|
||||
command.extend(["--android-arch", arch])
|
||||
|
@ -245,7 +243,6 @@ def make_deps_archive(target=None, name=None, full=False):
|
|||
if (base_dir / "meson_cross_file.txt").exists():
|
||||
files_to_archive.append(base_dir / "meson_cross_file.txt")
|
||||
files_to_archive += HOME.glob("BUILD_*/android-ndk*")
|
||||
files_to_archive += HOME.glob("BUILD_*/android-sdk*")
|
||||
if (BASE_DIR / "meson_cross_file.txt").exists():
|
||||
files_to_archive.append(BASE_DIR / "meson_cross_file.txt")
|
||||
|
||||
|
|
|
@ -74,12 +74,9 @@ invalid choice: 'not-existing-target' (choose from 'alldependencies', 'android-n
|
|||
|
||||
#### Target platform
|
||||
|
||||
If no target platform is specified, a default one will be infered from
|
||||
the specified target:
|
||||
- `libkiwix-app` will be build using the platform `android`
|
||||
- Other targets will be build using the platform `native_dyn`
|
||||
If no target platform is specified, the default will be `native_dyn`.
|
||||
|
||||
But you can select another target platform using the option
|
||||
You can select another target platform using the option
|
||||
`--target-platform`. For now, there is ten different supported
|
||||
platforms:
|
||||
|
||||
|
|
|
@ -60,10 +60,7 @@ def parse_args():
|
|||
options.ios_arch = ['arm64', 'x86_64']
|
||||
|
||||
if not options.target_platform:
|
||||
if options.target in ('libkiwix-app',):
|
||||
options.target_platform = 'android'
|
||||
else:
|
||||
options.target_platform = 'native_dyn'
|
||||
options.target_platform = 'native_dyn'
|
||||
|
||||
return options
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ from .base import *
|
|||
from . import (
|
||||
all_dependencies,
|
||||
android_ndk,
|
||||
android_sdk,
|
||||
aria2,
|
||||
armhf,
|
||||
docoptcpp,
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
import os
|
||||
import shutil
|
||||
|
||||
from .base import Dependency, ReleaseDownload, Builder
|
||||
from kiwixbuild.utils import Remotefile, run_command
|
||||
|
||||
pj = os.path.join
|
||||
|
||||
class android_sdk(Dependency):
|
||||
dont_skip = True
|
||||
neutral = True
|
||||
name = 'android-sdk'
|
||||
|
||||
class Source(ReleaseDownload):
|
||||
archive = Remotefile('tools_r25.2.3-linux.zip',
|
||||
'1b35bcb94e9a686dff6460c8bca903aa0281c6696001067f34ec00093145b560',
|
||||
'https://dl.google.com/android/repository/tools_r25.2.3-linux.zip')
|
||||
|
||||
class Builder(Builder):
|
||||
|
||||
@property
|
||||
def install_path(self):
|
||||
return pj(self.buildEnv.toolchain_dir, self.target.full_name())
|
||||
|
||||
def _build_platform(self, context):
|
||||
context.try_skip(self.install_path)
|
||||
tools_dir = pj(self.install_path, 'tools')
|
||||
shutil.copytree(self.source_path, tools_dir)
|
||||
script = pj(tools_dir, 'android')
|
||||
command = '{script} --verbose update sdk -a --no-ui --filter {packages}'
|
||||
packages = [
|
||||
'tools','platform-tools',
|
||||
'build-tools-28.0.3', 'build-tools-27.0.3',
|
||||
'android-28', 'android-27'
|
||||
]
|
||||
command = command.format(
|
||||
script=script,
|
||||
packages = ','.join(packages)
|
||||
)
|
||||
run_command(command, self.install_path, context, input="y\n")
|
||||
|
||||
def _fix_licenses(self, context):
|
||||
context.try_skip(self.install_path)
|
||||
os.makedirs(pj(self.install_path, 'licenses'), exist_ok=True)
|
||||
with open(pj(self.install_path, 'licenses', 'android-sdk-license'), 'w') as f:
|
||||
f.write("\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e")
|
||||
|
||||
def build(self):
|
||||
self.command('build_platform', self._build_platform)
|
||||
self.command('fix_licenses', self._fix_licenses)
|
|
@ -548,30 +548,3 @@ class MesonBuilder(Builder):
|
|||
command = "{} -v dist".format(neutralEnv('ninja_command'))
|
||||
env = self.get_env(cross_comp_flags=False, cross_compilers=False, cross_path=True)
|
||||
run_command(command, self.build_path, context, env=env)
|
||||
|
||||
|
||||
class GradleBuilder(Builder):
|
||||
gradle_target = "assembleKiwixRelease assembleKiwixDebug"
|
||||
gradle_option = "-i --no-daemon --build-cache"
|
||||
|
||||
def build(self):
|
||||
self.command('configure', self._configure)
|
||||
if hasattr(self, '_pre_compile_script'):
|
||||
self.command('pre_compile_script', self._pre_compile_script)
|
||||
self.command('compile', self._compile)
|
||||
|
||||
def _configure(self, context):
|
||||
# We don't have a lot to configure by itself
|
||||
context.try_skip(self.build_path)
|
||||
if os.path.exists(self.build_path):
|
||||
shutil.rmtree(self.build_path)
|
||||
shutil.copytree(self.source_path, self.build_path)
|
||||
|
||||
def _compile(self, context):
|
||||
context.try_skip(self.build_path)
|
||||
command = "./gradlew {gradle_target} {gradle_option}"
|
||||
command = command.format(
|
||||
gradle_target=self.gradle_target,
|
||||
gradle_option=self.gradle_option)
|
||||
env = self.get_env(cross_comp_flags=False, cross_compilers=True, cross_path=True)
|
||||
run_command(command, self.build_path, context, env=env)
|
||||
|
|
|
@ -3,8 +3,7 @@ import shutil, os
|
|||
from .base import (
|
||||
Dependency,
|
||||
GitClone,
|
||||
MesonBuilder,
|
||||
GradleBuilder)
|
||||
MesonBuilder)
|
||||
from kiwixbuild.utils import pj, copy_tree
|
||||
from kiwixbuild._global import option, get_target_step, neutralEnv
|
||||
|
||||
|
@ -36,58 +35,3 @@ class Libkiwix(Dependency):
|
|||
if self.buildEnv.platformInfo.build == 'android':
|
||||
return 'shared'
|
||||
return super().library_type
|
||||
|
||||
|
||||
class LibkiwixApp(Dependency):
|
||||
name = "libkiwix-app"
|
||||
force_build = True
|
||||
|
||||
class Source(Libkiwix.Source):
|
||||
name = "libkiwix"
|
||||
|
||||
class Builder(GradleBuilder):
|
||||
dependencies = ["libkiwix"]
|
||||
gradle_target = "assembleRelease writePom"
|
||||
|
||||
@classmethod
|
||||
def get_dependencies(cls, platformInfo, allDeps):
|
||||
if not allDeps:
|
||||
return super().get_dependencies(platformInfo, allDeps)
|
||||
else:
|
||||
deps = [('android_{}'.format(arch), 'libkiwix')
|
||||
for arch in option('android_arch')]
|
||||
return deps
|
||||
|
||||
def _configure(self, context):
|
||||
try:
|
||||
shutil.rmtree(self.build_path)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
if not os.path.exists(self.build_path):
|
||||
shutil.copytree(pj(self.source_path, 'android-kiwix-lib-publisher'), self.build_path, symlinks=True)
|
||||
for arch in option('android_arch'):
|
||||
try:
|
||||
kiwix_builder = get_target_step('libkiwix', 'android_{}'.format(arch))
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
copy_tree(pj(kiwix_builder.buildEnv.install_dir, 'libkiwix'),
|
||||
pj(self.build_path, 'kiwixLibAndroid', 'src', 'main'))
|
||||
|
||||
# The ICU dat file should be embedded with the libkiwix application
|
||||
# but for now it is package with kiwix-android app and use there.
|
||||
# We must fix this at a time (before we update the icu version).
|
||||
# os.makedirs(
|
||||
# pj(self.build_path, 'app', 'src', 'main', 'assets', 'icu'),
|
||||
# exist_ok=True)
|
||||
# for arch in option('android_arch'):
|
||||
# try:
|
||||
# kiwix_builder = get_target_step('libkiwix', 'android_{}'.format(arch))
|
||||
# except KeyError:
|
||||
# pass
|
||||
# else:
|
||||
# shutil.copy2(pj(kiwix_builder.buildEnv.install_dir, 'share', 'icu', '58.2',
|
||||
# 'icudt58l.dat'),
|
||||
# pj(self.build_path, 'app', 'src', 'main', 'assets',
|
||||
# 'icu', 'icudt58l.dat'))
|
||||
# break
|
||||
|
|
|
@ -126,7 +126,6 @@ class AndroidX8664(AndroidPlatformInfo):
|
|||
|
||||
class Android(MetaPlatformInfo):
|
||||
name = "android"
|
||||
toolchain_names = ['android-sdk']
|
||||
compatible_hosts = ['fedora', 'debian']
|
||||
|
||||
@property
|
||||
|
@ -134,22 +133,10 @@ class Android(MetaPlatformInfo):
|
|||
return ['android_{}'.format(arch) for arch in option('android_arch')]
|
||||
|
||||
def add_targets(self, targetName, targets):
|
||||
if targetName not in ('libkiwix-app',):
|
||||
return super().add_targets(targetName, targets)
|
||||
else:
|
||||
return AndroidPlatformInfo.add_targets(self, targetName, targets)
|
||||
return super().add_targets(targetName, targets)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
@property
|
||||
def sdk_builder(self):
|
||||
return get_target_step('android-sdk', 'neutral')
|
||||
|
||||
def get_env(self):
|
||||
env = super().get_env()
|
||||
env['ANDROID_HOME'] = self.sdk_builder.install_path
|
||||
return env
|
||||
|
||||
def set_comp_flags(self, env):
|
||||
pass
|
||||
|
|
|
@ -55,7 +55,6 @@ base_deps_versions = {
|
|||
'icu4c' : '58.2',
|
||||
'libaria2' : '1.36.0',
|
||||
'libmagic' : '5.35',
|
||||
'android-sdk' : 'r25.2.3',
|
||||
'android-ndk' : 'r13b',
|
||||
'qt' : '5.10.1',
|
||||
'qtwebengine' : '5.10.1',
|
||||
|
|
Loading…
Reference in New Issue