Skip to content

Commit bfca180

Browse files
authored
build: automate dependency analysis (#1101)
1 parent 9825f60 commit bfca180

File tree

8 files changed

+49
-60
lines changed

8 files changed

+49
-60
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -303,27 +303,6 @@ jobs:
303303
- name: test run-groovy
304304
run: coatjava/bin/run-groovy validation/advanced-tests/test-run-groovy.groovy
305305

306-
dependency_analysis:
307-
needs: [ build ]
308-
runs-on: ubuntu-latest
309-
steps:
310-
- uses: actions/checkout@v6
311-
- name: Set up JDK
312-
uses: actions/setup-java@v5
313-
with:
314-
java-version: ${{ env.JAVA_VERSION }}
315-
distribution: ${{ env.java_distribution }}
316-
cache: maven
317-
- uses: actions/download-artifact@v7
318-
with:
319-
name: build_ubuntu-latest
320-
- name: untar build
321-
run: tar xzvf coatjava.tar.gz
322-
- name: print dependency tree
323-
run: libexec/dependency-tree.sh
324-
- name: dependency analysis
325-
run: libexec/dependency-analysis.sh
326-
327306
# documentation
328307
#############################################################################
329308

@@ -413,7 +392,6 @@ jobs:
413392
final:
414393
needs:
415394
- test_coatjava
416-
- dependency_analysis
417395
- test_run-groovy
418396
- generate_documentation
419397
runs-on: ubuntu-latest

.gitlab-ci.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,6 @@ build:
6060
- coatjava.tar.gz
6161
- clara.tar.gz
6262

63-
.depana:
64-
allow_failure: true
65-
stage: build
66-
script:
67-
- libexec/dependency-tree.sh
68-
- libexec/dependency-analysis.sh
69-
7063
download:
7164
stage: build
7265
script:

build-coatjava.sh

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ set -o pipefail
1010
################################################################################
1111

1212
cleanBuild=false
13-
anaDepends=false
1413
runSpotBugs=false
1514
downloadMaps=true
1615
downloadNets=true
@@ -46,7 +45,6 @@ DATA RETRIEVAL OPTIONS
4645
TESTING OPTIONS
4746
--spotbugs also run spotbugs plugin
4847
--unittests also run unit tests
49-
--depana run dependency analysis (only)
5048
--data download test data (requires option `--lfs`)
5149
5250
MAVEN OPTIONS
@@ -70,7 +68,10 @@ do
7068
--nonets) downloadNets=false ;;
7169
--unittests) runUnitTests=true ;;
7270
--clean) cleanBuild=true ;;
73-
--depana) anaDepends=true ;;
71+
--depana)
72+
echo "ERROR: option \`$xx\` has been removed; dependency tree printout and analysis now happen automatically in the Maven build lifecycle" >&2
73+
exit 1
74+
;;
7475
--quiet)
7576
mvnArgs+=(--quiet --batch-mode)
7677
wgetArgs+=(--quiet)
@@ -86,7 +87,7 @@ do
8687
--clara) installClara=true ;;
8788
--data) downloadData=true ;;
8889
--xrootd)
89-
echo "ERROR: option \`$xx\` is deprecated; use \`--help\` for guidance" >&2
90+
echo "ERROR: option \`$xx\` has been removed; use \`--help\` for guidance" >&2
9091
exit 1
9192
;;
9293
-h|--help)
@@ -149,13 +150,6 @@ if $cleanBuild || [ "$dataRetrieval" = "wipe" ]; then
149150
exit
150151
fi
151152

152-
# run dependency analysis and exit
153-
if $anaDepends; then
154-
libexec/dependency-analysis.sh
155-
libexec/dependency-tree.sh
156-
exit 0
157-
fi
158-
159153

160154
################################################################################
161155
# download field maps, NN models, etc.

common-tools/coat-libs/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,15 @@
257257
<artifactId>maven-deploy-plugin</artifactId>
258258
</plugin>
259259

260+
<!-- no need for dependency analysis for this shaded JAR -->
261+
<plugin>
262+
<groupId>org.apache.maven.plugins</groupId>
263+
<artifactId>maven-dependency-plugin</artifactId>
264+
<configuration>
265+
<skip>true</skip>
266+
</configuration>
267+
</plugin>
268+
260269
</plugins>
261270
</build>
262271

libexec/dependency-analysis.sh

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

libexec/dependency-tree.sh

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

pom.xml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@
251251

252252
<plugins> <!-- plugins inherited by all child POMs -->
253253

254+
<!-- static analysis -->
254255
<plugin>
255256
<groupId>com.github.spotbugs</groupId>
256257
<artifactId>spotbugs-maven-plugin</artifactId>
@@ -260,6 +261,7 @@
260261
</configuration>
261262
</plugin>
262263

