Next: AntiFeatures, Previous: Binaries, Up: Metadata [Contents][Index]
Any number of these fields can be present, each specifying a version to automatically build from source. The value is a comma-separated list. For example:
‘Build:1.2,12’
The above specifies to build version 1.2, which has a version code of 12.
The commit=
parameter specifies the tag, commit or revision number from
which to build it in the source repository. It is the only mandatory flag,
which in this case could for example be commit=v1.2
.
In addition to the three, always required, parameters described above, further parameters can be added (in name=value format) to apply further configuration to the build. These are (roughly in order of application):
disable=<message>
Disables this build, giving a reason why. (For backwards compatibility, this can also be achieved by starting the commit ID with ’!’)
The purpose of this feature is to allow non-buildable releases (e.g. the source
is not published) to be flagged, so the scripts don’t generate repeated
messages about them. (And also to record the information for review later).
If an apk has already been built, disabling causes it to be deleted once
fdroid update
is run; this is the procedure if ever a version has to
be replaced.
subdir=<path>
Specifies to build from a subdirectory of the checked out source code. Normally this directory is changed to before building,
submodules=yes
Use if the project (git only) has submodules - causes git submodule
update --init --recursive
to be executed after the source is cloned.
Submodules are reset and cleaned like the main app repository itself before
each build.
init=xxxx
As for ’prebuild’, but runs on the source code BEFORE any other processing takes place.
You can use $$SDK$$, $$NDK$$ and $$MVN3$$ to substitute the paths to the android SDK and NDK directories, and maven 3 executable respectively. The following per-build variables are available likewise: $$VERSION$$, $$VERCODE$$ and $$COMMIT$$.
oldsdkloc=yes
The sdk location in the repo is in an old format, or the build.xml is expecting such. The ’new’ format is sdk.dir while the VERY OLD format is sdk-location. Typically, if you get a message along the lines of: "com.android.ant.SetupTask cannot be found" when trying to build, then try enabling this option.
target=<target>
Specifies a particular SDK target for compilation, overriding the value defined in the code by upstream. This has different effects depending on what build system used — this flag currently affects Ant, Maven and Gradle projects only. Note that this does not change the target SDK in the AndroidManifest.xml, which determines the level of features that can be included in the build.
In the case of an Ant project, it modifies project.properties of the app and possibly sub-projects. 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.
update=<auto/dirs>
By default, ’android update’ is used in Ant builds to generate or update the project and all its referenced projects. Specifying update=no bypasses that. Note that this is useless in builds that don’t use Ant.
Default value is ’auto
’, which recursively uses the paths in
project.properties to find all the subprojects to update.
Otherwise, the value can be a comma-separated list of directories in which to run ’android update’ relative to the application directory.
encoding=xxxx
Adds a java.encoding property to local.properties with the given value. Generally the value will be ’utf-8’. This is picked up by the SDK’s ant rules, and forces the Java compiler to interpret source files with this encoding. If you receive warnings during the compile about character encodings, you probably need this.
forceversion=yes
If specified, the package version in AndroidManifest.xml is replaced with the version name for the build as specified in the metadata.
This is useful for cases when upstream repo failed to update it for specific tag; to build an arbitrary revision; to make it apparent that the version differs significantly from upstream; or to make it apparent which architecture or platform the apk is designed to run on.
forcevercode=yes
If specified, the package version code in the AndroidManifest.xml is replaced with the version code for the build. See also forceversion.
rm=<path1>[,<path2>,...]
Specifies the relative paths of files or directories to delete before the build is done. The paths are relative to the base of the build directory - i.e. the root of the directory structure checked out from the source respository - not necessarily the directory that contains AndroidManifest.xml.
Multiple files/directories can be specified by separating them with ’,’. Directories will be recursively deleted.
extlibs=<lib1>[,<lib2>,...]
Comma-separated list of external libraries (jar files) from the
build/extlib
library, which will be placed in the libs
directory
of the project.
srclibs=[n:]a@r,[n:]b@r1,...
Comma-separated list of source libraries or Android projects. Each item is of the form name@rev where name is the predefined source library name and rev is the revision or tag to use in the respective source control.
For Ant projects, you can optionally append a number with a colon at the
beginning of a srclib item to automatically place it in project.properties as
a library under the specified number. For example, if you specify
1:somelib@1.0
, F-Droid will automatically do the equivalent of the
legacy practice prebuild=echo "android.library.reference.1=$$somelib$$"
>> project.properties
.
Each srclib has a metadata file under srclibs/ in the repository directory, and the source code is stored in build/srclib/. Repo Type: and Repo: are specified in the same way as for apps; Subdir: can be a comma separated list, for when directories are renamed by upstream; Update Project: updates the projects in the working directory and one level down; Prepare: can be used for any kind of preparation: in particular if you need to update the project with a particular target. You can then also use $$name$$ in the init/prebuild/build command to substitute the relative path to the library directory, but it could need tweaking if you’ve changed into another directory.
Currently srclibs are necessary when upstream uses jar files or pulls dependencies from non-trusted repositories. While there is no guarantee that those binaries are free and correspondent to the source code, F-Droid allows the following known repositories until a source-built alternative is available:
patch=x
Apply patch(es). ’x’ names one (or more - comma-seperated) files within a directory below the metadata, with the same name as the metadata file but without the extension. Each of these patches is applied to the code in turn.
prebuild=xxxx
Specifies a shell command (or commands - chain with &&) to run before the build takes place. Backslash can be used as an escape character to insert literal commas, or as the last character on a line to join that line with the next. It has no special meaning in other contexts; in particular, literal backslashes should not be escaped.
The command runs using bash.
Note that nothing should be built during this prebuild phase - scanning of the code and building of the source tarball, for example, take place after this. For custom actions that actually build things or produce binaries, use ’build’ instead.
You can use $$name$$ to substitute the path to a referenced srclib - see
the srclib
directory for details of this.
You can use $$SDK$$, $$NDK$$ and $$MVN3$$ to substitute the paths to the
android SDK and NDK directories, and Maven 3 executable respectively e.g.
for when you need to run android update project
explicitly. The
following per-build variables are available likewise: $$VERSION$$, $$VERCODE$$
and $$COMMIT$$.
scanignore=<path1>[,<path2>,...]
Enables one or more files/paths to be excluded from the scan process. This should only be used where there is a very good reason, and probably accompanied by a comment explaining why it is necessary.
When scanning the source tree for problems, matching files whose relative paths start with any of the paths given here are ignored.
scandelete=<path1>[,<path2>,...]
When running the scan process, any files that trigger errors - like binaries - will be removed. It acts just like scanignore=, but instead of ignoring the files, it removes them.
Useful when a source code repository includes binaries or other unwanted files which are not needed for the build. Instead of removing them manually via rm=, using scandelete= is easier.
build=xxxx
As for ’prebuild’, but runs during the actual build phase (but before the main Ant/Maven build). Use this only for actions that do actual building. Any prepartion of the source code should be done using ’init’ or ’prebuild’.
Any building that takes place before build= will be ignored, as either Ant, mvn or gradle will be executed to clean the build environment right before build= (or the final build) is run.
You can use $$SDK$$, $$NDK$$ and $$MVN3$$ to substitute the paths to the android SDK and NDK directories, and maven 3 executable respectively. The following per-build variables are available likewise: $$VERSION$$, $$VERCODE$$ and $$COMMIT$$.
buildjni=[yes|no|<dir list>]
Enables building of native code via the ndk-build script before doing the main Ant build. The value may be a list of directories relative to the main application directory in which to run ndk-build, or ’yes’ which corresponds to ’.’ . Using explicit list may be useful to build multi-component projects.
The build and scan processes will complain (refuse to build) if this
parameter is not defined, but there is a jni
directory present.
If the native code is being built by other means like a Gradle task, you
can specify no
here to avoid that. However, if the native code is
actually not required or used, remove the directory instead (using
rm=jni
for example). Using buildjni=no
when the jni code
isn’t used nor built will result in an error saying that native
libraries were expected in the resulting package.
ndk=<version>
Version of the NDK to use in this build. Defaults to the latest NDK release that included legacy toolchains, so as to not break builds that require toolchains no longer included in current versions of the NDK.
The buildserver supports r9b with its legacy toolchains and the latest release as of writing this document, r10e. You may add support for more versions by adding them to ’ndk_paths’ in your config file.
gradle=<flavour1>[,<flavour2>,...]
Build with Gradle instead of Ant, specifying what flavours to use. Flavours are case sensitive since the path to the output apk is as well.
If only one flavour is given and it is ’yes’, no flavour will be used. Note that for projects with flavours, you must specify at least one valid flavour since ’yes’ will build all of them separately.
maven=yes[@<dir>]
Build with Maven instead of Ant. An extra @<dir> tells F-Droid to run Maven inside that relative subdirectory. Sometimes it is needed to use @.. so that builds happen correctly.
preassemble=<task1>[,<task2>,...]
List of Gradle tasks to be run before the assemble task in a Gradle project build.
gradleprops=<prop1>[,<prop2>,...]
List of Gradle properties to pass via the command line to Gradle. A property
can be of the form foo
or of the form key=value
.
For example: gradleprops=enableFoo,someSetting=bar
will result in
gradle -PenableFoo -PsomeSetting=bar
.
antcommands=<target1>[,<target2>,...]
Specify an alternate set of Ant commands (target) instead of the default ’release’. It can’t be given any flags, such as the path to a build.xml.
output=glob/to/output.apk
Specify a glob path where the resulting unsigned release apk from the
build should be. This can be used in combination with build methods like
gradle=yes
or maven=yes
, but if no build method is
specified, the build is manual. You should run your build commands, such
as make
, in build=
.
novcheck=yes
Don’t check that the version name and code in the resulting apk are correct by looking at the build output - assume the metadata is correct. This takes away a useful level of sanity checking, and should only be used if the values can’t be extracted.
Another example, using extra parameters:
‘Build Version:1.09.03,10903,45,subdir=Timeriffic,oldsdkloc=yes’
Next: AntiFeatures, Previous: Binaries, Up: Metadata [Contents][Index]