History log of /dalvik/dx/src/com/android/dx/command/dexer/Main.java
Revision Date Author Comments
8a5d5ccc26c97d555024c36f54140f07a4b40b8c 08-Aug-2014 John Fazekas <jfazekas@fd-software.com> Fixes command line too long error on Windows

On Windows machines the command line can only accept
commands that are 8192 characters or less. This can
cause a problem when a project has many dependencies
and many libraries are being passed to dex at once.

This fixes it by adding a new option to dex called
--input-list that can read inputs from a file.
This way we only have to pass a single file name
instead of a ton of jar files. This keeps the command
short so Windows will not complain about it.

Bug: 17438982

Signed-off-by: John Fazekas <jfazekas@fd-software.com>

(cherry picked from commit 914f2263ca57b21dc4ef1fb218e345a16a5a5db5)

Change-Id: I6edd1e7c1d1fddc8d6bf4c4963295d4f4e64032e
084b7f109aa96a86a267074f5464732b8062bd5a 21-Jul-2014 Yohann Roussel <yroussel@google.com> Do not generate empty dex in multidex.

This was possible when the first class considered for adding in a dex was too
big to be sure it will fit. Now DX will try to add the class in the current dex
and crash if the class causes one index to overflow.

(cherry picked from commit f15dafe674d2270cafaf4fb7993963ec474d3761)

Change-Id: I323f8111c2be6bace908d0539ff324c4bd033c05
466d7d94b8b173a323fc5616837940219a216f9d 13-May-2014 Yohann Roussel <yroussel@google.com> Make a better detection of index limit in multidex.

- Intern annotation content sooner.
- Count declared methods separatly because it seems possible to have them
generate more method ids than they account in the constant pool if their
name and descriptor are the same as those of called methods.
- Take into account some possible ids that can be added during dex creation.
- Drop evaluation of type ids numbers because it was wrong, it's not simple
to do better and it's nearly impossible to have type ids overflow before
method ids.
Detection is still rough, only a max value is evaluated not the real value.

Bug 14633887

Change-Id: I2e3180662cb4b1c58bbc743b69270ffaa64f3106
cecacd3a4b5ab7a45340f3843522a42a0a4cf287 18-Apr-2014 Benoit Lamarche <benoitlamarche@google.com> Return the correct error code in multi-thread mode

Bug: 14062905

In "--num-threads" mode, dx did not return a result code different
than zero in case of a Throwable.
This CL aims to have the same behaviour in multi-threaded mode as in
normal mode.
There are 2 cases:
- When there is an Exception, it is supposed to be handled by
ClassPathOpener.Consumer.onException(). The number of errors is then
incremented, which is used in "com.android.dx.command.dexer.Main" to
return the error code. With "--num-threads" it couldn't be handled by
onException(). So I've modified the ParallelProcessor to use the
ClassPathOpener, so that the Exception is handled inside the thread.
- When there is an Error it is handled using the Futures of
ParallelProcessors through ExecutorService.

Change-Id: Idc9d8d8bc737587ca518f8f9166e5e511ec22908
c00fafdb91760a4cdfbe9e5323b5165ab4c01b76 28-Feb-2014 Benoit Lamarche <benoitlamarche@google.com> Fix detection of main dex overflow in multidex

Bug: 13239620

Change-Id: Ie897070cbbe0605f38fd6db7b6a50c91f2d1364b
3530d30f6adfd8b8607d6a0bf7988833945f5cf4 17-Jan-2014 Jean-Marie Henaff <jmhenaff@google.com> Remove code related to extended-opcode.

- This support was removed one year ago.

(cherry-pick from commit 18b65cbb3ec6634618bd3240a692507432e634b5)

Change-Id: I1154e518dc8a15220f2fcb163056570030492bb0
0820aa265488e7104ad43dc0584c01f0bfb01c7a 16-Jan-2014 Jean-Marie Henaff <jmhenaff@google.com> Fix dx test 034.

- Test 034 requires that a dex file is dumped in a human readable form
even if the dex file does not contain ClassDef.
Consequently, the command line behavior is modified to satisfy this requirement.

(cherry-pick from commit 64f4aad1e6ef58b29f860b59512ca1a676ac6eb8)

Change-Id: Id64b563745db2b22ec98fba9be25413192c07719
43ee5e97c443949aa68c529e249ed6e1e5057de5 22-Oct-2013 Benoit Lamarche <benoitlamarche@google.com> Deactivate multi-thread in multi-dex mode

It should already have been the case, but it wasn't and it crashed.

Change-Id: Icb461d6e43ef2d113f59038d8c2327f3cfaff86c
(cherry picked from commit cf069ca52f2af9f70fcbeac99443f00401d43b4a)
cf069ca52f2af9f70fcbeac99443f00401d43b4a 22-Oct-2013 Benoit Lamarche <benoitlamarche@google.com> Deactivate multi-thread in multi-dex mode

It should already have been the case, but it wasn't and it crashed.

Change-Id: Icb461d6e43ef2d113f59038d8c2327f3cfaff86c
418c84770acea60b3b13aa37ac21563dba4c8854 22-Aug-2013 Yohann Roussel <yroussel@google.com> Make a more verbose too many id error message.

This restores the old message, replacing "ids" by "references" and
advertising for multidex otpions.

Updates dalvik/tests/089-many-methods accordingly.

(cherry picked from commit d352de04f03b848e0246119344ea13e7233018f0)

Change-Id: I5934bc9fb7812b66c0e38935946cacdf1c35a402
3abdb48fdefcc3136a8d7f9c168a305d9be9690e 21-Aug-2013 Yohann Roussel <yroussel@google.com> Fix 2 filtering problems in multi dex + main list.

- Classes in archives were added in all dexes.
- Adding resources could be done twice in non "strictNameCheck" mode
(when using BestEffortMainDexListFilter) if there was 2 secondary
dex.

(cherry picked from commit ad27e19691c6723a801b127f8802f5cdf4f44359)

Change-Id: I5cbc1b273518e868fdd3d642d50488ddcbec2af6
4c656e4ec2f5c5036dc67fb4034c1e7ff7abf343 31-Jul-2013 Benoit Lamarche <benoitlamarche@google.com> Introduce --multi-dex option in dx.

Add --multi-dex options to dx command line to allow the generation of
several dex files when method index limit is about to be reached.
Also add
--main-dex-list allowing to force some classes in the main dex.
--minimal-main-dex to keep in main edx only classes specified by
main-dex-list.
--set-max-idx-number to set an arbitrary idx limit for the
splitting.

(cherry picked from commit c7daf656da3a4854296b6a8bb702e3ee418450e5)

Change-Id: I2b42272be91484a75783eb94cd30581159948975
d352de04f03b848e0246119344ea13e7233018f0 22-Aug-2013 Yohann Roussel <yroussel@google.com> Make a more verbose too many id error message.

This restores the old message, replacing "ids" by "references" and
advertising for multidex otpions.

Updates dalvik/tests/089-many-methods accordingly.

Change-Id: Ibc4ad1c4606dba59b515b793d729e4e982709699
ad27e19691c6723a801b127f8802f5cdf4f44359 21-Aug-2013 Yohann Roussel <yroussel@google.com> Fix 2 filtering problems in multi dex + main list.

- Classes in archives were added in all dexes.
- Adding resources could be done twice in non "strictNameCheck" mode
(when using BestEffortMainDexListFilter) if there was 2 secondary
dex.

Change-Id: Id7ecca9965a3adefc93f09d95235befbd2b1fe00
c7daf656da3a4854296b6a8bb702e3ee418450e5 31-Jul-2013 Benoit Lamarche <benoitlamarche@google.com> Introduce --multi-dex option in dx.

Add --multi-dex options to dx command line to allow the generation of
several dex files when method index limit is about to be reached.
Also add
--main-dex-list allowing to force some classes in the main dex.
--minimal-main-dex to keep in main edx only classes specified by
main-dex-list.
--set-max-idx-number to set an arbitrary idx limit for the
splitting.

Change-Id: I57d0860b6156e53355e08151b64c1320b7984004
0b44e47c51b5c735283cc99b0c08cac82dba8a00 26-Apr-2013 delphinemartin <delphinemartin@google.com> Report problems as errors in dx (with exit codes)

