@@ -841,7 +841,7 @@ def generate_clion_run_configs(self, configs):
841
841
run_config_path = os .path .join (run_dir , f"{ config_name } .run.xml" )
842
842
root = ET .Element ("component" , name = "ProjectRunConfigurationManager" )
843
843
if 'target' in config :
844
- clion_config = ET . SubElement ( root , "configuration" , {
844
+ attrib = {
845
845
"default" : "false" ,
846
846
"name" : config ["name" ],
847
847
"type" : "CMakeRunConfiguration" ,
@@ -857,20 +857,26 @@ def generate_clion_run_configs(self, configs):
857
857
"CONFIG_NAME" : self .options .mrdocs_preset_name or "debug" ,
858
858
"RUN_TARGET_PROJECT_NAME" : "MrDocs" ,
859
859
"RUN_TARGET_NAME" : config ["target" ]
860
- })
860
+ }
861
+ if 'folder' in config :
862
+ attrib ["folderName" ] = config ["folder" ]
863
+ clion_config = ET .SubElement (root , "configuration" , attrib )
861
864
method = ET .SubElement (clion_config , "method" , v = "2" )
862
865
ET .SubElement (method , "option" ,
863
866
name = "com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" ,
864
867
enabled = "true" )
865
868
elif 'script' in config :
866
869
if config ["script" ].endswith (".py" ):
867
- clion_config = ET . SubElement ( root , "configuration" , {
870
+ attrib = {
868
871
"default" : "false" ,
869
872
"name" : config ["name" ],
870
873
"type" : "PythonConfigurationType" ,
871
874
"factoryName" : "Python" ,
872
875
"nameIsGenerated" : "false"
873
- })
876
+ }
877
+ if 'folder' in config :
878
+ attrib ["folderName" ] = config ["folder" ]
879
+ clion_config = ET .SubElement (root , "configuration" , attrib )
874
880
ET .SubElement (clion_config , "module" , name = "mrdocs" )
875
881
ET .SubElement (clion_config , "option" , name = "ENV_FILES" , value = "" )
876
882
ET .SubElement (clion_config , "option" , name = "INTERPRETER_OPTIONS" , value = "" )
@@ -895,11 +901,14 @@ def generate_clion_run_configs(self, configs):
895
901
ET .SubElement (clion_config , "option" , name = "INPUT_FILE" , value = "" )
896
902
ET .SubElement (clion_config , "method" , v = "2" )
897
903
elif config ["script" ].endswith (".sh" ):
898
- clion_config = ET . SubElement ( root , "configuration" , {
904
+ attrib = {
899
905
"default" : "false" ,
900
906
"name" : config ["name" ],
901
907
"type" : "ShConfigurationType"
902
- })
908
+ }
909
+ if 'folder' in config :
910
+ attrib ["folderName" ] = config ["folder" ]
911
+ clion_config = ET .SubElement (root , "configuration" , attrib )
903
912
ET .SubElement (clion_config , "option" , name = "SCRIPT_TEXT" , value = f"bash { shlex .quote (config ['script' ])} " )
904
913
ET .SubElement (clion_config , "option" , name = "INDEPENDENT_SCRIPT_PATH" , value = "true" )
905
914
ET .SubElement (clion_config , "option" , name = "SCRIPT_PATH" , value = config ["script" ])
@@ -913,9 +922,43 @@ def generate_clion_run_configs(self, configs):
913
922
ET .SubElement (clion_config , "option" , name = "INTERPRETER_PATH" , value = "" )
914
923
ET .SubElement (clion_config , "option" , name = "INTERPRETER_OPTIONS" , value = "" )
915
924
ET .SubElement (clion_config , "option" , name = "EXECUTE_IN_TERMINAL" , value = "true" )
916
- ET .SubElement (clion_config , "option" , name = "EXECUTE_SCRIPT_FILE" , value = "true " )
925
+ ET .SubElement (clion_config , "option" , name = "EXECUTE_SCRIPT_FILE" , value = "false " )
917
926
ET .SubElement (clion_config , "envs" )
918
927
ET .SubElement (clion_config , "method" , v = "2" )
928
+ elif config ["script" ].endswith (".js" ):
929
+ attrb = {
930
+ "default" : "false" ,
931
+ "name" : config ["name" ],
932
+ "type" : "NodeJSConfigurationType" ,
933
+ "path-to-js-file" : config ["script" ],
934
+ "working-dir" : config .get ("cwd" , "$PROJECT_DIR$" )
935
+ }
936
+ if 'folder' in config :
937
+ attrb ["folderName" ] = config ["folder" ]
938
+ clion_config = ET .SubElement (root , "configuration" , attrb )
939
+ envs = ET .SubElement (clion_config , "envs" )
940
+ if 'env' in config :
941
+ for key , value in config ['env' ].items ():
942
+ ET .SubElement (envs , "env" , name = key , value = value )
943
+ ET .SubElement (clion_config , "method" , v = "2" )
944
+ elif config ["script" ] == "npm" :
945
+ attrib = {
946
+ "default" : "false" ,
947
+ "name" : config ["name" ],
948
+ "type" : "js.build_tools.npm"
949
+ }
950
+ if 'folder' in config :
951
+ attrib ["folderName" ] = config ["folder" ]
952
+ clion_config = ET .SubElement (root , "configuration" , attrib )
953
+ ET .SubElement (clion_config , "package-json" , value = os .path .join (config ["cwd" ], "package.json" ))
954
+ ET .SubElement (clion_config , "command" , value = config ["args" ][0 ] if config ["args" ] else "ci" )
955
+ ET .SubElement (clion_config , "node-interpreter" , value = "project" )
956
+ envs = ET .SubElement (clion_config , "envs" )
957
+ if 'env' in config :
958
+ for key , value in config ['env' ].items ():
959
+ ET .SubElement (envs , "env" , name = key , value = value )
960
+ ET .SubElement (clion_config , "method" , v = "2" )
961
+
919
962
tree = ET .ElementTree (root )
920
963
tree .write (run_config_path , encoding = "utf-8" , xml_declaration = False )
921
964
@@ -988,6 +1031,7 @@ def generate_run_configs(self):
988
1031
configs .append ({
989
1032
"name" : f"MrDocs { verb .title ()} Test Fixtures ({ generator .upper ()} )" ,
990
1033
"target" : "mrdocs-test" ,
1034
+ "folder" : "MrDocs Test Fixtures" ,
991
1035
"args" : [
992
1036
f'"{ self .options .mrdocs_src_dir } /test-files/golden-tests"' ,
993
1037
'--unit=false' ,
@@ -1062,6 +1106,7 @@ def generate_run_configs(self):
1062
1106
configs .append ({
1063
1107
"name" : f"MrDocs Bootstrap Update ({ bootstrap_refresh_config_name } )" ,
1064
1108
"script" : os .path .join (self .options .mrdocs_src_dir , "bootstrap.py" ),
1109
+ "folder" : "MrDocs Bootstrap Update" ,
1065
1110
"args" : bootstrap_args ,
1066
1111
"cwd" : self .options .mrdocs_src_dir
1067
1112
})
@@ -1070,6 +1115,7 @@ def generate_run_configs(self):
1070
1115
configs .append ({
1071
1116
"name" : f"MrDocs Bootstrap Refresh ({ bootstrap_refresh_config_name } )" ,
1072
1117
"script" : os .path .join (self .options .mrdocs_src_dir , "bootstrap.py" ),
1118
+ "folder" : "MrDocs Bootstrap Refresh" ,
1073
1119
"args" : bootstrap_refresh_args ,
1074
1120
"cwd" : self .options .mrdocs_src_dir
1075
1121
})
@@ -1078,6 +1124,7 @@ def generate_run_configs(self):
1078
1124
configs .append ({
1079
1125
"name" : f"MrDocs Generate Config Info ({ bootstrap_refresh_config_name } )" ,
1080
1126
"script" : os .path .join (self .options .mrdocs_src_dir , 'util' , 'generate-config-info.py' ),
1127
+ "folder" : "MrDocs Generate Config Info" ,
1081
1128
"args" : [os .path .join (self .options .mrdocs_src_dir , 'src' , 'lib' , 'ConfigOptions.json' ),
1082
1129
os .path .join (self .options .mrdocs_build_dir )],
1083
1130
"cwd" : self .options .mrdocs_src_dir
@@ -1121,6 +1168,32 @@ def generate_run_configs(self):
1121
1168
"cwd" : test_files_dir
1122
1169
})
1123
1170
1171
+ # Render landing page
1172
+ mrdocs_website_dir = os .path .join (mrdocs_docs_dir , "website" )
1173
+ configs .append ({
1174
+ "name" : f"MrDocs Render Landing Page ({ bootstrap_refresh_config_name } )" ,
1175
+ "script" : os .path .join (mrdocs_website_dir , "render.js" ),
1176
+ "folder" : "MrDocs Render Landing Page" ,
1177
+ "args" : [],
1178
+ "cwd" : mrdocs_website_dir ,
1179
+ "env" : {
1180
+ "NODE_ENV" : "production" ,
1181
+ "MRDOCS_ROOT" : self .options .mrdocs_install_dir
1182
+ }
1183
+ })
1184
+ configs .append ({
1185
+ "name" : f"MrDocs Clean Install Website Dependencies" ,
1186
+ "script" : "npm" ,
1187
+ "args" : ["ci" ],
1188
+ "cwd" : mrdocs_website_dir
1189
+ })
1190
+ configs .append ({
1191
+ "name" : f"MrDocs Install Website Dependencies" ,
1192
+ "script" : "npm" ,
1193
+ "args" : ["install" ],
1194
+ "cwd" : mrdocs_website_dir
1195
+ })
1196
+
1124
1197
print ("Generating CLion run configurations for MrDocs..." )
1125
1198
self .generate_clion_run_configs (configs )
1126
1199
print ("Generating Visual Studio run configurations for MrDocs..." )
0 commit comments