Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch synapse-react-client & automatically copy resources #5621

Merged
merged 4 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@
},
"scripts": {
"build": "mvn -B package --file pom.xml",
"dev": "concurrently -k -n \"CODESERVER,TOMCAT\" -c \"auto,auto\" \"yarn dev:codeserver\" \"yarn dev:tomcat\"",
"dev": "concurrently -k -n \"CODESERVER,WATCHER,TOMCAT\" -c \"auto,auto,auto\" \"yarn dev:codeserver\" \"yarn dev:watcher\" \"yarn dev:tomcat\"",
"dev:codeserver": "mvn clean gwt:run-codeserver",
"dev:watcher": "wait-on tcp:9876 && mvn fizzed-watcher:run",
"dev:tomcat": "wait-on tcp:9876 && docker pull tomcat:9.0; docker run --name swc-dev --rm -p 8888:8080 -v \"/$(pwd)/target/portal-develop-SNAPSHOT/:/usr/local/tomcat/webapps/ROOT/\" -v \"/$HOME/.m2/settings.xml\":/root/.m2/settings.xml tomcat:9.0",
"docker:start": "docker pull tomcat:9.0; docker run --name swc-tomcat -d --rm -p 8888:8080 -v \"/$(pwd)/target/portal-develop-SNAPSHOT.war:/usr/local/tomcat/webapps/ROOT.war\" -v \"/$(pwd)/e2e_workflow/settings.xml\":/root/.m2/settings.xml tomcat:9.0",
"docker:stop": "docker stop swc-tomcat",
Expand Down
34 changes: 30 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
<attachClasses>true</attachClasses>
</configuration>
</execution>
<!-- This next section is to copy the source maps into the WEB-INF directory
<!-- This next section is to copy the source maps into the WEB-INF directory
(during the package phase, from junit output) -->
<execution>
<id>execution2</id>
Expand All @@ -301,8 +301,34 @@
</executions>
</plugin>

<!-- We use this assembly to package the GWT RPC dependencies so they
are aviablible fore integration testing. -->
<plugin>
<groupId>com.fizzed</groupId>
<artifactId>fizzed-watcher-maven-plugin</artifactId>
<version>1.0.6</version>
<!-- This configuration is used to watch the node_modules directory for changes and copy those to the static assets folder when they change -->
<!-- Then those assets are copied into the exploded WAR -->
<configuration>
<touchFile>target/classes/watcher_explode_war.txt</touchFile>
<watches>
<watch>
<directory>
${project.basedir}/node_modules/synapse-react-client/dist/umd
</directory>
Comment on lines +314 to +316
Copy link
Contributor Author

@nickgros nickgros Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch synapse-react-client for changes. We can update this list as needed; I didn't want to start with watching the entire node_modules folder (not sure of the performance implications of watching 80k+ files)

</watch>
<watch>
<directory>${project.basedir}/src/main/webapp/css</directory>
<directory>${project.basedir}/src/main/webapp/sass</directory>
</watch>
Comment on lines +318 to +321
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Watch source SCSS and CSS files for changes

</watches>
<goals>
<goal>process-resources</goal>
<goal>war:exploded</goal>
</goals>
</configuration>
</plugin>

<!-- We use this assembly to compile the GWT RPC dependencies so they
are available for integration testing. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
Expand All @@ -316,7 +342,7 @@
<execution>
<id>make-assembly</id>
<!-- this is used for inheritance merges -->
<phase>package</phase>
<phase>compile</phase>
Copy link
Contributor Author

@nickgros nickgros Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, my local instance of the GWT servlet would occasionally respond with esoteric failure messages on RPCs. The error in the RPC response would read "Type name elision in RPC payloads is only supported if the RPC whitelist file is used." and the client could not deserialize it. I have been having this issue for ages, with both Tomcat & Jetty, regardless of if I started the code server with the Maven plugin or the IntelliJ GWT extension.

Today I discovered that this was because my code server seemed to create incorrect (stale?) .rpc files for DevMode after running either mvn clean compile or mvn gwt:run. Running mvn clean package somehow fixed this. I noticed that the compiled .rpc file names generated after running mvn package differed from those generated by mvn compile, so I am assuming this assembly step accounts for the difference.

My working theory is that this assembly step is related and maybe updates some stale cache layer? I would appreciate more insight into this step if more context is available. I am hoping that moving the RPC assembly to the compile step will prevent this from happening in general.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also encountered stale rpc files that breaks GWT RPC (with the unable to deserialize client error). I wish I had more context to give, but I don't see any issues moving this to the compile step

<!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
Expand Down
Loading