@@ -71,6 +71,7 @@ def _add_custom_options(self, parser):
71
71
72
72
group = parser .add_argument_group ("Web Options" )
73
73
group .add_argument ("--source-map" , dest = "source_map" , action = "store_true" , help = 'Enable source-map' )
74
+ group .add_argument ("--advanced" , dest = "advanced" , action = "store_true" , help = "Compile all source js files using Closure Compiler's advanced mode, bigger compression ratio bug more risk" )
74
75
75
76
group = parser .add_argument_group ("iOS/Mac Options" )
76
77
group .add_argument ("-t" , "--target" , dest = "target_name" , help = "Specify the target name to compile." )
@@ -138,6 +139,7 @@ def _check_custom_options(self, args):
138
139
self ._jobs = self .get_num_of_cpu ()
139
140
140
141
self ._has_sourcemap = args .source_map
142
+ self ._web_advanced = args .advanced
141
143
self ._no_res = args .no_res
142
144
self ._output_dir = self ._get_output_dir ()
143
145
self ._sign_id = args .sign_id
@@ -968,23 +970,26 @@ def build_web(self):
968
970
else :
969
971
self .sub_url = '/'
970
972
973
+ output_dir = "publish"
971
974
if self ._is_debug_mode ():
972
- return
973
- else :
974
- self .sub_url = '%spublish/html5/' % self .sub_url
975
+ output_dir = "runtime"
976
+ if not self ._web_advanced :
977
+ return
978
+
979
+ self .sub_url = '%s%s/html5/' % (self .sub_url , output_dir )
975
980
976
981
f = open (os .path .join (project_dir , "project.json" ))
977
982
project_json = json .load (f )
978
983
f .close ()
979
984
engine_dir = os .path .join (project_json ["engineDir" ])
980
985
realEngineDir = os .path .normpath (os .path .join (project_dir , engine_dir ))
981
- publish_dir = os .path .normpath (os .path .join (project_dir , "publish" , "html5" ))
986
+ publish_dir = os .path .normpath (os .path .join (project_dir , output_dir , "html5" ))
982
987
983
988
# need to config in options of command
984
989
buildOpt = {
985
990
"outputFileName" : "game.min.js" ,
986
- #"compilationLevel" : "simple ",
987
- "compilationLevel" : "advanced" ,
991
+ "debug" : "true" if self . _is_debug_mode () else "false " ,
992
+ "compilationLevel" : "advanced" if self . _web_advanced else "simple" ,
988
993
"sourceMapOpened" : True if self ._has_sourcemap else False
989
994
}
990
995
0 commit comments