Questions tagged [shake-build-system]
Shake is a Haskell library for writing build systems - designed as a replacement for make.
128
questions
0
votes
0
answers
7
views
Shake - Best way to delete intermediate files?
I would like to have a Shake rule which deletes its own dependency — and passes lint mode.
There are multiple ways of doing this, but I am wondering whether there is a way to work with the build ...
0
votes
0
answers
5
views
Generalizing intermediate rules when they will only be used end-to-end on one target
I'm writing Shake build rules for some ultimate result _build/a.4. Let's say its direct dependency is _build/a.3, which in turn depends on _build/a.2, and so on to _build/a.1. I also have a rule which ...
0
votes
0
answers
32
views
Shake: depend on rules from Shakefile in subdirectory?
I've got a project that looks something like this:
.
├── pyproject.toml
├── server.py
├── Shakefile.hs
└── ui
├── index.ts
└── Shakefile.hs
ui/Shakefile.hs contains something to the effect of:
...
1
vote
1
answer
34
views
Small binary Shake executable
Is there a way to use Shake using a small binary executable without pulling ghc ? We love Shake but we cannot ask our user to install ghc. As a nix user, could building a static Haskell executable ...
1
vote
0
answers
57
views
Shake update of index files after changes
I use the shake build system and watch to keep files for a web site current. I cannot understand how to assure that an index file for a directory is changed when a file in the directory changes.
The ...
0
votes
1
answer
31
views
need "ensure dependency is up to date"
I was watching Neil's discussing shake at ICFP. He mentions in the talk that the need function ensures that the dependency is "up to date". What does this mean exactly? Below is the code ...
2
votes
2
answers
115
views
haskell: cd command does not work in shake/command library
For some reason I cannot make cd command work in shake/command Haskell library. It thinks directory I called with cd does not exist even though it is present in the filesystem.
Here is an excerpt of ...
1
vote
1
answer
30
views
How can I get Shake to print errors only once?
If I ever have an error during a build, I see it twice
# ghc (for _build/lib/WCLoan.o)
# ghc (for _build/lib/WCLoan.o)
[2 of 2] Compiling WCLoan ( src/WCLoan.hs, _build/lib/WCLoan.o )
src/...
0
votes
0
answers
53
views
Avoiding a rebuild if none of the dependencies have changed, but the output file has
I have a complicated setup where I generate a Vivado project file, and then run Vivado's synthesis tool to consume said project file and produce a bitfile. During this last step, Vivado updates some ...
0
votes
1
answer
51
views
Why does Shake think this file has changed?
Full Shakefile.hs:
import Development.Shake
import Development.Shake.FilePath
outDir = "_build"
expensiveProcess :: IO ()
expensiveProcess = do
putStrLn "expensiveProcess"
...
1
vote
1
answer
66
views
How to allocate PTY using Shake?
I'm trying to run a command interactively from my build script:
#!/usr/bin/env stack
{- stack
script
--resolver lts-18.8
--ghc-options -Wall
-}
import Development.Shake
main :: IO ()
main = shakeArgs ...
0
votes
1
answer
29
views
is there a way of using this on an air gapped windows machine?
I've looked on shakebuild and it looks as though you have to have a haskell installation on a networked machine?
(verbiage to placate so follows)
0
votes
1
answer
25
views
Why no `Action a -> Rules a` function
In Shake there is a way to run an Action from Rules:
action :: Action a -> Rules ()
But I couldn't find a function which returns the result of the Action, namely:
actionWithResult :: Action a ->...
0
votes
0
answers
35
views
Shake script for detecting special filenames
I have a folder that I'd like to monitor.
Whenever there's filenames containing non alphanumeric characters, I'd like to rename them.
How could I write a shake rule to express this?
2
votes
1
answer
57
views
Avoiding oracle, OR separating oracles of the same type
I have the following situation:
find-deps is an external program that is very quick to run, and discovers dependency information, similar to ghc -M. Its output is some file deps.
compile is an ...
2
votes
1
answer
38
views
How can I get console input mid-build in Shake?
For various unfortunate reasons, part of my build requires root privileges. I'm trying to use sudo for this:
cmd_ "sudo other_script.sh" [input] [output]
However, presumably because of how ...
3
votes
1
answer
213
views
How to run shake without stack
I created the recommended build.sh file from the "Running" section of the Shake manual:
#!/bin/sh
mkdir -p _shake
ghc --make Shakefile.hs -v -rtsopts -threaded -with-rtsopts=-I0 -outputdir=...
1
vote
1
answer
64
views
Is it possible to depend on an in-memory value (instead of a file) in shake-build?
I'm writing a static site builder using shake and am trying to implement an efficient way of persisting the site's navigation (along with some metadata for each page). This is turning out to be more ...
1
vote
1
answer
87
views
"One-way" dependencies in shake-build?
My brain might be fried right now (have been hacking on this Shakefile for 3 days straight), but I just can't figure out how to express a "one-way" dependency in Shake?
I am building (...
2
votes
1
answer
56
views
In shake-build, how to run a command with a pipe in it?
I can't seem to get the following to work in shake:
cmd_ (AddEnv "PGPASSWORD" "REDACTED") "bzcat /tmp/db.sql.bz2 | psql -U pguser -h localhost dbname"
0
votes
1
answer
23
views
Correct way to start a service, if it is not running using shake-build?
My build process requires access to various services, such as, Postgres, Redis, and ElasticSearch. Taking Postgres as an example, I wrote the following "oracle":
data PostgresVersion = ...
1
vote
1
answer
34
views
How to build a versioned (or checksummed) file using shake-build?
My Elm build commands produce a versioned/checksummed JS file, which looks like main.[checksum].js. How do I handle this with shake (specifically, I can't figure out how to write the wantdeclaration ...
2
votes
1
answer
50
views
How to build for different environments using shake-build?
Is there a built-in way to pass command-line arguments to a "shakefile"? I'd like to pass --env production|development|staging and then use it within my rules to (slightly) alter the build-steps for ...
1
vote
1
answer
67
views
Correct way to implement "yarn install" in shake-build?
My question might be a duplicate of Shake depending on on node_modules directory
I'm new to shake-build and got stumped with the very first thing that I wanted to do. Basically, I want to run yarn ...
1
vote
1
answer
32
views
Where should Shake Share's .shake.cache directory be stored?
We're planning to start using Shake's share functionality more heavily, and one question that has come up is where to store the "share" cache.
Should it be (ignored by VCS) in the code repository so ...
1
vote
1
answer
18
views
If you have created limited resources in Shake, can you tell which resource the current rule is using?
We're hoping to use Shake to run many old Ruby tests in parallel. Many of these tests assume that they have sole control of the test database, so we have been creating multiple instances of the test ...
1
vote
1
answer
93
views
How can I write "unit" tests for Shake rules or actions?
I am writing specialised rules and oracles for Shake and I would like to write tests for those functions. How can I do that in Shake? I did not find any simple to use actionToIO function that could do ...
0
votes
1
answer
51
views
shake build: read filepath list from config file
I have a config.cfg file where a the variable file_list is a list of relative path to files
file_list = file1 dir1/file2 ../dir2/file3
How do I read this variable in to get a file_list::[FilePath]?
...
0
votes
2
answers
283
views
Haskell Shake build: how can I set up a shared cache folder using shakeShare and/or shakeCloud?
I understand this is a new feature being worked on for GHC's Hadrian build system, so the workflow might be advanced, oddly specific, or still evolving. I read these so far:
docs/Cloud.md
Exploring ...
1
vote
1
answer
36
views
actionFinally not running cmd invoked inside handler
I have the following code fragment:
withContainer :: String -> (String -> Action a) -> Action a
cid <= cmd "docker" [ "run" , "--rm", "-d", my_image ]
...
actionFinally (action ...
2
votes
1
answer
40
views
Shake: Inherit stderr
Using Shake, I am calling cdparanoia. cdparanoia outputs a useful progress meter (including graphics to display issues) when its stderr is connected to a terminal; but not otherwise. The --stderr-...
1
vote
1
answer
34
views
Shake: automatically deleting file after failed command
Using Shake, to create an mp3 (this is just a learning example), I use lame, and then id3v2 to tag it.
If the lame succeeds, but the id3v2 fails, then I'm left with the mp3 file in place; but of ...
2
votes
1
answer
82
views
Is it possible for Shake to change a source file?
When running tools such as formatters and linting tools with "auto-correction" options, it can be that the input and output for a Rule are the same file; for example:
"//*.hs" %> \out ->
...
0
votes
1
answer
59
views
Shake not rebuilding when source file changes
I am using Shake to build lilypond files, which are then being put into a webpage. I tried to model my Build.hs after the first example in the manual:
import Development.Shake
import Development....
1
vote
1
answer
41
views
In Shake, does the definition order of Rules matter?
If I have a general build rule for *.o object files but a more specific build rule for a foo.o object file, does the definition order matter?
0
votes
1
answer
33
views
Can I "force" parallel execution of dependent targets?
Say I have a target A that depends on B, but I can run A and B in parallel. Is this possible with Shake? It seems like need ... makes actions sequential which totally makes sense, of course, but this ...
0
votes
2
answers
103
views
A phony target for sending a file via e-mail?
I would like to execute a command that takes a specific file in the project (building it as necessary) and sends it somewhere externally. For example, it may be a command that uploads a web page, or ...
0
votes
1
answer
44
views
How to track "runtime" dependencies with shake?
I would like to extend our shake-based build system to include running integration tests, however running those tests require firing up some docker containers on which the tests depend and which may ...
1
vote
1
answer
187
views
Can shake generate dependency graph in graphviz format?
Using --profile makes shake generate a report.html file from which one can run queries and generate a dependency graph of build rules. Would it be possible to get that graph in graphviz format instead ...
0
votes
1
answer
24
views
Tracking compiler flags within a Shake Action
I need to track compiler flags used as part of a rule, e.g when supplied as arguments to a function. Does Shake have a way to track such flags as inputs in the same vein as need? As a trivial example, ...
1
vote
1
answer
82
views
shake build without producing a file for every input file
Building .html files from .md files for a web site, I have some .md files which should not produce an output .html (e.g. because not ready for publication). What is the best way to achieve this with ...
1
vote
2
answers
86
views
filepatterns to exclude a match
Shake uses various forms of matching, filepath against pattern. Is there one which can be used to exclude a pattern?
Example:
I have three directories a, b, c (somewhere in directory x) and each ...
0
votes
1
answer
175
views
.shake.database: openFile: resource busy (file is locked)
I encounter the error
.shake.database: openFile: resource busy (file is locked)
and I have the impression that it is caused by two starts of shake quickly one after the other (caused by Twitch ...
0
votes
1
answer
28
views
How to remove dependent files produced with shake if the source file is deleted
Using shake for a website generator, I encounter the already known problem of how to remove produce files when the source has been deleted. It seems to be difficult in general, but are there solutions ...
0
votes
1
answer
43
views
shake build: how to deal with case where the needed file are discovered later
I use shake to build a website (with pandoc). When files are converted to pandoc, other files (css, bibliography, templates, etc.) may be needed, but shake does not know it, because it is internal to ...
0
votes
1
answer
36
views
Lift an operation in ErrIO to Action in shake
I use shake but the operations I call are in an ErrIO and not in the IO monad. How can I lift such operations into the Action monad. I could runErr and get and Either value and then call throwIO or ...
0
votes
1
answer
83
views
shake - how to copy all contents of a directory
I want to use shake for regression testing and I have to set up the test directory. I would like to copy a directory with fonts into the test directory and included a need on the target directory and ...
2
votes
2
answers
58
views
shake - rule finished running but did not produce file:
I try to use shake to convert some markdonw files to html ("bake"). The markdown files are in a directory "dough" and the html should go to "baked". The goal is to produce the index.html file, which ...
1
vote
1
answer
22
views
Is there a way to run shake assuming some rule is up-to-date?
We would like to run a Shake build while assuming some target is built, e.g. something like
./Build.hs --dont-rebuild my-target
Reading the docs it seems there should be a way to do that but I can't ...
1
vote
1
answer
188
views
Generating a visual dependency graph with shake
I'd like to see a dependency graph of GHC's modules. Can I use GHC's Shake-based build system, Hadrian, to generate one?