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

build: Decrease make codegen time by (at least) 4 min #5284

Merged
merged 11 commits into from
Mar 4, 2021

Conversation

simster7
Copy link
Member

@simster7 simster7 commented Mar 3, 2021

Closes #5279

Before:

real	9m42.742s
user	13m24.102s
sys	10m12.749s

After:

real	5m36.731s
user	9m11.539s
sys	7m38.640s

Signed-off-by: Simon Behar <[email protected]>
Makefile Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@simster7
Copy link
Member Author

simster7 commented Mar 3, 2021

Looking for more improvements

@simster7
Copy link
Member Author

simster7 commented Mar 3, 2021

Working on failures...

Signed-off-by: Simon Behar <[email protected]>
Signed-off-by: Simon Behar <[email protected]>
Makefile Outdated Show resolved Hide resolved
@simster7 simster7 marked this pull request as ready for review March 4, 2021 16:25
Makefile Outdated Show resolved Hide resolved
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
Copy link
Contributor

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

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

Copy link
Member Author

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
Comment on lines 31 to 33
ifneq (,$(filter $@,codegen|lint|test))
STATIC_FILES := false
else
Copy link
Member Author

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

Copy link
Contributor

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]>
@simster7 simster7 requested a review from alexec March 4, 2021 20:09
Comment on lines +31 to +33
ifneq (,$(filter $@,codegen|lint|test|docs))
STATIC_FILES := false
else
Copy link
Member Author

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

Comment on lines -154 to -158
else
ui/dist/app/index.html:
@mkdir -p ui/dist/app
echo "Built without static files" > ui/dist/app/index.html
endif
Copy link
Member Author

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

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
server/static/files.go.stub Outdated Show resolved Hide resolved
@simster7 simster7 merged commit e396ea0 into argoproj:master Mar 4, 2021
This was referenced Mar 8, 2021
simster7 added a commit that referenced this pull request Mar 8, 2021
@simster7 simster7 mentioned this pull request Apr 19, 2021
50 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve make codegen speed
2 participants