|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
[Ivy] How to add a new option to ivy settingsI am doing some testing with Ivy and have implemented a small modification, to allow the downloaded resource to have the same date timestamp as the file in remote repo. It is a requirement from the customer. At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File dest, CopyProgressListener l) I added dest.setLastModified(srcConn.getLastModified()); How is it possible to add an attribute "timestamp" to the "dependencies" xml tag ? See below, a sample: <ivy-module version="2.0"> <info organisation="br.com.smartnet" module="hello-ivy"/> <dependencies timestamp="remote"> <dependency org="commons-lang" name="commons-lang" rev="2.0"/> <dependency org="commons-cli" name="commons-cli" rev="1.0"/> <dependency org="skaringa" name="skaringa" rev="r1p8"/> </dependencies> </ivy-module> It can have 2 values "remote" or "current", whereas "remote" set the last modified attribute, as the remote file is. The "current" means the current Ivy behavior. How can I read the timestamp value, at BasicURLHandler class ? This is the thread, with more explanation about this requested behavior http://www.nabble.com/How-to-download-files-from-ivyrepo-with-the-same-last-modified-date---td17515745.html I plan to submit it as an enhancement to the Ivy issue tracking. Thanks Claudio Miranda |
|
|
Re: [Ivy] How to add a new option to ivy settingsI modified the code displayed below. At BasicURLHandler, how is it possible to retrieve de value of "timestamp" attribute (from ivy.xml) Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java =================================================================== --- src/java/org/apache/ivy/util/url/BasicURLHandler.java (revision 661197) +++ src/java/org/apache/ivy/util/url/BasicURLHandler.java (working copy) @@ -131,6 +131,10 @@ "Downloaded file size doesn't match expected Content Length for " + src + ". Please retry."); } + boolean remoteTimestamp = false; + if (remoteTimestamp) { + dest.setLastModified(srcConn.getLastModified()); + } } finally { disconnect(srcConn); Index: src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd =================================================================== --- src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (revision 661197) +++ src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (working copy) @@ -229,10 +229,19 @@ </xs:complexType> </xs:element> </xs:sequence> - <xs:attribute name="defaultconf" type="xs:string"/> - <xs:attribute name="defaultconfmapping" type="xs:string"/> + <xs:attribute name="defaultconf" type="xs:string"/> + <xs:attribute name="defaultconfmapping" type="xs:string"/> <xs:attribute name="confmappingoverride" type="xs:boolean" /> - </xs:complexType> + <xs:attribute name="timestamp" default="current" use="optional"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value="current"/> + <xs:enumeration value="remote"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + Index: src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java =================================================================== --- src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java (revision 661197) +++ src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java (working copy) @@ -520,6 +520,10 @@ if (confMappingOverride != null) { md.setMappingOverride(Boolean.valueOf(confMappingOverride).booleanValue()); } + String timestamp = ivy.substitute(attributes.getValue("timestamp")); + if (timestamp != null) { + md.setTimestamp(timestamp); + } checkConfigurations();
|
|
|
Re: [Ivy] How to add a new option to ivy settingsThe idea of configuring wether a retrieve should keep the server
timestamp or use the current time is great I think. However, I would not put this parameter in the ivy file. For the same ivy files, some would like one option, other would preffer the other one. I think it should better be a parameter of the retrieve task, or maybe an attribute of the resolver in the settings file. preservelastmodified sounds a good name (like the ant copy task). Note that if you put it in the resolver settings, that should maybe also impact the publish and the install task. If you put it in both the settings and the task, then the task should have the priority. Thanks, Gilles 2008/5/29 Claudio Miranda <claudio@...>: > > > I am doing some testing with Ivy and have implemented a small > modification, to allow the downloaded resource to have the same date > timestamp as the file in remote repo. It is a requirement from the customer. > > At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File dest, > CopyProgressListener l) > I added > > dest.setLastModified(srcConn.getLastModified()); > > How is it possible to add an attribute "timestamp" to the "dependencies" > xml tag ? See below, a sample: > > <ivy-module version="2.0"> > <info organisation="br.com.smartnet" module="hello-ivy"/> > <dependencies timestamp="remote"> > <dependency org="commons-lang" name="commons-lang" rev="2.0"/> > <dependency org="commons-cli" name="commons-cli" rev="1.0"/> > <dependency org="skaringa" name="skaringa" rev="r1p8"/> > </dependencies> > </ivy-module> > > It can have 2 values "remote" or "current", whereas "remote" set the > last modified attribute, as the remote file is. The "current" means the > current Ivy behavior. > > How can I read the timestamp value, at BasicURLHandler class ? > > This is the thread, with more explanation about this requested behavior > http://www.nabble.com/How-to-download-files-from-ivyrepo-with-the-same-last-modified-date---td17515745.html > > I plan to submit it as an enhancement to the Ivy issue tracking. > > Thanks > > Claudio Miranda > > ----- > Claudio Miranda > http://weblogs.java.net/blog/claudio > http://www.claudius.com.br/blog > -- > View this message in context: http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-tp17526130p17526130.html > Sent from the Ant - Dev mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: [Ivy] How to add a new option to ivy settingsAs Gilles suggested, I'd better put that in settings, which is also much
easier to add (you only need a setter on the resolver to recognize an attribute for the resolver in the settings file, pretty much like how Ant tasks work). Still to do what you want in the ivy file you have to modify XmlModuleDescriptorParser, the ModuleDescriptor interface and its default implementation. HTH, Xavier On Thu, May 29, 2008 at 6:13 AM, Claudio Miranda <claudio@...> wrote: > > > I modified the code displayed below. > At BasicURLHandler, how is it possible to retrieve de value of > "timestamp" attribute (from ivy.xml) > > Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java > =================================================================== > --- src/java/org/apache/ivy/util/url/BasicURLHandler.java (revision > 661197) > +++ src/java/org/apache/ivy/util/url/BasicURLHandler.java (working > copy) > @@ -131,6 +131,10 @@ > "Downloaded file size doesn't match expected > Content Length for " + src > + ". Please retry."); > } > + boolean remoteTimestamp = false; > + if (remoteTimestamp) { > + dest.setLastModified(srcConn.getLastModified()); > + } > } finally { > disconnect(srcConn); > > > Index: src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd > =================================================================== > --- src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (revision 661197) > +++ src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (working copy) > @@ -229,10 +229,19 @@ > </xs:complexType> > </xs:element> > </xs:sequence> > - <xs:attribute > name="defaultconf" type="xs:string"/> > - <xs:attribute > name="defaultconfmapping" type="xs:string"/> > + <xs:attribute name="defaultconf" > type="xs:string"/> > + <xs:attribute name="defaultconfmapping" > type="xs:string"/> > <xs:attribute name="confmappingoverride" > type="xs:boolean" /> > - </xs:complexType> > + <xs:attribute name="timestamp" default="current" > use="optional"> > + <xs:simpleType> > + <xs:restriction base="xs:string"> > + <xs:enumeration value="current"/> > + <xs:enumeration value="remote"/> > + </xs:restriction> > + </xs:simpleType> > + </xs:attribute> > + > > > > Index: > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java > =================================================================== > --- > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java > (revision 661197) > +++ > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java > (working copy) > @@ -520,6 +520,10 @@ > if (confMappingOverride != null) { > > md.setMappingOverride(Boolean.valueOf(confMappingOverride).booleanValue()); > } > + String timestamp = > ivy.substitute(attributes.getValue("timestamp")); > + if (timestamp != null) { > + md.setTimestamp(timestamp); > + } > checkConfigurations(); > > > Claudio Miranda wrote: > > > > > > I am doing some testing with Ivy and have implemented a small > > modification, to allow the downloaded resource to have the same date > > timestamp as the file in remote repo. It is a requirement from the > > customer. > > > > At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File > > dest, CopyProgressListener l) > > I added > > > > dest.setLastModified(srcConn.getLastModified()); > > > > How is it possible to add an attribute "timestamp" to the > > "dependencies" xml tag ? See below, a sample: > > > > <ivy-module version="2.0"> > > <info organisation="br.com.smartnet" module="hello-ivy"/> > > <dependencies timestamp="remote"> > > <dependency org="commons-lang" name="commons-lang" rev="2.0"/> > > <dependency org="commons-cli" name="commons-cli" rev="1.0"/> > > <dependency org="skaringa" name="skaringa" rev="r1p8"/> > > </dependencies> > > </ivy-module> > > > > It can have 2 values "remote" or "current", whereas "remote" set the > > last modified attribute, as the remote file is. The "current" means the > > current Ivy behavior. > > > > How can I read the timestamp value, at BasicURLHandler class ? > > > > This is the thread, with more explanation about this requested > > behavior > > > http://www.nabble.com/How-to-download-files-from-ivyrepo-with-the-same-last-modified-date---td17515745.html > > > > I plan to submit it as an enhancement to the Ivy issue tracking. > > > > Thanks > > > > Claudio Miranda > > > > > ----- > Claudio Miranda > http://weblogs.java.net/blog/claudio > http://www.claudius.com.br/blog > -- > View this message in context: > http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-tp17526130p17527290.html > Sent from the Ant - Dev mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/ |
|
|
|
|
|
Re: [Ivy] How to add a new option to ivy settingsOn Thu, May 29, 2008 at 9:35 AM, Maarten Coene <maarten_coene@...>
wrote: > Why not always use the server timestamp for the artifacts as we already do > for the Ivy files? Why not, indeed, I see no specific reason. Xavier > > > Maarten > > ----- Original Message ---- > From: Xavier Hanin <xavier.hanin@...> > To: Ant Developers List <dev@...> > Sent: Thursday, May 29, 2008 8:51:36 AM > Subject: Re: [Ivy] How to add a new option to ivy settings > > As Gilles suggested, I'd better put that in settings, which is also much > easier to add (you only need a setter on the resolver to recognize an > attribute for the resolver in the settings file, pretty much like how Ant > tasks work). Still to do what you want in the ivy file you have to modify > XmlModuleDescriptorParser, the ModuleDescriptor interface and its default > implementation. > > HTH, > > Xavier > > On Thu, May 29, 2008 at 6:13 AM, Claudio Miranda <claudio@...> > wrote: > > > > > > > I modified the code displayed below. > > At BasicURLHandler, how is it possible to retrieve de value of > > "timestamp" attribute (from ivy.xml) > > > > Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java > > =================================================================== > > --- src/java/org/apache/ivy/util/url/BasicURLHandler.java (revision > > 661197) > > +++ src/java/org/apache/ivy/util/url/BasicURLHandler.java (working > > copy) > > @@ -131,6 +131,10 @@ > > "Downloaded file size doesn't match expected > > Content Length for " + src > > + ". Please retry."); > > } > > + boolean remoteTimestamp = false; > > + if (remoteTimestamp) { > > + dest.setLastModified(srcConn.getLastModified()); > > + } > > } finally { > > disconnect(srcConn); > > > > > > Index: src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd > > =================================================================== > > --- src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (revision 661197) > > +++ src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (working copy) > > @@ -229,10 +229,19 @@ > > </xs:complexType> > > </xs:element> > > </xs:sequence> > > - <xs:attribute > > name="defaultconf" type="xs:string"/> > > - <xs:attribute > > name="defaultconfmapping" type="xs:string"/> > > + <xs:attribute name="defaultconf" > > type="xs:string"/> > > + <xs:attribute name="defaultconfmapping" > > type="xs:string"/> > > <xs:attribute name="confmappingoverride" > > type="xs:boolean" /> > > - </xs:complexType> > > + <xs:attribute name="timestamp" default="current" > > use="optional"> > > + <xs:simpleType> > > + <xs:restriction base="xs:string"> > > + <xs:enumeration value="current"/> > > + <xs:enumeration value="remote"/> > > + </xs:restriction> > > + </xs:simpleType> > > + </xs:attribute> > > + > > > > > > > > Index: > > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java > > =================================================================== > > --- > > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java > > (revision 661197) > > +++ > > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java > > (working copy) > > @@ -520,6 +520,10 @@ > > if (confMappingOverride != null) { > > > > > md.setMappingOverride(Boolean.valueOf(confMappingOverride).booleanValue()); > > } > > + String timestamp = > > ivy.substitute(attributes.getValue("timestamp")); > > + if (timestamp != null) { > > + md.setTimestamp(timestamp); > > + } > > checkConfigurations(); > > > > > > Claudio Miranda wrote: > > > > > > > > > I am doing some testing with Ivy and have implemented a small > > > modification, to allow the downloaded resource to have the same date > > > timestamp as the file in remote repo. It is a requirement from the > > > customer. > > > > > > At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File > > > dest, CopyProgressListener l) > > > I added > > > > > > dest.setLastModified(srcConn.getLastModified()); > > > > > > How is it possible to add an attribute "timestamp" to the > > > "dependencies" xml tag ? See below, a sample: > > > > > > <ivy-module version="2.0"> > > > <info organisation="br.com.smartnet" module="hello-ivy"/> > > > <dependencies timestamp="remote"> > > > <dependency org="commons-lang" name="commons-lang" rev="2.0"/> > > > <dependency org="commons-cli" name="commons-cli" rev="1.0"/> > > > <dependency org="skaringa" name="skaringa" rev="r1p8"/> > > > </dependencies> > > > </ivy-module> > > > > > > It can have 2 values "remote" or "current", whereas "remote" set > the > > > last modified attribute, as the remote file is. The "current" means the > > > current Ivy behavior. > > > > > > How can I read the timestamp value, at BasicURLHandler class ? > > > > > > This is the thread, with more explanation about this requested > > > behavior > > > > > > http://www.nabble.com/How-to-download-files-from-ivyrepo-with-the-same-last-modified-date---td17515745.html > > > > > > I plan to submit it as an enhancement to the Ivy issue tracking. > > > > > > Thanks > > > > > > Claudio Miranda > > > > > > > > > ----- > > Claudio Miranda > > http://weblogs.java.net/blog/claudio > > http://www.claudius.com.br/blog > > -- > > View this message in context: > > > http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-tp17526130p17527290.html > > Sent from the Ant - Dev mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscribe@... > > For additional commands, e-mail: dev-help@... > > > > > > > -- > Xavier Hanin - Independent Java Consultant > http://xhab.blogspot.com/ > http://ant.apache.org/ivy/ > http://www.xoocode.org/ > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/ |
|
|
Re: [Ivy] How to add a new option to ivy settingsMaybe because later an other user will have the oposite requirements :
I want the retreive to use the current timestamp, so that I know when I made the retrieve, I know which files have been updated by my last retrieve, I can use some kind of up-to-date task, and I can also better integrate my retrieved libraries into my source control repository. I think both requirements are valid, so it should be configurable. Gilles 2008/5/29 Xavier Hanin <xavier.hanin@...>: > On Thu, May 29, 2008 at 9:35 AM, Maarten Coene <maarten_coene@...> > wrote: > >> Why not always use the server timestamp for the artifacts as we already do >> for the Ivy files? > > Why not, indeed, I see no specific reason. > > Xavier > > >> >> >> Maarten >> >> ----- Original Message ---- >> From: Xavier Hanin <xavier.hanin@...> >> To: Ant Developers List <dev@...> >> Sent: Thursday, May 29, 2008 8:51:36 AM >> Subject: Re: [Ivy] How to add a new option to ivy settings >> >> As Gilles suggested, I'd better put that in settings, which is also much >> easier to add (you only need a setter on the resolver to recognize an >> attribute for the resolver in the settings file, pretty much like how Ant >> tasks work). Still to do what you want in the ivy file you have to modify >> XmlModuleDescriptorParser, the ModuleDescriptor interface and its default >> implementation. >> >> HTH, >> >> Xavier >> >> On Thu, May 29, 2008 at 6:13 AM, Claudio Miranda <claudio@...> >> wrote: >> >> > >> > >> > I modified the code displayed below. >> > At BasicURLHandler, how is it possible to retrieve de value of >> > "timestamp" attribute (from ivy.xml) >> > >> > Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java >> > =================================================================== >> > --- src/java/org/apache/ivy/util/url/BasicURLHandler.java (revision >> > 661197) >> > +++ src/java/org/apache/ivy/util/url/BasicURLHandler.java (working >> > copy) >> > @@ -131,6 +131,10 @@ >> > "Downloaded file size doesn't match expected >> > Content Length for " + src >> > + ". Please retry."); >> > } >> > + boolean remoteTimestamp = false; >> > + if (remoteTimestamp) { >> > + dest.setLastModified(srcConn.getLastModified()); >> > + } >> > } finally { >> > disconnect(srcConn); >> > >> > >> > Index: src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd >> > =================================================================== >> > --- src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (revision 661197) >> > +++ src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (working copy) >> > @@ -229,10 +229,19 @@ >> > </xs:complexType> >> > </xs:element> >> > </xs:sequence> >> > - <xs:attribute >> > name="defaultconf" type="xs:string"/> >> > - <xs:attribute >> > name="defaultconfmapping" type="xs:string"/> >> > + <xs:attribute name="defaultconf" >> > type="xs:string"/> >> > + <xs:attribute name="defaultconfmapping" >> > type="xs:string"/> >> > <xs:attribute name="confmappingoverride" >> > type="xs:boolean" /> >> > - </xs:complexType> >> > + <xs:attribute name="timestamp" default="current" >> > use="optional"> >> > + <xs:simpleType> >> > + <xs:restriction base="xs:string"> >> > + <xs:enumeration value="current"/> >> > + <xs:enumeration value="remote"/> >> > + </xs:restriction> >> > + </xs:simpleType> >> > + </xs:attribute> >> > + >> > >> > >> > >> > Index: >> > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java >> > =================================================================== >> > --- >> > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java >> > (revision 661197) >> > +++ >> > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java >> > (working copy) >> > @@ -520,6 +520,10 @@ >> > if (confMappingOverride != null) { >> > >> > >> md.setMappingOverride(Boolean.valueOf(confMappingOverride).booleanValue()); >> > } >> > + String timestamp = >> > ivy.substitute(attributes.getValue("timestamp")); >> > + if (timestamp != null) { >> > + md.setTimestamp(timestamp); >> > + } >> > checkConfigurations(); >> > >> > >> > Claudio Miranda wrote: >> > > >> > > >> > > I am doing some testing with Ivy and have implemented a small >> > > modification, to allow the downloaded resource to have the same date >> > > timestamp as the file in remote repo. It is a requirement from the >> > > customer. >> > > >> > > At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File >> > > dest, CopyProgressListener l) >> > > I added >> > > >> > > dest.setLastModified(srcConn.getLastModified()); >> > > >> > > How is it possible to add an attribute "timestamp" to the >> > > "dependencies" xml tag ? See below, a sample: >> > > >> > > <ivy-module version="2.0"> >> > > <info organisation="br.com.smartnet" module="hello-ivy"/> >> > > <dependencies timestamp="remote"> >> > > <dependency org="commons-lang" name="commons-lang" rev="2.0"/> >> > > <dependency org="commons-cli" name="commons-cli" rev="1.0"/> >> > > <dependency org="skaringa" name="skaringa" rev="r1p8"/> >> > > </dependencies> >> > > </ivy-module> >> > > >> > > It can have 2 values "remote" or "current", whereas "remote" set >> the >> > > last modified attribute, as the remote file is. The "current" means the >> > > current Ivy behavior. >> > > >> > > How can I read the timestamp value, at BasicURLHandler class ? >> > > >> > > This is the thread, with more explanation about this requested >> > > behavior >> > > >> > >> http://www.nabble.com/How-to-download-files-from-ivyrepo-with-the-same-last-modified-date---td17515745.html >> > > >> > > I plan to submit it as an enhancement to the Ivy issue tracking. >> > > >> > > Thanks >> > > >> > > Claudio Miranda >> > > >> > >> > >> > ----- >> > Claudio Miranda >> > http://weblogs.java.net/blog/claudio >> > http://www.claudius.com.br/blog >> > -- >> > View this message in context: >> > >> http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-tp17526130p17527290.html >> > Sent from the Ant - Dev mailing list archive at Nabble.com. >> > >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: dev-unsubscribe@... >> > For additional commands, e-mail: dev-help@... >> > >> > >> >> >> -- >> Xavier Hanin - Independent Java Consultant >> http://xhab.blogspot.com/ >> http://ant.apache.org/ivy/ >> http://www.xoocode.org/ >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscribe@... >> For additional commands, e-mail: dev-help@... >> >> > > > -- > Xavier Hanin - Independent Java Consultant > http://xhab.blogspot.com/ > http://ant.apache.org/ivy/ > http://www.xoocode.org/ > -- Gilles Scokart --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
|
|
|
Re: [Ivy] How to add a new option to ivy settings2008/5/29 Maarten Coene <maarten_coene@...>:
> So maybe it should be an attribute on the ivy:retrieve task? Yes : task attribute and/or settings attribute are both valid. > I think the files in the cache should have the same timestamp as on the server. > This way, you still have the choice what you want to do with the timestamp when the artifacts are already resolved. Very good point. > > Maarten > > > ----- Original Message ---- > From: Gilles Scokart <gscokart@...> > To: Ant Developers List <dev@...> > Sent: Thursday, May 29, 2008 9:51:58 AM > Subject: Re: [Ivy] How to add a new option to ivy settings > > Maybe because later an other user will have the oposite requirements : > I want the retreive to use the current timestamp, so that I know when > I made the retrieve, I know which files have been updated by my last > retrieve, I can use some kind of up-to-date task, and I can also > better integrate my retrieved libraries into my source control > repository. > > I think both requirements are valid, so it should be configurable. > > Gilles > > 2008/5/29 Xavier Hanin <xavier.hanin@...>: >> On Thu, May 29, 2008 at 9:35 AM, Maarten Coene <maarten_coene@...> >> wrote: >> >>> Why not always use the server timestamp for the artifacts as we already do >>> for the Ivy files? >> >> Why not, indeed, I see no specific reason. >> >> Xavier >> >> >>> >>> >>> Maarten >>> >>> ----- Original Message ---- >>> From: Xavier Hanin <xavier.hanin@...> >>> To: Ant Developers List <dev@...> >>> Sent: Thursday, May 29, 2008 8:51:36 AM >>> Subject: Re: [Ivy] How to add a new option to ivy settings >>> >>> As Gilles suggested, I'd better put that in settings, which is also much >>> easier to add (you only need a setter on the resolver to recognize an >>> attribute for the resolver in the settings file, pretty much like how Ant >>> tasks work). Still to do what you want in the ivy file you have to modify >>> XmlModuleDescriptorParser, the ModuleDescriptor interface and its default >>> implementation. >>> >>> HTH, >>> >>> Xavier >>> >>> On Thu, May 29, 2008 at 6:13 AM, Claudio Miranda <claudio@...> >>> wrote: >>> >>> > >>> > >>> > I modified the code displayed below. >>> > At BasicURLHandler, how is it possible to retrieve de value of >>> > "timestamp" attribute (from ivy.xml) >>> > >>> > Index: src/java/org/apache/ivy/util/url/BasicURLHandler.java >>> > =================================================================== >>> > --- src/java/org/apache/ivy/util/url/BasicURLHandler.java (revision >>> > 661197) >>> > +++ src/java/org/apache/ivy/util/url/BasicURLHandler.java (working >>> > copy) >>> > @@ -131,6 +131,10 @@ >>> > "Downloaded file size doesn't match expected >>> > Content Length for " + src >>> > + ". Please retry."); >>> > } >>> > + boolean remoteTimestamp = false; >>> > + if (remoteTimestamp) { >>> > + dest.setLastModified(srcConn.getLastModified()); >>> > + } >>> > } finally { >>> > disconnect(srcConn); >>> > >>> > >>> > Index: src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd >>> > =================================================================== >>> > --- src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (revision 661197) >>> > +++ src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (working copy) >>> > @@ -229,10 +229,19 @@ >>> > </xs:complexType> >>> > </xs:element> >>> > </xs:sequence> >>> > - <xs:attribute >>> > name="defaultconf" type="xs:string"/> >>> > - <xs:attribute >>> > name="defaultconfmapping" type="xs:string"/> >>> > + <xs:attribute name="defaultconf" >>> > type="xs:string"/> >>> > + <xs:attribute name="defaultconfmapping" >>> > type="xs:string"/> >>> > <xs:attribute name="confmappingoverride" >>> > type="xs:boolean" /> >>> > - </xs:complexType> >>> > + <xs:attribute name="timestamp" default="current" >>> > use="optional"> >>> > + <xs:simpleType> >>> > + <xs:restriction base="xs:string"> >>> > + <xs:enumeration value="current"/> >>> > + <xs:enumeration value="remote"/> >>> > + </xs:restriction> >>> > + </xs:simpleType> >>> > + </xs:attribute> >>> > + >>> > >>> > >>> > >>> > Index: >>> > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java >>> > =================================================================== >>> > --- >>> > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java >>> > (revision 661197) >>> > +++ >>> > src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java >>> > (working copy) >>> > @@ -520,6 +520,10 @@ >>> > if (confMappingOverride != null) { >>> > >>> > >>> md.setMappingOverride(Boolean.valueOf(confMappingOverride).booleanValue()); >>> > } >>> > + String timestamp = >>> > ivy.substitute(attributes.getValue("timestamp")); >>> > + if (timestamp != null) { >>> > + md.setTimestamp(timestamp); >>> > + } >>> > checkConfigurations(); >>> > >>> > >>> > Claudio Miranda wrote: >>> > > >>> > > >>> > > I am doing some testing with Ivy and have implemented a small >>> > > modification, to allow the downloaded resource to have the same date >>> > > timestamp as the file in remote repo. It is a requirement from the >>> > > customer. >>> > > >>> > > At org.apache.ivy.util.url.BasicURLHandler.download(URL src, File >>> > > dest, CopyProgressListener l) >>> > > I added >>> > > >>> > > dest.setLastModified(srcConn.getLastModified()); >>> > > >>> > > How is it possible to add an attribute "timestamp" to the >>> > > "dependencies" xml tag ? See below, a sample: >>> > > >>> > > <ivy-module version="2.0"> >>> > > <info organisation="br.com.smartnet" module="hello-ivy"/> >>> > > <dependencies timestamp="remote"> >>> > > <dependency org="commons-lang" name="commons-lang" rev="2.0"/> >>> > > <dependency org="commons-cli" name="commons-cli" rev="1.0"/> >>> > > <dependency org="skaringa" name="skaringa" rev="r1p8"/> >>> > > </dependencies> >>> > > </ivy-module> >>> > > >>> > > It can have 2 values "remote" or "current", whereas "remote" set >>> the >>> > > last modified attribute, as the remote file is. The "current" means the >>> > > current Ivy behavior. >>> > > >>> > > How can I read the timestamp value, at BasicURLHandler class ? >>> > > >>> > > This is the thread, with more explanation about this requested >>> > > behavior >>> > > >>> > >>> http://www.nabble.com/How-to-download-files-from-ivyrepo-with-the-same-last-modified-date---td17515745.html >>> > > >>> > > I plan to submit it as an enhancement to the Ivy issue tracking. >>> > > >>> > > Thanks >>> > > >>> > > Claudio Miranda >>> > > >>> > >>> > >>> > ----- >>> > Claudio Miranda >>> > http://weblogs.java.net/blog/claudio >>> > http://www.claudius.com.br/blog >>> > -- >>> > View this message in context: >>> > >>> http://www.nabble.com/-Ivy--How-to-add-a-new-option-to-ivy-settings-tp17526130p17527290.html >>> > Sent from the Ant - Dev mailing list archive at Nabble.com. >>> > >>> > >>> > --------------------------------------------------------------------- >>> > To unsubscribe, e-mail: dev-unsubscribe@... >>> > For additional commands, e-mail: dev-help@... >>> > >>> > >>> >>> >>> -- >>> Xavier Hanin - Independent Java Consultant >>> http://xhab.blogspot.com/ >>> http://ant.apache.org/ivy/ >>> http://www.xoocode.org/ >>> >>> >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: dev-unsubscribe@... >>> For additional commands, e-mail: dev-help@... >>> >>> >> >> >> -- >> Xavier Hanin - Independent Java Consultant >> http://xhab.blogspot.com/ >> http://ant.apache.org/ivy/ >> http://www.xoocode.org/ >> > > > > -- > Gilles Scokart > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > -- Gilles Scokart --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: [Ivy] How to add a new option to ivy settingsHey guys, thank you for your suggestions. I started to better understand Ivy 2 days ago, and I have no knowledge about how to read those configurations. Can you show me some code or guidance on how to better acomplish this task ? I have already modified XmlModuleDescriptorParser and ModuleDescriptor implementation (I will do the same to the interface). Thanks Claudio Miranda
|
|
|
|
|
|
Re: [Ivy] How to add a new option to ivy settingsThis is the intended action, and it is working. But, I want this as a configurable option, to not disrupt the current behavior. Anyway the issue is there https://issues.apache.org/jira/browse/IVY-823 Thanks Claudio Miranda
|
| Free embeddable forum powered by Nabble | Forum Help |