diff --git a/CMakeLists.txt b/CMakeLists.txt index 406889daf42..5baca1d2ba7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ PROJECT(libswoole) ENABLE_LANGUAGE(ASM) -set(SWOOLE_VERSION 4.8.1) +set(SWOOLE_VERSION 4.8.2-dev) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g") diff --git a/include/swoole_version.h b/include/swoole_version.h index 79f4ba08a78..312111a439a 100644 --- a/include/swoole_version.h +++ b/include/swoole_version.h @@ -20,10 +20,10 @@ #define SWOOLE_MAJOR_VERSION 4 #define SWOOLE_MINOR_VERSION 8 -#define SWOOLE_RELEASE_VERSION 1 -#define SWOOLE_EXTRA_VERSION "" -#define SWOOLE_VERSION "4.8.1" -#define SWOOLE_VERSION_ID 40801 +#define SWOOLE_RELEASE_VERSION 2 +#define SWOOLE_EXTRA_VERSION "dev" +#define SWOOLE_VERSION "4.8.2-dev" +#define SWOOLE_VERSION_ID 40802 #define SWOOLE_API_VERSION_ID 0x202109a #define SWOOLE_BUG_REPORT \ diff --git a/tools/next-version.php b/tools/next-version.php index 7e13f76e548..ae4f76962ac 100755 --- a/tools/next-version.php +++ b/tools/next-version.php @@ -7,11 +7,13 @@ class Version public $minor; public $release; public $extra; + public $api; const REGX_MAJOR = '#define\s+SWOOLE_MAJOR_VERSION\s+(\d+)#'; const REGX_MINOR = '#define\s+SWOOLE_MINOR_VERSION\s+(\d+)#'; const REGX_RELEASE = '#define\s+SWOOLE_RELEASE_VERSION\s+(\d+)#'; const REGX_EXTRA = '#define\s+SWOOLE_EXTRA_VERSION\s+"(\w*)"#'; + const REGX_API = '#define\s+SWOOLE_API_VERSION_ID\s+(0x[0-9a-f]*)#'; function getVersion() { @@ -26,6 +28,21 @@ function getVersionId() { return intval(sprintf('%d%02d%02d', $this->major, $this->minor, $this->release)); } + + function match($versionInfo) { + preg_match(Version::REGX_MAJOR, $versionInfo, $match_major) or die('no match MAJOR_VERSION'); + preg_match(Version::REGX_MINOR, $versionInfo, $match_minor) or die('no match MAJOR_MINOR');; + preg_match(Version::REGX_RELEASE, $versionInfo, + $match_release) or die('no match RELEASE_VERSION');; + preg_match(Version::REGX_EXTRA, $versionInfo, $match_extra) or die('no match EXTRA_VERSION'); + preg_match(Version::REGX_API, $versionInfo, $match_api) or die('no match API_VERSION_ID'); + + $this->major = intval($match_major[1]); + $this->minor = intval($match_minor[1]); + $this->release = intval($match_release[1]); + $this->extra = trim($match_extra[1]); + $this->api = trim($match_api[1]); + } } $type = empty($argv[1]) ? 'release' : trim($argv[1]); @@ -33,19 +50,8 @@ function getVersionId() $cmake_file = dirname(__DIR__) . '/CMakeLists.txt'; $package_file = dirname(__DIR__) . '/package.xml'; -$versionInfo = file_get_contents($kernel_version_file); - -preg_match(Version::REGX_MAJOR, $versionInfo, $match_major) or die('no match MAJOR_VERSION'); -preg_match(Version::REGX_MINOR, $versionInfo, $match_minor) or die('no match MAJOR_MINOR');; -preg_match(Version::REGX_RELEASE, $versionInfo, - $match_release) or die('no match RELEASE_VERSION');; -preg_match(Version::REGX_EXTRA, $versionInfo, $match_extra) or die('no match EXTRA_VERSION'); - $current = new Version; -$current->major = intval($match_major[1]); -$current->minor = intval($match_minor[1]); -$current->release = intval($match_release[1]); -$current->extra = trim($match_extra[1]); +$current->match(file_get_contents($kernel_version_file)); $next = clone $current; @@ -65,17 +71,24 @@ function getVersionId() $next->minor = 0; $next->release = 0; $next->extra = 'dev'; +} elseif ($type == 'api') { + $date = substr($current->api, 2, strlen($current->api) - 3); + if ($date == date('Ym')) { + $c = substr($current->api, -1, 1); + if ($c == 'f') { + throw new RuntimeException("maximum exceeded[$current->api]"); + } + $next->api = '0x' . $date . chr(ord($c) + 1); + } else { + $next->api = '0x' . date('Ym') . 'a'; + } } else { exit("wrong version type"); } if (empty($next->extra)) { - $doc = new DOMDocument(); - $doc->load($package_file); - $versions = $doc->getElementsByTagName("version"); - $versions[0]->getElementsByTagName('release')->item(0)->nodeValue = $next->getVersion(); - $versions[0]->getElementsByTagName('api')->item(0)->nodeValue = $next->major . '.0'; - $doc->save($package_file); + $doc = file_get_contents($package_file); + file_put_contents($package_file, str_replace($current->getVersion(), $next->getVersion(), $doc)); } ob_start(); diff --git a/tools/templates/version.tpl.h b/tools/templates/version.tpl.h index 3487d27b23e..32affab28a4 100644 --- a/tools/templates/version.tpl.h +++ b/tools/templates/version.tpl.h @@ -24,7 +24,7 @@ #define SWOOLE_EXTRA_VERSION "extra ?>" #define SWOOLE_VERSION "getVersion() ?>" #define SWOOLE_VERSION_ID getVersionId()."\n" ?> -#define SWOOLE_API_VERSION_ID 0x202012a +#define SWOOLE_API_VERSION_ID api."\n" ?> #define SWOOLE_BUG_REPORT \ "A bug occurred in Swoole-v" SWOOLE_VERSION ", please report it.\n" \