Esempio n. 1
0
echo LINE;
echo centered("ICU Resource Bundle Stub Creation") . "\n";
echo LINE;
if (!Intl::isExtensionLoaded()) {
    bailout('The intl extension for PHP is not installed.');
}
if (!class_exists('\\Symfony\\Component\\Icu\\IcuData')) {
    bailout('You must run "composer update --dev" before running this script.');
}
$stubBranch = '1.0.x';
if (IcuData::isStubbed()) {
    bailout("Please switch to a branch of the Icu component that contains .res files (anything but {$stubBranch}).");
}
$shortIcuVersionInPhp = strip_minor_versions(Intl::getIcuVersion());
$shortIcuVersionInIntlComponent = strip_minor_versions(Intl::getIcuStubVersion());
$shortIcuVersionInIcuComponent = strip_minor_versions(IcuData::getVersion());
if ($shortIcuVersionInPhp !== $shortIcuVersionInIcuComponent) {
    bailout("The ICU version of the component ({$shortIcuVersionInIcuComponent}) does not match the ICU version in the intl extension ({$shortIcuVersionInPhp}).");
}
if ($shortIcuVersionInIntlComponent !== $shortIcuVersionInIcuComponent) {
    bailout("The ICU version of the component ({$shortIcuVersionInIcuComponent}) does not match the ICU version of the stub classes in the Intl component ({$shortIcuVersionInIntlComponent}).");
}
echo wordwrap("Make sure that you don't have any ICU development files " . "installed. If the build fails, try to run:\n", LINE_WIDTH);
echo "\n    sudo apt-get remove libicu-dev\n\n";
$icuVersionInIcuComponent = IcuData::getVersion();
echo "Compiling stubs for ICU version {$icuVersionInIcuComponent}.\n";
echo "Preparing stub creation...\n";
$targetDir = sys_get_temp_dir() . '/icu-stubs';
$context = new StubbingContext(IcuData::getResourceDirectory(), $targetDir, new Filesystem(), $icuVersionInIcuComponent);
$transformer = new BundleTransformer();
$transformer->addRule(new LanguageBundleTransformationRule());
Esempio n. 2
0
}
echo LINE;
echo centered('ICU Resource Bundle Compilation') . "\n";
echo LINE;
if (!Intl::isExtensionLoaded()) {
    bailout('The intl extension for PHP is not installed.');
}
$filesystem = new Filesystem();
$urls = parse_ini_file(__DIR__ . '/icu.ini');
echo "icu.ini parsed. Available versions:\n";
$maxVersion = 0;
foreach ($urls as $urlVersion => $url) {
    $maxVersion = IcuVersion::compare($maxVersion, $urlVersion, '<') ? $urlVersion : $maxVersion;
    echo "  {$urlVersion}\n";
}
$shortIcuVersion = strip_minor_versions($maxVersion);
if ($argc >= 2) {
    $sourceDir = $argv[1];
    $svn = new SvnRepository($sourceDir);
    echo "Using existing SVN repository at {$sourceDir}.\n";
} else {
    echo "Starting SVN checkout for version {$shortIcuVersion}. This may take a while...\n";
    $sourceDir = sys_get_temp_dir() . '/icu-data/' . $shortIcuVersion . '/source';
    $svn = SvnRepository::download($urls[$shortIcuVersion], $sourceDir);
    echo "SVN checkout to {$sourceDir} complete.\n";
}
if ($argc >= 3) {
    $buildDir = $argv[2];
} else {
    // Always build genrb so that we can determine the ICU version of the
    // download by running genrb --version
MESSAGE
);
}
echo LINE;
echo centered("ICU Resource Bundle Compilation") . "\n";
echo LINE;
if (!Intl::isExtensionLoaded()) {
    bailout('The intl extension for PHP is not installed.');
}
if (!class_exists('\\Symfony\\Component\\Icu\\IcuData')) {
    bailout('You must run "composer update --dev" before running this script.');
}
$filesystem = new Filesystem();
$icuVersionInPhp = Intl::getIcuVersion();
echo "Found intl extension with ICU version {$icuVersionInPhp}.\n";
$shortIcuVersion = strip_minor_versions($icuVersionInPhp);
$urls = parse_ini_file(__DIR__ . '/icu.ini');
if (!isset($urls[$shortIcuVersion])) {
    bailout('The version ' . $shortIcuVersion . ' is not available in the icu.ini file.');
}
echo "icu.ini parsed. Available versions:\n";
foreach ($urls as $urlVersion => $url) {
    echo "  {$urlVersion}\n";
}
if ($GLOBALS['argc'] >= 2) {
    $sourceDir = $GLOBALS['argv'][1];
    $svn = new SvnRepository($sourceDir);
    echo "Using existing SVN repository at {$sourceDir}.\n";
} else {
    echo "Starting SVN checkout for version {$shortIcuVersion}. This may take a while...\n";
    $sourceDir = sys_get_temp_dir() . '/icu-data/' . $shortIcuVersion . '/source';