Re: [racket-users] Re: What is the best way to "raco make" all *.rkt files in a directory tree?

2019-03-11 Thread Ben Greenman
On 3/11/19, 'John Clements' via Racket Users
 wrote:
> I would suggest maybe just using racket here:
>
> #lang racket
>
> (require setup/parallel-build)
>
> (define racket-files
>   (for/list ([file (in-directory "/tmp")]
>  #:when (regexp-match #px"\\.rkt$" file))
> file))
>
> (parallel-compile-files racket-files
> #:worker-count 8)

Racket 6.7 and later has a globbing library. Now you can write:

(require file/glob)
(define racket-files
  (glob "/tmp/***.rkt"))


... but since this is not what you'd write in most (all?) shells,
maybe the library should treat "/**/" instead of "**" specially.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: What is the best way to "raco make" all *.rkt files in a directory tree?

2019-03-11 Thread 'John Clements' via Racket Users
I would suggest maybe just using racket here:

#lang racket

(require setup/parallel-build)

(define racket-files
  (for/list ([file (in-directory "/tmp")]
 #:when (regexp-match #px"\\.rkt$" file))
file))

(parallel-compile-files racket-files
#:worker-count 8)


Naturally, you could also use (current-directory) rather than “/tmp”, or 
whatever makes sense for you. You could even bundle it up as a raco command, if 
you liked.

John


> On Mar 11, 2019, at 1:02 PM, Eric Griffis  wrote:
> 
> On Mon, Mar 11, 2019 at 12:04 PM Brian Adkins  wrote:
>> 
>> Hmm...  maybe the problem was just my lack of shell skills. I think the 
>> following works:
>> 
>> raco make -j 8 */*.rkt
> 
> This will only make the rkt files in subdirectories of the current
> working directory, excluding sub-subdirectories and the current
> working directory.
> 
> You can get them all with "find":
> 
> find . -name \*.rkt -exec raco make -j 8 {} \;
> 
> But this will run a separate "raco make" for each file, which may
> defeat the purpose of your "-j 8" switch. If your shell supports the
> "globstar" (**) in file paths (e.g. bash, zsh, maybe ksh):
> 
> raco make -j 8 *.rkt **/*.rkt
> 
> Otherwise, there's always xargs:
> 
> find . -name \*.rkt -print0 | xargs -0 -- raco make -j 8
> 
> FWIW, when my projects need "make"-ing, I turn them into packages and
> install them. The installation process will "make" every rkt file in
> the project folder, and the whole thing can be rebuilt with raco
> setup:
> 
> raco setup -D 
> 
> Eric
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: What is the best way to "raco make" all *.rkt files in a directory tree?

2019-03-11 Thread Eric Griffis
On Mon, Mar 11, 2019 at 12:04 PM Brian Adkins  wrote:
>
> Hmm...  maybe the problem was just my lack of shell skills. I think the 
> following works:
>
> raco make -j 8 */*.rkt

This will only make the rkt files in subdirectories of the current
working directory, excluding sub-subdirectories and the current
working directory.

You can get them all with "find":

find . -name \*.rkt -exec raco make -j 8 {} \;

But this will run a separate "raco make" for each file, which may
defeat the purpose of your "-j 8" switch. If your shell supports the
"globstar" (**) in file paths (e.g. bash, zsh, maybe ksh):

raco make -j 8 *.rkt **/*.rkt

Otherwise, there's always xargs:

find . -name \*.rkt -print0 | xargs -0 -- raco make -j 8

FWIW, when my projects need "make"-ing, I turn them into packages and
install them. The installation process will "make" every rkt file in
the project folder, and the whole thing can be rebuilt with raco
setup:

raco setup -D 

Eric

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.