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

2019-03-18 Thread Brian Adkins
Hmm... for some reason, I thought there were some "loopholes" where this 
wouldn't work, but I just modified an HTML template that is included by 
another template that is rendered by a function in a file included by my 
main app, and it worked as expected.

However, I did lose the -j 8 parallel aspect. I used --vv and it only 
reported one process. For my main use case of changing a few files and 
needing to compile them, it works great though. I'd only need the -j 8 
benefit if compiling many more files.

On Monday, March 11, 2019 at 8:34:59 PM UTC-4, Alex Harsanyi wrote:
>
> To add one more answer to this thread :-)
>
> In addition to compiling files specified on the command line, `raco make` 
> will recursively compile all files referenced via `require`.  This means 
> that if you have a top level file for your application, you can tell `raco 
> make` to compile that file, and it will compile all the files that it 
> references, the will be compiled only if they have changed.  There is also 
> a `-j` option which allows compiling in parallel.  So, for example, if the 
> toplevel file in your application is main.rkt you can do:
>
> raco make -j 8 main.rkt
>
> and all your project files will be updated.
>
> Alex.
>
> On Tuesday, March 12, 2019 at 3:00:34 AM UTC+8, Brian Adkins wrote:
>>
>> I looked over the documentation for raco make, and I didn't see anything 
>> about how to recursively make all *.rkt files in a directory tree. I 
>> suppose I could use something like:  find . -name \*.rkt | xargs raco make, 
>> but I like being able to use all 8 "cores" with -j 8, and I *think* I'd 
>> lose that with xargs.
>>
>> What is the best practice for making a tree of Racket code?
>>
>> Thanks,
>> Brian
>>
>

-- 
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 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.


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

2019-03-11 Thread Alex Harsanyi
To add one more answer to this thread :-)

In addition to compiling files specified on the command line, `raco make` 
will recursively compile all files referenced via `require`.  This means 
that if you have a top level file for your application, you can tell `raco 
make` to compile that file, and it will compile all the files that it 
references, the will be compiled only if they have changed.  There is also 
a `-j` option which allows compiling in parallel.  So, for example, if the 
toplevel file in your application is main.rkt you can do:

raco make -j 8 main.rkt

and all your project files will be updated.

Alex.

On Tuesday, March 12, 2019 at 3:00:34 AM UTC+8, Brian Adkins wrote:
>
> I looked over the documentation for raco make, and I didn't see anything 
> about how to recursively make all *.rkt files in a directory tree. I 
> suppose I could use something like:  find . -name \*.rkt | xargs raco make, 
> but I like being able to use all 8 "cores" with -j 8, and I *think* I'd 
> lose that with xargs.
>
> What is the best practice for making a tree of Racket code?
>
> Thanks,
> Brian
>

-- 
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.


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

2019-03-11 Thread Brian Adkins
On Monday, March 11, 2019 at 3:00:34 PM UTC-4, Brian Adkins wrote:
>
> I looked over the documentation for raco make, and I didn't see anything 
> about how to recursively make all *.rkt files in a directory tree. I 
> suppose I could use something like:  find . -name \*.rkt | xargs raco make, 
> but I like being able to use all 8 "cores" with -j 8, and I *think* I'd 
> lose that with xargs.
>
> What is the best practice for making a tree of Racket code?
>
> Thanks,
> Brian
>

Hmm...  maybe the problem was just my lack of shell skills. I think the 
following works:

raco make -j 8 */*.rkt 

-- 
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.