aboutsummaryrefslogtreecommitdiffstats
path: root/files/ant
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2011-05-10 22:34:45 -0700
committerRaphael Moll <ralf@android.com>2011-05-12 15:49:57 -0700
commit21b7ce23b4280350aaebba3ed3d480d74f07fc2b (patch)
treeb67675ffc43f7acd28f5f332a7fa42204114e55b /files/ant
parentfd19b2c89be703549e23d501541632883819ab7b (diff)
downloadsdk-21b7ce23b4280350aaebba3ed3d480d74f07fc2b.zip
sdk-21b7ce23b4280350aaebba3ed3d480d74f07fc2b.tar.gz
sdk-21b7ce23b4280350aaebba3ed3d480d74f07fc2b.tar.bz2
Fix space-in-dir issue with Proguard for the ant case.
This fixes the proper way to quote the compound paths arguments given to proguard. Each individual path is quoted if it contains spaces. Quoting for -libraryjars fixes the issue for the SDK install path containing a space. Quoting for -injars and the other arguments fixes the issue for the project path containing a space (although the ant build will fail later at the dx phase in this case.) Change-Id: I74283b4f1b19c353c1a5ed36e4d0ec58676b6a79
Diffstat (limited to 'files/ant')
-rw-r--r--files/ant/main_rules.xml38
1 files changed, 26 insertions, 12 deletions
diff --git a/files/ant/main_rules.xml b/files/ant/main_rules.xml
index a8d7266..996a70d 100644
--- a/files/ant/main_rules.xml
+++ b/files/ant/main_rules.xml
@@ -432,8 +432,15 @@
<!-- Set the android classpath Path object into a single property. It'll be
all the jar files separated by a platform path-separator.
+ Each path must be quoted if it contains spaces.
-->
- <property name="android.libraryjars" refid="android.target.classpath"/>
+ <pathconvert property="android.libraryjars" refid="android.target.classpath">
+ <firstmatchmapper>
+ <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
+ <identitymapper/>
+ </firstmatchmapper>
+ </pathconvert>
+
<!-- Build a path object with all the jar files that must be obfuscated.
This include the project compiled source code and any 3rd party jar
files. -->
@@ -443,22 +450,29 @@
</path>
<!-- Set the project jar files Path object into a single property. It'll be
all the jar files separated by a platform path-separator.
+ Each path must be quoted if it contains spaces.
-->
- <property name="project.jars" refid="project.jars.ref" />
-
- <mkdir dir="${obfuscate.absolute.dir}" />
+ <pathconvert property="project.jars" refid="project.jars.ref">
+ <firstmatchmapper>
+ <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
+ <identitymapper/>
+ </firstmatchmapper>
+ </pathconvert>
+
+ <mkdir dir="${obfuscate.absolute.dir}" />
<delete file="${preobfuscate.jar.file}"/>
<delete file="${obfuscated.jar.file}"/>
- <jar basedir="${out.classes.dir}" destfile="${preobfuscate.jar.file}" />
+ <jar basedir="${out.classes.dir}"
+ destfile="${preobfuscate.jar.file}" />
<proguard>
@${proguard.config}
- -injars ${project.jars}
- -outjars ${obfuscated.jar.file}
- -libraryjars ${android.libraryjars}
- -dump ${obfuscate.absolute.dir}/dump.txt
- -printseeds ${obfuscate.absolute.dir}/seeds.txt
- -printusage ${obfuscate.absolute.dir}/usage.txt
- -printmapping ${obfuscate.absolute.dir}/mapping.txt
+ -injars ${project.jars}
+ -outjars "${obfuscated.jar.file}"
+ -libraryjars ${android.libraryjars}
+ -dump "${obfuscate.absolute.dir}/dump.txt"
+ -printseeds "${obfuscate.absolute.dir}/seeds.txt"
+ -printusage "${obfuscate.absolute.dir}/usage.txt"
+ -printmapping "${obfuscate.absolute.dir}/mapping.txt"
</proguard>
</then>
</if>