mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
Lots of mad hacks to make com.funambol.android auto-build
This commit is contained in:
parent
a855e38fff
commit
8525782c7a
3 changed files with 149 additions and 26 deletions
27
README
27
README
|
@ -15,6 +15,22 @@
|
||||||
8. Transfer the repo directory to the appropriate http server. The script
|
8. Transfer the repo directory to the appropriate http server. The script
|
||||||
in upload.sh is an example of how to do this.
|
in upload.sh is an example of how to do this.
|
||||||
|
|
||||||
|
=Build System Requirements=
|
||||||
|
|
||||||
|
To be able to auto-build packages, you're going to need:
|
||||||
|
|
||||||
|
*Linux
|
||||||
|
*Python
|
||||||
|
*A fully functional Android SDK with all SDK platforms and tools
|
||||||
|
*The Android NDK
|
||||||
|
*Ant
|
||||||
|
*Ant Contrib Tasks (Debian package ant-contrib)
|
||||||
|
*JavaCC (Debian package javacc)
|
||||||
|
*A keystore for holding release keys. (Safe, secure and well backed up!)
|
||||||
|
|
||||||
|
You then need to create a config.py (copy config.sample.py and follow the
|
||||||
|
instructions) to specify the locations of some of these things.
|
||||||
|
|
||||||
=MetaData=
|
=MetaData=
|
||||||
|
|
||||||
Information used by update.py to compile the public index comes from two
|
Information used by update.py to compile the public index comes from two
|
||||||
|
@ -111,7 +127,11 @@ configuration to the build. These are:
|
||||||
is configured to put it elsewhere, that can be specified
|
is configured to put it elsewhere, that can be specified
|
||||||
here, relative to the base of the checked out repo..
|
here, relative to the base of the checked out repo..
|
||||||
oldsdkloc=yes - The sdk location in the repo is in an old format
|
oldsdkloc=yes - The sdk location in the repo is in an old format
|
||||||
target=<target> - Specifies a particular SDK target, when the source doesn't
|
target=<target> - Specifies a particular SDK target, when the source doesn't.
|
||||||
|
This is likely to cause the whole build.xml to be rewritten,
|
||||||
|
which is fine if it's a 'standard' android file or doesn't
|
||||||
|
already exist, but not a good idea if it's heavily
|
||||||
|
customised.
|
||||||
rm=<relpath> - Specifies the relative path of file to delete before the
|
rm=<relpath> - Specifies the relative path of file to delete before the
|
||||||
build is done. The path is relative to the base of the
|
build is done. The path is relative to the base of the
|
||||||
build directory - i.e. the directory that contains
|
build directory - i.e. the directory that contains
|
||||||
|
@ -122,6 +142,11 @@ configuration to the build. These are:
|
||||||
replaced with the version number for the build.
|
replaced with the version number for the build.
|
||||||
insertvercode=x - If specified, the pattern 'x' in the AndroidManifest.xml is
|
insertvercode=x - If specified, the pattern 'x' in the AndroidManifest.xml is
|
||||||
replaced with the version code for the build.
|
replaced with the version code for the build.
|
||||||
|
update=no By default, 'android update project' is used to generate or
|
||||||
|
update the build.xml file. Specifying update=no bypasses
|
||||||
|
that.
|
||||||
|
initfun=yes Enables a selection of mad hacks to make com.funambol.android
|
||||||
|
build. Probably not useful for any other application.
|
||||||
|
|
||||||
Another example, using extra parameters:
|
Another example, using extra parameters:
|
||||||
|
|
||||||
|
|
95
build.py
95
build.py
|
@ -167,6 +167,7 @@ for app in apps:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Generate (or update) the ant build file, build.xml...
|
# Generate (or update) the ant build file, build.xml...
|
||||||
|
if (not thisbuild.has_key('update')) or thisbuild['update'] == 'yes':
|
||||||
parms = ['android','update','project','-p','.']
|
parms = ['android','update','project','-p','.']
|
||||||
parms.append('--subprojects')
|
parms.append('--subprojects')
|
||||||
if thisbuild.has_key('target'):
|
if thisbuild.has_key('target'):
|
||||||
|
@ -186,6 +187,7 @@ for app in apps:
|
||||||
|
|
||||||
# Update the local.properties file...
|
# Update the local.properties file...
|
||||||
locprops = os.path.join(root_dir, 'local.properties')
|
locprops = os.path.join(root_dir, 'local.properties')
|
||||||
|
if os.path.exists(locprops):
|
||||||
f = open(locprops, 'r')
|
f = open(locprops, 'r')
|
||||||
props = f.read()
|
props = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -227,6 +229,94 @@ for app in apps:
|
||||||
print "Error running pre-build command"
|
print "Error running pre-build command"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Special case init functions for funambol...
|
||||||
|
if (thisbuild.has_key('initfun') and
|
||||||
|
thisbuild['initfun'] == "yes"):
|
||||||
|
|
||||||
|
if subprocess.call(['sed','-i','s@' +
|
||||||
|
'<taskdef resource="net/sf/antcontrib/antcontrib.properties" />' +
|
||||||
|
'@' +
|
||||||
|
'<taskdef resource="net/sf/antcontrib/antcontrib.properties">' +
|
||||||
|
'<classpath>' +
|
||||||
|
'<pathelement location="/usr/share/java/ant-contrib.jar"/>' +
|
||||||
|
'</classpath>' +
|
||||||
|
'</taskdef>' +
|
||||||
|
'@g',
|
||||||
|
'build.xml'], cwd=root_dir) !=0:
|
||||||
|
print "Failed to amend build.xml"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if subprocess.call(['sed','-i','s@' +
|
||||||
|
'\${user.home}/funambol/build/android/build.properties' +
|
||||||
|
'@' +
|
||||||
|
'build.properties' +
|
||||||
|
'@g',
|
||||||
|
'build.xml'], cwd=root_dir) !=0:
|
||||||
|
print "Failed to amend build.xml"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
buildxml = os.path.join(root_dir, 'build.xml')
|
||||||
|
f = open(buildxml, 'r')
|
||||||
|
xml = f.read()
|
||||||
|
f.close()
|
||||||
|
xmlout = ""
|
||||||
|
mode = 0
|
||||||
|
for line in xml.splitlines():
|
||||||
|
if mode == 0:
|
||||||
|
if line.find("jarsigner") != -1:
|
||||||
|
mode = 1
|
||||||
|
else:
|
||||||
|
xmlout += line + "\n"
|
||||||
|
else:
|
||||||
|
if line.find("/exec") != -1:
|
||||||
|
mode += 1
|
||||||
|
if mode == 3:
|
||||||
|
mode =0
|
||||||
|
f = open(buildxml, 'w')
|
||||||
|
f.write(xmlout)
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
if subprocess.call(['sed','-i','s@' +
|
||||||
|
'platforms/android-2.0' +
|
||||||
|
'@' +
|
||||||
|
'platforms/android-8' +
|
||||||
|
'@g',
|
||||||
|
'build.xml'], cwd=root_dir) !=0:
|
||||||
|
print "Failed to amend build.xml"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
shutil.copyfile(
|
||||||
|
os.path.join(root_dir, "build.properties.example"),
|
||||||
|
os.path.join(root_dir, "build.properties"))
|
||||||
|
|
||||||
|
if subprocess.call(['sed','-i','s@' +
|
||||||
|
'javacchome=.*'+
|
||||||
|
'@' +
|
||||||
|
'javacchome=' + javacc_path +
|
||||||
|
'@g',
|
||||||
|
'build.properties'], cwd=root_dir) !=0:
|
||||||
|
print "Failed to amend build.properties"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if subprocess.call(['sed','-i','s@' +
|
||||||
|
'sdk-folder=.*'+
|
||||||
|
'@' +
|
||||||
|
'sdk-folder=' + sdk_path +
|
||||||
|
'@g',
|
||||||
|
'build.properties'], cwd=root_dir) !=0:
|
||||||
|
print "Failed to amend build.properties"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if subprocess.call(['sed','-i','s@' +
|
||||||
|
'android.sdk.version.*'+
|
||||||
|
'@' +
|
||||||
|
'android.sdk.version=2.0' +
|
||||||
|
'@g',
|
||||||
|
'build.properties'], cwd=root_dir) !=0:
|
||||||
|
print "Failed to amend build.properties"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
# Build the source tarball right before we build the release...
|
# Build the source tarball right before we build the release...
|
||||||
tarname = app['id'] + '_' + thisbuild['vercode'] + '_src'
|
tarname = app['id'] + '_' + thisbuild['vercode'] + '_src'
|
||||||
tarball = tarfile.open(os.path.join(built_dir,
|
tarball = tarfile.open(os.path.join(built_dir,
|
||||||
|
@ -252,6 +342,11 @@ for app in apps:
|
||||||
bindir = os.path.join(build_dir, thisbuild['bindir'])
|
bindir = os.path.join(build_dir, thisbuild['bindir'])
|
||||||
else:
|
else:
|
||||||
bindir = os.path.join(root_dir, 'bin')
|
bindir = os.path.join(root_dir, 'bin')
|
||||||
|
if thisbuild.has_key('initfun') and thisbuild['initfun'] == "yes":
|
||||||
|
# Special case (again!) for funambol...
|
||||||
|
src = ("funambol-android-sync-client-" +
|
||||||
|
thisbuild['version'] + "-unsigned.apk")
|
||||||
|
else:
|
||||||
src = re.match(r".*^.*Creating (\S+) for release.*$.*", output,
|
src = re.match(r".*^.*Creating (\S+) for release.*$.*", output,
|
||||||
re.S|re.M).group(1)
|
re.S|re.M).group(1)
|
||||||
src = os.path.join(bindir, src)
|
src = os.path.join(bindir, src)
|
||||||
|
|
|
@ -3,9 +3,12 @@
|
||||||
#your system configuration.
|
#your system configuration.
|
||||||
|
|
||||||
aapt_path = "/path/to/android-sdk-linux_86/platforms/android-4/tools/aapt"
|
aapt_path = "/path/to/android-sdk-linux_86/platforms/android-4/tools/aapt"
|
||||||
|
sdk_path = "/path/to/android-sdk-linux_86"
|
||||||
ndk_path = "/path/to/android-ndk-r5"
|
ndk_path = "/path/to/android-ndk-r5"
|
||||||
|
|
||||||
|
#You probably don't need to change this...
|
||||||
|
javacc_path = "/usr/share/java"
|
||||||
|
|
||||||
repo_url = "http://f-droid.org/repo"
|
repo_url = "http://f-droid.org/repo"
|
||||||
repo_name = "FDroid"
|
repo_name = "FDroid"
|
||||||
repo_icon = "fdroid-icon.png"
|
repo_icon = "fdroid-icon.png"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue