On Mon, Jul 27, 2026 at 12:30 AM Daniel Sahlberg <
[email protected]> wrote:

> Den sön 26 juli 2026 kl 12:06 skrev Jun Omae <[email protected]>:
>
>> On Sun, Jul 26, 2026 at 6:39 PM Branko Čibej <[email protected]> wrote:
>> >
>> > On 26. 7. 2026 11:24, Jun Omae wrote:
>> >
>> > Hi,
>> >
>> > I noticed that svn-javahl.jar file has class files for unit tests while
>> working for support build JavaHL with cmake.
>> > I don't think it's necessary for the jar file for distribution.... is
>> that intentional?
>> >
>> >
>> >
>> > I noticed this myself the last time I looked at JavaHL. I'm not sure
>> how this came about in the first place, but by now it's intentional because
>> it's always been this way. Maybe it's to allow users who only use binaries
>> to run JavaHL tests. In any case this is part of the published ABI.
>>
>>
>> In JavaDoc for JavaHL, test classes are not described.
>> See https://subversion.apache.org/docs/javahl/1.14/
>>
>>
>> > In JavaHL build with cmake, the class files for unit tests are archived
>> into svn-javahl-tests.jar, and only svn-javahl.jar is installed.
>> >
>> >
>> > The CMake build must create a JAR that is identical to what the
>> autotools produce.
>>
>>
>> JUnit jar is not required for build with autoconf. Without JUnit jar,
>> the svn-javahl.jar doesn't have test classes.
>>
>
> How did you configure your build?
>
> If I configure with --with-junit=/path/to/junit-4.13.2.jar, I can run `make
> install-javahl` successfully.
>
> However if I configure without --with-junit (and run make clean!), I get
> error messages whenever I run `make install-javahl`:
> [[[
> /home/dsg/ramdisk/svn_trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/BasicTests.java:1446:
> error: cannot find symbol
>         assertEquals(expected, actual);
>         ^
>   symbol:   method assertEquals(String,String)
>   location: class BasicTests
> ]]]
>
> What I'd like to confirm is if we can create a JAR without the test
> classes.
>
> @Jun Omae <[email protected]> Is there a problem if we include the test
> classes?
>
> Cheers,
> Daniel
>
>

[[[
$ svn co -q https://svn.apache.org/repos/asf/subversion/branches/1.14.x
./subversion-1.14.x
$ svn cleanup --remove-{unversioned,ignored}
$ cd ./subversion-1.14.x$ /bin/sh autogen.sh
$ ./configure --prefix=/dev/shm/svn-javahl --without-apxs --without-swig \
>   --enable-javahl --with-jdk=/usr/lib/jvm/java-11-openjdk-amd64 \
>   --without-junit PYTHON=/usr/bin/python3
$ make -j$(nproc) all
$ make javahl
$ make install
$ make install-javahl
$ unzip -l /dev/shm/svn-javahl/lib/svn-javahl/svn-javahl.jar | grep -F
.class | wc -l
276
$ unzip -l /dev/shm/svn-javahl/lib/svn-javahl/svn-javahl.jar | grep -F Test
| wc -l
0
]]]

> Is there a problem if we include the test classes?

No direct issues have been found so far. However, static initializers
within test classes are executed simply by loading the class.

[[[
$ grep -r 'static *{' subversion/bindings/javahl
subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java:
   static {
subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java:
   static {
]]]

--
Jun Omae <[email protected]> (大前 潤)

Reply via email to