Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do a better job recognizing when magefile.go changes #114

Closed
mcandre opened this issue Mar 31, 2018 · 6 comments
Closed

Do a better job recognizing when magefile.go changes #114

mcandre opened this issue Mar 31, 2018 · 6 comments
Labels
⁉️ maybe-bug Something that might be a bug if more info is given

Comments

@mcandre
Copy link

mcandre commented Mar 31, 2018

mage often continues executing old build scripts after magefile.go has changed. Please do a better job identifying when this occurs, such as recording the modification time and/or hash of magefiles.

As a workaround, I am manually running mage -clean to force mage to recompile my magefiles.

@natefinch
Copy link
Member

So, mage does record a hash of all magefiles as a part of determining whether it needs to rebuild the binary. Where this can fall down is if you make changes to an external package with no changes to the magefiles in the current directory.

I'll have to look into the new code in 1.10 for recognizing when build parameters change to see if I can leverage that to determine when a rebuild is needed.

@natefinch
Copy link
Member

Let me know if you can reproduce this behavior, since it is important to me that the magefile changing definitely should cause a rebuild of the mage cached binary.

@andrewkroh
Copy link
Contributor

andrewkroh commented Aug 1, 2018

It definitely would be nice to be able to detect changes to the imported dependency tree of magefile.go.

In an effort to avoid code duplication between multiple magefile.go files I have moved common code to its own package and import this in each magefile.go. When changes are made to the common code this can break things for other developers on the project until they mage -clean in their local development environment.

@natefinch
Copy link
Member

Yes, that's a very good point. I wonder if the updates in 1.10 to detecting changes in code could be used by mage instead of my custom code. I'll have to take a look. Another option might be to add an environment variable to tell Mage to always rebuild.

@natefinch
Copy link
Member

I have a PR up that will address this if you're compiling with 1.10 or higher. It needs a few tests, but otherwise should be good to go.

@natefinch
Copy link
Member

Fixed in #168

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⁉️ maybe-bug Something that might be a bug if more info is given
Projects
None yet
Development

No branches or pull requests

3 participants