1+ plugins {
2+ id " de.undercouch.download" version " 3.4.3"
3+ }
4+
15apply plugin : ' cpp'
26apply from : ' common.gradle'
7+ apply plugin : ' de.undercouch.download'
38
49def coverageEnabled = System . getenv(' enableCoverage' )
510def target_system = System . getProperty(' targetSystem' ) ?: ' centos6'
@@ -46,7 +51,7 @@ project.ext {
4651
4752 apache22Version = " 2.2.31"
4853 apache24Version = " 2.4.23"
49- nginxVersion = ' 1.18.0 '
54+ nginxSupportedVersions = props . get( " nginxSupportedVersions " ) . split( ' , ' )
5055
5156 libraryStageDir = " ${ platBuildDir} /opentelemetry-webserver-sdk"
5257 apacheStageDir = " ${ libraryStageDir} /WebServerModule/Apache"
@@ -360,83 +365,98 @@ task assembleApacheModule(type: Tar) {
360365}
361366
362367// NGINX
363- task extractNginx (type : Copy ) {
364- from " build-dependencies"
365- into buildDir
366- }
367-
368- task configureNginx (type : Exec ){
369- group = ' OpenTelemetry module for Nginx'
370- description = ' Run configure to generate the build files for OpenTelemetry Module for Nginx'
371-
372- dependsOn extractNginx
368+ nginxSupportedVersions. each { nginxVersion ->
369+ task(" downloadNginx${ nginxVersion} " , type : Download ) {
370+ src " http://nginx.org/download/nginx-${ nginxVersion} .tar.gz"
371+ dest buildDir
372+ overwrite false
373+ }
373374
374- workingDir " ${ buildDir} /nginx-${ nginxVersion} "
375- commandLine ' ./configure' , " --with-compat" , " --with-cc-opt=-Wno-error -Wno-unused-variable -Wno-unused-but-set-variable" , " --with-ld-opt=-L${ libraryStageDir} /sdk_lib/lib" , " --add-dynamic-module=${ projectDir} /src/nginx"
376- }
375+ task(" extractNginx${ nginxVersion} " , type : Copy ) {
376+ dependsOn " downloadNginx${ nginxVersion} "
377+ from tarTree(resources. gzip(" build/nginx-${ nginxVersion} .tar.gz" ))
378+ into buildDir
379+ }
377380
378- task delMakefile ( type : Exec ){
379- group = ' OpenTelemetry module for Nginx'
380- description = ' Deleting old Makefile '
381+ task( " configureNginx ${ nginxVersion } " , type : Exec ) {
382+ group = ' OpenTelemetry module for Nginx'
383+ description = ' Run configure to generate the build files for OpenTelemetry Module for Nginx '
381384
382- workingDir " ${ buildDir} /nginx-${ nginxVersion} /objs"
383- commandLine ' rm' , ' -rf' , ' Makefile'
384- }
385+ dependsOn " extractNginx${ nginxVersion} "
386+ workingDir " ${ buildDir} /nginx-${ nginxVersion} "
387+ commandLine ' ./configure' , " --with-compat" , " --with-cc-opt=-Wno-error -Wno-unused-variable -Wno-unused-but-set-variable" , " --with-ld-opt=-L${ libraryStageDir} /sdk_lib/lib" , " --add-dynamic-module=${ projectDir} /src/nginx"
388+ }
385389
386- task copyMakefile ( type : Copy ) {
387- group = ' OpenTelemetry module for Nginx'
388- description = ' Copying Makefile for compiling Nginx Web Server Agent '
390+ task( " delMakefile ${ nginxVersion } " , type : Exec ) {
391+ group = ' OpenTelemetry module for Nginx'
392+ description = ' Deleting old Makefile '
389393
390- dependsOn delMakefile
394+ workingDir " ${ buildDir} /nginx-${ nginxVersion} /objs"
395+ commandLine ' rm' , ' -rf' , ' Makefile'
396+ }
391397
392- from " src/nginx/Makefile "
393- into " ${ buildDir } /nginx- ${ nginxVersion } /objs/ "
394- }
398+ task( " copyMakefile ${ nginxVersion } " , type : Copy ) {
399+ group = ' OpenTelemetry module for Nginx '
400+ description = ' Copying Makefile for compiling Nginx Web Server Agent '
395401
396- task buildNginxModule (type : Exec ) {
397- group = ' OpenTelemetry module for Nginx'
398- description = ' Build the Nginx Web Server Agent'
402+ dependsOn " delMakefile${ nginxVersion} "
403+ from " src/nginx/Makefile"
404+ into " ${ buildDir} /nginx-${ nginxVersion} /objs/"
405+ }
399406
400- dependsOn configureNginx
401- dependsOn stageLibrary
402- dependsOn copyMakefile
407+ task( " updateMakefile ${ nginxVersion } " , type : Exec ) {
408+ group = ' OpenTelemetry module for Nginx '
409+ description = ' Updating the Makefile for dynamic build '
403410
404- outputs. file " ${ buildDir} /nginx-${ nginxVersion} /objs/ngx_http_opentelemetry_module.so"
411+ commandLine ' bash' , ' -c' , " src/nginx/script.sh ${ buildDir} /nginx-${ nginxVersion} /objs/Makefile"
412+ }
405413
406- workingDir " ${ buildDir } /nginx- ${ nginxVersion} "
407- commandLine ' make ' , ' modules '
408- }
414+ task( " buildNginxModule ${ nginxVersion} " , type : Exec ) {
415+ group = ' OpenTelemetry module for Nginx '
416+ description = ' Build the Nginx Web Server Agent '
409417
410- task stageNginxModule ( type : Copy ) {
411- group = ' OpenTelemetry module for Nginx '
412- description = ' Stage the Nginx Web Server Agent distribution directory '
418+ dependsOn " configureNginx ${ nginxVersion } "
419+ dependsOn stageLibrary
420+ dependsOn " updateMakefile ${ nginxVersion } "
413421
414- // dependsOn stageLibrary
422+ outputs. file " ${ buildDir} /nginx-${ nginxVersion} /objs/ngx_http_opentelemetry_module.so"
423+ workingDir " ${ buildDir} /nginx-${ nginxVersion} "
424+ commandLine ' make' , ' modules'
425+ }
415426
416- from buildNginxModule
417- into nginxStageDir
418- }
427+ task( " stageNginxModule ${ nginxVersion } " , type : Copy ) {
428+ group = ' OpenTelemetry module for Nginx '
429+ description = ' Stage the Nginx Web Server Agent distribution directory '
419430
420- task stripNginxModule (type : Exec ){
421- group = ' OpenTelemetry module for Nginx'
422- description = ' Strip the production Nginx Web Server Agent'
431+ dependsOn " buildNginxModule${ nginxVersion} "
432+ def nginxStageDirVersion = " ${ nginxStageDir} /${ nginxVersion} "
433+ from " ${ buildDir} /nginx-${ nginxVersion} /objs/ngx_http_opentelemetry_module.so"
434+ into nginxStageDirVersion
435+ }
423436
424- dependsOn stageNginxModule
437+ task(" stripNginxModule${ nginxVersion} " , type : Exec ) {
438+ group = ' OpenTelemetry module for Nginx'
439+ description = ' Strip the production Nginx Web Server Agent'
425440
426- onlyIf { ! debug }
441+ dependsOn " stageNginxModule${ nginxVersion} "
442+ onlyIf { ! debug }
427443
428- inputs. dir stageNginxModule
429- outputs. file " ${ nginxStageDir} /ngx_http_opentelemetry_module.${ sharedLibraryExt} "
444+ inputs. dir " stageNginxModule${ nginxVersion } "
445+ outputs. file " ${ nginxStageDir} / ${ nginxVersion } /ngx_http_opentelemetry_module.${ sharedLibraryExt} "
430446
431- workingDir nginxStageDir
432- commandLine ' strip' , ' -x' , " ngx_http_opentelemetry_module.${ sharedLibraryExt} "
447+ workingDir " ${ nginxStageDir} /${ nginxVersion} "
448+ commandLine ' strip' , ' -x' , " ngx_http_opentelemetry_module.${ sharedLibraryExt} "
449+ }
433450}
434451
435452task assembleNginxModule (type : Tar ) {
436453 group = ' Nginx Web Server Module'
437454 description = ' Assemble the Nginx Web Server module artifact (tgz)'
438455
439- dependsOn stripNginxModule
456+ nginxSupportedVersions. each {
457+ nginxVersion ->
458+ dependsOn " stripNginxModule${ nginxVersion} "
459+ }
440460
441461 from libraryStageDir
442462 baseName " opentelemetry-webserver-sdk-${ osArch} -${ osName} "
@@ -451,7 +471,10 @@ task assembleWebServerModule(type: Tar) {
451471 description = ' Assemble the Web Server agent artifact (tgz)'
452472
453473 dependsOn stripApacheModule
454- dependsOn stripNginxModule
474+ nginxSupportedVersions. each {
475+ nginxVersion ->
476+ dependsOn " stripNginxModule${ nginxVersion} "
477+ }
455478
456479 from libraryStageDir
457480 baseName " opentelemetry-webserver-sdk-${ osArch} -${ osName} "
0 commit comments