Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ant build with cmake #14

Merged
merged 54 commits into from
Feb 16, 2020

Conversation

stephen-webb
Copy link
Contributor

No description provided.

stephen-webb and others added 20 commits October 6, 2019 14:48
@jvz
Copy link
Member

jvz commented Jan 31, 2020

I ❤️ PRs that have huge negative line counts like this! I'm not super familiar with the tooling in use, though I'll try this out over the weekend.

pom.xml Outdated Show resolved Hide resolved
Copy link
Member

@jvz jvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this out on macOS. After installing cmake 3.16.3, I was able to use mkdir build && cd build && cmake .. && make && make install and it seemed to build and install properly. Only tested using Makefiles so far, though it looks like Xcode is also supported in theory?

$ cd apache-log4cxx-x.x.x
$ mkdir build
$ cd build
$ ccmake ..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing cmake .. step? I'm not very familiar with the tool, but ccmake seems to be the GUI to configure some options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think I should duplicate the Windows instructions for building from source into a unix/macOS section (just need to change \ to / actually)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's any differences in the commands, go ahead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, the Windows technique will not work on unix/macOS as APR and APR-Util CMakeLists.txt file are Windows-only implementations.


** Mac OS/X:

APR and APR-Util are provided by the platform in Mac OS/X 10.5 and iODBC in 10.4.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be obvious to you, but cmake does not come with macOS by default. It might help users to add the cmake dependencies explicit in the install commands given here for various operating systems.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you tell what to add as I do not have macOS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The most common installer is via brew install cmake using homebrew or it can always be downloaded from their binaries page.

@stephen-webb
Copy link
Contributor Author

stephen-webb commented Feb 9, 2020 via email

@ams-tschoening
Copy link
Contributor

So let's close #12 and really focus on this one, replacing things in favour of CMAKE instead of adding it? I don't use the ANT-build myself anyway, so would focus on that site generation etc. still works. It's just that things might break for other users.

src/test/cpp/net/socketserverstarter.cpp Show resolved Hide resolved
src/test/java/CMakeLists.txt Outdated Show resolved Hide resolved
src/test/cpp/net/socketserverstarter.cpp Outdated Show resolved Hide resolved
src/test/cpp/net/socketserverstarter.cpp Outdated Show resolved Hide resolved
@@ -478,4 +477,4 @@ LOGUNIT_CLASS(SocketServerTestCase)
const File SocketServerTestCase::TEMP("output/temp");
const File SocketServerTestCase::FILTERED("output/filtered");

LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(SocketServerTestCase)
LOGUNIT_TEST_SUITE_REGISTRATION(SocketServerTestCase)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this test really be enabled? While your CMAKE-build might handle things automatically, it might be more difficult for users without CMAKE. Took me a while to figure things out based on this commit myself and the test still fails currently...

set PATH=C:\Program Files\Java\jdk-8\bin;C:\Program Files (x86)\UnxUtils\usr\local\wbin;%PATH%
set TEST_PROJ=%cd%
set LOG4CXX_VER_BASE=..\..\..\..
set TEST_SRC=%LOG4CXX_VER_BASE%\src\src\test
set TEST_RES=%TEST_SRC%\resources

set TOTO=wonderful
set key1=value
set key2=value2

set log4j_CLASSPATH=%LOG4CXX_VER_BASE%\..\..\..\..\Java\log4j-1.2.17.jar
set SOCKET_SERVER_SOURCES=%TEST_SRC%\java\org\apache\log4j\net\ShortSocketServer.java
set SOCKET_SERVER_CLASSPATH=%TEST_RES%;%log4j_CLASSPATH%
set CLASSPATH=%SOCKET_SERVER_CLASSPATH%
set SOCKET_SERVER_COMMAND=C:\Program Files\Java\jdk-8\bin\java.exe;org.apache.log4j.net.ShortSocketServer;8;input/socketServer

pushd "%TEST_RES%"
javac -d "." -classpath "%log4j_CLASSPATH%" "%SOCKET_SERVER_SOURCES%"
"%TEST_PROJ%\Win32\Debug\out\%~n0.exe" %*
popd

goto :EOF

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disabling a testcase is needed when building multiple tests into a single executable. To run a disabled test case you then need to add it as a parameter.
The socketservertestcase excutable has only one test case so I do not think it is appropriate to disable it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point is not about different executables, but that this one test case only requires additional Java and is difficult to setup. It has been disabled in the past for a long time already:

b279aa7#diff-78b9ec5d590a88f742877f2f096c52a9R51

@ams-tschoening
Copy link
Contributor

@stephen-webb Does socketservertestcase succeed for your? I get the following error messages for two tests which use the %C format flag in their configs:

|Files [output/filtered] and [witness/socketServer.2] differ on line 1
One reads:  [TRACE T2 [main] ? (socketservertestcase.cpp:XXX) Message 1].
Other reads:[TRACE T2 [main] SocketServerTestCase (socketservertestcase.cpp:XXX) Message 1].
--------------------------------
Contents of output/filtered:
1   : TRACE T2 [main] ? (socketservertestcase.cpp:XXX) Message 1
[...]
--------------------------------
Contents of witness/socketServer.2:
1   : TRACE T2 [main] SocketServerTestCase (socketservertestcase.cpp:XXX) Message 1

I have no idea where that ? comes from...

src/site/apt/building/cmake.apt Show resolved Hide resolved
src/site/apt/building/cmake.apt Show resolved Hide resolved
src/site/apt/building/vcpkg.apt Show resolved Hide resolved
@ams-tschoening
Copy link
Contributor

@ams-tschoening
Copy link
Contributor

ams-tschoening commented Feb 10, 2020

I have no idea where that ? comes from...

I think the log settings and witnesses were simply wrong, because the test has been disabled so long. %C gets the issuing class of a log statement, which might not be possible at all if a message is sent over network. %c works perfectly instead, maybe %C had a different fallback than ? in the past? the following commit describes the changes after which all tests succeed for me:

0baf607

I've additionally applied reformatting to the code, because non-tests have been reformatted in the past already and the tests were pretty inconsistent with indentation and stuff. Things look good to merge for me now. I won't have the time to test the CMAKE-stuff myself, but problems can be solved in master in future as well.

Note to self: Try not to forget closing the following issue when this is merged.

https://issues.apache.org/jira/browse/LOGCXX-494

@ams-tschoening
Copy link
Contributor

Using com.googlecode.cmake-maven-project with OpenJDK 8 fails, because they require JDK 11 for around a year now. Version 3.7.2 seems to be the last building with JDK 8.

Targetting older versions of CMAKE has been asked before as well and 3.7 was the preferred target then as well.

So, is it really necessary to use these current versions instead of older ones? Are the Maven plugin and the version of CMAKE bound at each other? Simply downgrading the MVN-plugin doesn't work:

[ERROR] Failed to execute goal com.googlecode.cmake-maven-project:cmake-maven-plugin:3.7.2-b1:generate (cmake-generate) on project apache-log4cxx: The parameters 'generator' for goal com.googlecode.cmake-maven-project:cmake-maven-plugin:3.7.2-b1:generate are missing or invalid -> [Help 1]

https://github.com/cmake-maven-project/cmake-maven-project/blame/release-3.7.2-b1/README.md#L30

@stephen-webb
Copy link
Contributor Author

stephen-webb commented Feb 11, 2020 via email

@ams-tschoening
Copy link
Contributor

I'm trying to test CMAKE and MVN on Sunday myself, just out of interest to see what happens, but nevertheless, as long as nobody objects, going to merge ghpr_14_replace-ant-build-with-cmake anyway. That contains this PR entirely, but some additional code style fixes as well.

So until Sunday, people should base their work on ghpr_14_replace-ant-build-with-cmake, like #16 was, and afterwards things simply need to be fixed as necessary in master.

@asfgit asfgit merged commit 3775ffa into apache:master Feb 16, 2020
@stephen-webb stephen-webb deleted the replace-ant-build-with-cmake branch February 17, 2020 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants