Hey Martin,

I'm not an expert, but I've asked and dealt with similar issues in the
past. The short of it is that tup was designed to give consistent builds
always. As such, it essentially doesn't allow for cache files and
directories because then it can't guarantee that the exact same things are
running. If you want to use tup to build it, then the trivial way would be
to do

: elm-package.json |> elm-make --yes Main.elm && rm -rf elm-stuff |>
index.html

This is probably not ideal, as based on what you've described, each build
is going to have elm re-download every dependency, in addition to a
cache-less build. I don't think you can get away from cache with tup, but
you might be able to get around the dependency download. The high level
would be that you want to set up rules for the pieces that are downloaded.
Assuming elm-make won't write to them if they're up to date, and the
dependencies are written to different files then the cache with predictable
names, you could do something like:

: elm-package.json |> ... |> elm-stuff/... <deps>
: elm-package.json <deps> |> elm-make --yes Main.elm && rm ...cache
files... |> index.html

I'm not sure what the first command is, but you could probably be clever by
using the lua api to parse the elm-dependencies to generate what those
commands are.
The second part of the last command could probably be something like `comm
-23 <(ls elm-stuff) <(<<< "%<deps>" tr ' ' '\n' | sort) | xargs rm -rf`.

Hope that helps,
Erik

On Fri, Jan 5, 2018 at 7:10 AM Martin Janiczek <[email protected]> wrote:

> Hello everybody,
> I'm trying to make tup work with the Elm language and failing because of a
> cache directory.
>
> If needed, the elm-make compiler creates an *elm-stuff* directory, where
> it downloads dependencies and puts its incremental build stuff. This
> behaviour can't be disabled with a flag.
>
> The whole repository is here, if you want to play with it:
> https://github.com/Janiczek/tup-elm-example
>
> Tupfile:
> : elm-package.json *.elm |> elm-make --yes Main.elm |> index.html
>
> Currently fails with:
> [ tup ] [0.037s] Scanning filesystem...
> [ tup ] [0.052s] Reading in new environment variables...
> [ tup ] [0.066s] Parsing Tupfiles...
>  1) [0.003s] .
>  [ ] 100%
> [ tup ] [0.076s] No files to delete.
>
> [ tup ] [0.076s] Generating .gitignore files...
> [ tup ] [0.089s] Executing Commands...
>  [ ]   0%tup error: Unable to utimens() files not created by this job:
> /var/www/html/elm/tup-elm-example/elm-stuff/packages/elm-lang-html-1208e71
> tup error: Unable to utimens() files not created by this job: /var/www/
> html/elm/tup-elm-example/elm-stuff/packages/elm-lang-virtual-dom-73c00fd
> tup error: Unable to utimens() files not created by this job: /var/www/
> html/elm/tup-elm-example/elm-stuff/packages/elm-lang-core-7fc14f2
> * 1) elm-make --yes Main.elm
>
> Error: The following HTTP request failed.
> <https://github.com/elm-lang/core/zipball/5.1.1/>
>
>
> elm-lang-core-7fc14f2/: setFileTimes: permission denied (Operation not
> permitted)
>
>
>
>
> Starting downloads...
>
>
>   ✗ elm-lang/html 2.0.0
>   ✗ elm-lang/virtual-dom 2.0.4
>   ✗ elm-lang/core 5.1.1
>  *** tup errors ***
>  *** Command ID=11 failed with return value 1
> tup error: Expected to write to file 'index.html' from cmd 11 but didn't
>  [ ] 100%
>  *** tup: 1 job failed.
>
> So, the question is, how can I allow creation of these directories and
> files, without specifying them into the Tupfile?
>
> I've also tried stuff like this, with no success:
> : elm-package.json |> elm-make --yes |> elm-stuff
> : elm-stuff *.elm |> elm-make --yes Main.elm |> index.html
>
>
> --
> --
> tup-users mailing list
> email: [email protected]
> unsubscribe: [email protected]
> options: http://groups.google.com/group/tup-users?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "tup-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to