Merge branch 'master' of gitea.azcona-becker.net:mochapowered/mocha-common
This commit is contained in:
commit
ce10750b3e
4
.gitignore
vendored
4
.gitignore
vendored
@ -19,3 +19,7 @@ buildlog
|
||||
mocha-common/compilers/yaml2mcl/editor
|
||||
mocha-common/compilers/yaml2mcl/framework
|
||||
|
||||
# Do not keep compiled .mcl's
|
||||
*.mcl
|
||||
*.mcx
|
||||
|
||||
|
||||
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -1,6 +1,6 @@
|
||||
[submodule "framework-python"]
|
||||
path = framework-python
|
||||
url = git@gitea.azcona-becker.net:beckermj/framework-python
|
||||
url = gitea@gitea.azcona-becker.net:beckermj/framework-python
|
||||
[submodule "editor-python"]
|
||||
path = editor-python
|
||||
url = git@gitea.azcona-becker.net:universaleditor/editor-python
|
||||
url = gitea@gitea.azcona-becker.net:universaleditor/editor-python
|
||||
|
||||
33
build.ninja
Normal file
33
build.ninja
Normal file
File diff suppressed because one or more lines are too long
@ -109,9 +109,11 @@ class Yaml2Mcl:
|
||||
|
||||
manager.library_reference_guids = libraryRefGuids
|
||||
|
||||
filenames2 = [ ]
|
||||
|
||||
for filename in filenames:
|
||||
if not os.path.isdir(filename):
|
||||
print ("not a directory: '" + filename + "'")
|
||||
filenames2.append(filename)
|
||||
continue
|
||||
|
||||
yaml_files = sorted(glob(filename + "/**/*.yaml", recursive=True))
|
||||
@ -141,41 +143,68 @@ class Yaml2Mcl:
|
||||
|
||||
print("export entities to file: '" + exportEntitiesFileName + "'")
|
||||
manager.save_entities_to_file(exportEntitiesFileName, outputFileName)
|
||||
|
||||
if len(filenames2) > 0:
|
||||
yaml_files = filenames2
|
||||
|
||||
# first, load the entity defs
|
||||
for yaml_file in yaml_files:
|
||||
yl.load_entity_definitions_from_file(yaml_file)
|
||||
|
||||
#try:
|
||||
# then, load instance definitions (also loads sugar elements into memory for later use)
|
||||
for yaml_file in yaml_files:
|
||||
yl.load_instances_from_file(yaml_file)
|
||||
|
||||
# finally, apply syntactic sugar
|
||||
yl.apply_sugar()
|
||||
|
||||
manager.filename = outputFileName
|
||||
manager.parser = yl
|
||||
manager.commit()
|
||||
|
||||
if not exportEntitiesFileName is None:
|
||||
if exportEntitiesFileName == "":
|
||||
exportEntitiesFileName = "entities.cs"
|
||||
|
||||
return True
|
||||
print("export entities to file: '" + exportEntitiesFileName + "'")
|
||||
manager.save_entities_to_file(exportEntitiesFileName, outputFileName)
|
||||
|
||||
|
||||
return True
|
||||
|
||||
#except NameError as ex:
|
||||
|
||||
print (ex)
|
||||
# print (ex)
|
||||
|
||||
rgx = "&(.*);"
|
||||
# rgx = "&(.*);"
|
||||
|
||||
# go through and get all entity references across all files
|
||||
import re
|
||||
# # go through and get all entity references across all files
|
||||
# import re
|
||||
|
||||
stuff = []
|
||||
# stuff = []
|
||||
|
||||
for yaml_file in yaml_files:
|
||||
f = open(yaml_file, "r")
|
||||
text = f.read()
|
||||
matches = re.findall(rgx, text)
|
||||
for match in matches:
|
||||
stuff.append(match)
|
||||
f.close()
|
||||
# for yaml_file in yaml_files:
|
||||
# f = open(yaml_file, "r")
|
||||
# text = f.read()
|
||||
# matches = re.findall(rgx, text)
|
||||
# for match in matches:
|
||||
# stuff.append(match)
|
||||
# f.close()
|
||||
|
||||
missingEntities = []
|
||||
for stuf in stuff:
|
||||
if not stuf in manager.entityReferences:
|
||||
if not stuf in missingEntities:
|
||||
missingEntities.append(stuf)
|
||||
# missingEntities = []
|
||||
# for stuf in stuff:
|
||||
# if not stuf in manager.entityReferences:
|
||||
# if not stuf in missingEntities:
|
||||
# missingEntities.append(stuf)
|
||||
|
||||
if len(missingEntities) > 0:
|
||||
print("\nNOTE: there were undefined referenced entities:\n")
|
||||
for missingEntity in missingEntities:
|
||||
print("\t" + missingEntity)
|
||||
print("\n")
|
||||
# if len(missingEntities) > 0:
|
||||
# print("\nNOTE: there were undefined referenced entities:\n")
|
||||
# for missingEntity in missingEntities:
|
||||
# print("\t" + missingEntity)
|
||||
# print("\n")
|
||||
|
||||
return False
|
||||
# return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
- entityDefinitions:
|
||||
- IDC_StyleSheet: '{a727f9fa-0688-4203-9acf-7306b88c44fe}'
|
||||
- IDR_Style__has__Style_Sheet: '{9c27fdd6-4f28-4844-98be-8fb9a72a81d7}'
|
||||
- IDR_Style_Sheet__for__Style: '{aadd1dec-ce29-4ecf-bafe-efc67751dd0e}'
|
||||
|
||||
- library: '&IDL_MochaBaseSystem;'
|
||||
instances:
|
||||
- class: '&IDC_StyleSheet;'
|
||||
name: 'Style Sheet'
|
||||
attributes:
|
||||
- instance: '&IDA_Name;'
|
||||
customTagName: 'name'
|
||||
- instance: '&IDA_ContentType;'
|
||||
customTagName: 'contentType'
|
||||
- instance: '&IDA_Value;'
|
||||
customTagName: 'content'
|
||||
|
||||
- relationship: '&IDR_Style__has__Style_Sheet;'
|
||||
index: 24626
|
||||
sourceClassId: '&IDC_Style;'
|
||||
type: 'has'
|
||||
destinationClassId: '&IDC_StyleSheet;'
|
||||
siblingRelationshipId: '&IDR_Style_Sheet__for__Style;'
|
||||
singular: no
|
||||
|
||||
- relationship: '&IDR_Style_Sheet__for__Style;'
|
||||
index: 24628
|
||||
sourceClassId: '&IDC_StyleSheet;'
|
||||
type: 'for'
|
||||
destinationClassId: '&IDC_Style;'
|
||||
siblingRelationshipId: '&IDR_Style__has__Style_Sheet;'
|
||||
singular: no
|
||||
@ -48,6 +48,7 @@
|
||||
relationships:
|
||||
- instance: '&IDR_Route_Table__has__Route;'
|
||||
customTagName: 'routes'
|
||||
customTagNameCreatesInstanceOf: '&IDC_Route;'
|
||||
|
||||
- relationship: '&IDR_Route_Table__has__Route;'
|
||||
sourceClassId: '&IDC_RouteTable;'
|
||||
@ -93,13 +94,24 @@
|
||||
|
||||
- routeTable: '{641ea97b-a1c2-4005-9bda-c0111a254365}'
|
||||
routes:
|
||||
- instance: '{1184d102-0710-4632-bf64-6362b9485a0f}'
|
||||
- instance: '{88de14b6-53ca-4394-8500-bd4120499875}'
|
||||
|
||||
- route: '{1184d102-0710-4632-bf64-6362b9485a0f}'
|
||||
name: MADI Authentication Gateway Login
|
||||
url: 'madi/authgwy/{tenant}/login.htmld'
|
||||
|
||||
- route: '{88de14b6-53ca-4394-8500-bd4120499875}'
|
||||
name: MADI Authentication Gateway Login
|
||||
url: 'madi/authgwy/{tenant}/login.htmld'
|
||||
- globalIdentifier: '{1184d102-0710-4632-bf64-6362b9485a0f}'
|
||||
name: MADI Authentication Gateway Login
|
||||
url: 'madi/authgwy/{tenant}/login.htmld'
|
||||
- globalIdentifier: '{88de14b6-53ca-4394-8500-bd4120499875}'
|
||||
name: MADI Authentication Gateway Login
|
||||
url: 'madi/authgwy/{tenant}/login.htmld'
|
||||
- globalIdentifier: '{a113eee4-7e06-4cf4-86fe-ff2235199611}'
|
||||
name: Tenant Instance Page
|
||||
url: '{tenant}/d/inst/{iid}.htmld'
|
||||
- globalIdentifier: '{373d6921-52be-4ba9-9771-3e1b0b1d3da7}'
|
||||
name: Tenant Instance Related Task List Page
|
||||
url: '{tenant}/d/inst/{iid}/rel-tasks.htmld'
|
||||
- globalIdentifier: '{a1f57965-3419-4031-b872-283103162751}'
|
||||
name: Tenant Instance Related Task Page
|
||||
url: '{tenant}/d/inst/{iid}/rel-task/{task-iid}.htmld'
|
||||
- globalIdentifier: '{4a94bcb8-bb02-4d65-a20e-a0250c91f677}'
|
||||
name: Tenant Home Page
|
||||
url: '{tenant}/d/home.htmld'
|
||||
- globalIdentifier: '{4a94bcb8-bb02-4d65-a20e-a0250c91f677}'
|
||||
name: Tenant Logout Page
|
||||
url: '{tenant}/d/logout.htmld'
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
export PYTHONPATH=".;../editor-python/editor-python/src;../framework-python/lib/mbs"
|
||||
python3 compilers/yaml2mcl/Program.py ${1+"$@"}
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
export PYTHONPATH="$SCRIPT_DIR:$SCRIPT_DIR/../editor-python/editor-python/src:$SCRIPT_DIR/../framework-python/lib/mbs"
|
||||
python3 $SCRIPT_DIR/compilers/yaml2mcl/Program.py ${1+"$@"}
|
||||
|
||||
|
||||
24
ninjen
Executable file
24
ninjen
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# usage : ninjen LIBRARY_NAME
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
LIB=$1
|
||||
WORKDIR=$SCRIPT_DIR
|
||||
SRCPATH=$WORKDIR/mocha-common/data/libraries/yaml/$LIB
|
||||
PREFIX=$2
|
||||
|
||||
if [ "$LIB" == "" ]; then
|
||||
|
||||
echo "usage: ninjen LIBRARY_NAME [PREFIX]"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
YAMLFILES=$(find $SRCPATH -name '*.yaml' -type f | sed 's/ /\$ /g' | sort | tr '\n' ' ')
|
||||
|
||||
if [ "$PREFIX" != "" ]; then
|
||||
YAMLFILESSPACE="${YAMLFILES//"$WORKDIR"/"\$root/$PREFIX"}"
|
||||
echo "build \$root/$PREFIX/mocha-common/output/$LIB.mcl: yaml2mcl $YAMLFILESSPACE"
|
||||
else
|
||||
YAMLFILESSPACE="${YAMLFILES//"$WORKDIR"/"\$root"}"
|
||||
echo "build \$root/mocha-common/output/$LIB.mcl: yaml2mcl $YAMLFILESSPACE"
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user