From 84f70c56a00329401f1439276a180d9dea98822d Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 3 Sep 2023 22:40:26 +0300 Subject: [PATCH] tools: improve changelog helper; finish 0.4.1 changelogs --- CHANGELOG.md | 74 ++++++++-------- cmd/tools/changelog_helper.v | 167 +++++++++++++++++++++++++---------- 2 files changed, 157 insertions(+), 84 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37e70d7142d554..7df648fdd7ada4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,16 +2,18 @@ *3 September 2023* #### Improvements in the language -- Do not allow uninitialized function pointers -- Fix compiling V programs with latest clang 16 on windows (clang 16 is stricter than clang 14) (#19095) -ast, checker, cgen: implement enum static `from_string(name string)` (#19156) - Pure `array.sorted()` and `array.sorted_with_compare()` methods, that do not modify their receivers (#19251) - UB overflow has been removed +- Implement `Enum.from_string(name string)` for converting strings to enum values (#19156) - Disallow casting string to enum, suggest using Enum.from_string() instead (#19260) +- Use autocasting in complex conditions (#18839) +- Allow alias as fixed array on return (#18817) +- Do not allow uninitialized function pointers +- Fix compiling V programs with latest clang 16 on windows (clang 16 is stricter than clang 14) (#19095) - Fix anonymous struct with default expr (#19257) -- log: improve the most common use case, it's no longer necessary to create a `Log` instance (#19242) - Allow using consts as enum values (#19193) -- `@[attr]` syntax to replace `[attr]` (`[]` is used for too many things). Most likely to be replaced with `@attr()` in the futre. +- `@[attr]` syntax to replace `[attr]` (`[]` is used for too many things). Most likely to be replaced with `@attr()` in the future. +- Allow `none` for not first values on map initialization (#18821) - Make all .trace() methods generic on the type of the passed expression #### Breaking changes @@ -47,26 +49,35 @@ ast, checker, cgen: implement enum static `from_string(name string)` (#19156) - Disallow an empty `chan` type (#19167) #### Parser improvements -- parser: change warn to error, for const names with upper letter (fix #18838) (#18840) -- parser: disallow declaring static functions as method receivers (#19007) -- parser: disallow having builtin type as type names for `enum`, `sum type` and `alias` (#19043) -- parser: support `const x := 123`, to make extracting locals as constants less annoying while prototyping -- parser: fix struct field fn type with default value (fix #19099) (#19106) -- parser, cgen: fix `for i++; i<10; i++ {` (fix #18445) (#19035) -- parser, checker, cgen: fix fn return alias of fixed array (#19116) -- Ast, parser, cgen: fix generic struct init (Stack[&Person]{}) (fix #19119) (#19122) -- v.token: add inline next_to() and cleanup related calls (#19226) +- Change warn to error, for const names with upper letter (fix #18838) (#18840) +- Disallow declaring static functions as method receivers (#19007) +- Disallow having builtin type as type names for `enum`, `sum type` and `alias` (#19043) +- Support `const x := 123`, to make extracting locals as constants less annoying while prototyping +- Fix struct field fn type with default value (fix #19099) (#19106) +- Fix `for i++; i<10; i++ {` (fix #18445) (#19035) +- Fix fn return alias of fixed array (#19116) +- Fix generic struct init (Stack[&Person]{}) (fix #19119) (#19122) #### Compiler internals +- pref: make -autofree work without -gc none +- builder,pref: allow thirdparty objects compilation with CPP compiler (#19124) - scanner: fix string interpolation with nested string interpolation in inner quotes p. 3 (#19121) - scanner: error early on an unsupported escape sequence in a string, like `\_` (fix #19131) (#19134) +- v.token: add inline next_to() and cleanup related calls (#19226) #### Standard library +- eventbus: add generic support for event name (#18805) +- readline: add support for ctlr+w and ctrl+u shortcuts (#18921) +- strconv.atoi: fix string.int() returning numbers for non number characters (fix #18875) (#18925) +- builtin: reduce the number of array allocations for consts in all V programs (#18889) +- builtin: move array.data to the top of the struct +- os.notify: implement the kqueue backend for notify.FdNotifier (#19057) - vlib: add a new module `builtin.wchar`, to ease dealing with C APIs that accept `wchar_t*` (#18794) - arrays: add more util functions and tests for them - find_first, find_last, join_to_string (#18784) - vlib: use sync.new_mutex() consistently for initialising all vlib structures containing mutex fields - crypto.pem: add a static method `Block.new`, to replace `new` (#18846) - crypto.pem: add decode_only and general improvements to decoding (#18908) +- log: improve the most common use case, it's no longer necessary to create a `Log` instance (#19242) - crypto.sha512: make the new384/0, new512_256/0, new512_224/0 functions public - json: fix option alias support (#18801) - time: fix `parse_format` with `YY` (#18887) @@ -90,6 +101,14 @@ ast, checker, cgen: implement enum static `from_string(name string)` (#19156) - toml: Add generic automatic decoding and encoding of simple structs, when they don't implement custom methods (#17970) #### Web +- http: Request.host +- net.ftp: fix dir() for file names, which contain spaces (fix #18800) (#18804) +- net.http: make listener public, and add addr in Server struct (#18871) +- net.http.chunked: return `!string` on decode (#18928) +- net.conv: rename functions to match other langs, making them easier t… (#18937) +- wasm: remove dependency on thirdparty/binaryen, webassembly backend rewrite (#18120) +- wasm: add a -wasm-stack-top flag to compiler (#19157) +- net.mbedtls: add SSLListener to allow creating SSL servers (#19022) - picoev, picohttparser: reimplement in V (#18506) - vweb: fix parsing of form fields, send with multipart/form-data (by JS fetch) - vweb: make vweb route paths case sensitive (#18973) @@ -98,8 +117,8 @@ ast, checker, cgen: implement enum static `from_string(name string)` (#19156) - vweb: add a user_agent utility method to the vweb context (#19204) - vweb: avoid the controllers having to be defined in specific order (#19182) - #### ORM +- orm: fix inserting sequential values (id=0), in tables with an i64 primary field (#18791) - Add OR in where on update and delete (#19172) #### Database drivers @@ -109,6 +128,7 @@ ast, checker, cgen: implement enum static `from_string(name string)` (#19156) - db.sqlite: make functions return results, breaking change (#19093) #### Native backend +- native: move functions out of amd64.v (#18857) #### C backend - Fix selector code to use interface method table on closure when needed (#18736) @@ -134,9 +154,9 @@ ast, checker, cgen: implement enum static `from_string(name string)` (#19156) - Fix comptime assign with generic result return type (#19192) - Fix match with comptime if expr in branch (#19189) -#### Comptime - #### Tools +- ci: add v-analyzer builds (#18835) +- ci: cleanup more the contents of the generated v_linux.zip, v_macos.zip, and v_windows.zip, use -skip-unused - tools: fix vcomplete for zsh (#18950) - tools: support a toc for projects, with single exposing module, in `v doc` (#19001) - Add support for `v should-compile-all -c examples/`, which will delete all the produced executables at the end @@ -150,26 +170,6 @@ ast, checker, cgen: implement enum static `from_string(name string)` (#19156) - v.builder: show the number of files, types, modules, when a program is compiled with -stats - Improve the output of parser_speed.v and scanner_speed.v - - - - - - - - - - - - - - - - - - - - ## V 0.4 *1 July 2023* diff --git a/cmd/tools/changelog_helper.v b/cmd/tools/changelog_helper.v index 954d24faba3a55..6f7ed946acc988 100644 --- a/cmd/tools/changelog_helper.v +++ b/cmd/tools/changelog_helper.v @@ -18,12 +18,9 @@ enum Category { comptime tools compiler_internals + examples } -//__global ( -// lines []Line -//) - struct Line { category Category text string @@ -31,10 +28,11 @@ struct Line { const log_txt = 'log.txt' -__global ( - counter = 0 - total_lines = 0 -) +struct App { + total_lines int +mut: + counter int +} fn main() { if !os.exists(log_txt) { @@ -42,14 +40,16 @@ fn main() { } lines := os.read_lines(log_txt)! changelog_txt := os.read_file('CHANGELOG.md')!.to_lower() + mut app := &App{ + total_lines: lines.len + } // mut counter := 0 // to display how many commits are left for line in lines { s := line.trim_space() if s == '' { - counter++ + app.counter++ } } - total_lines = lines.len // println('${counter} / ${lines.len}') for line in lines { s := line.to_lower() @@ -60,12 +60,21 @@ fn main() { continue } - process_line(line)! + app.process_line(line)! } println('done.') } -fn process_line(text string) ! { +fn (mut app App) process_line(text string) ! { + if text == '' { + return + } + semicolon_pos := text.index(': ') or { + println('no `:` in commit, skipping: "${text}"') + return + } + prefix := text[..semicolon_pos] + // Get category based on keywords in the commit message/prefix mut category := Category.improvements if text.contains('checker:') { category = .checker @@ -75,7 +84,9 @@ fn process_line(text string) ! { category = .db } else if is_stdlib(text) { category = .stdlib - } else if text.contains('vweb:') { + } else if is_orm(text) { + category = .orm + } else if is_web(text) { category = .web } else if is_tools(text) { category = .tools @@ -85,7 +96,13 @@ fn process_line(text string) ! { category = .compiler_internals } else if is_improvements(text) { category = .improvements + } else if is_native(text) { + category = .native + } else if is_examples(text) { + // TODO maybe always skip these as well? + category = .examples } else if text.contains('docs:') || text.contains('doc:') { + // Always skip docs delete_processed_line_from_log(text)! return } @@ -95,12 +112,7 @@ fn process_line(text string) ! { } // Trim everything to the left of `:` for some commits (e.g. `checker: `) - semicolon_pos := text.index(': ') or { - println('no : in commit, skipping') - return - } mut s := text - prefix := text[..semicolon_pos] // println("PREFIX='${prefix}'") // if true { // exit(0) @@ -111,7 +123,7 @@ fn process_line(text string) ! { // Get input from the user print('\033[H\033[J') - println('${counter} / ${total_lines}') + println('${app.counter} / ${app.total_lines}') // println('\n') println(text) input := os.input('${category} ?') @@ -149,7 +161,7 @@ fn process_line(text string) ! { } else {} } - counter++ + app.counter++ // Don't forget to remove the line we just processed from log.txt delete_processed_line_from_log(text)! } @@ -228,6 +240,25 @@ fn delete_processed_line_from_log(line string) ! { os.write_file(log_txt, new_text)! } +const db_strings = [ + 'db:', + 'db.sqlite', + 'db.mysql', + 'db.pg', +] + +const improvements_strings = [ + 'vfmt:', + 'fmt:', + 'all:', + 'v:', +] + +const parser_strings = [ + 'parser:', + 'ast:', +] + const stdlib_strings = [ 'gg:', 'json:', @@ -244,33 +275,15 @@ const stdlib_strings = [ 'toml:', 'vlib:', 'arrays:', -] - -const db_strings = [ - 'db:', - 'db.sqlite', - 'db.mysql', -] - -const internal_strings = [ - 'scanner:', - 'transformer:', -] - -const improvements_strings = [ - 'vfmt:', - 'fmt:', - 'all:', -] - -const tools_strings = [ - 'tools:', - 'vpm:', -] - -const parser_strings = [ - 'parser:', - 'ast:', + 'math.', + 'os.', + 'term:', + 'sync.', + 'builtin:', + 'strconv', + 'readline', + 'cli:', + 'eventbus:', ] fn is_stdlib(text string) bool { @@ -281,6 +294,22 @@ fn is_db(text string) bool { return is_xxx(text, db_strings) } +const orm_strings = [ + 'orm:', +] + +fn is_orm(text string) bool { + return is_xxx(text, orm_strings) +} + +const internal_strings = [ + 'scanner:', + 'transformer:', + 'builder:', + 'pref:', + 'v.util', +] + fn is_internal(text string) bool { return is_xxx(text, internal_strings) } @@ -289,6 +318,27 @@ fn is_improvements(text string) bool { return is_xxx(text, improvements_strings) } +const examples_strings = [ + 'example', + 'tests', + 'readme:', + '.md:', +] + +fn is_examples(text string) bool { + return is_xxx(text, examples_strings) +} + +const tools_strings = [ + 'tools:', + 'vpm:', + 'ci', + 'github:', + 'gitignore', + 'benchmark', + 'v.help:', +] + fn is_tools(text string) bool { return is_xxx(text, tools_strings) } @@ -297,6 +347,29 @@ fn is_parser(text string) bool { return is_xxx(text, parser_strings) } +const web_strings = [ + 'vweb:', + 'websocket:', + 'picoev:', + 'mbedtls', + 'net:', + 'net.', + 'wasm:', + 'http:', +] + +fn is_web(text string) bool { + return is_xxx(text, web_strings) +} + +const native_strings = [ + 'native:', +] + +fn is_native(text string) bool { + return is_xxx(text, native_strings) +} + fn is_xxx(text string, words []string) bool { for s in words { if text.contains(s) {