Skip to content

Commit 9d28e90

Browse files
authored
fix: Add missing getters to Options (#16059) (#16065)
1 parent 764977b commit 9d28e90

22 files changed

Lines changed: 264 additions & 133 deletions

flow-plugins/flow-plugin-base/src/main/java/com/vaadin/flow/plugin/base/BuildFrontendUtil.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static void prepareFrontend(PluginAdapterBase adapter)
161161
.createMissingPackageJson(
162162
new File(adapter.npmFolder(), PACKAGE_JSON).exists())
163163
.enableImportsUpdate(false).enablePackagesUpdate(false)
164-
.runNpmInstall(false)
164+
.withRunNpmInstall(false)
165165
.withFrontendGeneratedFolder(adapter.generatedTsFolder())
166166
.withNodeVersion(adapter.nodeVersion())
167167
.withNodeDownloadRoot(nodeDownloadRootURI)
@@ -310,20 +310,20 @@ public static void runNodeUpdater(PluginAdapterBuild adapter)
310310
.withGeneratedFolder(adapter.generatedFolder())
311311
.withFrontendDirectory(adapter.frontendDirectory())
312312
.withBuildDirectory(adapter.buildFolder())
313-
.runNpmInstall(adapter.runNpmInstall())
313+
.withRunNpmInstall(adapter.runNpmInstall())
314314
.withWebpack(adapter.webpackOutputDirectory(),
315315
adapter.servletResourceOutputDirectory())
316316
.enablePackagesUpdate(true)
317317
.useByteCodeScanner(adapter.optimizeBundle())
318318
.withJarFrontendResourcesFolder(
319319
getJarFrontendResourcesFolder(adapter))
320-
.copyResources(jarFiles).copyTemplates(true)
320+
.copyResources(jarFiles).withCopyTemplates(true)
321321
.copyLocalResources(adapter.frontendResourcesDirectory())
322322
.enableImportsUpdate(true)
323323
.withEmbeddableWebComponents(
324324
adapter.generateEmbeddableWebComponents())
325325
.withTokenFile(BuildFrontendUtil.getTokenFile(adapter))
326-
.enablePnpm(adapter.pnpmEnable())
326+
.withEnablePnpm(adapter.pnpmEnable())
327327
.useGlobalPnpm(adapter.useGlobalPnpm())
328328
.withFrontendGeneratedFolder(adapter.generatedTsFolder())
329329
.withHomeNodeExecRequired(adapter.requireHomeNodeExec())
@@ -381,19 +381,19 @@ public static void runDevBuildNodeUpdater(PluginAdapterBuild adapter)
381381
.withGeneratedFolder(adapter.generatedFolder())
382382
.withFrontendDirectory(adapter.frontendDirectory())
383383
.withBuildDirectory(adapter.buildFolder())
384-
.runNpmInstall(adapter.runNpmInstall())
384+
.withRunNpmInstall(adapter.runNpmInstall())
385385
.withWebpack(adapter.webpackOutputDirectory(),
386386
adapter.servletResourceOutputDirectory())
387387
.enablePackagesUpdate(true).useByteCodeScanner(false)
388388
.withJarFrontendResourcesFolder(
389389
getJarFrontendResourcesFolder(adapter))
390-
.copyResources(jarFiles).copyTemplates(true)
390+
.copyResources(jarFiles).withCopyTemplates(true)
391391
.copyLocalResources(adapter.frontendResourcesDirectory())
392392
.enableImportsUpdate(true)
393393
.withEmbeddableWebComponents(
394394
adapter.generateEmbeddableWebComponents())
395395
.withTokenFile(BuildFrontendUtil.getTokenFile(adapter))
396-
.enablePnpm(adapter.pnpmEnable())
396+
.withEnablePnpm(adapter.pnpmEnable())
397397
.useGlobalPnpm(adapter.useGlobalPnpm())
398398
.withFrontendGeneratedFolder(adapter.generatedTsFolder())
399399
.withHomeNodeExecRequired(adapter.requireHomeNodeExec())

flow-server/src/main/java/com/vaadin/flow/server/frontend/AbstractUpdateImports.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ protected Collection<String> getCssLines() {
215215
options.getFrontendDirectory().getPath());
216216

217217
String suffix;
218-
if (options.tokenFile == null
218+
if (options.getTokenFile() == null
219219
&& !options.getFrontendDirectory().exists()) {
220220
suffix = "Unable to locate frontend resources and missing token file. "
221221
+ "Please run the `prepare-frontend` Vaadin plugin goal before deploying the application";
@@ -355,7 +355,7 @@ && frontendFileExists(localModulePath)) {
355355
if (!resourceNotFound.isEmpty()) {
356356
String prefix = "Failed to find the following files: ";
357357
String suffix;
358-
if (options.tokenFile == null
358+
if (options.getTokenFile() == null
359359
&& !options.getFrontendDirectory().exists()) {
360360
suffix = "Unable to locate frontend resources and missing token file. "
361361
+ "Please run the `prepare-frontend` Vaadin plugin goal before deploying the application";
@@ -381,7 +381,7 @@ && frontendFileExists(localModulePath)) {
381381
notFoundMessage(resourceNotFound, prefix, suffix));
382382
}
383383

384-
boolean devModeWithoutServer = !options.productionMode
384+
boolean devModeWithoutServer = !options.isProductionMode()
385385
&& !options.isFrontendHotdeploy()
386386
&& !options.isDevBundleBuild();
387387
if (!npmNotFound.isEmpty() && getLogger().isInfoEnabled()

flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeTasks.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -88,36 +88,36 @@ public class NodeTasks implements FallibleCommand {
8888
public NodeTasks(Options options) {
8989

9090
ClassFinder classFinder = new ClassFinder.CachedClassFinder(
91-
options.classFinder);
91+
options.getClassFinder());
9292
FrontendDependenciesScanner frontendDependencies = null;
9393

9494
Set<String> webComponentTags = new HashSet<>();
9595

9696
final FeatureFlags featureFlags = options.getFeatureFlags();
9797

98-
if (options.enablePackagesUpdate || options.enableImportsUpdate
99-
|| options.enableWebpackConfigUpdate) {
98+
if (options.isEnablePackagesUpdate() || options.isEnableImportsUpdate()
99+
|| options.isEnableWebpackConfigUpdate()) {
100100
frontendDependencies = new FrontendDependenciesScanner.FrontendDependenciesScannerFactory()
101-
.createScanner(!options.useByteCodeScanner, classFinder,
102-
options.generateEmbeddableWebComponents,
101+
.createScanner(!options.isUseByteCodeScanner(), classFinder,
102+
options.isGenerateEmbeddableWebComponents(),
103103
featureFlags);
104104

105105
// The dev bundle check needs the frontendDependencies to be able to
106106
// determine if we need a rebuild as the check happens immediately
107107
// and no update tasks are executed before it.
108-
if (!options.productionMode && options.isDevBundleBuild()) {
108+
if (!options.isProductionMode() && options.isDevBundleBuild()) {
109109
UsageStatistics.markAsUsed("flow/expressBuild", null);
110110
if (TaskRunDevBundleBuild.needsBuild(options,
111111
frontendDependencies, classFinder)) {
112-
options.runNpmInstall(true);
113-
options.copyTemplates(true);
112+
options.withRunNpmInstall(true);
113+
options.withCopyTemplates(true);
114114
} else {
115115
// A dev bundle build is not needed after all, skip it
116116
options.withDevBundleBuild(false);
117117
}
118118
}
119119

120-
if (options.generateEmbeddableWebComponents) {
120+
if (options.isGenerateEmbeddableWebComponents()) {
121121
FrontendWebComponentGenerator generator = new FrontendWebComponentGenerator(
122122
classFinder);
123123
Set<File> webComponents = generator.generateWebComponents(
@@ -136,14 +136,14 @@ public NodeTasks(Options options) {
136136
}
137137

138138
TaskUpdatePackages packageUpdater = null;
139-
if (options.enablePackagesUpdate
140-
&& options.jarFrontendResourcesFolder != null) {
139+
if (options.isEnablePackagesUpdate()
140+
&& options.getJarFrontendResourcesFolder() != null) {
141141
packageUpdater = new TaskUpdatePackages(classFinder,
142142
frontendDependencies, options);
143143
commands.add(packageUpdater);
144144
}
145145

146-
if (packageUpdater != null && options.runNpmInstall) {
146+
if (packageUpdater != null && options.isRunNpmInstall()) {
147147
commands.add(new TaskRunNpmInstall(packageUpdater, options));
148148

149149
commands.add(new TaskInstallFrontendBuildPlugins(options));
@@ -155,7 +155,7 @@ public NodeTasks(Options options) {
155155

156156
}
157157

158-
if (options.createMissingPackageJson) {
158+
if (options.isCreateMissingPackageJson()) {
159159
TaskGeneratePackageJson packageCreator = new TaskGeneratePackageJson(
160160
options);
161161
commands.add(packageCreator);
@@ -165,7 +165,7 @@ public NodeTasks(Options options) {
165165
addGenerateServiceWorkerTask(options,
166166
frontendDependencies.getPwaConfiguration());
167167

168-
if (options.productionMode || options.isFrontendHotdeploy()
168+
if (options.isProductionMode() || options.isFrontendHotdeploy()
169169
|| options.isDevBundleBuild()) {
170170
addGenerateTsConfigTask(options);
171171
}
@@ -181,13 +181,13 @@ public NodeTasks(Options options) {
181181

182182
commands.add(new TaskGenerateFeatureFlags(options));
183183

184-
if (options.jarFiles != null
185-
&& options.jarFrontendResourcesFolder != null) {
184+
if (options.getJarFiles() != null
185+
&& options.getJarFrontendResourcesFolder() != null) {
186186
commands.add(new TaskCopyFrontendFiles(options));
187187
}
188188

189-
if (options.localResourcesFolder != null
190-
&& options.jarFrontendResourcesFolder != null) {
189+
if (options.getLocalResourcesFolder() != null
190+
&& options.getJarFrontendResourcesFolder() != null) {
191191
commands.add(new TaskCopyLocalFrontendFiles(options));
192192
}
193193

@@ -202,12 +202,12 @@ public NodeTasks(Options options) {
202202
pwa = new PwaConfiguration();
203203
}
204204
commands.add(new TaskUpdateSettingsFile(options, themeName, pwa));
205-
if (options.productionMode || options.isFrontendHotdeploy()
205+
if (options.isProductionMode() || options.isFrontendHotdeploy()
206206
|| options.isDevBundleBuild()) {
207207
commands.add(new TaskUpdateVite(options, webComponentTags));
208208
}
209209

210-
if (options.enableImportsUpdate) {
210+
if (options.isEnableImportsUpdate()) {
211211
commands.add(new TaskUpdateImports(classFinder,
212212
frontendDependencies,
213213
finder -> getFallbackScanner(options, finder, featureFlags),
@@ -217,18 +217,18 @@ public NodeTasks(Options options) {
217217
frontendDependencies.getThemeDefinition(), options));
218218
}
219219

220-
if (options.copyTemplates) {
220+
if (options.isCopyTemplates()) {
221221
commands.add(new TaskCopyTemplateFiles(classFinder, options));
222222

223223
}
224224
}
225225

226226
private void addBootstrapTasks(Options options) {
227227
commands.add(new TaskGenerateIndexHtml(options));
228-
if (options.productionMode || options.isFrontendHotdeploy()
228+
if (options.isProductionMode() || options.isFrontendHotdeploy()
229229
|| options.isDevBundleBuild()) {
230230
commands.add(new TaskGenerateIndexTs(options));
231-
if (!options.productionMode) {
231+
if (!options.isProductionMode()) {
232232
commands.add(new TaskGenerateViteDevMode(options));
233233
}
234234
}
@@ -253,7 +253,7 @@ private void addGenerateServiceWorkerTask(Options options,
253253
}
254254

255255
private void addEndpointServicesTasks(Options options) {
256-
Lookup lookup = options.lookup;
256+
Lookup lookup = options.getLookup();
257257
EndpointGeneratorTaskFactory endpointGeneratorTaskFactory = lookup
258258
.lookup(EndpointGeneratorTaskFactory.class);
259259

@@ -262,7 +262,7 @@ private void addEndpointServicesTasks(Options options) {
262262
.createTaskGenerateOpenAPI(options);
263263
commands.add(taskGenerateOpenAPI);
264264

265-
if (options.frontendGeneratedFolder != null) {
265+
if (options.getFrontendGeneratedFolder() != null) {
266266
TaskGenerateEndpoint taskGenerateEndpoint = endpointGeneratorTaskFactory
267267
.createTaskGenerateEndpoint(options);
268268
commands.add(taskGenerateEndpoint);
@@ -272,10 +272,10 @@ private void addEndpointServicesTasks(Options options) {
272272

273273
private FrontendDependenciesScanner getFallbackScanner(Options options,
274274
ClassFinder finder, FeatureFlags featureFlags) {
275-
if (options.useByteCodeScanner) {
275+
if (options.isUseByteCodeScanner()) {
276276
return new FrontendDependenciesScanner.FrontendDependenciesScannerFactory()
277277
.createScanner(true, finder,
278-
options.generateEmbeddableWebComponents,
278+
options.isGenerateEmbeddableWebComponents(),
279279
featureFlags, true);
280280
} else {
281281
return null;

flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeUpdater.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ String writePackageFile(JsonObject packageJson) throws IOException {
485485
String writePackageFile(JsonObject json, File packageFile)
486486
throws IOException {
487487
String content = stringify(json, 2) + "\n";
488-
if (packageFile.exists() || options.productionMode
488+
if (packageFile.exists() || options.isProductionMode()
489489
|| options.isFrontendHotdeploy()
490490
|| options.isDevBundleBuild()) {
491491
log().debug("writing file {}.", packageFile.getAbsolutePath());

0 commit comments

Comments
 (0)