Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BC50995ED for ; Fri, 15 Jun 2012 12:25:28 +0000 (UTC) Received: (qmail 69553 invoked by uid 500); 15 Jun 2012 12:25:28 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 69351 invoked by uid 500); 15 Jun 2012 12:25:26 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 69314 invoked by uid 99); 15 Jun 2012 12:25:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jun 2012 12:25:24 +0000 X-ASF-Spam-Status: No, hits=-1.3 required=5.0 tests=FRT_ADOBE2,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rmuntean@adobe.com designates 64.18.1.189 as permitted sender) Received: from [64.18.1.189] (HELO exprod6og105.obsmtp.com) (64.18.1.189) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jun 2012 12:25:16 +0000 Received: from outbound-smtp-1.corp.adobe.com ([192.150.11.134]) by exprod6ob105.postini.com ([64.18.5.12]) with SMTP ID DSNKT9spl1GrILtw2Waiurmn8kKOaamQFhIx@postini.com; Fri, 15 Jun 2012 05:24:55 PDT Received: from inner-relay-4.eur.adobe.com (inner-relay-4.adobe.com [193.104.215.14]) by outbound-smtp-1.corp.adobe.com (8.12.10/8.12.10) with ESMTP id q5FCMZJ0024200 for ; Fri, 15 Jun 2012 05:22:36 -0700 (PDT) Received: from nahub02.corp.adobe.com (nahub02.corp.adobe.com [10.8.189.98]) by inner-relay-4.eur.adobe.com (8.12.10/8.12.9) with ESMTP id q5FCOgYs005488 for ; Fri, 15 Jun 2012 05:24:53 -0700 (PDT) Received: from eurhub01.eur.adobe.com (10.128.4.30) by nahub02.corp.adobe.com (10.8.189.98) with Microsoft SMTP Server (TLS) id 8.3.192.1; Fri, 15 Jun 2012 05:24:44 -0700 Received: from eurmbx02.eur.adobe.com ([10.128.4.126]) by eurhub01.eur.adobe.com ([10.128.4.30]) with mapi; Fri, 15 Jun 2012 13:24:42 +0100 From: Robert Munteanu To: "dev@felix.apache.org" Date: Fri, 15 Jun 2012 13:24:40 +0100 Subject: RE: Reimplementing the SCR Generator using annotation processing (FELIX-3550) Thread-Topic: Reimplementing the SCR Generator using annotation processing (FELIX-3550) Thread-Index: Ac1K6hzzbXR00xhcR3moY1Xn0beUEAABLHaw Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Hi Carsten, > Hi Robert, >=20 > thanks for starting this discussion. It really would be nice to base > the implementation on the javax.annotation.proessing stuff. >=20 > 2012/6/14 Robert Munteanu : > > 1. Configuration > > > > There is a standard way of passing compiler arguments when invoking > javac (-Akey=3Dvalue ) but it would require configuring the compiler > rather than the scr plugin. At least for maven builds this is less > convenient. >=20 > Yes, I guess this is one of the biggest challenges. Now, we might > simply pass the information through a static field in some common > class. However this would be problematic with parallel builds like > Maven. So we maybe could use a thread local which would only work if > the same thread is used. But I guess we could find a solution here. If > we are able to pass objects into the processor, we can use these > objects to pass back the result. For example, the Maven plugin is > creating a manifest header afterwards. I _think_ that the arguments are passed to each processor instance individu= ally, so we should be safe here. As far as I remember not even Eclipse reus= es instances between processing runs. >=20 > > > > 2. Incremental builds > > > > When performing a partial build ( for instance in Eclipse, but I > think it also applies to Maven ) not all annotated classes are passed > to the processor so the SCR generator should either only work on full > builds by deign or be able to perform incremental builds. >=20 > Incremental builds should not pose a problem. Right now, all > descriptors are written into a single xml file, however we can change > this easily with generating a file for each component. This can easily > be updated incrementally (as long as we can handle deletes etc.) OK, I was under the impression that there has to be a single xml file. Havi= ng one file per annotated component will greatly simplify matters. >=20 > But I see some problems in the general processing: right now the tool > is parsing two different kinds of classes: classes belonging to the > project and classes from dependencies as a project class might inherit > from a dependency and it might want to inherit the descriptors as > well. I guess we would still need ASM for handling the dependencies. > The result of a component descriptor is the assembly of several > annotations and these annotations are pluggable and therefore are > processed by different processors. So we need a way to first assemble > all annotations and once all annotations of a particular class are > assembled, process them in one go. I'm not sure if this is possible. If I understand correctly one particular annotated class can also depend on= another annotated class and perhaps on files on the compiler classpath . A= n annotation processing engine should be able to=20 - supply complete type information when processing an annotated class - thi= s includes all superclasses and their annotations - supply all the classes which require compilation in the same annotation p= rocessor invocation . One notable exception is Eclipse - when running an in= cremental compilation only the changed classes are set up for processing. Also, an annotation processor can be declared to handle multiple annotation= s, so we don't have to implement one processor for each annotation. For fle= xibility we can implement multiple annotation handlers, but we will hook in= a single class in the compilation process. Robert >=20 > Regards > Carsten > -- > Carsten Ziegeler > cziegeler@apache.org