Skip to content

Commit 161e5f9

Browse files
committed
build(pom): gate GPU/OpenCL-Android compile passes behind -Pcuda / -Popencl-android
The maven-compiler-plugin had two extra <execution>s (gpu, opencl-android) and the maven-resources-plugin had two extra <execution>s (copy-resources, copy-resources-opencl-android) all bound to the default lifecycle. They ran on every `mvn compile` even on plain CPU dev machines, writing into target/classes_cuda and target/classes_opencl_android — output that is only consumed when packaging the CUDA or OpenCL-Android classifier jars via -Pcuda / -Popencl-android. Move both pairs into their respective profiles so that: - `mvn compile` (default): only the standard compile pass + JNI header generation; no target/classes_cuda or target/classes_opencl_android. - `mvn -Pcuda compile`: gpu compile pass + cuda copy-resources + the existing cuda jar packaging — unchanged from before. - `mvn -Popencl-android compile`: opencl-android compile pass + opencl-android copy-resources + the existing classifier jar. CI release path (mvn -P release,cuda,opencl-android package) is unaffected because both profiles are active. Verified: - mvn clean compile: no target/classes_cuda or target/classes_opencl_android. - mvn -Pcuda clean compile: target/classes_cuda populated. https://claude.ai/code/session_01NHGqtxTLHUXAEzqABvmKnB
1 parent d1a8953 commit 161e5f9

1 file changed

Lines changed: 97 additions & 77 deletions

File tree

pom.xml

Lines changed: 97 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -281,87 +281,10 @@ SPDX-License-Identifier: MIT
281281
</annotationProcessorPaths>
282282
</configuration>
283283
</execution>
284-
<!-- We have to perform a separate build pass for cuda
285-
classifier -->
286-
<execution>
287-
<id>gpu</id>
288-
<phase>compile</phase>
289-
<goals>
290-
<goal>compile</goal>
291-
</goals>
292-
<configuration>
293-
<compilerArgs>
294-
<arg>-h</arg>
295-
<arg>src/main/cpp</arg>
296-
</compilerArgs>
297-
<outputDirectory>
298-
${project.build.outputDirectory}_cuda</outputDirectory>
299-
</configuration>
300-
</execution>
301-
<!-- Separate build pass for opencl-android classifier -->
302-
<execution>
303-
<id>opencl-android</id>
304-
<phase>compile</phase>
305-
<goals>
306-
<goal>compile</goal>
307-
</goals>
308-
<configuration>
309-
<compilerArgs>
310-
<arg>-h</arg>
311-
<arg>src/main/cpp</arg>
312-
</compilerArgs>
313-
<outputDirectory>
314-
${project.build.outputDirectory}_opencl_android</outputDirectory>
315-
</configuration>
316-
</execution>
317284
</executions>
318285
</plugin>
319286
<plugin>
320287
<artifactId>maven-resources-plugin</artifactId>
321-
<executions>
322-
<!-- Copy custom cuda libs to the output directory -->
323-
<execution>
324-
<id>copy-resources</id>
325-
<phase>process-classes</phase>
326-
<goals>
327-
<goal>copy-resources</goal>
328-
</goals>
329-
<configuration>
330-
<outputDirectory>
331-
${project.build.outputDirectory}_cuda</outputDirectory>
332-
<resources>
333-
<resource>
334-
<directory>
335-
${basedir}/src/main/resources_linux_cuda/</directory>
336-
<includes>
337-
<include>**/*.*</include>
338-
</includes>
339-
</resource>
340-
</resources>
341-
</configuration>
342-
</execution>
343-
<!-- Copy custom opencl-android libs to the output directory -->
344-
<execution>
345-
<id>copy-resources-opencl-android</id>
346-
<phase>process-classes</phase>
347-
<goals>
348-
<goal>copy-resources</goal>
349-
</goals>
350-
<configuration>
351-
<outputDirectory>
352-
${project.build.outputDirectory}_opencl_android</outputDirectory>
353-
<resources>
354-
<resource>
355-
<directory>
356-
${basedir}/src/main/resources_android_opencl/</directory>
357-
<includes>
358-
<include>**/*.*</include>
359-
</includes>
360-
</resource>
361-
</resources>
362-
</configuration>
363-
</execution>
364-
</executions>
365288
</plugin>
366289
<plugin>
367290
<groupId>org.apache.maven.plugins</groupId>
@@ -552,6 +475,55 @@ SPDX-License-Identifier: MIT
552475
<id>cuda</id>
553476
<build>
554477
<plugins>
478+
<plugin>
479+
<groupId>org.apache.maven.plugins</groupId>
480+
<artifactId>maven-compiler-plugin</artifactId>
481+
<executions>
482+
<!-- We have to perform a separate build pass for cuda
483+
classifier -->
484+
<execution>
485+
<id>gpu</id>
486+
<phase>compile</phase>
487+
<goals>
488+
<goal>compile</goal>
489+
</goals>
490+
<configuration>
491+
<compilerArgs>
492+
<arg>-h</arg>
493+
<arg>src/main/cpp</arg>
494+
</compilerArgs>
495+
<outputDirectory>
496+
${project.build.outputDirectory}_cuda</outputDirectory>
497+
</configuration>
498+
</execution>
499+
</executions>
500+
</plugin>
501+
<plugin>
502+
<artifactId>maven-resources-plugin</artifactId>
503+
<executions>
504+
<!-- Copy custom cuda libs to the output directory -->
505+
<execution>
506+
<id>copy-resources</id>
507+
<phase>process-classes</phase>
508+
<goals>
509+
<goal>copy-resources</goal>
510+
</goals>
511+
<configuration>
512+
<outputDirectory>
513+
${project.build.outputDirectory}_cuda</outputDirectory>
514+
<resources>
515+
<resource>
516+
<directory>
517+
${basedir}/src/main/resources_linux_cuda/</directory>
518+
<includes>
519+
<include>**/*.*</include>
520+
</includes>
521+
</resource>
522+
</resources>
523+
</configuration>
524+
</execution>
525+
</executions>
526+
</plugin>
555527
<plugin>
556528
<groupId>org.apache.maven.plugins</groupId>
557529
<artifactId>maven-jar-plugin</artifactId>
@@ -580,6 +552,54 @@ SPDX-License-Identifier: MIT
580552
<id>opencl-android</id>
581553
<build>
582554
<plugins>
555+
<plugin>
556+
<groupId>org.apache.maven.plugins</groupId>
557+
<artifactId>maven-compiler-plugin</artifactId>
558+
<executions>
559+
<!-- Separate build pass for opencl-android classifier -->
560+
<execution>
561+
<id>opencl-android</id>
562+
<phase>compile</phase>
563+
<goals>
564+
<goal>compile</goal>
565+
</goals>
566+
<configuration>
567+
<compilerArgs>
568+
<arg>-h</arg>
569+
<arg>src/main/cpp</arg>
570+
</compilerArgs>
571+
<outputDirectory>
572+
${project.build.outputDirectory}_opencl_android</outputDirectory>
573+
</configuration>
574+
</execution>
575+
</executions>
576+
</plugin>
577+
<plugin>
578+
<artifactId>maven-resources-plugin</artifactId>
579+
<executions>
580+
<!-- Copy custom opencl-android libs to the output directory -->
581+
<execution>
582+
<id>copy-resources-opencl-android</id>
583+
<phase>process-classes</phase>
584+
<goals>
585+
<goal>copy-resources</goal>
586+
</goals>
587+
<configuration>
588+
<outputDirectory>
589+
${project.build.outputDirectory}_opencl_android</outputDirectory>
590+
<resources>
591+
<resource>
592+
<directory>
593+
${basedir}/src/main/resources_android_opencl/</directory>
594+
<includes>
595+
<include>**/*.*</include>
596+
</includes>
597+
</resource>
598+
</resources>
599+
</configuration>
600+
</execution>
601+
</executions>
602+
</plugin>
583603
<plugin>
584604
<groupId>org.apache.maven.plugins</groupId>
585605
<artifactId>maven-jar-plugin</artifactId>

0 commit comments

Comments
 (0)