Skip to content

Commit

Permalink
Feature gradle (#1943)
Browse files Browse the repository at this point in the history
* Fix ".. has no member named ... compile error" (#1938)

* Fix ".. has no member named ... compile error" by renaming apache conn_rec
attributes

 - conn_rec attributes remote_ip and remote_addr were replaced by client_ip
 and client_addr once they have been renamed in Apache 2.4
 - a server_rec pointer must be passed to ap_log_error() since apache 2.4,
 therefore, a change was necessary at the ap_log_error log function.
 A null pointer has been passed for avoiding deeper changes at the function.
 - the smart pointer auto_ptr was replaced by unique_ptr once it was made
 deprecated in C++11 standard, it has been replaced by unique_ptr.

* Add the properly #ifdef directives for backward compatibility purposes

 - Adding proper #ifdef preprocessor directives to keeping backward
 compatibility with older apache versions.

* Update ApacheConnector.cpp

* Add Gradle build.scripts

Signed-off-by: zosrothko <zosrothko@orange.fr>

* New files

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add distrib directory

Signed-off-by: zosrothko <zosrothko@orange.fr>

* Add PostgreSQL. Remove POCO_NO_WSTRING

Signed-off-by: zosrothko <zosrothko@orange.fr>
  • Loading branch information
zosrothko authored and aleks-f committed Oct 18, 2017
1 parent 4a8d522 commit 696c8e2
Show file tree
Hide file tree
Showing 88 changed files with 25,199 additions and 16 deletions.
18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ config.build
config.make

# CMake #
########
#########
cmake_install.cmake
cmake_uninstall.cmake
CMakeFiles
Expand All @@ -31,6 +31,21 @@ CPackConfig.cmake
CPackSourceConfig.cmake
cmake_*

# Gradle #
##########
.gradle
gradle/

# NuGet #
#########
*.nupkg

# WiX #
#######
*.msi
*.wixobj
*.wixpdb

# Packages #
############
# it's better to unpack these files and commit the raw source
Expand All @@ -51,6 +66,7 @@ cmake_*
*.db
test*.txt
XML/testsuite/rss.xml
Zip/testsuite/test.dat

# OS generated files #
######################
Expand Down
41 changes: 29 additions & 12 deletions ApacheConnector/src/ApacheConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,13 @@ void ApacheRequestRec::copyHeaders(ApacheServerRequest& request)

void ApacheConnector::log(const char* file, int line, int level, int status, const char *text)
{
ap_log_error(file, line, level, 0, NULL, "%s", text);
// ap_log_error() has undergone significant changes in Apache 2.4.
// Validate Apache version for using a proper ap_log_error() version.
#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER < 4
ap_log_error(file, line, level, 0, NULL, "%s", text);
#else
ap_log_error(file, line, level, 0, NULL, 0, text);
#endif
}


Expand All @@ -170,23 +176,34 @@ extern "C" int ApacheConnector_handler(request_rec *r)

apr_status_t rv;
if ((rv = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)))
return rv;

std::auto_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
&rec,
r->connection->local_ip,
r->connection->local_addr->port,
r->connection->remote_ip,
r->connection->remote_addr->port));

std::auto_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));
return rv;

// The properties conn_rec->remote_ip and conn_rec->remote_addr have undergone significant changes in Apache 2.4.
// Validate Apache version for using conn_rec->remote_ip and conn_rec->remote_addr proper versions.
#if AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER < 4
std::unique_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
&rec,
r->connection->local_ip,
r->connection->local_addr->port,
r->connection->remote_ip,
r->connection->remote_addr->port));
#else
std::unique_ptr<ApacheServerRequest> pRequest(new ApacheServerRequest(
&rec,
r->connection->local_ip,
r->connection->local_addr->port,
r->connection->client_ip,
r->connection->client_addr->port));
#endif

std::unique_ptr<ApacheServerResponse> pResponse(new ApacheServerResponse(pRequest.get()));

// add header information to request
rec.copyHeaders(*pRequest);

try
{
std::auto_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));
std::unique_ptr<HTTPRequestHandler> pHandler(app.factory().createRequestHandler(*pRequest));

