Skip to content

Commit 26b8df0

Browse files
authored
feat: build-frontent to propagate build info (#22726)
Add build info propagation to build-frontend goal so it can be executed also without prepare-frontend Closes #22679
1 parent ad49236 commit 26b8df0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

flow-plugins/flow-maven-plugin/src/main/java/com/vaadin/flow/plugin/maven/BuildFrontendMojo.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ protected void executeInternal()
141141
throws MojoExecutionException, MojoFailureException {
142142
long start = System.nanoTime();
143143

144+
if (!BuildFrontendUtil.getTokenFile(this).exists()) {
145+
// if not prepare-frontend token file exists propagate build info
146+
// to token file
147+
File tokenFile = BuildFrontendUtil.propagateBuildInfo(this);
148+
}
149+
144150
Options options = new Options(null, getClassFinder(), npmFolder())
145151
.withFrontendDirectory(frontendDirectory())
146152
.withFrontendGeneratedFolder(generatedTsFolder());

flow-plugins/flow-maven-plugin/src/test/java/com/vaadin/flow/plugin/maven/BuildFrontendMojoTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public void setup() throws Exception {
149149
"flow_resources");
150150

151151
defaultJavaSource = new File(".", "src/test/java");
152+
File defaultJavaResource = new File(".", "src/test/resources");
152153
openApiJsonFile = new File(npmFolder,
153154
"target/classes/com/vaadin/hilla/openapi.json");
154155
generatedTsFolder = new File(npmFolder, "src/main/frontend/generated");
@@ -185,6 +186,8 @@ public void setup() throws Exception {
185186
"src/main/resources/application.properties"));
186187
ReflectionUtils.setVariableValueInObject(mojo, "javaSourceFolder",
187188
defaultJavaSource);
189+
ReflectionUtils.setVariableValueInObject(mojo, "javaResourceFolder",
190+
defaultJavaResource);
188191
ReflectionUtils.setVariableValueInObject(mojo, "generatedTsFolder",
189192
generatedTsFolder);
190193
ReflectionUtils.setVariableValueInObject(mojo, "nodeVersion",
@@ -671,11 +674,11 @@ public void commercialComponent_noLicenseKey_commercialBannerNotEnabled_buildFai
671674
}
672675

673676
@Test
674-
public void noTokenFile_noTokenFileShouldBeCreated()
677+
public void noTokenFile_tokenFileShouldBeCreated()
675678
throws MojoExecutionException, MojoFailureException {
676679
mojo.execute();
677680

678-
Assert.assertFalse(tokenFile.exists());
681+
Assert.assertTrue(tokenFile.exists());
679682
}
680683

681684
@Test

0 commit comments

Comments
 (0)