From easyant-dev-return-309-apmail-incubator-easyant-dev-archive=incubator.apache.org@incubator.apache.org Fri Aug 24 22:29:01 2012 Return-Path: X-Original-To: apmail-incubator-easyant-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-easyant-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 704B9D56C for ; Fri, 24 Aug 2012 22:29:01 +0000 (UTC) Received: (qmail 88897 invoked by uid 500); 24 Aug 2012 22:29:01 -0000 Delivered-To: apmail-incubator-easyant-dev-archive@incubator.apache.org Received: (qmail 88854 invoked by uid 500); 24 Aug 2012 22:29:01 -0000 Mailing-List: contact easyant-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: easyant-dev@incubator.apache.org Delivered-To: mailing list easyant-dev@incubator.apache.org Received: (qmail 88842 invoked by uid 99); 24 Aug 2012 22:29:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 22:29:00 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jeanlouis.boudart@gmail.com designates 209.85.210.175 as permitted sender) Received: from [209.85.210.175] (HELO mail-iy0-f175.google.com) (209.85.210.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 22:28:55 +0000 Received: by iaky10 with SMTP id y10so4312655iak.6 for ; Fri, 24 Aug 2012 15:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=dTXzRh9oghy+qEcUQzD2bVfWPUEmKJizCgwO/aBPBsY=; b=NKjDoM7/oksn2NTMsSWrCYlV8I3zKkA6EA3fG3grG8sXgnJvbrEEydYvJkuLGdlx/y w281uKf8eBQS4c1bZ3u8pCqvJ2fTkxcAvo4Uip6XBmqf2oB0zYqkcCZ14tjjin2/cLja AlX6I19BiRMxhhDwF+Hh5FUGjBTzBEqp6/VzTOBs/Qf6PuRH4xANMS4yCORqNiGwTaQa /YIJv/gcgNAQumy3gUpQvIP2Wm1E8WU64tHeNw7A4yY4bDhkowH84L6Y0wgCFoUEVdJk kiV1Z/rbfhUg8iOO+OAr10NOW7cHkv55SUQjFu/0iJvF7c4r60O5dJ8J24sUz7n/utxK YVCQ== MIME-Version: 1.0 Received: by 10.50.46.133 with SMTP id v5mr2912185igm.63.1345847315110; Fri, 24 Aug 2012 15:28:35 -0700 (PDT) Received: by 10.43.49.5 with HTTP; Fri, 24 Aug 2012 15:28:35 -0700 (PDT) Date: Sat, 25 Aug 2012 00:28:35 +0200 Message-ID: Subject: EasyAnt and ProjectHelpers From: Jean-Louis Boudart To: easyant-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=14dae9340a39239bc104c80a7f08 X-Virus-Checked: Checked by ClamAV on apache.org --14dae9340a39239bc104c80a7f08 Content-Type: text/plain; charset=ISO-8859-1 Hi, I have made some expermentations with ProjectHelpers yesterday. But first to understand why, i'll give you some points. *Understanding ProjectHelpers* Ant's core relies on ProjectHelpers to translate a buildFile (it can be build.xml or more recently .groovy, or event .java files) into Ant Java model. It should understand targets/ extensionPoints, and all other elements (UnknownElements as they name it) are considered as typedef or taskdefs. ProjectHelper implementation defines if they can parse buildFile or antlib.xml. *Our problems* The default ProjectHelper is ProjectHelper2, it return all the time "true" for both methods canParseBuildFile and canParseAntLib (this caused me some troubles see below) Some ant tasks invokes a static method ProjectHelper.configureProject(Project project, File buildFile). This is for example the case of "Ant" task (the one designed to invoke target in other buildFile). But how could this work in easyant as our entry point is not a build.xml. I guess our entry point is most of the time a module.ivy. It means people can't use task or (as it relies on under the hood) if they want to invoke targets in other easyant projects. This is not really problematic as easyant is responsible of invoking stuff on submodules based on project cross dependencies. *Then where is the problem? * I've started implementing a sonar plugin [1] using sonar ant task [2]. The plugin is pretty basic for instance and works only in mono project. Then i wanted to make multimodule working. To invoke sonar they need to collect informations across subprojects before running project analysis. But how could we specify "subprojects" in "pure" ant ? While reading the code of their ant task i realised that they were calling ProjectHelper.configureProject(Project project, File buildFile). This is probably not the easiest way for them to collect informations, i'm in discussion with them to make something much more flexible (teasing....). *Experimentations* By the way this motivated me to experiment stuff with ProjectHelpers. Since ant 1.8.2, you can have multiple project helpers. This was introduced to support any combinaisons of import (build.xml importing .groovy ant file etc...). I've commited a new projectHelper named ModuleIvyProjectHelper. It can parse files ending with ".ivy" and cannot parse antlib. For the parsing logic it uses EasyAntEngine under the hood. I don't know if we should move code from EasyAntEngine to this ProjectHelper, as this would probably create a circular dependency between the two classes. I don't know either if this ProjectHelper makes sense, that's why it isn't registered in ProjectHelperRepository by default. While implementing it i encountered a limitation on ProjectHelpers, if you register ModuleIvyProjectHelper (with api or even with the task) it is not taken into account. Why ? because default ProjectHelper is the first declared in ProjectHelperRepository and it always return true when canParseBuildFile method is called. To make our stuff work i've overriden the method canParseBuildFile in our legacy ProjectHelper (the one that was supporting phases). [1] https://github.com/easyant/sonar-plugin [2] http://docs.codehaus.org/display/SONAR/Analyzing+with+Ant+Task --14dae9340a39239bc104c80a7f08--