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

Move dev script to a bash script, allow compiling for Firefox in #5461

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Prettier-specific

# Currently do not have a formatter for shell scripts
*.sh

# Ignore all CSS files (source files are scss)
*.css

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@
},
"scripts": {
"build": "mvn -B package --file pom.xml",
"dev": "npm-run-all --parallel dev:tomcat dev:codeserver",
"dev:tomcat": "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",
"dev:codeserver": "mvn gwt:run-codeserver -Dgwt.compiler.skip=true -Dnoserver=true -Dwar=/$(pwd)/target/portal-develop-SNAPSHOT -Dstyle=PRETTY",
"dev": "./startDevServer.sh",
"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",
"prepare": "husky install",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@
src/main/webapp/sass:src/main/webapp/generated
</arguments>
</configuration>
<phase>compile</phase>
<phase>process-resources</phase>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move sass compilation to process-resources to ensure the static resources created by this job are copied, which happens in the compile step

</execution>
</executions>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<module rename-to='Portal'>
<inherits name="org.sagebionetworks.web.Portal" />

<set-property name="user.agent" value="safari" />
<set-property name="user.agent" value="safari,gecko1_8" />
Copy link
Contributor Author

@nickgros nickgros Jul 19, 2024

Choose a reason for hiding this comment

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

allow using firefox with PortalDebug module. If you have precompile off, it won't compile the gecko1_8 permutation unless you actually load the app in devmode with the expected user agent

</module>
22 changes: 22 additions & 0 deletions startDevServer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
TOMCAT_IMAGE="tomcat:9.0"
CONTAINER_NAME="swc-dev"
EXPLODED_WAR_DIR="$(pwd)/target/portal-develop-SNAPSHOT/"
GWT_DEV_ARGS="-Dgwt.module=org.sagebionetworks.web.PortalDebug -Dgwt.codeServer.launcherDir=$EXPLODED_WAR_DIR -Dgwt.style=PRETTY"

trap 'echo \"Stopping container "$CONTAINER_NAME"\"; docker stop "$CONTAINER_NAME"; exit' EXIT

# Precompile the app. This is important; if the exploded war directory does not exist, the tomcat container would create
# it, and it would be owned by the root user. The GWT code server would not be able to write to it!
mvn compile $GWT_DEV_ARGS

docker pull $TOMCAT_IMAGE
docker run --name $CONTAINER_NAME -d --rm -p 8888:8080 -v "$EXPLODED_WAR_DIR:/usr/local/tomcat/webapps/ROOT/:ro" -v "/$HOME/.m2/settings.xml:/root/.m2/settings.xml:ro" $TOMCAT_IMAGE

echo "Deployed image $TOMCAT_IMAGE as container $CONTAINER_NAME. Waiting for Tomcat to start..."
until [ $(curl -sS --connect-timeout 3 -w "%{http_code}" "http://127.0.0.1:8888/" -o /dev/null 2>/dev/null) == "200" ]; do
printf "."
sleep 1
done;

mvn gwt:run-codeserver -Dgwt.precompile=false $GWT_DEV_ARGS
Loading