@@ -170,23 +170,23 @@ dependencies {
170170def isReleaseBuild = project. hasProperty(" buildType" ) && project. buildType == " release"
171171def cxxBuildVariantDirName = isReleaseBuild ? " Release" : " Debug"
172172def thirdPartySourceDir = file(" ${ project.projectDir} /../third_party" ). absolutePath
173- def otelSourceDir = " $thirdPartySourceDir /opentelemetry-cpp"
174173def protobufSourceDir = " $thirdPartySourceDir /protobuf"
175174def openSSLForAndroidSourceDir = " $thirdPartySourceDir /openssl_for_android"
176175def brotliSourceDir = " $thirdPartySourceDir /brotli"
177176def zlibSourceDir = " $thirdPartySourceDir /zlib"
178177def curlSourceDir = " $thirdPartySourceDir /curl"
179178def wrapperRootDir = " $thirdPartySourceDir /wrapper"
180- def getWrapperBuildDir = { String abi -> " $wrapperRootDir /android/$cxxBuildVariantDirName /$abi " }
181- def getGeneric3PBuildDir = { String libName , String abi -> " $wrapperRootDir /android/$cxxBuildVariantDirName /$abi /$libName " }
179+ def wrapperBuildDir = " $wrapperRootDir /android"
180+ def getCmakeInstallDir = { String abi -> " $wrapperBuildDir /install/$abi " }
181+ def getGeneric3PBuildDir = { String libName , String abi -> " $wrapperBuildDir /$cxxBuildVariantDirName /$abi /$libName " }
182182def getProtobufBuildDir = { String abi -> getGeneric3PBuildDir(" protobuf" , abi) }
183183def getOpenSSLForAndroidBuildDir = { String abi -> new File (openSSLForAndroidSourceDir, " openssl_${ opensslVersion} _${ abi} " ). path }
184184def getBrotliBuildDir = { String abi -> getGeneric3PBuildDir(" brotli" , abi) }
185185def getZlibBuildDir = { String abi -> getGeneric3PBuildDir(" zlib" , abi) }
186186def getCurlBuildDir = { String abi -> getGeneric3PBuildDir(" curl" , abi) }
187- def getCmakeInstallDir = { String abi -> " $wrapperRootDir /android/install/$abi " }
188187
189188def prepareOttreliteInteropHeadersTask = tasks. register(' prepareOttreliteInteropHeadersTask' , Copy ) {
189+ println (" Preparing Ottrelite Interop OTEL headers..." )
190190 from files(
191191 fileTree(' ../cpp/include/public/' ),
192192 fileTree(' ../nitrogen/generated/shared/c++/' )
@@ -237,7 +237,7 @@ tasks.register("buildOpenSSL") {
237237 copy {
238238 from tarTree(tarFile. path)
239239
240- // below: actually, the script creates the openssl-${opensslVersion} directory by itself
240+ // below: actually, the script appends the openssl-${opensslVersion} directory by itself
241241 into openSSLSourceDirFile. parent
242242 }
243243 } else {
@@ -571,81 +571,35 @@ tasks.register("buildAndInstallProtobuf") {
571571 }
572572}
573573
574- // // CPP wrapper + OTEL CPP SDK
575- // tasks.register("buildAndInstallCppWrapper") {
576- // doFirst {
577- // if (!new File(otelSourceDir, "CMakeLists.txt").exists()) {
578- // println("[@ottrelite/interop-otel] Cloning OpenTelemetry C++ SDK to ${otelSourceDir}...")
579- //
580- // if (!file(otelSourceDir).exists()) {
581- // file(otelSourceDir).mkdirs()
582- // exec {
583- // commandLine "git", "clone", "--depth", "1", "--branch", "v1.23.0", "https://github.com/open-telemetry/opentelemetry-cpp.git", otelSourceDir
584- // }
585- // }
586- // } else {
587- // println("[@ottrelite/interop-otel] OpenTelemetry C++ SDK already cloned in ${otelSourceDir}")
588- // }
589- // }
590- //
591- // doLast {
592- // reactNativeArchitectures().each { abi ->
593- // def wrapperBuildDir = getWrapperBuildDir(abi)
594- // def cmakeInstallDir = getCmakeInstallDir(abi)
595- //
596- // println("[@ottrelite/interop-otel] Building & installing artifacts for ABI $abi, this may take a while...")
597- //
598- // if (!new File(wrapperBuildDir).exists()) {
599- // file(wrapperBuildDir).mkdirs()
600- // }
601- //
602- // exec {
603- // println("[@ottrelite/interop-otel] Configuring for ABI $abi from ${thirdPartySourceDir} and writing to ${wrapperBuildDir}...")
604- //
605- // commandLine "cmake", "-S", thirdPartySourceDir, "-B", wrapperBuildDir,
606- // "-DANDROID_ABI=$abi",
607- // "-DANDROID_PLATFORM=${android.defaultConfig.minSdkVersion.apiLevel}",
608- // "-DCMAKE_TOOLCHAIN_FILE=${android.ndkDirectory}/build/cmake/android.toolchain.cmake",
609- // "-DCMAKE_BUILD_TYPE=${cxxBuildVariantDirName}",
610- // "-DCMAKE_CXX_FLAGS_DEBUG=-g",
611- // "-DProtobuf_DIR=$cmakeInstallDir/lib/cmake/protobuf",
612- // "-Dabsl_DIR=$cmakeInstallDir/lib/cmake/absl",
613- // "-Dutf8_range_DIR=$cmakeInstallDir/lib/cmake/utf8_range",
614- // "-DCURL_DIR=$cmakeInstallDir/lib/cmake/CURL",
615- // "-DOPENSSL_ROOT_DIR=${cmakeInstallDir}",
616- // "-DOPENSSL_SSL_LIBRARY=${cmakeInstallDir}/lib/libssl.a",
617- // "-DOPENSSL_CRYPTO_LIBRARY=${cmakeInstallDir}/lib/libcrypto.a",
618- // "-DOPENSSL_INCLUDE_DIR=${cmakeInstallDir}/include"
619- // }
620- //
621- // println("[@ottrelite/interop-otel] Building for ABI $abi ${wrapperBuildDir}...")
622- //
623- // exec {
624- // commandLine "cmake", "--build", wrapperBuildDir, "-j8"
625- // }
626- //
627- // println("[@ottrelite/interop-otel] Installing build artifacts for ABI $abi to ${cmakeInstallDir}...")
628- //
629- // exec {
630- // commandLine "cmake", "--install", wrapperBuildDir, "--prefix", cmakeInstallDir
631- // }
632- //
633- // println("[@ottrelite/interop-otel] Build & install finished for ABI $abi")
634- // }
635- // }
636- // }
637- //
638- // buildAndInstallCppWrapper.dependsOn(copyOpenSSL)
639- // buildAndInstallCppWrapper.dependsOn(buildAndInstallProtobuf)
640- // buildAndInstallCppWrapper.dependsOn(buildAndInstallBrotli)
641- // buildAndInstallCppWrapper.dependsOn(buildAndInstallZlib)
642- // buildAndInstallCppWrapper.dependsOn(buildAndInstallCURL)
643-
644- // tasks.matching { it.name.startsWith("buildCMake") }.all { task ->
645574preBuild. dependsOn(copyOpenSSL)
646575preBuild. dependsOn(buildAndInstallProtobuf)
647576preBuild. dependsOn(buildAndInstallBrotli)
648577preBuild. dependsOn(buildAndInstallZlib)
649578preBuild. dependsOn(buildAndInstallCURL)
650- // }
651579
580+ tasks. named(' clean' ) {
581+ doLast {
582+ reactNativeArchitectures(). each { abi ->
583+ def wrapperBuildDirFile = new File (wrapperBuildDir)
584+
585+ if (wrapperBuildDirFile. exists()) {
586+ println " Deleting wrapper build directory: ${ wrapperBuildDirFile.path} "
587+ delete(wrapperBuildDirFile)
588+ }
589+
590+ def openSSLBuildDirFile = new File (getOpenSSLForAndroidBuildDir(abi))
591+
592+ if (openSSLBuildDirFile. exists()) {
593+ println " Deleting OpenSSL build directory: ${ openSSLBuildDirFile.path} "
594+ delete(openSSLBuildDirFile)
595+ }
596+
597+ def cmakeInstallDirFile = getCmakeInstallDir(abi)
598+
599+ if (cmakeInstallDirFile. exists()) {
600+ println " Deleting dependencies install directory: ${ cmakeInstallDirFile.path} "
601+ delete(cmakeInstallDirFile)
602+ }
603+ }
604+ }
605+ }
0 commit comments