Giter Site home page Giter Site logo

Comments (5)

jachris avatar jachris commented on July 20, 2024

Hello velkyel,

rules may write to arbitrary files in the filesystem. Only the outputs declared to the build system (the ones metioned in core.publish(outputs=...)) are required to be inside the build directory. This is currently enforced here:

cook/cook/core/rules.py

Lines 69 to 70 in 74e79da

elif not phony and not misc.is_inside(output, system.build('.')):
raise ValueError('output outside of build directory')

For example you may install any files in the appropriate system directories. Just don't mention them inside core.publish. This means the files will not be tracked by the system — for example, modification or deletion will not trigger a rebuild. Tasks like "install" should be created by using core.publish(phony=True, outputs=['install'], force=True, ...), which means that they will be executed uncondictionally.

Do you have use-case where you require an output outside of the build directory that should be tracked by the build-system? If so, sharing it would help very much. We can change this behaviour if reasonable.

from cook.

velkyel avatar velkyel commented on July 20, 2024

Hello,

my simplified use-case is following: I have two directories a/ and b/ in project root. a/ contains files and I want convert/transform them (based on quite complicated rules) into b/ (b/ contains other files too - not only conversions from a/). Changes in a/ or deletion in b/ should trigger rebuild.

Another issue: cook doesn't track BUILD.py itself like scons do with SConstruct. (forced rebuild is invoked on build script modifications)

from cook.

jachris avatar jachris commented on July 20, 2024

Alright,

the restriction regarding output file paths is disabled for now (b58b54e). It might be enabled again in the future, but I guess having the option to disable this on individual rules might be useful then. For example, one could write core.publish(strict=False, ...) or something like that, we will have to see.

Regarding your other point: Cook does not automatically track the BUILD.py because of granularity: Tiny changes which might only affect one single task would lead to rebuilding every single task defined in that script. Instead, rules are advised to mention any data they depend on using core.publish(check=XYZ, ...). However, I just pushed a new commit (c19e094) which allows you to do the following:

core.publish(
    inputs=[__file__],
    outputs=...,
    message=...
)

This will track the entire BUILD.py script. __file__ resolves to the path of the file containg it.

In the future, we might add means of automatically tracking the function defining the rules (i.e. hashing the functions __code__ attribute or something like that).

from cook.

velkyel avatar velkyel commented on July 20, 2024

great. For this patch ae1f48b too. strict keyword switch will be ok. Issue about tracking BUILD.py script changes is not so important for me so file solution is good enough.
Thank you!

from cook.

jachris avatar jachris commented on July 20, 2024

Great to hear this!

If you have any other comments / questions, feel free to open issues / message me. 👍

from cook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.