-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
build: Decrease make codegen
time by (at least) 4 min
#5284
Conversation
Signed-off-by: Simon Behar <[email protected]>
Signed-off-by: Simon Behar <[email protected]>
Looking for more improvements |
Working on failures... |
Signed-off-by: Simon Behar <[email protected]>
Signed-off-by: Simon Behar <[email protected]>
Signed-off-by: Simon Behar <[email protected]>
Signed-off-by: Simon Behar <[email protected]>
Signed-off-by: Simon Behar <[email protected]>
Makefile
Outdated
@@ -131,7 +131,7 @@ define docker_pull | |||
endef | |||
|
|||
define gen-static-stub | |||
[ -e ./server/static/files.go ] || echo -e "//DELETEME\npackage static\nimport \"net/http\"\nfunc ServeHTTP(w http.ResponseWriter, r *http.Request) {}\nfunc Hash(file string) string { return \"\" }" > ./server/static/files.go | |||
[ -e ./server/static/files.go ] || cp ./server/static/files.go.stub ./server/static/files.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use ifneq
in Makefile
to change targets completely, I think you could avoid function like this:
server/static/files.go:
ifeq ($(STATIC_FILES),true)
// do yarn stuff
else
cp server/static/files.go.stub server/static/files.go
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking that I wouldn't want to use a build flag for this, and I think the current approach gives us more granularity in exactly where and when we create the mock file. Happy to use this pattern if you feel strongly about it though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, unless you really cannot make it work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Signed-off-by: Simon Behar <[email protected]>
Makefile
Outdated
ifneq (,$(filter $@,codegen|lint|test)) | ||
STATIC_FILES := false | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not build static files in the target is one of these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice - I did not know about that
Signed-off-by: Simon Behar <[email protected]>
ifneq (,$(filter $@,codegen|lint|test|docs)) | ||
STATIC_FILES := false | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not build static files if target is one of these
else | ||
ui/dist/app/index.html: | ||
@mkdir -p ui/dist/app | ||
echo "Built without static files" > ui/dist/app/index.html | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer necessary as our stub file does not depend on index.html
Signed-off-by: Simon Behar <[email protected]>
Signed-off-by: Simon Behar <[email protected]>
Closes #5279
Before:
After: