Pass secret to Exec task

2023-01-30 Thread Gilles Querret
Hello,


I have to pass a secret to an Exec task (in a custom Ant plugin), and one
way to do that is to pipe the output of another command line to this exec
task.

First, is there a way to programmatically pass the output this command line
to an Exec task ? Usage of my task would be something like:
.
In my Java file, I first do some logic, then instantiate the Exec object,
fill parameters and execute it. Apart from setInput and setInputString, I
don't see any way to pipe the output.

I've tried setInputString, but the passphrase is visible when using "ant
-v", and I'd like to avoid that. I'd also like to avoid having to use
temporary files with the passphrase, as this is usually not very secure.
Is it possible to use the Redirector element from Java code ?

Thanks !

-- 
Gilles QUERRET

Riverside Software
91 chemin des églantiers • 69440 Taluyers • France
Mob : +33 662.525.532


Re: Message output level not public for Project class

2022-10-10 Thread Gilles Querret
Hello Earl,


So far I've used this workaround to retrieve the log level:
https://github.com/Riverside-Software/pct/blob/d8446a002aaf2efb255d2016a16e9a71f7ad269f/src/java/com/phenix/pct/PCT.java#L593
Usage in the Ant task:
https://github.com/Riverside-Software/pct/blob/master/src/java/com/phenix/pct/PCTRun.java#L475

Code was written years ago, there might be a better solution now.

Gilles

On Wed, Sep 7, 2022 at 8:24 PM Earl Hood  wrote:

> Ant Devs,
>
> Working on a custom task that will exec an external program. One thing I
> would like to do is if ant is invoked with debugging output level, set the
> debugging flag to the external program.
>
> Unfortunately, it seems to get the current logging level is not easy, as
> the level set when Ant is invoked is private with no getter method to
> retrieve it.  I see the level is passed into build listeners, but those
> APIs also do not expose the level.
>
> Is there any way to retrieve the current logging level, and if not, is
> reasonable to make the current level accessible via a public method in the
> Project class?
>
> Best regards,
>
> --ewh
>


-- 
Gilles QUERRET

Riverside Software
91 chemin des églantiers • 69440 Taluyers • France
Mob : +33 662.525.532


Re: Selectors not executed on Zipfileset

2021-03-15 Thread Gilles Querret
On Sat, Mar 13, 2021 at 1:03 PM Stefan Bodewig  wrote:

> On 2021-03-08, Gilles Querret wrote:
>
> > I think I've found an issue with selectors which are not executed on
> > Zipfileset. Here is a very small test case to reproduce the issue:
>
> The selectors that can be nested directly into a fileset (and this into
> a zipfileset which inherits the behavior) are FileSelectors that can
> only be applied to real files. For non-File resources you'd need
> ResourceSelectors and they are not directly supported as nested elements
> of the zipfileset - rather you'd wrap the whole thing into a 
> container.
>
>
Thank you Stefan for the explanation ! I've used the  selector in
this example, but my use case is in fact similar to the 
selector, where a comparison is done on both the source file and the target
file. I assume that this is not possible within the restrict element ?

Gilles
-- 
Gilles QUERRET

Riverside Software
91 chemin des églantiers • 69440 Taluyers • France
Mob : +33 662.525.532


Re: Selectors not executed on Zipfileset

2021-03-09 Thread Gilles Querret
Hello,


I've ran some tests and I confirm that selectors are not executed on
ZipFilesets (at least in the copy task). Here is what happens:
* In Copy.java:490 (
https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Copy.java#L490
), a DirectoryScanner is created when using a standard FileSet. This
DirectoryScanner will then execute selectors at line 1505 (
https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/DirectoryScanner.java#L1505
)
* However, a different behavior happens with ZipFileset (in Copy.java line
515
https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Copy.java#L515
), where the resource is directly added to the list :
https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Copy.java#L557

Is that specific to the copy task ? Or do all other tasks behave
identically ? And don't you think that selectors should be executed on
non-filesystem filesets ?

Gilles

On Mon, Mar 8, 2021 at 1:14 PM Gilles Querret <
g.quer...@riverside-software.fr> wrote:

> Hello,
>
>
> I think I've found an issue with selectors which are not executed on
> Zipfileset. Here is a very small test case to reproduce the issue:
>
> 
>   
>   
>
>   
>   
>   
>   
>   
> 
>   
>
>   
>   
> 
>   
> 
>   
>
>   
>   
> 
>   
> 
>   
> 
> When executed, the first copy task only copies one file (test2.txt which
> contains def), but the second copy task copies all three files. My original
> problem was coming from the  selector, also not executed on
> zipfileset, but it was easier to reproduce with .
> Is that a known issue ? Or just the expected behavior ?
>
> Gilles
>
>
> --
> Gilles QUERRET
>
> Riverside Software
> 91 chemin des églantiers • 69440 Taluyers • France
> Mob : +33 662.525.532
>


-- 
Gilles QUERRET

Riverside Software
91 chemin des églantiers • 69440 Taluyers • France
Mob : +33 662.525.532


Selectors not executed on Zipfileset

2021-03-08 Thread Gilles Querret
Hello,


I think I've found an issue with selectors which are not executed on
Zipfileset. Here is a very small test case to reproduce the issue:


  
  

  
  
  
  
  

  

  
  

  

  

  
  

  

  

When executed, the first copy task only copies one file (test2.txt which
contains def), but the second copy task copies all three files. My original
problem was coming from the  selector, also not executed on
zipfileset, but it was easier to reproduce with .
Is that a known issue ? Or just the expected behavior ?

Gilles


-- 
Gilles QUERRET

Riverside Software
91 chemin des églantiers • 69440 Taluyers • France
Mob : +33 662.525.532


Re: File type mapping in external task

2018-04-04 Thread Gilles Querret
Thank you Stefan ! I was a bit afraid of duplicating the logic for String
to File mapping, but if it's just about using Project#resolveFile then I'll
do it.


Gilles

On Wed, Apr 4, 2018 at 1:40 PM, Stefan Bodewig <bode...@apache.org> wrote:

> On 2018-04-03, Gilles Querret wrote:
>
> > If I have an attribute mapped to a File type (such as setSrcDir(File
> file)
> > { this.srcDir = file; } ), then passing an empty string (as in  > srcDir="" ) leads to srcDir set to baseDir (or current directory, not
> sure).
>
> baseDir :-)
>
> > Is there a way to trap the empty string in the setter ? Or is it required
> > to change the setter to accept a String parameter, and create the File
> > object from the string ?
>
> You will need the String-arg setter for that. The File (or Path) -arg
> versions simply go through Project#resolveFile.
>
> If you are using typed attribute setters you are all in on Ant's
> behavior without any chance to tweak it.
>
> An alternative may be a type of your own with a Project and String-arg
> constructor, something like
>
> public class MyFileWrapper {
> private final File file;
>
> public MyFileWrapper(Project p, String fileName) {
> if ("".equals(fileName)) {
> throw new BuildException("file name must not be empty");
> }
> this.file = p.resolveFile(fileName);
> }
>
> public File getFile() {
> return file;
> }
> }
>
> public void setSrcDir(MyFileWrapper w) {
> this.srcDir = w.getFile();
> }
>
> which may be slightly better.
>
> Stefan
>
> ---------
> To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
> For additional commands, e-mail: dev-h...@ant.apache.org
>
>


-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532


File type mapping in external task

2018-04-03 Thread Gilles Querret
Hello all,


If I have an attribute mapped to a File type (such as setSrcDir(File file)
{ this.srcDir = file; } ), then passing an empty string (as in 

Re: Fisheye links

2018-01-21 Thread Gilles Querret
Hi Gintautas,


I've modified the redirection, pct.sourceforge.net now redirects to the
GitHub page. Still hops through pct.rssw.eu, but I wasn't able to find
*where* pct.sf.net redirection can be configured.

Gilles

On Mon, Jan 15, 2018 at 5:21 PM, Gintautas Grigelionis <
g.grigelio...@gmail.com> wrote:

> Hi Gilles,
>
> I checked pct.sourceforge.net and it still redirects to
> http://pct.rssw.eu/
> which does not reply.
>
> Gintas
>
> 2018-01-15 14:01 GMT+01:00 Gilles Querret <g.quer...@riverside-software.fr
> >:
>
> > Hi Gintautas,
> >
> >
> > Sourceforge page has been updated, it now redirects to GitHub.
> >
> > Gilles
> >
> > On Mon, Jan 15, 2018 at 9:04 AM, Gintautas Grigelionis <
> > g.grigelio...@gmail.com> wrote:
> >
> > > Hi Gilles,
> > >
> > > thanks for update. Could you please try to update redirection from
> > > pct.sourceforge.net, too?
> > > Then it would be clear which site is currently hosting PCT.
> > >
> > > Regarding Ant site, I would be happy to update the pages, but I'm not
> > sure
> > > what the process is.
> > > By the looks of it, any committer can change the sources, regenerate
> the
> > > site and push it into production.
> > > Is that correct, Stefan?
> > >
> > > Gintas
> > >
> > > 2018-01-14 18:49 GMT+01:00 Gilles Querret
> <g.querret@riverside-software.
> > fr
> > > >:
> > >
> > > > Hi,
> > > >
> > > >
> > > > PCT has been moved to GitHub some time ago, URL is
> > > > https://github.com/Riverside-Software/pct
> > > > If you're able to update the link, that would be perfect !
> > > >
> > > > Gilles
> > > >
> > > > On Sat, Jan 13, 2018 at 7:58 PM, Gintautas Grigelionis <
> > > > g.grigelio...@gmail.com> wrote:
> > > >
> > > > > I took the liberty to check the links in
> > > > > https://ant.apache.org/external.html and this is the result:
> > > > >
> > > > > *404*: AntRunner, Java+ Precompile Task, JIndent, JMetra, JRun Ant
> > > Tasks,
> > > > > PesterCat, PRes, RefactorIT, WOProject, miniRMI, Gel, Embarcadero
> > > > JBuilder,
> > > > > IDX, JDeveloper
> > > > >
> > > > > *moved to GitHub*: Antomology, DynaTrace plugin, Grand, J2ME
> Polish?,
> > > > > JarPatch, JavaMake (Pants), JDeb, JPP for Ant?, PMD, AntUtility
> > > > >
> > > > > *available at SourceForge*: AntXtras (antxtras.sourceforge.net
> > broken,
> > > > use
> > > > > https://sourceforge.net/projects/antxtras/), Kanaputs, PCT (
> > > > > pct.sourceforge.net broken, use https://sourceforge.net/
> > projects/pct/
> > > ),
> > > > > Ant
> > > > > Version Tool
> > > > >
> > > > > *changed URL*: AntTimerTask & XInclude (jeckle.de ->
> mario-jeckle.de
> > ),
> > > > > Clover (openclover.org), RunDoc & Snip (
> > > > > http://www.martiansoftware.com/lab/{rundoc,snip}.html), Simian (
> > > > > http://www.harukizaemon.com/simian/installation.html#ant)
> > > > >
> > > > > Gintas
> > > > >
> > > > >
> > > > > 2017-12-18 21:44 GMT+01:00 Gintautas Grigelionis <
> > > > g.grigelio...@gmail.com
> > > > > >:
> > > > >
> > > > > > ... at https://ant.apache.org/git.html are incorrect.
> > > > > >
> > > > > > Gintas
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Gilles QUERRET
> > > >
> > > > Riverside Software
> > > > 15d route de Bellevue • 69440 Mornant • France
> > > > Mob : +33 662.525.532
> > > >
> > >
> >
> >
> >
> > --
> > Gilles QUERRET
> >
> > Riverside Software
> > 15d route de Bellevue • 69440 Mornant • France
> > Mob : +33 662.525.532
> >
>



-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532


Re: Fisheye links

2018-01-15 Thread Gilles Querret
Hi Gintautas,


Sourceforge page has been updated, it now redirects to GitHub.

Gilles

On Mon, Jan 15, 2018 at 9:04 AM, Gintautas Grigelionis <
g.grigelio...@gmail.com> wrote:

> Hi Gilles,
>
> thanks for update. Could you please try to update redirection from
> pct.sourceforge.net, too?
> Then it would be clear which site is currently hosting PCT.
>
> Regarding Ant site, I would be happy to update the pages, but I'm not sure
> what the process is.
> By the looks of it, any committer can change the sources, regenerate the
> site and push it into production.
> Is that correct, Stefan?
>
> Gintas
>
> 2018-01-14 18:49 GMT+01:00 Gilles Querret <g.quer...@riverside-software.fr
> >:
>
> > Hi,
> >
> >
> > PCT has been moved to GitHub some time ago, URL is
> > https://github.com/Riverside-Software/pct
> > If you're able to update the link, that would be perfect !
> >
> > Gilles
> >
> > On Sat, Jan 13, 2018 at 7:58 PM, Gintautas Grigelionis <
> > g.grigelio...@gmail.com> wrote:
> >
> > > I took the liberty to check the links in
> > > https://ant.apache.org/external.html and this is the result:
> > >
> > > *404*: AntRunner, Java+ Precompile Task, JIndent, JMetra, JRun Ant
> Tasks,
> > > PesterCat, PRes, RefactorIT, WOProject, miniRMI, Gel, Embarcadero
> > JBuilder,
> > > IDX, JDeveloper
> > >
> > > *moved to GitHub*: Antomology, DynaTrace plugin, Grand, J2ME Polish?,
> > > JarPatch, JavaMake (Pants), JDeb, JPP for Ant?, PMD, AntUtility
> > >
> > > *available at SourceForge*: AntXtras (antxtras.sourceforge.net broken,
> > use
> > > https://sourceforge.net/projects/antxtras/), Kanaputs, PCT (
> > > pct.sourceforge.net broken, use https://sourceforge.net/projects/pct/
> ),
> > > Ant
> > > Version Tool
> > >
> > > *changed URL*: AntTimerTask & XInclude (jeckle.de -> mario-jeckle.de),
> > > Clover (openclover.org), RunDoc & Snip (
> > > http://www.martiansoftware.com/lab/{rundoc,snip}.html), Simian (
> > > http://www.harukizaemon.com/simian/installation.html#ant)
> > >
> > > Gintas
> > >
> > >
> > > 2017-12-18 21:44 GMT+01:00 Gintautas Grigelionis <
> > g.grigelio...@gmail.com
> > > >:
> > >
> > > > ... at https://ant.apache.org/git.html are incorrect.
> > > >
> > > > Gintas
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Gilles QUERRET
> >
> > Riverside Software
> > 15d route de Bellevue • 69440 Mornant • France
> > Mob : +33 662.525.532
> >
>



-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532


Re: Fisheye links

2018-01-14 Thread Gilles Querret
Hi,


PCT has been moved to GitHub some time ago, URL is
https://github.com/Riverside-Software/pct
If you're able to update the link, that would be perfect !

Gilles

On Sat, Jan 13, 2018 at 7:58 PM, Gintautas Grigelionis <
g.grigelio...@gmail.com> wrote:

> I took the liberty to check the links in
> https://ant.apache.org/external.html and this is the result:
>
> *404*: AntRunner, Java+ Precompile Task, JIndent, JMetra, JRun Ant Tasks,
> PesterCat, PRes, RefactorIT, WOProject, miniRMI, Gel, Embarcadero JBuilder,
> IDX, JDeveloper
>
> *moved to GitHub*: Antomology, DynaTrace plugin, Grand, J2ME Polish?,
> JarPatch, JavaMake (Pants), JDeb, JPP for Ant?, PMD, AntUtility
>
> *available at SourceForge*: AntXtras (antxtras.sourceforge.net broken, use
> https://sourceforge.net/projects/antxtras/), Kanaputs, PCT (
> pct.sourceforge.net broken, use https://sourceforge.net/projects/pct/),
> Ant
> Version Tool
>
> *changed URL*: AntTimerTask & XInclude (jeckle.de -> mario-jeckle.de),
> Clover (openclover.org), RunDoc & Snip (
> http://www.martiansoftware.com/lab/{rundoc,snip}.html), Simian (
> http://www.harukizaemon.com/simian/installation.html#ant)
>
> Gintas
>
>
> 2017-12-18 21:44 GMT+01:00 Gintautas Grigelionis <g.grigelio...@gmail.com
> >:
>
> > ... at https://ant.apache.org/git.html are incorrect.
> >
> > Gintas
> >
> >
>



-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532


Re: Regexp mapper + Zip task on Windows

2016-05-19 Thread Gilles Querret
Thanks Stephan for having integrated the patch in Git !
One question : I've tried to fetch a CI build from the Jenkins and TeamCity
CI server. However, unless it's too early in the morning (which is not the
case :) ), I wasn't able to find any. Is there another location I could
find one ? Otherwise, I'll directly use the output of my local repo.

Gilles

On Wed, May 18, 2016 at 6:02 AM, Stefan Bodewig <bode...@apache.org> wrote:

> On 2016-05-17, Gilles Querret wrote:
>
> > PS : posted on the ML, will update the bugzilla entry. Are bugzilla
> > comments posted on this ML ?
>
> to a different mailing list, notifications @ ant.apache.org.
>
> I've responded there, it's probably better to keep the discussion there
> so people will find it when searching for a similar problem.
>
> Stefan
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
> For additional commands, e-mail: dev-h...@ant.apache.org
>
>


-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532


Re: Regexp mapper + Zip task on Windows

2016-05-17 Thread Gilles Querret
Hi,


I think I've found the issue, but would like to get confirmation : the
granularity of file timestamps is different on NTFS and Linux filesystems
(1 and 2000 respectively), however it seems that file entries in ZIP files
have a different granularity. From my tests, I'm always gettings timestamps
from ZIP file which are 1.5 seconds more recent than file timestamps, so
the ZIP file is not updated on Unix (less than 2 seconds), but not on
Windows (only 1ms granularity).
Does anybody have enough knowledge of ZIP files to confirm that ?
A fix could be to have a different granularity based on the resource type
we're trying to update, but I don't know how easy it would be to do that.

Gilles

PS : posted on the ML, will update the bugzilla entry. Are bugzilla
comments posted on this ML ?


On Tue, May 17, 2016 at 5:03 PM, Stefan Bodewig <bode...@apache.org> wrote:

> On 2016-05-17, Gilles Querret wrote:
>
> > Thanks for your answer. I've just opened
> > https://bz.apache.org/bugzilla/show_bug.cgi?id=59562 in order to keep
> track
> > of this issue, and also attached patches.
>
> Many thanks!
>
> > I'll try to find the problem, and I'm sure I'll have questions !
>
> Don't hesitate to ask.
>
> Cheers
>
> Stefan
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
> For additional commands, e-mail: dev-h...@ant.apache.org
>
>


-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532


Re: Regexp mapper + Zip task on Windows

2016-05-17 Thread Gilles Querret
Hi Stefan,


Thanks for your answer. I've just opened
https://bz.apache.org/bugzilla/show_bug.cgi?id=59562 in order to keep track
of this issue, and also attached patches.
I'll try to find the problem, and I'm sure I'll have questions !

Gilles


On Tue, May 17, 2016 at 4:35 PM, Stefan Bodewig <bode...@apache.org> wrote:

> Hi Gilles
>
> On 2016-05-17, Gilles Querret wrote:
>
> > Following a previous message on the user ML (
> >
> http://mail-archives.apache.org/mod_mbox/ant-user/201605.mbox/%3CCALDHZaLxBFWW6V32FOs%3DOHXadr1VXCHAupCDMnZDe6C5nNaQyg%40mail.gmail.com%3E
> > ), here is a small patch for unit tests which shows the problem.
> > Unit tests are running correctly on Linux and MacOS, but not on Windows.
>
> Your patch didn't make it through to the dev list, it is configured to
> strip attachments. You probably best open a bugzilla issue and attach
> your testcase there. This way it doesn't get lost.
>
> > Before digging into the details of this problem, does anybody know if
> it's
> > a known problem, or would have a suggestion on how to fix it ?
>
> At least I am not aware of a similar issue and can't see any quick
> workaround until I manage to reproduce the issue - which is rather
> difficult without access to Windows :-)
>
> Thanks
>
> Stefan
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
> For additional commands, e-mail: dev-h...@ant.apache.org
>
>


-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532


Regexp mapper + Zip task on Windows

2016-05-17 Thread Gilles Querret
Hello,


Following a previous message on the user ML (
http://mail-archives.apache.org/mod_mbox/ant-user/201605.mbox/%3CCALDHZaLxBFWW6V32FOs%3DOHXadr1VXCHAupCDMnZDe6C5nNaQyg%40mail.gmail.com%3E
), here is a small patch for unit tests which shows the problem.
Unit tests are running correctly on Linux and MacOS, but not on Windows.
Before digging into the details of this problem, does anybody know if it's
a known problem, or would have a suggestion on how to fix it ?

Thanks,

-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Regexp mapper + Zip task on Windows

2016-05-17 Thread Gilles Querret
Hello,


Following a previous message on the user ML (
http://mail-archives.apache.org/mod_mbox/ant-user/201605.mbox/%3CCALDHZaLxBFWW6V32FOs%3DOHXadr1VXCHAupCDMnZDe6C5nNaQyg%40mail.gmail.com%3E
), here is a small patch for unit tests which shows the problem.
Unit tests are running correctly on Linux and MacOS, but not on Windows.
Before digging into the details of this problem, does anybody know if it's
a known problem, or would have a suggestion on how to fix it ?

Thanks,

-- 
Gilles QUERRET

Riverside Software
15d route de Bellevue • 69440 Mornant • France
Mob : +33 662.525.532

-
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

build.xml and DTD

2004-01-06 Thread Gilles QUERRET
Hi,
I have found there is a DTD for Ant build files in the jakarta-POI 
module of the Apache repository. However, I would like to extend it to 
include my custom tasks with something like this :

!DOCTYPE project PUBLIC -//Ant//Project 1.5//EN ant.dtd [
  !ENTITY MyCustomTask (fileset)* 
  !ATTLIST ... 
]
The XML specifications are a bit obscure for me...
What I would like to do is :
  * using an external file to store my DTD
  * leave the ant.dtd unmodified if possible
By the way, is there an official DTD (other that the one I found in 
jakarta-POI) ?

Thanks
--
Gilles QUERRET
http://gillesqfr.nerim.net/public_key.txt
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]