Skip to content

Commit 39d2f4e

Browse files
authored
Fix typo and Add update package.xml (swoole#4211)
1 parent 46ab345 commit 39d2f4e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tools/next-version.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ class Version
1515

1616
function getVersion()
1717
{
18-
$versoin = implode('.', [$this->major, $this->minor, $this->release]);
18+
$version = implode('.', [$this->major, $this->minor, $this->release]);
1919
if ($this->extra) {
20-
$versoin .= '-' . $this->extra;
20+
$version .= '-' . $this->extra;
2121
}
22-
return $versoin;
22+
return $version;
2323
}
2424

2525
function getVersionId()
@@ -31,6 +31,7 @@ function getVersionId()
3131
$type = empty($argv[1]) ? 'release' : trim($argv[1]);
3232
$kernel_version_file = dirname(__DIR__) . '/include/swoole_version.h';
3333
$cmake_file = dirname(__DIR__) . '/CMakeLists.txt';
34+
$package_file = dirname(__DIR__) . '/package.xml';
3435

3536
$versionInfo = file_get_contents($kernel_version_file);
3637

@@ -68,6 +69,15 @@ function getVersionId()
6869
exit("wrong version type");
6970
}
7071

72+
if (empty($next->extra)) {
73+
$doc = new DOMDocument();
74+
$doc->load($package_file);
75+
$versions = $doc->getElementsByTagName("version");
76+
$versions[0]->getElementsByTagName('release')->item(0)->nodeValue = $next->getVersion();
77+
$versions[0]->getElementsByTagName('api')->item(0)->nodeValue = $next->major . '.0';
78+
$doc->save($package_file);
79+
}
80+
7181
ob_start();
7282
include __DIR__ . '/templates/version.tpl.h';
7383
file_put_contents($kernel_version_file, ob_get_clean());

0 commit comments

Comments
 (0)