Package com.vaadin.flow.plugin.base
Class BuildFrontendUtil
java.lang.Object
com.vaadin.flow.plugin.base.BuildFrontendUtil
Util class provides all methods a Plugin will need.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.vaadin.flow.server.frontend.scanner.ClassFindergetClassFinder(List<String> classpathElements) creates aClassFinderfrom a List of classpathElements.static FilegetFrontendDirectory(PluginAdapterBase adapter) Get the legacy frontend folder if available and new folder doesn't exist.static FileThe generated folder should be under frontend folder and will be moved to the legacy package if not changed by the user.static FilegetTokenFile(PluginAdapterBase adapter) Location of the Token File.static voidprepareFrontend(PluginAdapterBase adapter) Prepares the Frontendstatic FilepropagateBuildInfo(PluginAdapterBase adapter) Propagates the BuildInfo.static voidremoveBuildFile(PluginAdapterBuild adapter) Delete the build token file.static voidrunDevBuildNodeUpdater(PluginAdapterBuild adapter) Run a dev-bundle build.static voidrunFrontendBuild(PluginAdapterBase adapter) Execute the frontend build with the wanted build system.static voidrunNodeUpdater(PluginAdapterBuild adapter, com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner frontendDependencies) runs the node-Updater.static voidrunVite(PluginAdapterBase adapter, com.vaadin.flow.server.frontend.FrontendTools frontendTools) Runs the Vite buildstatic voidupdateBuildFile(PluginAdapterBuild adapter, boolean licenseRequired) Deprecated, for removal: This API element is subject to removal in a future version.static voidupdateBuildFile(PluginAdapterBuild adapter, boolean licenseRequired, boolean needsCommercialBanner) Updates the build info after the bundle has been built by build-frontend.static booleanvalidateLicenses(PluginAdapterBase adapter, com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner frontendDependencies) Validate pro component licenses.
-
Method Details
-
getClassFinder
public static com.vaadin.flow.server.frontend.scanner.ClassFinder getClassFinder(List<String> classpathElements) creates aClassFinderfrom a List of classpathElements.- Parameters:
classpathElements- the list of classpath elements- Returns:
- the
ClassFinderthat uses the classpathElements
-
getTokenFile
Location of the Token File.- Parameters:
adapter- - the PluginAdapterBase.- Returns:
Filethe Token File
-
prepareFrontend
public static void prepareFrontend(PluginAdapterBase adapter) throws IOException, com.vaadin.flow.server.ExecutionFailedException, URISyntaxException Prepares the Frontend- Parameters:
adapter- - the PluginAdapterBase.- Throws:
IOException- - Could not forceMkdir(adapter.generatedFolder());com.vaadin.flow.server.ExecutionFailedException- - While NodeTasks.execute()URISyntaxException- - Could not build an URI from nodeDownloadRoot().
-
propagateBuildInfo
Propagates the BuildInfo.- Parameters:
adapter- - the PluginAdapterBase.- Returns:
- the Token
File.
-
runNodeUpdater
public static void runNodeUpdater(PluginAdapterBuild adapter, com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner frontendDependencies) throws com.vaadin.flow.server.ExecutionFailedException, URISyntaxException runs the node-Updater.- Parameters:
adapter- - the PluginAdapterBase.frontendDependencies- Frontend dependencies scanner to use. If not set, one will be initialized byOptionsclass later.- Throws:
com.vaadin.flow.server.ExecutionFailedException- - a ExecutionFailedException.URISyntaxException- - - Could not build an URI from nodeDownloadRoot().
-
runDevBuildNodeUpdater
public static void runDevBuildNodeUpdater(PluginAdapterBuild adapter) throws com.vaadin.flow.server.ExecutionFailedException, URISyntaxException, IOException Run a dev-bundle build.- Parameters:
adapter- - the PluginAdapterBase.- Throws:
com.vaadin.flow.server.ExecutionFailedException- - a ExecutionFailedException.URISyntaxException- - - Could not build an URI from nodeDownloadRoot().IOException
-
getFrontendDirectory
Get the legacy frontend folder if available and new folder doesn't exist.- Parameters:
adapter- PluginAdapterBase- Returns:
- correct folder or legacy folder if not user defined
-
getGeneratedFrontendDirectory
The generated folder should be under frontend folder and will be moved to the legacy package if not changed by the user.- Parameters:
adapter- PluginAdapterBase- Returns:
- correct generated folder as child to frontend
-
runFrontendBuild
public static void runFrontendBuild(PluginAdapterBase adapter) throws TimeoutException, URISyntaxException Execute the frontend build with the wanted build system.- Parameters:
adapter- - the PluginAdapterBase.- Throws:
TimeoutException- - while running build systemURISyntaxException- - while parsing nodeDownloadRoot()) to URI
-
runVite
public static void runVite(PluginAdapterBase adapter, com.vaadin.flow.server.frontend.FrontendTools frontendTools) throws TimeoutException Runs the Vite build- Parameters:
adapter- - the PluginAdapterBase.frontendTools- - frontend tools access object- Throws:
TimeoutException- - while running vite
-
validateLicenses
public static boolean validateLicenses(PluginAdapterBase adapter, com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner frontendDependencies) Validate pro component licenses.- Parameters:
adapter- the PluginAdapterBasefrontendDependencies- frontend dependencies scanner- Returns:
- true if license validation is required because of the presence of commercial components, otherwise false.
- Throws:
com.vaadin.pro.licensechecker.MissingLicenseKeyException- if commercial components are used in a commercial banner-enabled build and no license key is presentcom.vaadin.pro.licensechecker.LicenseException- if commercial components are used without a license and commercial banner is not enabled
-
updateBuildFile
@Deprecated(since="24.9", forRemoval=true) public static void updateBuildFile(PluginAdapterBuild adapter, boolean licenseRequired) Deprecated, for removal: This API element is subject to removal in a future version.Updates the build info after the bundle has been built by build-frontend.Removes the abstract folder paths as they should not be used for prebuilt bundles and ensures production mode is set to true.
- Parameters:
adapter- - the PluginAdapterBase.licenseRequired- true if a license was required for the production build.
-
updateBuildFile
public static void updateBuildFile(PluginAdapterBuild adapter, boolean licenseRequired, boolean needsCommercialBanner) Updates the build info after the bundle has been built by build-frontend.Removes the abstract folder paths as they should not be used for prebuilt bundles and ensures production mode is set to true.
- Parameters:
adapter- - the PluginAdapterBase.licenseRequired- true if a license was required for the production build.needsCommercialBanner- true if a commercial banner should be applied to the application at runtime.
-
removeBuildFile
Delete the build token file. This is used with dev-bundle build as token file should never be added to the package.- Parameters:
adapter- used plugin adapter implementation- Throws:
IOException
-
updateBuildFile(PluginAdapterBuild, boolean, boolean)instead