-
Notifications
You must be signed in to change notification settings - Fork 113
Кэширование скомпилированных скритпов #1555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nixel2007
wants to merge
91
commits into
EvilBeaver:develop
Choose a base branch
from
nixel2007:copilot/fix-1
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
aa145e7
fix #1542: точное позиционирование ошибки
Mr-Rm 9217227
убрано НЕ из бинарных операторов
Mr-Rm 65a8d40
уточнение места ошибки препроцессора
Mr-Rm 5b79c11
опечатки
Mr-Rm 461e1b8
убран переход к следующему токену и возможное NRE
Mr-Rm 9d2ddf6
Initial plan for issue
Copilot 75adaad
Implement basic script caching infrastructure
Copilot ebdb5da
Complete script caching infrastructure with tests and documentation
Copilot faa57af
Enhance cache integration with library loading and add documentation
Copilot 6b63e42
Implement full script module serialization/deserialization for caching
Copilot 11f4159
Migrate script serialization from BinaryFormatter to MessagePack
Copilot b78523a
Fix error handling, configuration, and logging in script caching
Copilot 4eb499d
Enhance method serialization to support MachineMethodInfo structures
Copilot 256893f
Remove redundant checks and implement IoC for cache service
Copilot cecf707
Address code review feedback: rename config, remove builders, add exc…
Copilot 6ebb094
изменена отметка позиции ошибки
Mr-Rm 57f5cc5
Address final code review comments: remove fallback, fix redundant ch…
Copilot 01885f3
Merge upstream develop branch to resolve conflicts
Copilot c89c18b
Fix failing ScriptCacheServiceTests by adding proper mock setup
Copilot 72fb882
Temporarily disable script caching by default to fix Windows build
Copilot 1078f1b
Fix boolean constant deserialization to handle localized values
Copilot be42206
Fix compilation errors in boolean and numeric constant deserialization
Copilot 67bb1cb
Enable script caching by default in configuration
Copilot 05c04c9
Fix build issues and CodeRabbit AI concerns - disable caching by defa…
Copilot 712f238
Re-enable script caching by default as requested
Copilot 1a6c1cf
Fix Windows path resolution issue in cached module loading
Copilot 9724e39
Merge pull request #1547 from Mr-Rm/v2/fix-1542
EvilBeaver 1bab56e
Debug script caching path resolution issue - discovered root cause no…
Copilot 60c1c57
Add oscript_modules directory with package-loader.os for system libra…
Copilot 59251a7
Add comprehensive debug logging for script caching operations
Copilot 1c94e05
Fix library loading issue by diagnosing missing package-loader.os
Copilot 00cf2d6
Fix BslScriptMethodInfo deserialization in caching - add protected co…
Copilot d0a3e8a
Create copilot-setup-steps.yml
nixel2007 c860dca
Update copilot-setup-steps.yml
nixel2007 ded0476
Update copilot-setup-steps.yml
nixel2007 ff9fe1e
Create copilot-instructions.md
nixel2007 56d4736
Add test result files for comprehensive build and test validation
Copilot 2a98135
Update copilot-setup-steps.yml
nixel2007 9610c78
Update copilot-setup-steps.yml
nixel2007 e319faa
Update copilot-instructions.md
nixel2007 57ae651
Fix Build.csproj to exclude TestApp and NativeApi from Linux builds
Copilot 5c02c58
Fix script cache deserialization index out of range issues
Copilot 1b80a11
Remove manual cache service setup from AttachedScriptsFactory to fix …
Copilot a1ba5ce
Remove committed test result files and add them to .gitignore
Copilot 6074475
Удалил кеши, добавленные копилотом
EvilBeaver f6a5ad6
Рефакторинг после копилота
EvilBeaver ced957e
Удалены файлы из LFS
EvilBeaver 346ab70
Merge branch 'develop' of https://github.com/EvilBeaver/OneScript int…
EvilBeaver 264a48d
Initial plan for issue
Copilot 853aaa2
Implement basic script caching infrastructure
Copilot cf0eb06
Complete script caching infrastructure with tests and documentation
Copilot 2d72695
Enhance cache integration with library loading and add documentation
Copilot cf0f1f9
Implement full script module serialization/deserialization for caching
Copilot 137310b
Migrate script serialization from BinaryFormatter to MessagePack
Copilot 9f9a71c
Fix error handling, configuration, and logging in script caching
Copilot c228753
Enhance method serialization to support MachineMethodInfo structures
Copilot b0143ed
Remove redundant checks and implement IoC for cache service
Copilot def85ee
Address code review feedback: rename config, remove builders, add exc…
Copilot 08662b1
Address final code review comments: remove fallback, fix redundant ch…
Copilot 0d37282
Fix failing ScriptCacheServiceTests by adding proper mock setup
Copilot 140d3f7
Temporarily disable script caching by default to fix Windows build
Copilot 697e552
Fix boolean constant deserialization to handle localized values
Copilot 04c71bb
Fix compilation errors in boolean and numeric constant deserialization
Copilot d2edbac
Enable script caching by default in configuration
Copilot ba1fb84
Fix build issues and CodeRabbit AI concerns - disable caching by defa…
Copilot c1143cb
Re-enable script caching by default as requested
Copilot 0e929f4
Fix Windows path resolution issue in cached module loading
Copilot 80e4b7f
Debug script caching path resolution issue - discovered root cause no…
Copilot 357727c
Add oscript_modules directory with package-loader.os for system libra…
Copilot cf88557
Add comprehensive debug logging for script caching operations
Copilot 737d76d
Fix library loading issue by diagnosing missing package-loader.os
Copilot 2b544df
Fix BslScriptMethodInfo deserialization in caching - add protected co…
Copilot 71d0fbf
Create copilot-setup-steps.yml
nixel2007 55ae0a0
Update copilot-setup-steps.yml
nixel2007 a0ce373
Update copilot-setup-steps.yml
nixel2007 10c49a3
Create copilot-instructions.md
nixel2007 069e99b
Add test result files for comprehensive build and test validation
Copilot a62b8c6
Update copilot-setup-steps.yml
nixel2007 605f72f
Update copilot-setup-steps.yml
nixel2007 5cb1928
Update copilot-instructions.md
nixel2007 7ef5c59
Fix Build.csproj to exclude TestApp and NativeApi from Linux builds
Copilot 60c53a7
Fix script cache deserialization index out of range issues
Copilot 9979624
Remove manual cache service setup from AttachedScriptsFactory to fix …
Copilot d597567
Remove committed test result files and add them to .gitignore
Copilot 94533c2
Удалил кеши, добавленные копилотом
EvilBeaver d607680
Рефакторинг после копилота
EvilBeaver d43a159
Merge remote-tracking branch 'nixel2007/copilot/fix-1' into copilot/f…
EvilBeaver ab67ad3
Установка глобальной библиотеки пакетов
nixel2007 7bb5d09
Update copilot-instructions.md
nixel2007 b9547ac
Add script cache files to .gitignore to prevent committing generated …
Copilot c437e04
Корректный вызов функции в MSBuild
EvilBeaver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Команда запуска полной сборки и прогона тестов на Linux: | ||
|
|
||
| ```sh | ||
| dotnet msbuild Build.csproj /t:"CleanAll;MakeFDD;GatherLibrary;ComposeDistributionFolders;Test" /p:Configuration=LinuxDebug /p:NoCppCompiler=True | ||
| ``` | ||
|
|
||
| Запуск приемочных тестов: | ||
|
|
||
| ```sh | ||
| dotnet oscript.dll tests/testrunner.os -runAll tests | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: "OneScript Development Environment Setup" | ||
|
|
||
| # Allow testing of the setup steps from your repository's "Actions" tab. | ||
| on: workflow_dispatch | ||
|
|
||
| jobs: | ||
| # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. | ||
| copilot-setup-steps: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| # Set the permissions to the lowest permissions possible needed for your steps. | ||
| # Copilot will be given its own token for its operations. | ||
| permissions: | ||
| # Clone the repository to install dependencies | ||
| contents: read | ||
|
|
||
| # Setup steps for OneScript development environment | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - run: git config --global core.quotepath false | ||
|
|
||
| - uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '6.0.x' | ||
|
|
||
| - name: Установка OneScript | ||
| uses: otymko/setup-onescript@v1.5 | ||
| with: | ||
| version: stable | ||
|
|
||
| - name: Установка зависимостей | ||
| run: | | ||
| opm install opm | ||
| opm update --all | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # Демонстрация кэширования скриптов для библиотек OneScript | ||
|
|
||
| ## Обзор | ||
|
|
||
| Система кэширования скриптов интегрирована с загрузчиком библиотек OneScript и автоматически работает с методами `ДобавитьКласс` и `ДобавитьМодуль`. | ||
|
|
||
| ## Как работает кэширование | ||
|
|
||
| 1. **Автоматическая интеграция**: Когда `LibraryLoader` использует методы `ДобавитьКласс()` или `ДобавитьМодуль()`, вызывается цепочка: | ||
| - `LibraryLoader.CompileFile()` | ||
| - `AttachedScriptsFactory.CompileModuleFromSource()` | ||
| - `ScriptCacheService.TryLoadFromCache()` и `ScriptCacheService.SaveToCache()` | ||
|
|
||
| 2. **Кэш-файлы**: Для каждого скрипта создаются: | ||
| - `script.os.metadata.json` - метаданные с информацией о времени изменения, размере файла, версии рантайма | ||
| - `script.os.obj` - объектный файл с информацией о модуле | ||
|
|
||
| 3. **Валидация кэша**: Кэш автоматически становится недействительным при: | ||
| - Изменении исходного файла (время модификации или размер) | ||
| - Обновлении версии рантайма OneScript | ||
|
|
||
| ## Тестирование кэширования | ||
|
|
||
| ### Включение отладочного режима | ||
|
|
||
| ```bash | ||
| export OS_CACHE_DEBUG=1 | ||
| ``` | ||
|
|
||
| ### Включение трассировки загрузки библиотек | ||
|
|
||
| ```bash | ||
| export OS_LRE_TRACE=1 | ||
| ``` | ||
|
|
||
| ### Создание тестовых файлов | ||
|
|
||
| 1. **Тестовый модуль** (`/tmp/test_module.os`): | ||
| ```bsl | ||
| // Тестовый модуль для демонстрации кэширования | ||
| Функция ПолучитьВремя() Экспорт | ||
| Возврат ТекущаяДата(); | ||
| КонецФункции | ||
| ``` | ||
|
|
||
| 2. **Тестовый класс** (`/tmp/test_class.os`): | ||
| ```bsl | ||
| // Тестовый класс для демонстрации кэширования | ||
| Перем Значение; | ||
|
|
||
| Процедура ПриСозданииОбъекта() | ||
| Значение = "Тест"; | ||
| КонецПроцедуры | ||
|
|
||
| Функция ПолучитьЗначение() Экспорт | ||
| Возврат Значение; | ||
| КонецФункции | ||
| ``` | ||
|
|
||
| 3. **Загрузчик библиотеки** (`/tmp/package-loader.os`): | ||
| ```bsl | ||
| Функция ПриЗагрузкеБиблиотеки(ПутьКБиблиотеке, СтандартнаяОбработка, ОтменитьЗагрузку) | ||
|
|
||
| // Добавляем модуль - будет создан кэш | ||
| ДобавитьМодуль("/tmp/test_module.os", "ТестМодуль"); | ||
|
|
||
| // Добавляем класс - будет создан кэш | ||
| ДобавитьКласс("/tmp/test_class.os", "ТестКласс"); | ||
|
|
||
| СтандартнаяОбработка = Ложь; | ||
|
|
||
| КонецФункции | ||
| ``` | ||
|
|
||
| ### Проверка создания кэша | ||
|
|
||
| После выполнения загрузки библиотеки должны появиться файлы: | ||
| - `/tmp/test_module.os.metadata.json` | ||
| - `/tmp/test_module.os.obj` | ||
| - `/tmp/test_class.os.metadata.json` | ||
| - `/tmp/test_class.os.obj` | ||
|
|
||
| ### Пример метаданных кэша | ||
|
|
||
| ```json | ||
| { | ||
| "FormatVersion": 1, | ||
| "SourceModifiedTime": "2025-06-19T09:30:15.123456+00:00", | ||
| "SourceSize": 145, | ||
| "SourcePath": "/tmp/test_module.os", | ||
| "CacheCreatedTime": "2025-06-19T09:30:16.789012+00:00", | ||
| "RuntimeVersion": "2.0.0.0" | ||
| } | ||
| ``` | ||
|
|
||
| ## Статус реализации | ||
|
|
||
| ✅ **Готово:** | ||
| - Интеграция кэша с `AttachedScriptsFactory` | ||
| - Автоматическое кэширование при использовании `ДобавитьКласс` и `ДобавитьМодуль` | ||
| - Валидация кэша по времени изменения файла, размеру и версии рантайма | ||
| - Создание метаданных и объектных файлов | ||
| - Конфигурируемое включение/отключение кэширования | ||
|
|
||
| ⚠️ **В разработке:** | ||
| - Полная сериализация/десериализация `IExecutableModule` | ||
| - Загрузка скомпилированных модулей из кэша | ||
|
|
||
| ## Результат | ||
|
|
||
| Система кэширования **уже работает** с методами загрузчика библиотек `ДобавитьКласс` и `ДобавитьМодуль`. Кэш-файлы создаются автоматически, валидация работает корректно. | ||
|
|
||
| Инфраструктура готова для будущей реализации полной загрузки модулей из кэша, что даст значительное ускорение загрузки больших библиотек типа oneunit. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.