[build] merge graph rules building and regex rules building