soneta / Soneta.MsBuild.SDK

Sdk stworzone przez firmę Soneta pozwalające automatycznie skonfigurować oraz uzupełnić projekty dodatków o niezbędne elementy potrzebne do współpracy z oprogramowaniem enova.
MIT License
8 stars 12 forks source link

Fix błędu generatora przy wielu business.xml. #59

Closed fitithw closed 2 years ago

fitithw commented 2 years ago

Naprawa błędu generatora gdy wiele business.xml w projekcie ma odwołania do siebie nawzajem. Problem był omawiany na QA Geek OUT 21 czerwca 2022r.

Przykład błędu:

ExecuteSonetaGenerator:
15:07:13           "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.generator\12.2.0\lib\net472\Soneta.Generator.exe" -s "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.bi\2204.1.1\schema\BI.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.business\2204.1.1\schema\Business.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.business\2204.1.1\schema\Snapshots.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.core\2204.1.1\schema\Core.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.core\2204.1.1\schema\Oceny.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.crm\2204.1.1\schema\CRM.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.czlonkowieszkolenia\2204.1.1\schema\CzlonkowieSzkolenia.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.deklaracje\2204.1.1\schema\Deklaracje.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.handel\2204.1.1\schema\Handel.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.handel\2204.1.1\schema\Magazyny.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.handel\2204.1.1\schema\Produkcja.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.handel\2204.1.1\schema\Towary.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\HR.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\HR2.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\Kadry.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\Kalend.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\Place.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\Przeszeregowania.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kasa\2204.1.1\schema\Kasa.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kasa\2204.1.1\schema\Waluty.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kasa\2204.1.1\schema\Windykacja.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\Delegacje.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\EwidencjaVat.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\Import.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\Ksiega.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\RMK.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\Samochodowka.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\SrodkiTrwale.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.support\2204.1.1\schema\Support.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.web.business\2204.1.1\schema\WebAuthorization.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.workflow\2204.1.1\schema\Dms.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.workflow\2204.1.1\schema\Workflow.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.zadania\2204.1.1\schema\PracaHybrydowa.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.zadania\2204.1.1\schema\Zadania.business.xml" "C:\TeamCity\buildAgent\work\10642be4120d18ee\FIT_ProdukcjaExtender\FIT_ProdukcjaExtender\FPT\TerminaleKonf.business.xml"
15:07:13         
15:07:13           Wyj─ůtek nieobs┼éu┼╝ony: System.InvalidOperationException: Unexpected column type 'FitLinia'. Column name 'PrzypisanieLinii.LiniaProdukcji'.
15:07:13              w Soneta.Generator.Schema.Col.assignColType(Session session)
15:07:13              w Soneta.Generator.Schema.ColCollection.assignColType(Session session)
15:07:13              w Soneta.Generator.Schema.Session.assignColType()
15:07:13              w Soneta.Generator.Schema.Session.Initialize(CsWriter cs)
15:07:13              w Soneta.Generator.Program.GenerateBusiness(XmlReader xml, String path, IEnumerable`1 paths, CsWriter writer)
15:07:13              w Soneta.Generator.Program.Main(String[] args)

Powinno być:

ExecuteSonetaGenerator:
"C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.generator\12.2.0\lib\net472\Soneta.Generator.exe" -s "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.bi\2204.1.1\schema\BI.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.business\2204.1.1\schema\Business.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.business\2204.1.1\schema\Snapshots.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.core\2204.1.1\schema\Core.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.core\2204.1.1\schema\Oceny.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.crm\2204.1.1\schema\CRM.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.czlonkowieszkolenia\2204.1.1\schema\CzlonkowieSzkolenia.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.deklaracje\2204.1.1\schema\Deklaracje.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.handel\2204.1.1\schema\Handel.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.handel\2204.1.1\schema\Magazyny.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.handel\2204.1.1\schema\Produkcja.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.handel\2204.1.1\schema\Towary.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\HR.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\HR2.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\Kadry.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\Kalend.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\Place.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kadryplace\2204.1.1\schema\Przeszeregowania.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kasa\2204.1.1\schema\Kasa.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kasa\2204.1.1\schema\Waluty.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.kasa\2204.1.1\schema\Windykacja.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\Delegacje.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\EwidencjaVat.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\Import.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\Ksiega.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\RMK.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\Samochodowka.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.ksiega\2204.1.1\schema\SrodkiTrwale.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.support\2204.1.1\schema\Support.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.web.business\2204.1.1\schema\WebAuthorization.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.zadania\2204.1.1\schema\PracaHybrydowa.business.xml" "C:\Windows\system32\config\systemprofile\.nuget\packages\soneta.zadania\2204.1.1\schema\Zadania.business.xml" "C:\TeamCity\buildAgent\work\10642be4120d18ee\FIT_ProdukcjaExtender\FIT_ProdukcjaExtender\FPM\Fit_Produkcja.business.xml" "C:\TeamCity\buildAgent\work\10642be4120d18ee\FIT_ProdukcjaExtender\FIT_ProdukcjaExtender\FPT\TerminaleKonf.business.xml" "C:\TeamCity\buildAgent\work\10642be4120d18ee\FIT_ProdukcjaExtender\FIT_ProdukcjaExtender\MWS\FitMWS.business.xml" "C:\TeamCity\buildAgent\work\10642be4120d18ee\FIT_ProdukcjaExtender\FIT_ProdukcjaExtender\FPT\TerminaleKonf.business.xml"
a4099181 commented 2 years ago

TL;DR W przypadku gdy w dodatku jest więcej niż jeden business.xml i w jednym z plików wykorzystywana jest tabela z innego z nich sugerujemy stosować element <import /> celem dostarczenia do generatora wiedzy o zależnościach.

Proponowana poprawka niestety nadal nie zapewnia odpowiedniego poziomu asekuracji w odniesieniu do takich przypadków, które już korzystają z elementu <import />. W rezultacie istnieje zagrożenie, że generator podczas pracy otrzyma pliki business.xml zarówno te wskazane poleceniem jak i te, na które wskazuje <import /> w przetwarzanym business.xml. Efekt: błąd generatora spowodowany zdublowanymi tabelami.

W konsekwencji rozważań uważamy, że zadanie SDK w tej kwestii powinno zostać ograniczone do dostarczania tylko i wyłącznie tych business.xml, które są efektem referencji do paczek NuGet. Wewnętrzne wzajemne referencje plików business.xml znajdujących się w dodatkach powinny być rozwiązane za pomocą elementu <import />. Za pomocą elementu <import /> można dokonać dwóch form wskazania:

  1. precyzyjne - <import>Konkretny.business.xml</import>
  2. ogólne - przez wskazanie na folder, wewnątrz którego generator będzie rekursywnie w głąb poszukiwał innych business.xml. Możliwe jest wskazanie na ścieżkę względną (względem położenia business.xml w którym import jest zastosowany). Przykład <import>..</import>: dostarczy do generatora wszystkie pliki business.xml, jakie znajdą się w folderze nadrzędnym i wszystkich jemu podrzędnym.
fitithw commented 2 years ago

Faktycznie <import /> rozwiązuje ten problem dużo precyzyjniej niż ta poprawka, dziękuję za informację.