(cherry picked from commit 593a7233e13d6eeb8ae5d894e29c6a27cbc7b7f0)

Change-Id: I6421f95ceb97a596a19781e46cb4767bfb21cdbd
fe107fb6e3f308ac5174ebdc5a794ee880c741d9 17-Sep-2011 Jesse Wilson <jessewilson@google.com> Mechanical refactoring of dx into two parts.

This splits off a new package, com.android.dex that contains
code for parsing and modelling dex files. This code is usable
both at build time (for compilation and analysis) and at runtime
(for introspection).

The original package, com.android.dx is the tool that compiles
.class files into .dex files. That package also includes utilities
for merging and querying dex files, all visible to the dx command
line application.

In a follow up change I'll move the new com.android.dex package
into the libcore/ project, and configure build rules so that it's
included in both dx.jar and core.jar. The core.jar will then be
able to use it for annotation processing.

Change-Id: I3c58cf87e728e4dda1925a0992c1ee7b8130e81a
(cherry picked from commit bab4abb07335d162ecdb8091fc395cf84803a580)

Conflicts:
dx/junit-tests/com/android/dx/util/BitIntSetTest.java
dx/junit-tests/com/android/dx/util/BitsTest.java
dx/junit-tests/com/android/dx/util/IntListTest.java
dx/junit-tests/com/android/dx/util/ListIntSetTest.java
dx/src/com/android/dex/Dex.java
dx/src/com/android/dex/TableOfContents.java
dx/src/com/android/dx/annotations/AnnotationAccess.java
dx/src/com/android/dx/command/Main.java
dx/src/com/android/dx/dex/code/OutputFinisher.java
dx/src/com/android/dx/dex/code/form/Form32s.java
dx/src/com/android/dx/dex/code/form/Form33x.java
dx/src/com/android/dx/dex/code/form/Form41c.java
dx/src/com/android/dx/dex/code/form/Form52c.java
dx/src/com/android/dx/gen/DexGenerator.java
dx/src/com/android/dx/merge/DexMerger.java
f870f2dce9300c8dec620613371f08e5c234245b 16-Oct-2012 jeffhao <jeffhao@google.com> Add dx option to always generate const-string/jumbo.do not merge.

This allows large dex files with many strings to be merged properly.

(cherry picked from commit 266f45ff7da18022faf5f77df76c69f8cdad313f)

Change-Id: I5fe4c55d84a91101a4f89f590117aa6dc0bfc0f2
9db54b1e21b8e994658890328e57caa822e444a7 16-Oct-2012 jeffhao <jeffhao@google.com> Add dx option to always generate const-string/jumbo. do not merge.

This allows large dex files with many strings to be merged properly.

(cherry picked from commit 266f45ff7da18022faf5f77df76c69f8cdad313f)

Change-Id: I0277b1a0a81b3a77092a9e9f8f648ff190e29723
69dd411c7ef47e3ea3f6ff8be9a4d903f545f0d5 16-Oct-2012 jeffhao <jeffhao@google.com> Add dx option to always generate const-string/jumbo. do not merge.

This allows large dex files with many strings to be merged properly.

(cherry picked from commit 266f45ff7da18022faf5f77df76c69f8cdad313f)

Change-Id: I5e85346610c4c5280ecdd9e97c63eaef4420642e
266f45ff7da18022faf5f77df76c69f8cdad313f 16-Oct-2012 jeffhao <jeffhao@google.com> Add dx option to always generate const-string/jumbo.

This allows large dex files with many strings to be merged properly.

Change-Id: I2c32b03ddb42735d16bc6155c1a1096159fb15ed
45ffaef820370a176097e2987a27e9169d1f8869 12-Jun-2012 Xavier Ducrohet <xav@android.com> Make dex merging stateless. do not merge.

This is required to run dx in Eclipse which doesn't unload the dx
library after each run.

(cherry-pick of 7aa5ce7e990dc3766eba97cd0932b62e4de21503.)

(cherry picked from commit 5e90165d5918f18aec0964bc475f4064e9143599)

Change-Id: Id5818f516539d13423b7cef4b2b1af30a9686b45
5e90165d5918f18aec0964bc475f4064e9143599 12-Jun-2012 Xavier Ducrohet <xav@android.com> Make dex merging stateless.

