@@ -863,16 +863,6 @@ tasks.register('fetch') {
863863 println " =" * 70
864864 println " "
865865
866- // Step 1: Update build.properties with today's date
867- printInfo " Step 1: Updating build.properties with current date..."
868- def buildPropsFile = file(' build.properties' )
869- def buildPropsContent = buildPropsFile. text
870- def today = new Date (). format(' yyyy.MM.dd' )
871- buildPropsContent = buildPropsContent. replaceAll(/ bundle\. release\s *=\s *\d {4}\.\d {2}\.\d {2}/ , " bundle.release = ${ today} " )
872- buildPropsFile. text = buildPropsContent
873- printOk " Updated bundle.release to ${ today} "
874- println " "
875-
876866 // Extract major.minor version (e.g., 8.4 from 8.4.15)
877867 def versionParts = versionToBuild. split(' \\ .' )
878868 def majorMinor = " ${ versionParts[0]} .${ versionParts[1]} "
@@ -1137,7 +1127,6 @@ tasks.register('fetch') {
11371127 println " "
11381128 printInfo " Summary:"
11391129 printInfo " - PHP Version: ${ versionToBuild} "
1140- printInfo " - Bundle Release: ${ today} "
11411130 printInfo " - Release Tag: ${ releaseTag} "
11421131 printInfo " - Files Updated: ${ filesUpdated} "
11431132 printInfo " - Dependencies Found: ${ updates.size()} "
@@ -1443,10 +1432,98 @@ tasks.register('packageRelease') {
14431432 dependsOn archiveFormat == ' 7z' ? ' packageRelease7z' : ' packageReleaseZip'
14441433}
14451434
1435+ // Task: Test PHP extensions
1436+ tasks. register(' testExtensions' ) {
1437+ group = ' verification'
1438+ description = ' Verify PHP extension DLLs exist and are valid'
1439+ dependsOn ' releaseBuild'
1440+
1441+ doLast {
1442+ def versionToBuild = bundleVersionProvider. getOrNull()
1443+ if (! versionToBuild) {
1444+ throw new GradleException (" bundleVersion property not set" )
1445+ }
1446+
1447+ def bundleFolder = " ${ bundleName}${ versionToBuild} "
1448+ def phpBuildPath = file(" ${ bundleTmpBuildPath} /${ bundleFolder} " )
1449+
1450+ if (! phpBuildPath. exists()) {
1451+ println " [SKIP] Build path not found: ${ phpBuildPath} "
1452+ return
1453+ }
1454+
1455+ println " "
1456+ println " =" . multiply(70 )
1457+ println " Verifying PHP Extensions"
1458+ println " =" . multiply(70 )
1459+ println " "
1460+
1461+ // Get expected extensions from exts.properties
1462+ def bundlePath = new File (projectDir, " bin/${ bundleName}${ versionToBuild} " )
1463+ if (! bundlePath. exists()) {
1464+ bundlePath = new File (projectDir, " bin/archived/${ bundleName}${ versionToBuild} " )
1465+ }
1466+
1467+ def extsFile = new File (bundlePath, ' exts.properties' )
1468+ def expectedExtensions = []
1469+
1470+ if (extsFile. exists()) {
1471+ def exts = new Properties ()
1472+ extsFile. withInputStream { exts. load(it) }
1473+ exts. each { key , url ->
1474+ def extName = key. toString()
1475+ expectedExtensions. add(extName)
1476+ }
1477+ }
1478+
1479+ // Verify that extension DLLs exist and are valid
1480+ def allPassed = true
1481+ def missingExtensions = []
1482+ println " Checking extension DLLs:"
1483+ expectedExtensions. each { extName ->
1484+ def dllFile = new File (phpBuildPath, " ext/php_${ extName} .dll" )
1485+ def exists = dllFile. exists()
1486+
1487+ if (exists) {
1488+ // Verify it's a valid 64-bit DLL
1489+ try {
1490+ validateDllArchitecture(dllFile)
1491+ println " [PASS] ${ extName} (${ dllFile.name} )"
1492+ } catch (Exception e) {
1493+ println " [FAIL] ${ extName} - Invalid DLL: ${ e.message} "
1494+ allPassed = false
1495+ missingExtensions. add(extName)
1496+ }
1497+ } else {
1498+ println " [FAIL] ${ extName} - DLL not found"
1499+ allPassed = false
1500+ missingExtensions. add(extName)
1501+ }
1502+ }
1503+ println " "
1504+
1505+ // Store results for final summary
1506+ def testResultsFile = file(" ${ buildTmpPath} /.gradle-extensionTest" )
1507+ testResultsFile. parentFile. mkdirs()
1508+ testResultsFile. text = " ${ allPassed} \n ${ expectedExtensions.size()} ,${ expectedExtensions.size()} "
1509+
1510+ if (allPassed) {
1511+ println " Verified ${ expectedExtensions.size()} extension DLLs - All present and valid"
1512+ } else {
1513+ println " Verified ${ expectedExtensions.size()} extension DLLs - ${ missingExtensions.size()} issues: ${ missingExtensions.join(', ')} "
1514+ }
1515+ println " "
1516+ println " Note: Extensions will be tested for loading when deployed in Bearsampp environment"
1517+ println " =" . multiply(70 )
1518+ println " "
1519+ }
1520+ }
1521+
14461522// Task: Generate hash files for the produced archive (.md5, .sha1, .sha256, .sha512)
14471523tasks. register(' generateHashes' ) {
14481524 group = ' build'
14491525 description = ' Generate hash sidecar files for the packaged archive'
1526+ dependsOn ' testExtensions'
14501527
14511528 doLast {
14521529 def versionToBuild = bundleVersionProvider. getOrNull()
@@ -1483,16 +1560,44 @@ tasks.register('generateHashes') {
14831560 writeHash(' SHA-256' , ' sha256' )
14841561 writeHash(' SHA-512' , ' sha512' )
14851562
1563+ // Read test results
1564+ def testResultsFile = file(" ${ buildTmpPath} /.gradle-extensionTest" )
1565+ def testPassed = true
1566+ def expectedCount = 0
1567+
1568+ if (testResultsFile. exists()) {
1569+ def lines = testResultsFile. text. split(' \n ' )
1570+ testPassed = lines[0 ] == ' true'
1571+ if (lines. size() > 1 ) {
1572+ def parts = lines[1 ]. split(' ,' )
1573+ expectedCount = parts[0 ]. toInteger()
1574+ }
1575+ }
1576+
14861577 // Print final success message
14871578 println " "
14881579 println " =" . multiply(70 )
1489- println " [SUCCESS] Release build completed successfully for version ${ versionToBuild} "
1580+
1581+ if (testPassed) {
1582+ println " [SUCCESS] Release build completed successfully for version ${ versionToBuild} "
1583+ } else {
1584+ println " [WARNING] Release build completed with extension issues for version ${ versionToBuild} "
1585+ }
1586+
14901587 println " "
14911588 println " Build directories:"
14921589 println " Temp prep: ${ file("${bundleTmpPrepPath}/${bundleName}${versionToBuild}").absolutePath} "
14931590 println " Build output: ${ file("${bundleTmpBuildPath}/${bundleName}${versionToBuild}").absolutePath} "
14941591 println " "
14951592 println " Archive: ${ new File(externalOutputDir, "bearsampp-${bundleName}-${versionToBuild}-${bundleRelease}").absolutePath} .${ extFormat} "
1593+
1594+ if (expectedCount > 0 ) {
1595+ println " "
1596+ println " Extension Verification:"
1597+ println " Verified: ${ expectedCount} "
1598+ println " Status: ${ testPassed ? '[PASS] All extension DLLs present and valid' : '[FAIL] Some extension DLLs missing or invalid'} "
1599+ }
1600+
14961601 println " =" . multiply(70 )
14971602 }
14981603}
0 commit comments