devsoap / ds-gradle-vaadin

Gradle plugin for building Vaadin Flow 10/11/12/13/14/15 apps
https://devsoap.com/gradle-vaadin-flow-plugin
Other
36 stars 13 forks source link

ClassIntrospectionUtils.findJsModules doesn't find elements that are not in a @Route annotated class #309

Closed sascha-frinken closed 4 years ago

sascha-frinken commented 4 years ago

Desktop (please complete the following information):

Describe the bug We use form components generated by an ioc framework. Those components are not directly used in @Route annotated views. This prevents the compoents from working. The problem seems to be in ClassIntrospectionUtils.findJsModules.

johndevs commented 4 years ago

Added a new scanning strategy 'whitelist' which allows to change the classpath search to restrict the search to the whitelist instead of traversing the class hierarchy from the root route.

When using the 'whitelist' scanning strategy all found components which conforms to the whitelist will be included in the bundle. This is why it is recommended to manually configure the vaadin.whitelistedPackages property so that it only lists packages which has the wanted components in the bundle. By default the whitelist will contain the 'com.vaadin' root package as well as all packages in the project.

For example:

vaadin.scanStrategy = 'whitelist'
vaadin.whitelistedPackages = [
        'com.vaadin.flow.component.orderedlayout',
        'my.project.root.package'
]

This would only include the ordered layouts as well as your project packages.

sascha-frinken commented 4 years ago

Looks good so far (w/o testing). Is there an easy way to test snapshots? Are they public available?

johndevs commented 4 years ago

There are no snapshots available but it should be quite easy to test locally by building the project locally from master sources. The generic way of doing it is:

1) git clone https://github.com/devsoap/gradle-vaadin-flow.git 2) In the project directory run gradle jar -> the plugin will be created in build/libs 3) Follow the steps in https://github.com/devsoap/gradle-vaadin-flow/blob/master/CONTRIBUTING.md#using-the-plugin-from-a-test-project to apply the locally built plugin in your project.

I'll probably release this feature in a plugin update next weekend if you rather wait for a binary build.

sascha-frinken commented 4 years ago

Sorry, I wasn't able to test before… Looks good so far. Thanks!