This is required to run dx in Eclipse which doesn't unload the dx
library after each run.

(cherry-pick of 7aa5ce7e990dc3766eba97cd0932b62e4de21503.)

Change-Id: I7a69a3015d448ddd5558c307cd01346156cbc739
7aa5ce7e990dc3766eba97cd0932b62e4de21503 12-Jun-2012 Xavier Ducrohet <xav@android.com> Make dex merging stateless.

This is required to run dx in Eclipse which doesn't unload the dx
library after each run.

Change-Id: I84df49d424ea465f70613eb602d1a4890804296a
36db01eeaa04e3af3401c5bd6a399d3fb7b040e3 23-Aug-2011 jeffhao <jeffhao@google.com> Removed parsing and output for unused --target-api switch in dx.

This is cherry-picked from dalvik-dev.

Change-Id: I74627e4c261e086e8c2c7cf38591cd3e9f5707e6
1e4c4bebc1feb4b68155e9c2e7e6f2c056ef8e3b 12-Jul-2011 Raphael Moll <ralf@android.com> Dex for Windows: Support paths with spaces.

1- Change the format of the command line parsed by dx.jar.
Parameters with values are usually specified with one
single argument e.g.
--output=/some/path with spaces
That breaks for a variety of reasons on windows, so the first
step is to allow a new 2-parameter form:
--output "/some/path with spaces"

2- The next step is fixing the way the dx.bat wrapper
extracts the -J parameters to be able to cope with
arguments that contain spaces.

SDK bugs: 4567, 18388

Change-Id: Ia837e7307998c0bf41ae39abb36abebfc27da104
a7ab2182266fb9ea1e4e8d1347fc6d6da35760d4 16-Jun-2011 Elliott Hughes <enh@google.com> Fix unbundled apps on pre-ICS devices.

Change-Id: I4aa58b5395423ec2f05be3dcb1783d0e35eabb2c
7baeded82e40352ebfb43b716e0b1dd752e72e7e 15-Jun-2011 jeffhao <jeffhao@google.com> Dx defaults to emitting dexfiles without jumbo opcodes.

There's compatibility issues with going back and forth between versions,
and it's best to have dx default to a stable point and allow
optimizations to be controlled by switches. For jumbo opcodes to be
enabled, dx can be given the switch "--target-api=14".

Change-Id: I824092c795638ca329325b14c435bc41c1ab56d5
9fdbd91288a237eb58e18e4de9c729c3c268c318 25-May-2011 Dan Bornstein <danfuzz@android.com> Update dex file magic number.

Even though the dex format was technically resilient with respect to
the addition of new opcodes, consensus is that the errors one sees
when trying to use a new dex file on an old build were sufficiently
inscrutable that it was worth the effort to update the version number
embedded in the dex format magic.

This change updates dx to produce the new version number when extended
opcodes are enabled (which is the default, but may be overridden by
targeting an older API level).

This also updates the vm to recognize and accept both the new current
version number as well as the immediately previous one. Note: It won't
reject an old-version file if it happens to use the new opcodes; that
would just be a gratuitous and pointless failure.

Bug: 4364986
Change-Id: If8febbb0b91c1719df4247bf69c511251362d91f
333201833d506a3accdeac6ceb7caba8d4b95797 13-Apr-2011 Jesse Wilson <jessewilson@google.com> Combine CstUtf8 and CstString.

The only benefit we were seeing is that one wrapped its toHuman
in quotes, the other didn't.

It was far too easy to use the wrong one. We had code defending
against that in NameValuePair and CstArray.

Change-Id: Ib2e6a1596b97decced37952d46e1831b7bcd0d5d
afe002d1474d7c2ef2ac80de32f21f1949af2a41 07-Apr-2011 Dan Bornstein <danfuzz@android.com> Update the interpretation of --target-api.

Change-Id: I4ab158384d09470d84097d944ae1ddadeb2ad045
09dc1b7301e8b03fc6772b022d21afe9cb077d89 22-Mar-2011 Dan Bornstein <danfuzz@android.com> Make sure both options objects get created.

Previously, the new DexOptions object would only get created when
calling dx as a command directly, but not when it was used as a
library (via a call to Main.run()).

Change-Id: Ie4f37ff9140539a4f2c7af50228ac6eaf6bebe05
09d308b04b7c4fd3ed83a8f8f4c07be67a25478c 17-Mar-2011 Jesse Wilson <jessewilson@google.com> Add support for pre-dexed libraries to dx.

http://b/4090053

Change-Id: Ifb8b9230939cb2a72a767128f79cbfbd042e95a6
3dfda9ad1964510e4a7948a240b30cd710e86341 17-Mar-2011 Dan Bornstein <danfuzz@android.com> Add --target-api=N option to dx.

This change adds the option and plumbs it into where it
needs to go, but doesn't add any code to take action on it.
That will come in a follow-up.

Bug: 4094709
Change-Id: I9c796e176e125b0bcee18af56d9e6da802dfa081
d2b3f499be6f5b1d4076b1244be3d1501d178315 08-Mar-2011 Jesse Wilson <jessewilson@google.com> Permit dx to build resource-only dex files.

Previously it would build a .jar file containing a classes.dex
that itself contained no classes.

Change-Id: I9c36a5dcdd17d2821be15f87656d72ef0048c113
dc520adfdcf0f0e9190cdb90605c42a7cc8fa98f 07-Feb-2011 Dan Bornstein <danfuzz@android.com> Fix dex processing when no output file is specified.

This case is mainly exercised in test code.

Change-Id: Ifbcbec3f001cae925090796ce8ed69f6a986384c
d0900d13fb7bb1706aff5205af7e2d6517335bee 21-Jan-2011 jeffhao <jeffhao@google.com> Made handling of sim exceptions nicer.

Change-Id: I089512c046d90ea37da4a33433edc4ec308a628d
dc86cd9edc8b80953c8b698a83cdaebf6825d798 18-Jan-2011 Jesse Wilson <jessewilson@google.com> Add an undocumented --incremental option to dx.

Change-Id: I48879b2f724e9b92c99c669803f9c8de01487327
9028bfd131e42a58255699d1471c914d58893c61 13-Dec-2010 jeffhao <jeffhao@google.com> Adding javax.sip to the dx blacklist.

Change-Id: I5be068821862ccf073cb758e60b686f46a3c97c1
590f78fc4b6e3268149c5eacb7c8b7dd33497f44 22-Oct-2010 jeffhao <jeffhao@google.com> Added multi-threaded support to processing of class files in dx.

Change-Id: Ideb54c414073a9651b21ce0697e6444fa80f146d
85dc40d2a0cb19792bf3ee6f6c57fed08eb91ea4 27-Sep-2010 Dan Bornstein <danfuzz@android.com> Take another tilt at the "--core-library" messaging windmill.

This time, I added a note about what appears to be the most common
inadvertent triggering, and I point people at JarJar as a possible
solution when the core class inclusion was intentional.

Change-Id: I2d576df0b8944882838cbb6e2b050d59434a238b
de75089fb7216d19e9c22cce4dc62a49513477d3 09-Jun-2010 Carl Shapiro <cshapiro@google.com> Remove trailing whitespace.

Change-Id: I95534bb2b88eaf48f2329282041118cd034c812b
72e93344b4d1ffc71e9c832ec23de0657e5b04a5 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
55423dcd081e30c4fc27b997f127db7b00f1b981 15-May-2009 Dan Bornstein <danfuzz@android.com> Fix a bunch of little problems noticed by FindBugs, and cleaned up some
spacing issues that I happened to notice along the way.
de1ab3724b284ab053322db7ff723f54d7826c96 31-Mar-2009 Dan Bornstein <> AI 143732: Tweaks, in response to public critique.

Automated import of CL 143732
291fe153ba3b64dfb0472f1f53cee59c53f5da04 30-Mar-2009 Dan Bornstein <> AI 143492: Another crank of the --core-library wheel.

Automated import of CL 143492
99409883d9c4c0ffb49b070ce307bb33a9dfe9f1 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import //branches/master/...@140412
f6c387128427e121477c1b32ad35cdcaa5101ba3 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
f72d5de56a522ac3be03873bdde26f23a5eeeb3c 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
2ad60cfc28e14ee8f0bb038720836a4696c478ad 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution