Once we have per-variant transform (after 2.2), you'll be able to create a
separate transform for each variant and inject this file yourself into the
transform (this is actually exactly how the current dex transform inputs it)

The API cost of adding the main-dex-list as a proper transform input is not
something we're willing to deal with at this time.

On Mon, Jun 6, 2016 at 2:02 PM, Ariel Cattan <ar...@safedk.com> wrote:

> Thank you Xavier for the quick response.
> Regarding the main dex list - it is extremely important to us, and we
> already use it today. Indeed our dex transforms add stuff, but what we add
> we are aware of and know if it needs to go into the main dex or not. And if
> it does - then we can move out some other class as long as we have the
> original main dex list. I am also aware of another company (not related to
> us) which uses the main dex list already today for a similar purpose. Since
> the list is already computed and known - it would really help if you could
> provide some mean to access it - either by reading it from a file, or
> getting it through some API, also for the case of Jack running. Regarding
> Jack, perhaps a new configuration option can be added for Jack to dump this
> list into a file once computed?
> Regarding instant run I fully agree, today we are disabling our plugin if
> we identify it's an instant run build.
>
> Thanks!
> Ariel
>
> On Monday, June 6, 2016 at 9:07:33 PM UTC+3, Xavier Ducrohet wrote:
>>
>> The dex transform will not be passed any non dex files. It's also
>> happening after the computation has been made, so if you add stuff to
>> classes, you're likely going to break legacy multi-dex. The only way would
>> be for you to gather the list of entry point (which aapt will now give us
>> in the form of a proguard rule file) and recompute the main dex list
>> yourself (your transform will see all the dex file so you can move stuff
>> around).
>>
>> Based on all that work, I think you should find a way to disable your
>> transforms during instant run or performance won't be good.
>>
>> For Jack, the process is different. It's a single pass that goes .java ->
>> .dex including legacy multidex. It computes the list of class for the main
>> dex internally and applies it right away so there's no access to it because
>> it doesn't need to be saved on disk to pass from one task to another.
>>
>> On Mon, Jun 6, 2016 at 6:36 AM, Ariel Cattan <ar...@safedk.com> wrote:
>>
>>> Oh, and apart from understanding the availability timeframe/version of
>>> dex transformation, I wanted to ask a couple of related questions:
>>>
>>>
>>>    - When dex transform is made available, will the API also pass the
>>>    "main-dex-list", i.e. the list of classes that must go into the first dex
>>>    file in a multidex case? As this is essential, especially if the 
>>> transform
>>>    adds classes and adds methods to existing classes, therefore may need to
>>>    re-arrange the dex files.
>>>    - Related to the above - what will happen with Jack? I've noticed
>>>    that when Jack is enabled it will create multiple dex files if needed, 
>>> but
>>>    the maindexlist file is not generated anymore. Will there be a way to get
>>>    the main-dex-list also when Jack is used?
>>>
>>> Thanks!
>>> Ariel
>>>
>>>
>>> On Monday, June 6, 2016 at 11:08:22 AM UTC+3, Ariel Cattan wrote:
>>>>
>>>> Thanks Jerome! Will it still make it to 2.2.0, or will be available
>>>> only in a later version?
>>>> Ariel
>>>>
>>>> On Monday, June 6, 2016 at 7:09:33 AM UTC+3, Jerome Dochez wrote:
>>>>>
>>>>> it's not there yet but someone is working on it. I will make it's
>>>>> documented once it's out.
>>>>>
>>>>> On Sun, Jun 5, 2016 at 6:46 AM, Ariel Cattan <ar...@safedk.com> wrote:
>>>>>
>>>>>> Hi Jerome,
>>>>>>
>>>>>> Is it possible to do Dex transformations using the transform API in
>>>>>> Gradle plugin 2.2.0-alpha2 ? If yes - is there any documentation for it?
>>>>>> And if not - is it still planned for 2.2.0?
>>>>>>
>>>>>> Thanks :)
>>>>>> Ariel
>>>>>>
>>>>>> On Tuesday, April 12, 2016 at 9:51:34 AM UTC+3, Ariel Cattan wrote:
>>>>>>>
>>>>>>> That's excellent news! Thanks!!
>>>>>>> Ariel
>>>>>>>
>>>>>>> On Monday, April 11, 2016 at 11:50:40 PM UTC+3, Jerome Dochez wrote:
>>>>>>>>
>>>>>>>> got it. yes this is relatively easy, we should add it in 2.2
>>>>>>>> timeframe.
>>>>>>>>
>>>>>>>> https://code.google.com/p/android/issues/detail?id=206504
>>>>>>>>
>>>>>>>> Jerome
>>>>>>>>
>>>>>>>> On Mon, Apr 11, 2016 at 1:35 PM Ariel Cattan <ar...@safedk.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hi Jerome,
>>>>>>>>>
>>>>>>>>> Actually we are already doing very extensive dex transformations
>>>>>>>>> today. We found we had much more control with dex transformations, 
>>>>>>>>> and in
>>>>>>>>> fact switched our entire solution to be based on dex transformations.
>>>>>>>>> Today our Gradle plugin finds its way through the various Android
>>>>>>>>> plugin tasks, takes the output of the dex task, does the 
>>>>>>>>> transformations,
>>>>>>>>> and then adjusts the inputs of the packaging task so that it uses our
>>>>>>>>> instrumented dex files instead of the original ones. We are doing it 
>>>>>>>>> with
>>>>>>>>> Android plugins below version 1.5.0, as well as above.  However, since
>>>>>>>>> these are not official APIs, we have to "chase" you guys with every 
>>>>>>>>> release
>>>>>>>>> :-)
>>>>>>>>> That's why we are striving to have an official, stable API that
>>>>>>>>> will allow us to do that.
>>>>>>>>> Using the Jack API may be interesting, depending on what
>>>>>>>>> capabilities it will expose. However since we're already heavily 
>>>>>>>>> invested
>>>>>>>>> in dex instrumentation, it will be better for us to just be able to 
>>>>>>>>> get the
>>>>>>>>> dex files as an input to a transform, and output back instrumented dex
>>>>>>>>> files.
>>>>>>>>> Wouldn't it be relatively easy for you to support such a path,
>>>>>>>>> using the transform API?
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>>>>>> Ariel
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Monday, April 11, 2016 at 10:41:31 PM UTC+3, Jerome Dochez
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Ariel
>>>>>>>>>>
>>>>>>>>>> I think this discussion can go into different directions.
>>>>>>>>>>
>>>>>>>>>> - we might at some point give access to transforms that
>>>>>>>>>> manipulate dex files but the question remain, how do you plan to do 
>>>>>>>>>> the
>>>>>>>>>> actual transformation ? asm-dex seems to not be complete for 
>>>>>>>>>> instance.
>>>>>>>>>>
>>>>>>>>>> - we will keep a path (even with jack enabled) where javac will
>>>>>>>>>> be used to compile java code into .class files and bytecode 
>>>>>>>>>> manipulation
>>>>>>>>>> will still be possible before the .class files are reinjected into 
>>>>>>>>>> the jack
>>>>>>>>>> pipeline (which will be how instant-run+jack will be implemented 
>>>>>>>>>> initially).
>>>>>>>>>>
>>>>>>>>>> - Jack will also provide an API (based on ECJ) to register jack
>>>>>>>>>> native bytecode enhancement that will allow you to do byte code
>>>>>>>>>> manipulation as well (although constructs will be at a higher level
>>>>>>>>>> obviously). This might be how instant-run will evolve.
>>>>>>>>>>
>>>>>>>>>> which path would you rather take ?
>>>>>>>>>>
>>>>>>>>>> On Mon, Apr 11, 2016 at 6:26 AM Ariel Cattan <ar...@safedk.com>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> At the initial stages of the Transform API there seemed to be a
>>>>>>>>>>> way to add a Dex transformation, but this was taken away.
>>>>>>>>>>> We are seeking for official/safe ways to instrument Dex files.
>>>>>>>>>>> It became important when Jack was introduced (as Java bytecode
>>>>>>>>>>> instrumentation is not possible with Jack), and now with Instant 
>>>>>>>>>>> Run it is
>>>>>>>>>>> again very relevant. We would like to have the build system call 
>>>>>>>>>>> our plugin
>>>>>>>>>>> in order to transform each Dex file being created, so that we could
>>>>>>>>>>> instrument it. With Instant Run, for example, once a new small Dex 
>>>>>>>>>>> is
>>>>>>>>>>> created - if we could have a transform being called and handed this 
>>>>>>>>>>> changed
>>>>>>>>>>> file - we could instrument it on-the-fly, as part of the instant 
>>>>>>>>>>> run build.
>>>>>>>>>>> Is there a way to do it today, or plans to support such
>>>>>>>>>>> functionality in the future?
>>>>>>>>>>>
>>>>>>>>>>> Thanks!
>>>>>>>>>>> Ariel Cattan
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>> Google Groups "adt-dev" group.
>>>>>>>>>>>
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>>>> send an email to adt-dev+u...@googlegroups.com.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "adt-dev" group.
>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>> send an email to adt-dev+u...@googlegroups.com.
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>
>>>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "adt-dev" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to adt-dev+u...@googlegroups.com.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "adt-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to adt-dev+u...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Xavier Ducrohet
>> Android SDK Tech Lead
>> Google Inc.
>> http://developer.android.com | http://tools.android.com
>>
>> Please do not send me questions directly. Thanks!
>>
> --
> You received this message because you are subscribed to the Google Groups
> "adt-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to adt-dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adt-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to