if (pHandler.get())
{
Expand Down
32 changes: 32 additions & 0 deletions CppParser/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
model {
components {
CppParser(NativeLibrarySpec) {
sources {
rc {
source {
srcDir '..'
include 'DLLVersion.rc'
}
}
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
binaries {
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "CppParser_EXPORTS"
}
}
}
}
task poco { dependsOn "assemble" }
52 changes: 52 additions & 0 deletions CppParser/testsuite/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec

model {
components {
TestSuite(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
exclude '*Driver.cpp'
}
exportedHeaders {
srcDir 'src'
}
lib project: ':CppUnit', library: 'CppUnit'
lib project: ':CppParser', library: 'CppParser'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
testSuites {
CppParserTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
}
}
binaries {
all {
if (toolChain in VisualCpp) {
if (buildType == buildTypes.debug) {
cCompiler.args "/MDd"
cppCompiler.args "/MDd"
} else
if (buildType == buildTypes.release) {
cCompiler.args "/MD"
cppCompiler.args "/MD"
} else {
throw new GradleException("Unknown buildType" + buildType)
}
}
if (toolChain in Gcc) {
}
}
withType(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteBinarySpec) {
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
}
}
}
task testsuite { dependsOn "assemble" }


33 changes: 33 additions & 0 deletions CppUnit/WinTestRunner/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
project(":CppUnit/WinTestRunner") {
model {
components {
PocoWinTestRunner(NativeExecutableSpec) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
}
}
}
}
binaries {
all {
}
withType(SharedLibraryBinarySpec) {
lib project: ':CppUnit', library: 'PocoCppUnit', linkage: 'shared'
if (toolChain in VisualCpp) {
cppCompiler.define "WinTestRunner_EXPORTS"
}
}
withType(StaticLibraryBinarySpec) {
lib project: ':CppUnit', library: 'PocoCppUnit', linkage: 'static'
}
}
}
}

35 changes: 35 additions & 0 deletions CppUnit/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
model {
components {
CppUnit(NativeLibrarySpec) {
sources {
rc {
source {
srcDir '..'
include 'DLLVersion.rc'
}
}
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
}
}
}
}
binaries {
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "CppUnit_EXPORTS"
}
}
withType(StaticLibraryBinarySpec) {
}
}
}
task poco { dependsOn "assemble" }


45 changes: 45 additions & 0 deletions Crypto/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
model {
components {
Crypto(NativeLibrarySpec) {
sources {
rc {
source {
srcDir '..'
include 'DLLVersion.rc'
}
}
cpp {
source {
srcDir 'src'
include '**/*.cpp'
}
exportedHeaders {
srcDir 'include'
}
lib library: 'ssl'
lib library: 'crypto'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
binaries {
all {
if (toolChain in VisualCpp) {
linker.args "ws2_32.lib"
linker.args "iphlpapi.lib"
}
if (toolChain in Gcc) {
linker.args "-lssl"
linker.args "-lcrypto"
}
}
withType(SharedLibraryBinarySpec) {
if (toolChain in VisualCpp) {
cppCompiler.define "Crypto_EXPORTS"
}
}
}
}
task poco { dependsOn "assemble" }

27 changes: 27 additions & 0 deletions Crypto/samples/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
model {
components {
genrsakey(NativeExecutableSpec) {
sources {
cpp.source { srcDir 'genrsakey/src' include '**/*.cpp' }
cpp.lib project: ':Crypto', library: 'Crypto'
cpp.lib project: ':Foundation', library: 'Foundation'
}
}
}
binaries {
all {
}
withType(SharedLibraryBinarySpec) {
lib project: ':Foundation', library: 'Foundation', linkage: 'shared'
}
withType(StaticLibraryBinarySpec) {
lib project: ':Foundation', library: 'Foundation', linkage: 'static'
}
withType(NativeExecutableSpec) {
lib project: ':Foundation', library: 'Foundation', linkage: 'static'
}
}
}
task sample { dependsOn "assemble" }


65 changes: 65 additions & 0 deletions Crypto/testsuite/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec

model {
components {
withType(NativeComponentSpec) {
binaries.withType(NativeBinarySpec) {
if (buildType == buildTypes.debug) {
if (it instanceof NativeExecutableBinarySpec) {
executable.file = toLocalBin(appendDebugSuffix(executable.file), targetPlatform)
}
} else
if (buildType == buildTypes.release) {
if (it instanceof NativeExecutableBinarySpec) {
executable.file = toLocalBin(executable.file, targetPlatform)
}
}
}
}
TestSuite(NativeLibrarySpec) {
sources {
cpp {
source {
srcDir 'src'
include '**/*.cpp'
exclude '*Driver.cpp'
}
exportedHeaders {
srcDir 'src'
}
lib project: ':CppUnit', library: 'CppUnit'
lib project: ':Crypto', library: 'Crypto'
lib library: 'ssl'
lib library: 'crypto'
lib project: ':Foundation', library: 'Foundation'
}
}
}
}
testSuites {
CryptoTestSuite(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteSpec) {
testing $.components.TestSuite
}
}
binaries {
withType(org.gradle.nativeplatform.test.cppunit.CppUnitTestSuiteBinarySpec) {
lib project: ':CppUnit', library: 'CppUnit', linkage: 'shared'
if (toolChain in VisualCpp) {
if (buildType == buildTypes.debug) {
cCompiler.args "/MDd"
cppCompiler.args "/MDd"
} else
if (buildType == buildTypes.release) {
cCompiler.args "/MD"
cppCompiler.args "/MD"
} else {
throw new GradleException("Unknown buildType" + buildType)
}
}
if (toolChain in Gcc) {
}
}
}
}
task testsuite { dependsOn "assemble" }

Loading

0 comments on commit 696c8e2

Please sign in to comment.