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

Remove building of frontend when running backend tests #1630

Closed
yhtMinceraft1010X opened this issue Jan 25, 2022 · 5 comments · Fixed by #1631
Closed

Remove building of frontend when running backend tests #1630

yhtMinceraft1010X opened this issue Jan 25, 2022 · 5 comments · Fixed by #1631

Comments

@yhtMinceraft1010X
Copy link
Contributor

What feature(s) would you like to see in RepoSense?

Currently, when running gradlew test or gradlew test systemtest, the frontend is built even though running the backend tests do not appear to require frontend in any way.

I propose restructuring the dependencies in build.gradle such the frontend is not built when running test or systemtest alone. (I.e. not part of build)

@gerhean
Copy link
Contributor

gerhean commented Jan 26, 2022

@dcshzj I have copied my comments over from #1631

Is it possible to just remove zipReport since it is just zipping an empty folder if buildFrontend is not run? Or is the real problem that buildFrontend needs to be run at least once, but the current script runs it multiple times which is redundant (Which means your code will cause unexpected bugs by not requiring buildFrontend)?

Actually the entire process is a little weird and should probably be overhauled. Maybe introduce a build everything command, and maybe add checks that the required components exist for each command else build them.

For example, startServerInBackground has some weird dependency issues.

@gerhean
Copy link
Contributor

gerhean commented Jan 26, 2022

I propose for the gradle build to be overhauled, with the following functions:

  • Build frontend only
  • Build backend
  • Generate json report, depend on backend being built
  • Build frontend and generate json report
  • Conditional build frontend and generate json report if not already exist in \reposense-report
  • startServerInBackground should only depend on the task directly above

Existing to modify (?)

  • Copy files from \reposense-report to frontend public folder should check that relevant files exist in \reposense-report?

To discuss

  • Should --view flag be deprecated since frontend hot-reload exists now?

Explanation for weird build process

  • Previously frontend only took 10s to build due to using Browserify. However now it takes a lot longer due to having migrated to using Webpack (cause it allows hot reload to work).

@dcshzj
Copy link
Member

dcshzj commented Feb 8, 2022

@yhtMinceraft1010X Are you still working on this?

@yhtMinceraft1010X
Copy link
Contributor Author

I'm putting it on hold for now. But I hope to revisit it after finishing up #1625

@yhtMinceraft1010X
Copy link
Contributor Author

yhtMinceraft1010X commented Feb 13, 2022

Will wait for the following before continuing on this:

dcshzj pushed a commit that referenced this issue Apr 11, 2022
When running pure backend tests alone using gradlew test systemtest, the
frontend is built before these tests. This is due to zipReport task
being needed for compileJava. zipReport in turn relies on buildFrontend.

The frontend is not used for these tests. It is wasteful to run 
buildFrontend when only the backend tests are being run.

In addition, some other tasks and properties are scattered throughout
the build.gradle file or have dependencies that could be pushed forward.
This complicates maintenance.

Let's remove the `test` and `systemtest` dependency on the frontend as
well as re-order and consolidate some task properties and dependencies.
This should make running either of them faster.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants