Skip to content

Commit

Permalink
Build the site when something is pushed to main, or on PRs (#9)
Browse files Browse the repository at this point in the history
There is room for improvement here, this is meant to be a first draft
before we start merging other cleanup, to validate those merges.

Fixes #7
  • Loading branch information
niloc132 authored Dec 18, 2024
1 parent 2707076 commit 35f5dbb
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 20 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build gwt-site-webapp
on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'

- name: Compile the webapp to JS
run: mvn --batch-mode --no-transfer-progress -e verify

- name: Rename generated directory
# Fixes issue where artifact zip contains top level directory due to wildcard expansion
run: mv target/gwt-site-webapp-*/ target/gwt-site-webapp
- name: Upload the generated JS
uses: actions/upload-artifact@v3
with:
name: 'gwt-site-webapp'
path: target/gwt-site-webapp/
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
# gwt-site-webapp
This project includes the server an client code of the GWT site
It does not include the site content which is in the gwt-site project
nor the utilities for uploading the documentation to GAE Servers which
are in the gwt-site-uploader project.
This project includes the client code of the GWT site. It does not include the
site content which is in the gwt-site project nor the utilities to create and
deploy with samples and plugin releases.

## Requirements
[Apache Maven](http://maven.apache.org) 3.0 or greater, and JDK 7+ in order to run.
[Apache Maven](http://maven.apache.org) 3.8 or greater, and JDK 11+ in order to run.

- Before building the project you may need **gwt-site** packaged file.
Go to the `gwt-site` folder and run:
To build the project, invoke the following command:

$ mvn verify

This only tests and builds the JS to enhance the site content. To build the contents
first, you need to build the gwt-site project.

1. Check out the [gwt-site](https://github.com/gwtproject/gwt-site) project.
2. Build the gwt-site project:

$ cd [...]/gwt-site
$ mvn install

- To **build** and check the app, run
3. Build the gwt-site-webapp project, with the -Pfull-site profile:

$ cd [...]/gwt-site-webapp
$ mvn verify -P full-site
$ mvn verify -Pfull-site

Now you can point your browser to the `target/www` folder, or you can serve
its content with any web-server (i.e [serve](https://www.npmjs.com/package/serve)).
Notice that the second way is needed if you want to test site navigation via Ajax.
Now you can point your browser to the `target/www` folder, or you can serve
its content with any web-server (i.e [serve](https://www.npmjs.com/package/serve) or
[http.server](https://docs.python.org/3/library/http.server.html)).
Notice that an http server is needed if you want to test site navigation via Ajax.

- Building will run the **tests**, but to explicitly run them you can use the test target
Building will run the **tests**, but to explicitly run them you can use the test target

$ mvn test

Expand Down
11 changes: 8 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<gwt.version>2.11.0</gwt.version>
<gwt.version>2.12.1</gwt.version>

<junit.version>4.13.2</junit.version>

Expand Down Expand Up @@ -81,6 +81,11 @@
<compilerArgs>
<arg>-saveSource</arg>
</compilerArgs>
<!--
Draft and pretty mode are turned on so that beginners can try out debugging
in their browser with no setup.
Please don't disable this; code size is less important.
-->
<draftCompile>true</draftCompile>
<style>PRETTY</style>
<failOnError>true</failOnError>
Expand All @@ -103,7 +108,7 @@
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/</outputDirectory>
<outputDirectory>${project.build.directory}/${project.build.finalName}/</outputDirectory>
<resources>
<!-- copy GWT source code to website for debugging -->
<resource>
Expand Down Expand Up @@ -175,7 +180,7 @@
<outputDirectory>${project.build.directory}/www/</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/${project.artifactId}-${project.version}/</directory>
<directory>${project.build.directory}/${project.build.finalName}/</directory>
</resource>
</resources>
</configuration>
Expand Down
7 changes: 3 additions & 4 deletions src/main/module.gwt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
<!-- Could not determine the version of your GWT SDK; using the module DTD from GWT 1.6.4. You may want to change this. -->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<module rename-to="gwtproject">
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.gwt.user.User" />
<inherits name="elemental2.dom.Dom"/>
<source path="client" />
<entry-point
class="com.google.gwt.site.webapp.client.GWTProjectEntryPoint" />
<source path="client" />
<entry-point class="com.google.gwt.site.webapp.client.GWTProjectEntryPoint" />
<add-linker name="xsiframe"/>
<set-property name="compiler.useSourceMaps" value="true"/>
<!-- change to localhost for development -->
Expand Down

0 comments on commit 35f5dbb

Please sign in to comment.