From dev-return-83075-apmail-ant-dev-archive=ant.apache.org@ant.apache.org Thu Aug 14 08:47:25 2008 Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 25535 invoked from network); 14 Aug 2008 08:47:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Aug 2008 08:47:25 -0000 Received: (qmail 71041 invoked by uid 500); 14 Aug 2008 08:47:23 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 71002 invoked by uid 500); 14 Aug 2008 08:47:23 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 70991 invoked by uid 99); 14 Aug 2008 08:47:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2008 01:47:23 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gscokart@gmail.com designates 209.85.200.168 as permitted sender) Received: from [209.85.200.168] (HELO wf-out-1314.google.com) (209.85.200.168) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Aug 2008 08:46:27 +0000 Received: by wf-out-1314.google.com with SMTP id 23so412460wfg.10 for ; Thu, 14 Aug 2008 01:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=53AUDwTgjZbvyeFUftYkAqixwG/i/jt3RLZPXuInRvY=; b=h739q1/YuAz9OXojlZfG6gHskm0d+EfALfgUGwo87fRAmP6v226t9Lr1lVk4VovUNI C2c3MrFnFnq6DFrmkZ9FWSR6RbY1ZOJzHOsJl9QExgtnqLHlHPQ5yMaK8azjVkUf4X2c sDTasxcmZLm3Uov8veEpU+4oTuaJnyVOxtcdk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=IHHjfW25ZUXqbdWWeovQbk5uCd+J2seXvgFWCWxkWRb+4wBq4LxF+qfYMLOLYA7rhM k5vHpv83YAG2qCgcSjH9wPETrEYUxM5ghqawgSYpVGtezmv1B1iCHAKtLwOTaittGPF+ MuP7l8AoAKHRm93oAryOxF9YtzCQ3gnxNg2jE= Received: by 10.142.240.9 with SMTP id n9mr387506wfh.136.1218703615861; Thu, 14 Aug 2008 01:46:55 -0700 (PDT) Received: by 10.142.49.15 with HTTP; Thu, 14 Aug 2008 01:46:55 -0700 (PDT) Message-ID: Date: Thu, 14 Aug 2008 10:46:55 +0200 From: "Gilles Scokart" To: dev@ant.apache.org Subject: Re: svn commit: r683552 - in /ant/ivy/core/trunk: ./ doc/use/ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/report/ src/java/org/apache/ivy/core/resolve/ test/java/org/apache/ivy/ant/ In-Reply-To: <20080807084154.BB82623889C4@eris.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080807084154.BB82623889C4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org I remember a discussion about lower case / mixed case attributes of the ivy ant task but I don't remind me the conclusion and I didn't find it back. For the next change (adding an option to tell to not compute ivy.deps.changed) I have added an task attribute 'checkIfChanged' mixed case. Should I change that? I also noticed that there is an other new attribute 'resolveMode' that use mixed case. Gilles PS : It is not related, but my reply to on a notifiaction didn't point to dev@ant.apache.org. But it seems the header is set correctly. Is it my mail reader that is broken? I'm using gmail on line. 2008/8/7 : > Author: gscokart > Date: Thu Aug 7 01:41:52 2008 > New Revision: 683552 > > URL: http://svn.apache.org/viewvc?rev=683552&view=rev > Log: > Give the possibility to not compute ivy.deps.changed (IVY-876) > > Modified: > ant/ivy/core/trunk/CHANGES.txt > ant/ivy/core/trunk/doc/use/resolve.html > ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java > ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java > ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java > ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java > ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java > ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java > > Modified: ant/ivy/core/trunk/CHANGES.txt > URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=683552&r1=683551&r2=683552&view=diff > ============================================================================== > --- ant/ivy/core/trunk/CHANGES.txt (original) > +++ ant/ivy/core/trunk/CHANGES.txt Thu Aug 7 01:41:52 2008 > @@ -101,6 +101,7 @@ > - IMPROVEMENT: Change allownomd and skipbuildwithoutivy into a more semantically correct name (IVY-297) > - IMPROVEMENT: Smarter determination if an expression is exact or not for RegexpPatternMatcher and GlobPatternMatcher > - IMPROVEMENT: Check branch consistency during resolve (IVY-858) > +- IMPROVEMENT: Give the possibility to not compute ivy.deps.changed (IVY-876) > > - FIX: Incorrect parsing artifactPattern attribute in a sftp resolver (IVY-661) (thanks to Alexey Kiselev) > - FIX: Maven2 "ejb" packaging is not supported (IVY-873) > > Modified: ant/ivy/core/trunk/doc/use/resolve.html > URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/use/resolve.html?rev=683552&r1=683551&r2=683552&view=diff > ============================================================================== > --- ant/ivy/core/trunk/doc/use/resolve.html (original) > +++ ant/ivy/core/trunk/doc/use/resolve.html Thu Aug 7 01:41:52 2008 > @@ -41,6 +41,8 @@ > > Since 1.2: > An additional property is set to true if the resolved dependencies are changes since the last resolve, and to false otherwise: ivy.deps.changed > +Since 2.0: > +The property ivy.deps.changed will not be set (and not be computed) if you set the parameter checkIfCompiled to false. (by default it is true to keep backward compatibility). This allow to optimize your build when you have multi-module build with multiple configurations. > > Since 2.0: > In addition, if the resolveId attribute has been set, the following properties are set as well: > @@ -148,6 +150,9 @@ >
  • quiet
  • disable all usual messages, making the whole resolve process quiet unless errors occur > No, defaults to 'default'. > > + checkIfChangedWhen set to true, the resolve will compare the result with the last resolution done on this module, with those configurationsNo, default to 'true' > + > + > > >

    Examples

    > > Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java > URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java?rev=683552&r1=683551&r2=683552&view=diff > ============================================================================== > --- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java (original) > +++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java Thu Aug 7 01:41:52 2008 > @@ -77,6 +77,8 @@ > private String resolveId = null; > > private String log = ResolveOptions.LOG_DEFAULT; > + > + private boolean checkIfChanged = true; //for backward compatibility > > public boolean isUseOrigin() { > return useOrigin; > @@ -256,9 +258,12 @@ > md.getResolvedModuleRevisionId().getRevision()); > settings.setVariable( > "ivy.revision", md.getResolvedModuleRevisionId().getRevision()); > - boolean hasChanged = report.hasChanged(); > - getProject().setProperty("ivy.deps.changed", String.valueOf(hasChanged)); > - settings.setVariable("ivy.deps.changed", String.valueOf(hasChanged)); > + Boolean hasChanged = null; > + if (getCheckIfChanged()) { > + hasChanged = Boolean.valueOf(report.hasChanged()); > + getProject().setProperty("ivy.deps.changed", hasChanged.toString()); > + settings.setVariable("ivy.deps.changed", hasChanged.toString()); > + } > if (conf.trim().equals("*")) { > getProject().setProperty("ivy.resolved.configurations", > mergeConfs(md.getConfigurationsNames())); > @@ -285,10 +290,13 @@ > md.getResolvedModuleRevisionId().getRevision()); > settings.setVariable("ivy.revision." + resolveId, md > .getResolvedModuleRevisionId().getRevision()); > - getProject().setProperty("ivy.deps.changed." + resolveId, > - String.valueOf(hasChanged)); > - settings.setVariable("ivy.deps.changed." + resolveId, String > - .valueOf(hasChanged)); > + if (getCheckIfChanged()) { > + //hasChanged has already been set earlier > + getProject().setProperty("ivy.deps.changed." + resolveId, > + hasChanged.toString()); > + settings.setVariable("ivy.deps.changed." + resolveId, > + hasChanged.toString()); > + } > if (conf.trim().equals("*")) { > getProject().setProperty("ivy.resolved.configurations." + resolveId, > mergeConfs(md.getConfigurationsNames())); > @@ -340,7 +348,8 @@ > .setRefresh(refresh) > .setTransitive(transitive) > .setResolveMode(resolveMode) > - .setResolveId(resolveId); > + .setResolveId(resolveId) > + .setCheckIfChanged(checkIfChanged); > } > > public String getModule() { > @@ -406,4 +415,12 @@ > public void setResolveMode(String resolveMode) { > this.resolveMode = resolveMode; > } > + > + public boolean getCheckIfChanged() { > + return checkIfChanged; > + } > + > + public void setCheckIfChanged(boolean checkIfChanged) { > + this.checkIfChanged = checkIfChanged; > + } > } > > Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java > URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java?rev=683552&r1=683551&r2=683552&view=diff > ============================================================================== > --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java (original) > +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java Thu Aug 7 01:41:52 2008 > @@ -47,23 +47,25 @@ > */ > public class ConfigurationResolveReport { > > - private ModuleDescriptor md; > + private final ModuleDescriptor md; > > - private String conf; > + private final String conf; > > - private Date date; > + private final Date date; > + > + private final ResolveOptions options; > > private Map dependencyReports = new LinkedHashMap(); > > private Map dependencies = new LinkedHashMap(); > > - private ResolveEngine resolveEngine; > + private final ResolveEngine resolveEngine; > > private Map modulesIdsMap = new LinkedHashMap(); > > private List modulesIds; > > - private List previousDeps; > + private Boolean hasChanged = null; > > public ConfigurationResolveReport(ResolveEngine resolveEngine, ModuleDescriptor md, > String conf, Date date, ResolveOptions options) { > @@ -71,8 +73,21 @@ > this.md = md; > this.conf = conf; > this.date = date; > + this.options = options; > + } > > - // parse previous deps from previous report file if any > + > + /** > + * Check if the set of dependencies has changed since the previous execution > + * of a resolution.
    > + * This function use the report file found in the cache. So the function must be called > + * before the new report is serialized there.
    > + * This function also use the internal dependencies that must already be filled. > + * This function might be 'heavy' because it may have to parse the previous > + * report. > + * @return > + */ > + public void checkIfChanged() { > ResolutionCacheManager cache = resolveEngine.getSettings().getResolutionCacheManager(); > String resolveId = options.getResolveId(); > File previousReportFile = cache.getConfigurationResolveReportInCache(resolveId, conf); > @@ -80,23 +95,25 @@ > try { > XmlReportParser parser = new XmlReportParser(); > parser.parse(previousReportFile); > - previousDeps = Arrays.asList(parser.getDependencyRevisionIds()); > + List previousDeps = Arrays.asList(parser.getDependencyRevisionIds()); > + HashSet previousDepSet = new HashSet(previousDeps); > + hasChanged = Boolean.valueOf(!previousDepSet.equals(getModuleRevisionIds())); > } catch (Exception e) { > Message.warn("Error while parsing configuration resolve report " > + previousReportFile.getAbsolutePath()); > e.printStackTrace(); > - previousDeps = null; > + hasChanged = Boolean.TRUE; > } > } else { > - previousDeps = null; > + hasChanged = Boolean.TRUE; > } > } > - > - public boolean hasChanged() { > - if (previousDeps == null) { > - return true; > - } > - return !new HashSet(previousDeps).equals(getModuleRevisionIds()); > + > + /** > + * @pre checkIfChanged has been called. > + */ > + public boolean hasChanged() { > + return hasChanged.booleanValue(); > } > > /** > > Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java > URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java?rev=683552&r1=683551&r2=683552&view=diff > ============================================================================== > --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java (original) > +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java Thu Aug 7 01:41:52 2008 > @@ -176,6 +176,16 @@ > return (ArtifactDownloadReport[]) all.toArray(new ArtifactDownloadReport[all.size()]); > } > > + > + public void checkIfChanged() { > + for (Iterator iter = confReports.values().iterator(); iter.hasNext();) { > + ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next(); > + report.checkIfChanged(); > + } > + } > + > + > + /** Can only be called if checkIfChanged has been called */ > public boolean hasChanged() { > for (Iterator iter = confReports.values().iterator(); iter.hasNext();) { > ConfigurationResolveReport report = (ConfigurationResolveReport) iter.next(); > @@ -310,4 +320,5 @@ > public String getResolveId() { > return resolveId; > } > + > } > > Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java > URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?rev=683552&r1=683551&r2=683552&view=diff > ============================================================================== > --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original) > +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Thu Aug 7 01:41:52 2008 > @@ -231,6 +231,10 @@ > // resolve dependencies > IvyNode[] dependencies = getDependencies(md, options, report); > report.setDependencies(Arrays.asList(dependencies), options.getArtifactFilter()); > + > + if (options.getCheckIfChanged()) { > + report.checkIfChanged(); > + } > > // produce resolved ivy file and ivy properties in cache > ResolutionCacheManager cacheManager = settings.getResolutionCacheManager(); > @@ -528,8 +532,8 @@ > List sortedDependencies = sortEngine.sortNodes(dependencies); > Collections.reverse(sortedDependencies); > > - handleTransiviteEviction(md, confs, data, sortedDependencies); > - > + handleTransiviteEviction(md, confs, data, sortedDependencies); > + > return (IvyNode[]) dependencies.toArray(new IvyNode[dependencies.size()]); > } finally { > IvyContext.popContext(); > > Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java > URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java?rev=683552&r1=683551&r2=683552&view=diff > ============================================================================== > --- ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java (original) > +++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java Thu Aug 7 01:41:52 2008 > @@ -112,6 +112,11 @@ > private String resolveId; > > private boolean refresh; > + > + /** > + * True if the resolve should compare the new resolution against the previous report > + **/ > + private boolean checkIfChanged = false; > > public ResolveOptions() { > } > @@ -130,6 +135,7 @@ > resolveMode = options.resolveMode; > artifactFilter = options.artifactFilter; > resolveId = options.resolveId; > + checkIfChanged = options.checkIfChanged; > } > > public Filter getArtifactFilter() { > @@ -281,6 +287,15 @@ > return refresh; > } > > + public ResolveOptions setCheckIfChanged(boolean checkIfChanged) { > + this.checkIfChanged = checkIfChanged; > + return this; > + } > + > + public boolean getCheckIfChanged() { > + return checkIfChanged; > + } > + > > public static String getDefaultResolveId(ModuleDescriptor md) { > ModuleId module = md.getModuleRevisionId().getModuleId(); > @@ -291,4 +306,6 @@ > return moduleId.getOrganisation() + "-" + moduleId.getName(); > } > > + > + > } > > Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java > URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java?rev=683552&r1=683551&r2=683552&view=diff > ============================================================================== > --- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java (original) > +++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java Thu Aug 7 01:41:52 2008 > @@ -194,6 +194,18 @@ > assertEquals("false", getIvy().getVariable("ivy.deps.changed")); > } > > + public void testDontCheckIfChanged() throws Exception { > + resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-simple.xml")); > + resolve.setCheckIfChanged(false); > + resolve.execute(); > + assertNull(getIvy().getVariable("ivy.deps.changed")); > + resolve.execute(); > + assertNull(getIvy().getVariable("ivy.deps.changed")); > + //To be complete, we should also check that the XmlReportParser is not invoked > + //but this would require a too big refactoring to inject a mock object > + } > + > + > public void testConflictingDepsChanged() throws Exception { > resolve.setFile(new File("test/repositories/2/mod4.1/ivy-4.1.xml")); > resolve.execute(); > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org