Remove fixapos and fixtrans

These are legacy fixes for very old versions of the Android SDK tools. These
issues have been fixed in stable versions for years.
This commit is contained in:
Daniel Martí 2014-02-12 10:23:02 +01:00
parent 7309b3c198
commit 5125b52e39
3 changed files with 16 additions and 82 deletions

View file

@ -855,11 +855,7 @@ exist, but not a good idea if it's heavily customised.
@item update=xxx @item update=xxx
By default, 'android update project' is used to generate or update the By default, 'android update project' is used to generate or update the
project and all its referenced projects. Specifying update=no bypasses that. project and all its referenced projects. Specifying update=no bypasses that.
Note that this only matters in ant build recipes.
Specifiying update=force forces rebuilding of the build.xml file at the
same time - this is frequently needed with r14 of the Android platform
tools. Be aware of any customisations in build.xml when using
update=force.
Default value is '@code{auto}', which uses the paths used in the Default value is '@code{auto}', which uses the paths used in the
project.properties file to find out what project paths to update. project.properties file to find out what project paths to update.
@ -898,17 +894,6 @@ AndroidManifest.xml.
Multiple files/directories can be specified by separating them with ';'. Multiple files/directories can be specified by separating them with ';'.
Directories will be recursively deleted. Directories will be recursively deleted.
@item fixtrans=yes
Modifies any instances of string resources that use multiple
formatting arguments, but don't use positional notation. For example,
"Hello %s, %d" becomes "Hello %1$s, %2$d". Newer versions of the
Android platform tools enforce this sensible standard. If you get
error messages relating to that, you need to enable this.
@item fixapos=yes
Like fixtrans, but deals with an even older issue relating to
'unescaped apostrophes' in translation strings.
@item extlibs=a;b;c @item extlibs=a;b;c
Specifies a list of external libraries (jar files) from the Specifies a list of external libraries (jar files) from the
@code{build/extlib} library, which will be placed in the @code{libs} directory @code{build/extlib} library, which will be placed in the @code{libs} directory
@ -937,23 +922,22 @@ 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. directory, but it could need tweaking if you've changed into another directory.
@item patch=x @item patch=x
Apply patch(es). 'x' names one (or more - comma-seperated) Apply patch(es). 'x' names one (or more - comma-seperated) files within a
files within a directory below the metadata, with the same directory below the metadata, with the same name as the metadata file but
name as the metadata file but without the extension. Each of without the extension. Each of these patches is applied to the code in turn.
these patches is applied to the code in turn.
@item prebuild=xxxx @item prebuild=xxxx
Specifies a shell command (or commands - chain with &&) to run before Specifies a shell command (or commands - chain with &&) to run before the
the build takes place. Backslash can be used as an escape character to build takes place. Backslash can be used as an escape character to insert
insert literal commas, or as the last character on a line to join that literal commas, or as the last character on a line to join that line with the
line with the next. It has no special meaning in other contexts; in next. It has no special meaning in other contexts; in particular, literal
particular, literal backslashes should not be escaped. backslashes should not be escaped.
The command runs using bash. The command runs using bash.
Note that nothing should be build during this prebuild phase - scanning Note that nothing should be build during this prebuild phase - scanning of the
of the code and building of the source tarball, for example, take place code and building of the source tarball, for example, take place after this.
after this. For custom actions that actually build things, use 'build' For custom actions that actually build things or produce binaries, use 'build'
instead. instead.
You can use $$name$$ to substitute the path to a referenced srclib - see You can use $$name$$ to substitute the path to a referenced srclib - see

View file

@ -1022,56 +1022,6 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
else: else:
logging.info("...but it didn't exist") logging.info("...but it didn't exist")
# Fix apostrophes translation files if necessary
if build['fixapos']:
for root, dirs, files in os.walk(os.path.join(root_dir, 'res')):
for filename in files:
if has_extension(filename, 'xml'):
if subprocess.call(['sed','-i','s@' +
r"\([^\\]\)'@\1\\'" +
'@g',
os.path.join(root, filename)]) != 0:
raise BuildException("Failed to amend " + filename)
# Fix translation files if necessary
if build['fixtrans']:
for root, dirs, files in os.walk(os.path.join(root_dir, 'res')):
for filename in files:
if has_extension(filename, 'xml'):
f = open(os.path.join(root, filename))
changed = False
outlines = []
for line in f:
num = 1
index = 0
oldline = line
while True:
index = line.find("%", index)
if index == -1:
break
next = line[index+1:index+2]
if next == "s" or next == "d":
line = (line[:index+1] +
str(num) + "$" +
line[index+1:])
num += 1
index += 3
else:
index += 1
# We only want to insert the positional arguments
# when there is more than one argument
if oldline != line:
if num > 2:
changed = True
else:
line = oldline
outlines.append(line)
f.close()
if changed:
f = open(os.path.join(root, filename), 'w')
f.writelines(outlines)
f.close()
remove_signing_keys(build_dir) remove_signing_keys(build_dir)
# Add required external libraries # Add required external libraries

View file

@ -66,9 +66,9 @@ ordered_flags = [
'disable', 'commit', 'subdir', 'submodules', 'init', 'disable', 'commit', 'subdir', 'submodules', 'init',
'gradle', 'maven', 'output', 'oldsdkloc', 'target', 'gradle', 'maven', 'output', 'oldsdkloc', 'target',
'update', 'encoding', 'forceversion', 'forcevercode', 'rm', 'update', 'encoding', 'forceversion', 'forcevercode', 'rm',
'fixtrans', 'fixapos', 'extlibs', 'srclibs', 'patch', 'extlibs', 'srclibs', 'patch', 'prebuild', 'scanignore',
'prebuild', 'scanignore', 'scandelete', 'build', 'buildjni', 'scandelete', 'build', 'buildjni', 'preassemble', 'bindir',
'preassemble', 'bindir', 'antcommand', 'novcheck' 'antcommand', 'novcheck'
] ]
@ -152,7 +152,7 @@ valuetypes = {
['yes', 'no'], None, ['yes', 'no'], None,
[ ], [ ],
[ 'submodules', 'oldsdkloc', 'forceversion', 'forcevercode', [ 'submodules', 'oldsdkloc', 'forceversion', 'forcevercode',
'fixtrans', 'fixapos', 'novcheck' ]), 'novcheck' ]),
'Repo Type' : FieldType("Repo Type", 'Repo Type' : FieldType("Repo Type",
[ 'git', 'git-svn', 'svn', 'hg', 'bzr', 'srclib' ], None, [ 'git', 'git-svn', 'svn', 'hg', 'bzr', 'srclib' ], None,