mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-12 03:15:35 +08:00
Merge remote-tracking branch 'origin/v3-refactor/libs' into v3-refactor/libs
This commit is contained in:
@@ -22,9 +22,9 @@ class curl
|
|||||||
{
|
{
|
||||||
shell()->cd($lib->getSourceDir())->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ./CMakeLists.txt');
|
shell()->cd($lib->getSourceDir())->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ./CMakeLists.txt');
|
||||||
if (SystemTarget::getTargetOS() === 'Darwin') {
|
if (SystemTarget::getTargetOS() === 'Darwin') {
|
||||||
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/curl/CMakeLists.txt", '/NOT COREFOUNDATION_FRAMEWORK/m', 'FALSE');
|
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/CMakeLists.txt", '/NOT COREFOUNDATION_FRAMEWORK/m', 'FALSE');
|
||||||
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/curl/CMakeLists.txt", '/NOT SYSTEMCONFIGURATION_FRAMEWORK/m', 'FALSE');
|
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/CMakeLists.txt", '/NOT SYSTEMCONFIGURATION_FRAMEWORK/m', 'FALSE');
|
||||||
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/curl/CMakeLists.txt", '/NOT CORESERVICES_FRAMEWORK/m', 'FALSE');
|
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/CMakeLists.txt", '/NOT CORESERVICES_FRAMEWORK/m', 'FALSE');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace StaticPHP\Command;
|
namespace StaticPHP\Command;
|
||||||
|
|
||||||
|
use StaticPHP\Artifact\DownloaderOptions;
|
||||||
use StaticPHP\Package\PackageInstaller;
|
use StaticPHP\Package\PackageInstaller;
|
||||||
use StaticPHP\Util\V2CompatLayer;
|
use StaticPHP\Util\V2CompatLayer;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
@@ -23,6 +24,8 @@ class BuildLibsCommand extends BaseCommand
|
|||||||
new InputOption('no-download', null, null, 'Skip downloading artifacts (use existing cached files)'),
|
new InputOption('no-download', null, null, 'Skip downloading artifacts (use existing cached files)'),
|
||||||
...V2CompatLayer::getLegacyBuildOptions(),
|
...V2CompatLayer::getLegacyBuildOptions(),
|
||||||
]);
|
]);
|
||||||
|
// Downloader options (with 'dl-' prefix to avoid conflicts)
|
||||||
|
$this->getDefinition()->addOptions(DownloaderOptions::getConsoleOptions('dl'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class LicenseDumper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate LICENSE-SUMMARY.json (read-modify-write)
|
// Generate SUMMARY.json (read-modify-write)
|
||||||
$this->generateSummary($target_dir, $license_summary);
|
$this->generateSummary($target_dir, $license_summary);
|
||||||
|
|
||||||
logger()->info("Successfully dumped {$dumped_count} license(s) to: {$target_dir}");
|
logger()->info("Successfully dumped {$dumped_count} license(s) to: {$target_dir}");
|
||||||
@@ -198,7 +198,7 @@ class LicenseDumper
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate LICENSE-SUMMARY.json file with read-modify-write support.
|
* Generate SUMMARY.json file with read-modify-write support.
|
||||||
*
|
*
|
||||||
* @param string $target_dir Target directory
|
* @param string $target_dir Target directory
|
||||||
* @param array<string, array> $license_summary License summary data (license_type => [artifacts])
|
* @param array<string, array> $license_summary License summary data (license_type => [artifacts])
|
||||||
@@ -210,14 +210,14 @@ class LicenseDumper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$summary_file = "{$target_dir}/LICENSE-SUMMARY.json";
|
$summary_file = "{$target_dir}/SUMMARY.json";
|
||||||
|
|
||||||
// Read existing summary if exists
|
// Read existing summary if exists
|
||||||
$existing_data = [];
|
$existing_data = [];
|
||||||
if (file_exists($summary_file)) {
|
if (file_exists($summary_file)) {
|
||||||
$content = file_get_contents($summary_file);
|
$content = file_get_contents($summary_file);
|
||||||
$existing_data = json_decode($content, true) ?? [];
|
$existing_data = json_decode($content, true) ?? [];
|
||||||
logger()->debug('Loaded existing LICENSE-SUMMARY.json');
|
logger()->debug('Loaded existing SUMMARY.json');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize structure
|
// Initialize structure
|
||||||
@@ -225,7 +225,7 @@ class LicenseDumper
|
|||||||
$existing_data['artifacts'] = [];
|
$existing_data['artifacts'] = [];
|
||||||
}
|
}
|
||||||
if (!isset($existing_data['summary'])) {
|
if (!isset($existing_data['summary'])) {
|
||||||
$existing_data['summary'] = ['license_types' => []];
|
$existing_data['summary'] = ['license-types' => []];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge new license information
|
// Merge new license information
|
||||||
@@ -234,30 +234,30 @@ class LicenseDumper
|
|||||||
// Add/update artifact info
|
// Add/update artifact info
|
||||||
$existing_data['artifacts'][$artifact_name] = [
|
$existing_data['artifacts'][$artifact_name] = [
|
||||||
'license' => $license_type,
|
'license' => $license_type,
|
||||||
'dumped_at' => date('Y-m-d H:i:s'),
|
'dumped-at' => date('Y-m-d H:i:s'),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Update license_types summary
|
// Update license_types summary
|
||||||
if (!isset($existing_data['summary']['license_types'][$license_type])) {
|
if (!isset($existing_data['summary']['license-types'][$license_type])) {
|
||||||
$existing_data['summary']['license_types'][$license_type] = [];
|
$existing_data['summary']['license-types'][$license_type] = [];
|
||||||
}
|
}
|
||||||
if (!in_array($artifact_name, $existing_data['summary']['license_types'][$license_type])) {
|
if (!in_array($artifact_name, $existing_data['summary']['license-types'][$license_type])) {
|
||||||
$existing_data['summary']['license_types'][$license_type][] = $artifact_name;
|
$existing_data['summary']['license-types'][$license_type][] = $artifact_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort license types and artifacts
|
// Sort license types and artifacts
|
||||||
ksort($existing_data['summary']['license_types']);
|
ksort($existing_data['summary']['license-types']);
|
||||||
foreach ($existing_data['summary']['license_types'] as &$artifacts) {
|
foreach ($existing_data['summary']['license-types'] as &$artifacts) {
|
||||||
sort($artifacts);
|
sort($artifacts);
|
||||||
}
|
}
|
||||||
ksort($existing_data['artifacts']);
|
ksort($existing_data['artifacts']);
|
||||||
|
|
||||||
// Update totals
|
// Update totals
|
||||||
$existing_data['summary']['total_artifacts'] = count($existing_data['artifacts']);
|
$existing_data['summary']['total-artifacts'] = count($existing_data['artifacts']);
|
||||||
$existing_data['summary']['total_license_types'] = count($existing_data['summary']['license_types']);
|
$existing_data['summary']['total-license-types'] = count($existing_data['summary']['license-types']);
|
||||||
$existing_data['summary']['last_updated'] = date('Y-m-d H:i:s');
|
$existing_data['summary']['last-updated'] = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
// Write JSON file
|
// Write JSON file
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
@@ -265,6 +265,6 @@ class LicenseDumper
|
|||||||
json_encode($existing_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)
|
json_encode($existing_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)
|
||||||
);
|
);
|
||||||
|
|
||||||
logger()->info('Generated LICENSE-SUMMARY.json with ' . $existing_data['summary']['total_artifacts'] . ' artifact(s)');
|
logger()->info('Generated SUMMARY.json with ' . $existing_data['summary']['total-artifacts'] . ' artifact(s)');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user