Skip to content

Commit 8bf14e4

Browse files
c-dilkstongtongcao
authored andcommitted
build!: use same parent POM for all modules, and fix javadoc inter-module linking (#538)
* build: aggregate javadoc * fix: some progress... * fix: make sure all `pom.xml`s have a preamble * build!: use the main parent POM for `common-tools/cnuphys` - fixes missing UTF-8 encoding bug by making sure that `common-tools/cnuphys/` POMs use the same `javadoc` config as everything else - a bit of scope creep here, since this is another "major" build change * feat: use `build-coatjava.sh` to build documentation * fix: ignore `docs/javadoc` files for those who have generated them locally * fix: cleanup * fix: version num conflicts
1 parent b261645 commit 8bf14e4

File tree

18 files changed

+123
-321
lines changed

18 files changed

+123
-321
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,9 @@ jobs:
199199
java-version: ${{ env.javadoc_version }}
200200
distribution: ${{ env.java_distribution }}
201201
- name: build coatjava
202-
run: ./build-coatjava.sh
203-
- name: generate javadoc documentation
204202
run: |
205-
./build-javadocs.sh
206-
mv docs/javadoc pages/
203+
./build-coatjava.sh --docs
204+
mv coatjava/share/doc/coatjava/html/* pages/
207205
### upload artifacts
208206
- uses: actions/upload-pages-artifact@v3
209207
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/myLocalMvnRepo
44
target
55
/publish
6+
/docs/javadoc/*
67

78
*.class
89
*lundfiles*.dat

.gitlab-ci.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,13 @@ coatjava:singularity:
8686
create-pages:
8787
image: codecr.jlab.org/hallb/alert/coatjava/coatjava:development
8888
script:
89-
- export MAVEN_OPTS=" -Dfile.encoding=UTF-8"
9089
- echo "${CI_COMMIT_REF_NAME}"
9190
- ls -lrth
9291
- mvn --version
9392
- java --version
9493
- ls -lrth
9594
- pwd
96-
- ls -lrth docs/javadoc
97-
- ./build-javadocs.sh
98-
- ls -lrth
99-
- ls -lrth docs/
100-
- ls -lrth docs/javadoc
101-
- mv docs/javadoc public
95+
- ./build-coatjava.sh --docs
96+
- mv coatjava/share/doc/coatjava/html public
10297
pages: true # specifies that this is a Pages job and publishes the default public directory
10398

build-coatjava.sh

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,32 @@ set -e
44
set -u
55
set -o pipefail
66

7-
usage='''build-coatjava.sh [-h] [--help] [--quiet] [--clean] [--spotbugs] [--nomaps] [--unittests]
8-
- all other arguments will be passed to `mvn`, e.g., -T4 will build with 4 parallel threads'''
7+
usage='''build-coatjava.sh [OPTIONS]... [MAVEN_OPTIONS]...
8+
9+
OPTIONS
10+
11+
--quiet run more quietly
12+
--clean clean up built objects and exit (does not compile)
13+
14+
--nomaps do not download field maps
15+
16+
--docs also build the API documentation webpages
17+
--spotbugs also run spotbugs plugin
18+
--unittests also run unit tests
19+
20+
--help show this message
21+
22+
MAVEN_OPTIONS
23+
24+
all other arguments will be passed to `mvn`, e.g., -T4 will build with 4 parallel threads
25+
'''
926

1027
quiet="no"
1128
cleanBuild="no"
1229
runSpotBugs="no"
1330
downloadMaps="yes"
1431
runUnitTests="no"
32+
buildDocs="no"
1533
mvnArgs=()
1634
for xx in $@
1735
do
@@ -20,6 +38,7 @@ do
2038
-n) runSpotBugs="no" ;;
2139
--nomaps) downloadMaps="no" ;;
2240
--unittests) runUnitTests="yes" ;;
41+
--docs) buildDocs="yes" ;;
2342
--quiet) quiet="yes" ;;
2443
--clean) cleanBuild="yes" ;;
2544
-h|--help)
@@ -116,24 +135,38 @@ mkdir -p $prefix_dir/lib/services
116135
# FIXME: this is still needed by one of the tests
117136
cp external-dependencies/jclara-4.3-SNAPSHOT.jar $prefix_dir/lib/utils
118137

138+
# spotbugs, unit tests
119139
unset CLAS12DIR
120140
if [ $runUnitTests == "yes" ]; then
121-
$mvn install # also runs unit tests
122-
if [ $? != 0 ] ; then echo "mvn install failure" ; exit 1 ; fi
141+
$mvn install # also runs unit tests
142+
if [ $? != 0 ] ; then echo "mvn install failure" ; exit 1 ; fi
123143
else
124-
$mvn -Dmaven.test.skip=true install
125-
if [ $? != 0 ] ; then echo "mvn install failure" ; exit 1 ; fi
144+
$mvn -Dmaven.test.skip=true install
145+
if [ $? != 0 ] ; then echo "mvn install failure" ; exit 1 ; fi
126146
fi
127147

128148
if [ $runSpotBugs == "yes" ]; then
129-
# mvn com.github.spotbugs:spotbugs-maven-plugin:spotbugs # spotbugs goal produces a report target/spotbugsXml.xml for each module
130-
$mvn com.github.spotbugs:spotbugs-maven-plugin:check # check goal produces a report and produces build failed if bugs
131-
# the spotbugsXml.xml file is easiest read in a web browser
132-
# see http://spotbugs.readthedocs.io/en/latest/maven.html and https://spotbugs.github.io/spotbugs-maven-plugin/index.html for more info
133-
if [ $? != 0 ] ; then echo "spotbugs failure" ; exit 1 ; fi
149+
# mvn com.github.spotbugs:spotbugs-maven-plugin:spotbugs # spotbugs goal produces a report target/spotbugsXml.xml for each module
150+
$mvn com.github.spotbugs:spotbugs-maven-plugin:check # check goal produces a report and produces build failed if bugs
151+
# the spotbugsXml.xml file is easiest read in a web browser
152+
# see http://spotbugs.readthedocs.io/en/latest/maven.html and https://spotbugs.github.io/spotbugs-maven-plugin/index.html for more info
153+
if [ $? != 0 ] ; then echo "spotbugs failure" ; exit 1 ; fi
134154
fi
135155

156+
# documentation
157+
if [ $buildDocs == "yes" ]; then
158+
$mvn javadoc:javadoc javadoc:aggregate -Ddoclint=none
159+
fi
160+
161+
# installation
136162
cp common-tools/coat-lib/target/coat-libs-*-SNAPSHOT.jar $prefix_dir/lib/clas/
137163
cp reconstruction/*/target/clas12detector-*-SNAPSHOT*.jar $prefix_dir/lib/services/
164+
echo "installed coatjava to: $prefix_dir"
165+
if [ $buildDocs == "yes" ]; then
166+
doc_dir=$prefix_dir/share/doc/coatjava/html
167+
mkdir -p $doc_dir
168+
cp -r target/reports/apidocs/* $doc_dir/
169+
echo "installed documentation to: $doc_dir"
170+
fi
138171

139172
echo "COATJAVA SUCCESSFULLY BUILT !"

build-javadocs.sh

Lines changed: 0 additions & 59 deletions
This file was deleted.

common-tools/cnuphys/cnuphys/pom.xml

Lines changed: 0 additions & 110 deletions
This file was deleted.

common-tools/cnuphys/magfield/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<artifactId>magfield</artifactId>
66
<version>12.0.6t-SNAPSHOT</version>
77
<packaging>jar</packaging>
8-
8+
99
<parent>
10-
<groupId>cnuphys</groupId>
11-
<artifactId>cnuphys-clas12</artifactId>
12-
<relativePath>../parent/pom.xml</relativePath>
13-
<version>2.0-SNAPSHOT</version>
10+
<groupId>org.jlab.clas</groupId>
11+
<artifactId>clas12rec</artifactId>
12+
<relativePath>../../../parent/pom.xml</relativePath>
13+
<version>12.0.6t-SNAPSHOT</version>
1414
</parent>
1515

1616
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->

common-tools/cnuphys/parent/pom.xml

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)