mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-08-16 03:10:09 +02:00
Support for source libraries
This commit is contained in:
parent
9c140d126c
commit
c33903cf14
10
README
10
README
@ -204,6 +204,16 @@ configuration to the build. These are:
|
|||||||
files within a directory below the metadata, with the same
|
files within a directory below the metadata, with the same
|
||||||
name as the metadata file but without the extension. Each of
|
name as the metadata file but without the extension. Each of
|
||||||
these patches is applied to the code in turn.
|
these patches is applied to the code in turn.
|
||||||
|
extlibs=a;b;c Specifies a list of external libraries (jar files) from the
|
||||||
|
build/extlib library, which will be placed in the libs
|
||||||
|
directory of the project. Separate items with semicolons.
|
||||||
|
srclibs=a@r;b@r1 Specifies a list of source libraries (kept up to date using
|
||||||
|
version control) from a predefined set. Separate items with
|
||||||
|
semicolons, and each item is of the form name@rev where name
|
||||||
|
is the predefined source library name and rev is the
|
||||||
|
revision in source control to use. You can then also use
|
||||||
|
$$name$$ in the prebuild command to substitute the relative
|
||||||
|
path to the library directory.
|
||||||
|
|
||||||
Another example, using extra parameters:
|
Another example, using extra parameters:
|
||||||
|
|
||||||
|
12
build.py
12
build.py
@ -78,16 +78,6 @@ if not os.path.isdir(build_dir):
|
|||||||
os.makedirs(build_dir)
|
os.makedirs(build_dir)
|
||||||
extlib_dir = os.path.join(build_dir, 'extlib')
|
extlib_dir = os.path.join(build_dir, 'extlib')
|
||||||
|
|
||||||
# Update extlib directory...
|
|
||||||
if False: # Don't need this yet!
|
|
||||||
greendroid_dir = os.path.join(extlib_dir, 'GreenDroid')
|
|
||||||
greendroid_vcs = common.getvcs('git',
|
|
||||||
'https://github.com/cyrilmottier/GreenDroid.git', greendroid_dir)
|
|
||||||
greendroid_vcs.gotorevision('5f92227c959d51e1d7220199135c2c239eabd4d2')
|
|
||||||
subprocess.call(['android', 'update', 'project', '-p',
|
|
||||||
os.path.join(greendroid_dir, 'GreenDroid')])
|
|
||||||
|
|
||||||
|
|
||||||
# Build applications...
|
# Build applications...
|
||||||
for app in apps:
|
for app in apps:
|
||||||
|
|
||||||
@ -290,7 +280,7 @@ for app in apps:
|
|||||||
|
|
||||||
# Move the source tarball into the output directory...
|
# Move the source tarball into the output directory...
|
||||||
if output_dir != tmp_dir:
|
if output_dir != tmp_dir:
|
||||||
shutil.movefile(os.path.join(tmp_dir, tarname + '.tar.gz'),
|
shutil.move(os.path.join(tmp_dir, tarname + '.tar.gz'),
|
||||||
os.path.join(output_dir, tarname + '.tar.gz'))
|
os.path.join(output_dir, tarname + '.tar.gz'))
|
||||||
|
|
||||||
build_succeeded.append(app)
|
build_succeeded.append(app)
|
||||||
|
1
build/extlib/.gitignore
vendored
1
build/extlib/.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
!*/
|
!*/
|
||||||
GreenDroid/
|
GreenDroid/
|
||||||
|
ActionBarSherlock/
|
||||||
|
44
common.py
44
common.py
@ -540,6 +540,32 @@ class MetaDataException(Exception):
|
|||||||
return repr(self.value)
|
return repr(self.value)
|
||||||
|
|
||||||
|
|
||||||
|
# Get the specified source library.
|
||||||
|
# Returns the path to it.
|
||||||
|
def getsrclib(spec, extlib_dir):
|
||||||
|
name, ref = spec.split('@')
|
||||||
|
|
||||||
|
if name == 'GreenDroid':
|
||||||
|
sdir = os.path.join(extlib_dir, 'GreenDroid')
|
||||||
|
vcs = getvcs('git',
|
||||||
|
'https://github.com/cyrilmottier/GreenDroid.git', sdir)
|
||||||
|
vcs.gotorevision(ref)
|
||||||
|
return os.path.join(sdir, 'GreenDroid')
|
||||||
|
|
||||||
|
if name == 'ActionBarSherlock':
|
||||||
|
sdir = os.path.join(extlib_dir, 'ActionBarSherlock')
|
||||||
|
vcs = getvcs('git',
|
||||||
|
'https://github.com/JakeWharton/ActionBarSherlock.git', sdir)
|
||||||
|
vcs.gotorevision(ref)
|
||||||
|
libdir = os.path.join(sdir, 'library')
|
||||||
|
if subprocess.call(['android', 'update', 'project', '-p',
|
||||||
|
libdir]) != 0:
|
||||||
|
raise BuildException('Error updating ActionBarSherlock project')
|
||||||
|
return libdir
|
||||||
|
|
||||||
|
raise BuildException('Unknown srclib ' + name)
|
||||||
|
|
||||||
|
|
||||||
# Prepare the source code for a particular build
|
# Prepare the source code for a particular build
|
||||||
# 'vcs' - the appropriate vcs object for the application
|
# 'vcs' - the appropriate vcs object for the application
|
||||||
# 'app' - the application details from the metadata
|
# 'app' - the application details from the metadata
|
||||||
@ -696,16 +722,26 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
|
|||||||
libsdir = os.path.join(root_dir, 'libs')
|
libsdir = os.path.join(root_dir, 'libs')
|
||||||
if not os.path.exists(libsdir):
|
if not os.path.exists(libsdir):
|
||||||
os.mkdir(libsdir)
|
os.mkdir(libsdir)
|
||||||
libs = build['extlibs'].split(';')
|
for lib in build['extlibs'].split(';'):
|
||||||
for lib in libs:
|
|
||||||
libf = os.path.basename(lib)
|
libf = os.path.basename(lib)
|
||||||
shutil.copyfile(os.path.join(extlib_dir, lib),
|
shutil.copyfile(os.path.join(extlib_dir, lib),
|
||||||
os.path.join(libsdir, libf))
|
os.path.join(libsdir, libf))
|
||||||
|
|
||||||
|
# Get required source libraries...
|
||||||
|
srclibpaths = []
|
||||||
|
if build.has_key('srclibs'):
|
||||||
|
for lib in build['srclibs'].split(';'):
|
||||||
|
name, _ = lib.split('@')
|
||||||
|
srclibpaths.append((name, getsrclib(lib, extlib_dir)))
|
||||||
|
|
||||||
# Run a pre-build command if one is required...
|
# Run a pre-build command if one is required...
|
||||||
if build.has_key('prebuild'):
|
if build.has_key('prebuild'):
|
||||||
if subprocess.call(build['prebuild'],
|
prebuild = build['prebuild']
|
||||||
cwd=root_dir, shell=True) != 0:
|
# Substitute source library paths into prebuild commands...
|
||||||
|
for name, libpath in srclibpaths:
|
||||||
|
libpath = os.path.relpath(libpath, root_dir)
|
||||||
|
prebuild = prebuild.replace('$$' + name + '$$', libpath)
|
||||||
|
if subprocess.call(prebuild, cwd=root_dir, shell=True) != 0:
|
||||||
raise BuildException("Error running pre-build command")
|
raise BuildException("Error running pre-build command")
|
||||||
|
|
||||||
# Apply patches if any
|
# Apply patches if any
|
||||||
|
Loading…
Reference in New Issue
Block a user