From cee0a9794ae6b014fc10aa3efd346fae403ddcc2 Mon Sep 17 00:00:00 2001 From: "Federico M. Facca" Date: Wed, 16 Oct 2024 13:36:22 +0200 Subject: [PATCH 1/2] fix .gitignore for mac devs Signed-off-by: Federico M. Facca --- .DS_Store | Bin 0 -> 8196 bytes .gitignore | 2 ++ cgmes_schema/.DS_Store | Bin 0 -> 6148 bytes 3 files changed, 2 insertions(+) create mode 100644 .DS_Store create mode 100644 cgmes_schema/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..524baf8cbbb35da9833cc04315fae78c3e4450f3 GIT binary patch literal 8196 zcmeHMU2GIp6h3GA!=2&p7K#qog$)(OvOs~-f=q@& z8ui7$nD`e>B*vcyA0$x&F-DCfJ`goNn8t{SyqM^NKKK)(CKx<-?kr&!cu<29otxZy z?m73KJNJI`oxMF%0Ko2|xe7oB07g|vKAoD26frL91x1N0^(2w}0nF@#Kc02G>;-dU zLySO-K#V|)K#V|)z?Fdj-PxkBOWgZ%G;U)AVg&w|2#DW@Bvm2Pk(`t={OO=3OaVyN zk~u8Yr#v9^Nk%dq$w?_gS6WkM4;Z;(lwzQCr}3niPBIc~=4%*g4hBx+jZeZB1RR|qy)1oQ+hHTgLCc3?%Yx<#YpB!K+ zQ!`vYbf~SPBb97hyXtT%d1(FWR_eF69X_nGdCe<3cW3rHdDnYL9s;8u0+?BKsD~?0 zQwmUjP z*tvmyr)?F~24#`j?;3e)iqD!o^Qxlk29M!3XdOoPsalOE?W* z!FTX8`~ttiZ>V4m)?q!)#U@PPLTte`*oN)cfg7+FH{llCiaT%!hj9e=qJekee$1nb zCA=3W@qT;&AH}Ef8GII>!&mVQd=ro1aXf(^;z#%~p2lzR2mBF#!ZY|go>f4Zt28PJ zWwEkMZd)lw#c(CPloaXb#W_Vq^qo#QaIvUJY}&l#%7}_nGejIT%$eIbZ=nc|_RjP< z3Q5wHd3HX3L&{bVJ)~^-j;pyw(K3I*HCkeTIBgxQj}P|d*@_48ny_i6dxxti9trIM@Hw*Jkl>5}KG z!l4qh%c9lDRdtd7_g?z@|7Cf0yl9L-jKGzF0M>5o+t^KeDgW_My)BVzC#l{+RTMFA xQp(VUnlK$F8K&bT&;7%Y`bnB9eA1Del#(n|{_zh1R($`*_y1o>P5)c>{~zPOkTU=P literal 0 HcmV?d00001 diff --git a/.gitignore b/.gitignore index f58c6d1..d8c0846 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ output/ *.py[cod] __pycache__/ .vscode/* +*/.DS_Store +.DS_Store diff --git a/cgmes_schema/.DS_Store b/cgmes_schema/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7ec199a05d38d31791c6ee89fe7cb8cb7f432c86 GIT binary patch literal 6148 zcmeH~%}T>S5XWcRYEz2PgF=rBUW>-s3gRWCEuOp>(Su5CXwhKIN066HxTnURGjK;~AEN6R&LO&yb5DsAv zTy(bopa8wQGPK|n&Y%O|-=7;zhR;!=B8+&Co|AYua@`M+%NI5_i%!ugJGa4ungpZn zXgu`0gKKJCD3wI>dN;a^`;)M;-BRhO8>jt&PKbMb47s_A)1I36YMl0lIyW!_PRS{S zmFjfbXf|rH-gIX*IX$ksHQ6|7%w{ELXLtYPJbX-^QuS&i7WnmP+p?VF4J#{F_Yw@! zM5Xr_G0&c7FI>a7C{`hBGF0+9^s zbeAAXOV2Vh#1S-MQjsQA*eixG>DVuAoM)LCnsg9)W_*sFS=bwj(6eK|)ZrjJLoQhX zR$x(qylGbG{O_#3|1TzSixpr6)=B|UXa{W{mt@b@rNz-%E79-J$tW%}{7S)!K8i7x ej^Zl1Htd&FL3);%A@-p0kARke3s&Gy75D^eN=f7Z literal 0 HcmV?d00001 From 6e0712344033da0bb5010ab0786034a8fe8f862f Mon Sep 17 00:00:00 2001 From: "Federico M. Facca" Date: Wed, 16 Oct 2024 13:54:52 +0200 Subject: [PATCH 2/2] fix makefile to support 3.0.0 Signed-off-by: Federico M. Facca Delete .DS_Store Signed-off-by: Federico M. Facca Update build.yaml Signed-off-by: Federico M. Facca Delete cgmes_schema/.DS_Store Signed-off-by: Federico M. Facca Update build.yaml Signed-off-by: Federico M. Facca --- .DS_Store | Bin 8196 -> 0 bytes .github/workflows/build.yaml | 10 ++++- Makefile | 8 +++- README.md | 75 +++++++++++++++++++++++++++++++++-- cgmes_schema/.DS_Store | Bin 6148 -> 0 bytes 5 files changed, 86 insertions(+), 7 deletions(-) delete mode 100644 .DS_Store delete mode 100644 cgmes_schema/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 524baf8cbbb35da9833cc04315fae78c3e4450f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMU2GIp6h3GA!=2&p7K#qog$)(OvOs~-f=q@& z8ui7$nD`e>B*vcyA0$x&F-DCfJ`goNn8t{SyqM^NKKK)(CKx<-?kr&!cu<29otxZy z?m73KJNJI`oxMF%0Ko2|xe7oB07g|vKAoD26frL91x1N0^(2w}0nF@#Kc02G>;-dU zLySO-K#V|)K#V|)z?Fdj-PxkBOWgZ%G;U)AVg&w|2#DW@Bvm2Pk(`t={OO=3OaVyN zk~u8Yr#v9^Nk%dq$w?_gS6WkM4;Z;(lwzQCr}3niPBIc~=4%*g4hBx+jZeZB1RR|qy)1oQ+hHTgLCc3?%Yx<#YpB!K+ zQ!`vYbf~SPBb97hyXtT%d1(FWR_eF69X_nGdCe<3cW3rHdDnYL9s;8u0+?BKsD~?0 zQwmUjP z*tvmyr)?F~24#`j?;3e)iqD!o^Qxlk29M!3XdOoPsalOE?W* z!FTX8`~ttiZ>V4m)?q!)#U@PPLTte`*oN)cfg7+FH{llCiaT%!hj9e=qJekee$1nb zCA=3W@qT;&AH}Ef8GII>!&mVQd=ro1aXf(^;z#%~p2lzR2mBF#!ZY|go>f4Zt28PJ zWwEkMZd)lw#c(CPloaXb#W_Vq^qo#QaIvUJY}&l#%7}_nGejIT%$eIbZ=nc|_RjP< z3Q5wHd3HX3L&{bVJ)~^-j;pyw(K3I*HCkeTIBgxQj}P|d*@_48ny_i6dxxti9trIM@Hw*Jkl>5}KG z!l4qh%c9lDRdtd7_g?z@|7Cf0yl9L-jKGzF0M>5o+t^KeDgW_My)BVzC#l{+RTMFA xQp(VUnlK$F8K&bT&;7%Y`bnB9eA1Del#(n|{_zh1R($`*_y1o>P5)c>{~zPOkTU=P diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5f8b0fa..b047b4f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,6 +23,7 @@ jobs: schema: - CGMES_2.4.15_27JAN2020 + - CGMES_3.0.0 steps: - name: Checkout repo @@ -40,10 +41,15 @@ jobs: pip install . + # Extract version (2.4.15 => 2_4_15), ignore the date part + SCHEMA_VERSION=$(echo "${{matrix.schema}}" | cut -d'_' -f2 | cut -d'.' -f1-3 | tr '.' '_') + + # Run cimgen with the valid version cimgen \ - --outdir=output/${{matrix.language}} \ + --outdir=output/${{matrix.language}}/${{matrix.schema}} \ --schemadir=cgmes_schema/${{matrix.schema}} \ - --langdir=${{matrix.language}} + --langdir=${{matrix.language}} \ + --cgmes_version=cgmes_v${SCHEMA_VERSION} - name: Create artifact uses: actions/upload-artifact@v4 diff --git a/Makefile b/Makefile index e1b7b03..0b2c7ae 100644 --- a/Makefile +++ b/Makefile @@ -9,15 +9,19 @@ else LANGUAGE_DEPS = image endif +# Extract version from SCHEMA (CGMES_2.4.15_27JAN2020 => 2_4_15) +CGMES_VERSION=$(subst .,_,$(wordlist 2,4,$(subst _, ,$(SCHEMA)))) + all: $(LANGUAGES) $(LANGUAGES): $(LANGUAGE_DEPS) $(CIMGEN) \ --outdir=output/$@/$(SCHEMA) \ --schemadir=cgmes_schema/$(SCHEMA) \ - --langdir=$@ + --langdir=$@ \ + --cgmes_version=cgmes_v$(CGMES_VERSION) image: docker build -t cimgen -f Dockerfile . -.PHONY: all image python modernpython java javascript +.PHONY: all image $(LANGUAGES) diff --git a/README.md b/README.md index eb52133..c31918f 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,19 @@ cimgen --outdir=output/cpp/CGMES_2.4.15_27JAN2020 --schemadir=cgmes_schema/CGMES This will build version `CGMES_2.4.15_27JAN2020` in the subfolder `output/cpp/CGMES_2.4.15_27JAN2020`. -If you wish to build an alternative version, you can see available options in the subfolder called `cgmes_schema`. -For the schema `CGMES_3.0.0` you have to use the option `--cgmes_version=cgmes_v3_0_0`. +> [!NOTE] +> If you wish to build an alternative version, you can see available options in the subfolder called `cgmes_schema`. +> For the schema `CGMES_3.0.0` you have to use the option +> `--cgmes_version=cgmes_v3_0_0`. `outdir` can be set to whichever absolute path you wish to create the files in. + +Alternatively, you can leverage `Makefile`: + +```bash +pip install -e . +#unset BUILD_IN_DOCKER # if you previously set to use docker +#export SCHEMA=CGMES_3.0.0 # to use CGMES 3.0.0 +make cpp +``` #### Generating C++ files in a Docker container @@ -29,6 +40,14 @@ docker build --tag cimgen --file Dockerfile . docker run --volume "$(pwd)/output:/output" cimgen --outdir=/output/cpp/CGMES_2.4.15_27JAN2020 --schemadir=/cimgen/cgmes_schema/CGMES_2.4.15_27JAN2020 --langdir=cpp --cgmes_version=cgmes_v2_4_15 ``` +alternatively, you can leverage `Makefile`: + +```bash +export BUILD_IN_DOCKER=true +#export SCHEMA=CGMES_3.0.0 to use CGMES 3.0.0 +make cpp +``` + ### Generating Python files #### Generating Python files on Linux @@ -38,7 +57,14 @@ pip install -e . cimgen --outdir=output/python/CGMES_2.4.15_27JAN2020 --schemadir=cgmes_schema/CGMES_2.4.15_27JAN2020 --langdir=python --cgmes_version=cgmes_v2_4_15 ``` -`outdir` can be set to whichever absolute path you wish to create the files in. +alternatively, you can leverage `Makefile`: + +```bash +pip install -e . +#unset BUILD_IN_DOCKER # if you previously set to use docker +#export SCHEMA=CGMES_3.0.0 # to use CGMES 3.0.0 +make python +``` #### Generating Python files in a Docker container @@ -47,6 +73,49 @@ docker build --tag cimgen --file Dockerfile . docker run --volume "$(pwd)/output:/output" cimgen --outdir=/output/python/CGMES_2.4.15_27JAN2020 --schemadir=/cimgen/cgmes_schema/CGMES_2.4.15_27JAN2020 --langdir=python --cgmes_version=cgmes_v2_4_15 ``` +alternatively, you can leverage `Makefile`: + +```bash +export BUILD_IN_DOCKER=true +#export SCHEMA=CGMES_3.0.0 to use CGMES 3.0.0 +make python +``` + +### Generating Modern Python (i.e. PyDantic based dataclasses) files + +#### Generating Modern Python files on Linux + +```bash +pip install -e . +cimgen --outdir=output/modernpython/CGMES_2.4.15_27JAN2020 --schemadir=cgmes_schema/CGMES_2.4.15_27JAN2020 --langdir=modernpython --cgmes_version=cgmes_v2_4_15 +``` + +`outdir` can be set to whichever absolute path you wish to create the files in. + +alternatively, you can leverage `Makefile`: + +```bash +pip install -e . +#unset BUILD_IN_DOCKER # if you previously set to use docker +#export SCHEMA=CGMES_3.0.0 # to use CGMES 3.0.0 +make modernpython +``` + +#### Generating Modern Python files in a Docker container + +```bash +docker build --tag cimgen --file Dockerfile . +docker run --volume "$(pwd)/output:/output" cimgen --outdir=/output/modernpython/CGMES_2.4.15_27JAN2020 --schemadir=/cimgen/cgmes_schema/CGMES_2.4.15_27JAN2020 --langdir=modernpython --cgmes_version=cgmes_v2_4_15 +``` + +alternatively, you can leverage `Makefile`: + +```bash +export BUILD_IN_DOCKER=true +#export SCHEMA=CGMES_3.0.0 to use CGMES 3.0.0 +make modernpython +``` + ## License This project is released under the terms of the [Apache 2.0 license](./LICENSE). diff --git a/cgmes_schema/.DS_Store b/cgmes_schema/.DS_Store deleted file mode 100644 index 7ec199a05d38d31791c6ee89fe7cb8cb7f432c86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~%}T>S5XWcRYEz2PgF=rBUW>-s3gRWCEuOp>(Su5CXwhKIN066HxTnURGjK;~AEN6R&LO&yb5DsAv zTy(bopa8wQGPK|n&Y%O|-=7;zhR;!=B8+&Co|AYua@`M+%NI5_i%!ugJGa4ungpZn zXgu`0gKKJCD3wI>dN;a^`;)M;-BRhO8>jt&PKbMb47s_A)1I36YMl0lIyW!_PRS{S zmFjfbXf|rH-gIX*IX$ksHQ6|7%w{ELXLtYPJbX-^QuS&i7WnmP+p?VF4J#{F_Yw@! zM5Xr_G0&c7FI>a7C{`hBGF0+9^s zbeAAXOV2Vh#1S-MQjsQA*eixG>DVuAoM)LCnsg9)W_*sFS=bwj(6eK|)ZrjJLoQhX zR$x(qylGbG{O_#3|1TzSixpr6)=B|UXa{W{mt@b@rNz-%E79-J$tW%}{7S)!K8i7x ej^Zl1Htd&FL3);%A@-p0kARke3s&Gy75D^eN=f7Z