264+
<!-- documentation generation -->
263265
<plugin>
264266
<groupId>org.apache.maven.plugins</groupId>
265267
<artifactId>maven-javadoc-plugin</artifactId>
@@ -280,6 +282,7 @@
280282
</executions>
281283
</plugin>
282284

285+
<!-- general settings -->
283286
<plugin>
284287
<groupId>org.apache.maven.plugins</groupId>
285288
<artifactId>maven-compiler-plugin</artifactId>
@@ -289,7 +292,6 @@
289292
<encoding>UTF-8</encoding>
290293
</configuration>
291294
</plugin>
292-
293295
<plugin>
294296
<groupId>org.apache.maven.plugins</groupId>
295297
<artifactId>maven-resources-plugin</artifactId>
@@ -299,6 +301,7 @@
299301
</configuration>
300302
</plugin>
301303

304+
<!-- JAR -->
302305
<plugin>
303306
<groupId>org.apache.maven.plugins</groupId>
304307
<artifactId>maven-jar-plugin</artifactId>
@@ -323,6 +326,35 @@
323326
</configuration>
324327
</plugin>
325328

329+
<!-- dependency analysis -->
330+
<plugin>
331+
<groupId>org.apache.maven.plugins</groupId>
332+
<artifactId>maven-dependency-plugin</artifactId>
333+
<version>3.10.0</version>
334+
<executions>
335+
<execution>
336+
<id>analyze</id>
337+
<phase>verify</phase>
338+
<goals>
339+
<goal>tree</goal>
340+
<goal>analyze-only</goal>
341+
</goals>
342+
<configuration>
343+
<failOnWarning>true</failOnWarning>
344+
<!-- ignore certain "unused but declared" warnings -->
345+
<ignoredUnusedDeclaredDependencies>
346+
<ignoredUnusedDeclaredDependency>ai.djl:model-zoo</ignoredUnusedDeclaredDependency>
347+
<ignoredUnusedDeclaredDependency>ai.djl.pytorch:pytorch-model-zoo</ignoredUnusedDeclaredDependency>
348+
<ignoredUnusedDeclaredDependency>ai.djl.pytorch:pytorch-engine</ignoredUnusedDeclaredDependency>
349+
<ignoredUnusedDeclaredDependency>ai.djl.pytorch:pytorch-native-cpu</ignoredUnusedDeclaredDependency>
350+
<ignoredUnusedDeclaredDependency>ai.djl.pytorch:pytorch-jni</ignoredUnusedDeclaredDependency>
351+
</ignoredUnusedDeclaredDependencies>
352+
</configuration>
353+
</execution>
354+
</executions>
355+
</plugin>
356+
357+
<!-- dependency convergence -->
326358
<plugin>
327359
<groupId>org.apache.maven.plugins</groupId>
328360
<artifactId>maven-enforcer-plugin</artifactId>
@@ -347,6 +379,7 @@
347379
</executions>
348380
</plugin>
349381

382+
<!-- coverage -->
350383
<plugin>
351384
<groupId>org.jacoco</groupId>
352385
<artifactId>jacoco-maven-plugin</artifactId>

reconstruction/alert/pom.xml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
<plugin>
128128
<groupId>org.apache.maven.plugins</groupId>
129129
<artifactId>maven-dependency-plugin</artifactId>
130-
<version>3.9.0</version>
130+
<version>3.10.0</version>
131131
<executions>
132132
<execution>
133133
<id>copy-dependencies</id>
@@ -141,15 +141,6 @@
141141
</configuration>
142142
</execution>
143143
</executions>
144-
<configuration>
145-
<ignoredUnusedDeclaredDependencies> <!-- tell 'dependency:analyze' to not complain that these are unused -->
146-
<ignoredUnusedDeclaredDependency>ai.djl:model-zoo</ignoredUnusedDeclaredDependency>
147-
<ignoredUnusedDeclaredDependency>ai.djl.pytorch:pytorch-model-zoo</ignoredUnusedDeclaredDependency>
148-
<ignoredUnusedDeclaredDependency>ai.djl.pytorch:pytorch-engine</ignoredUnusedDeclaredDependency>
149-
<ignoredUnusedDeclaredDependency>ai.djl.pytorch:pytorch-native-cpu</ignoredUnusedDeclaredDependency>
150-
<ignoredUnusedDeclaredDependency>ai.djl.pytorch:pytorch-jni</ignoredUnusedDeclaredDependency>
151-
</ignoredUnusedDeclaredDependencies>
152-
</configuration>
153144
</plugin>
154145
</plugins>
155146
</build>

0 commit comments

Comments
 (0)