Skip to content

Commit

Permalink
Change endpoint use checking
Browse files Browse the repository at this point in the history
  • Loading branch information
tepi authored and mshabarov committed Dec 19, 2024
1 parent bccb42b commit c9b5c97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1382,22 +1382,18 @@ public static boolean isHillaUsed(File frontendDirectory,

/**
* Checks if Hilla's endpoints, i.e. {@code BrowserCallable} or
* {@code Endpoint} annotated classes, or/and Hilla views are used in a
* project.
* {@code Endpoint} annotated classes are used in the project.
*
* @param options
* frontend build options
* @return {@code true} if Hilla views and/or Hilla endpoints are used,
* {@code false} otherwise
* @return {@code true} if Hilla endpoints are used, {@code false} otherwise
*/
public static boolean areEndpointsUsed(Options options) {
Lookup lookup = options.getLookup();
EndpointUsageDetector endpointUsageDetector = lookup
.lookup(EndpointUsageDetector.class);
return isHillaUsed(options.getFrontendDirectory(),
options.getClassFinder())
|| (endpointUsageDetector != null
&& endpointUsageDetector.areEndpointsUsed(options));
return endpointUsageDetector != null
&& endpointUsageDetector.areEndpointsUsed(options);
}

private static boolean isRoutesContentUsingHillaViews(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,9 @@ private JsonObject generateVersionsFromPackageJson(JsonObject packageJson)
*/
private void putHillaComponentsDependencies(
Map<String, String> dependencies, String packageJsonKey) {
if (FrontendUtils.areEndpointsUsed(options)) {
if (FrontendUtils.isHillaUsed(options.getFrontendDirectory(),
options.getClassFinder())
|| FrontendUtils.areEndpointsUsed(options)) {
if (options.isReactEnabled()) {
dependencies.putAll(readDependenciesIfAvailable(
"hilla/components/react", packageJsonKey));
Expand Down

0 comments on commit c9b5c97

Please sign in to comment.