Skip to content

Commit 2ceba42

Browse files
author
minggo
authored
Merge pull request #359 from natural-law/issue16083
Solve the error in command gen-templates & gen-simulator.
2 parents a62a0f9 + 47a1b52 commit 2ceba42

File tree

9 files changed

+42
-69
lines changed

9 files changed

+42
-69
lines changed

plugins/plugin_generate/bin-templates/cpp-template-default/Classes/HelloWorldScene.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "HelloWorldScene.h"
2-
#include "cocostudio/CocoStudio.h"
2+
#include "editor-support/cocostudio/CocoStudio.h"
33
#include "ui/CocosGUI.h"
44

55
USING_NS_CC;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system use,
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
10+
# Project target.
11+
target=android-19
12+

plugins/plugin_generate/bin-templates/js-template-runtime/cocos-project-template.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
"project_replace_project_name":{
2121
"src_project_name":"HelloJavascript",
2222
"files":[
23-
"config.json",
24-
".project",
2523
"PROJECT_NAME.ccs"
2624
]
2725
},
@@ -82,8 +80,6 @@
8280
"project_replace_project_name":{
8381
"src_project_name":"HelloJavascript",
8482
"files":[
85-
"config.json",
86-
".project",
8783
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj",
8884
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
8985
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
@@ -125,11 +121,6 @@
125121
"to": ""
126122
},
127123
"modify_files": [
128-
{
129-
"file_path": "config.json",
130-
"pattern": "\\\"isLandscape\\\"\\s*:.*,",
131-
"replace_string": "\"isLandscape\": false,"
132-
},
133124
{
134125
"file_path": "main.js",
135126
"pattern": "setDesignResolutionSize\\(\\s*(\\d+),\\s*(\\d+),(.*)\\)",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system use,
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
10+
# Project target.
11+
target=android-19
12+

plugins/plugin_generate/bin-templates/lua-template-runtime/cocos-project-template.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
"project_replace_project_name": {
2121
"src_project_name": "HelloLua",
2222
"files": [
23-
"config.json",
24-
".project",
2523
"PROJECT_NAME.ccs"
2624
]
2725
},
@@ -60,8 +58,6 @@
6058
"project_replace_project_name": {
6159
"src_project_name": "HelloLua",
6260
"files": [
63-
"config.json",
64-
".project",
6561
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj",
6662
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.filters",
6763
"frameworks/runtime-src/proj.win32/PROJECT_NAME.vcxproj.user",
@@ -103,11 +99,6 @@
10399
"to": ""
104100
},
105101
"modify_files": [
106-
{
107-
"file_path": "config.json",
108-
"pattern": "\\\"isLandscape\\\"\\s*:.*,",
109-
"replace_string": "\"isLandscape\": false,"
110-
},
111102
{
112103
"file_path": "src/config.lua",
113104
"pattern": "width\\s*=.*,",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system use,
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
10+
# Project target.
11+
target=android-19
12+

plugins/plugin_generate/configs/gen_templates_config.json

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
]
4444
},
4545
{
46-
"from": "templates/js-template-runtime",
46+
"from": "templates/js-template-default",
4747
"to": "js-template-binary",
4848
"exclude": [
4949
"*android-studio",
@@ -56,13 +56,6 @@
5656
"runtime/*"
5757
]
5858
},
59-
{
60-
"from": "tools/simulator/frameworks/runtime-src/Classes/ide-support",
61-
"to": "lua-template-binary/frameworks/runtime-src/Classes/ide-support/",
62-
"exclude": [
63-
"RuntimeJsImpl.*"
64-
]
65-
},
6659
{
6760
"from": "cocos/scripting/lua-bindings/manual",
6861
"to": "lua-template-binary/frameworks/runtime-src/Classes",
@@ -107,14 +100,6 @@
107100
"js_module_register.h"
108101
]
109102
},
110-
{
111-
"from": "tools/simulator/frameworks/runtime-src/Classes/ide-support",
112-
"to": "js-template-binary/frameworks/runtime-src/Classes/ide-support/",
113-
"exclude": [
114-
"RuntimeLuaImpl.*",
115-
"lua_debugger.*"
116-
]
117-
},
118103
{
119104
"from": "tools/simulator/frameworks/runtime-src/proj.ios_mac/ios",
120105
"to": "js-template-binary/frameworks/runtime-src/proj.ios_mac/ios",
@@ -132,19 +117,6 @@
132117
"build-cfg.json"
133118
]
134119
},
135-
{
136-
"from": "tools/simulator/frameworks/runtime-src/proj.win32",
137-
"to": "js-template-binary/frameworks/runtime-src/proj.win32/",
138-
"include": [
139-
"game.rc",
140-
"main.cpp",
141-
"main.h",
142-
"res",
143-
"resource.h",
144-
"SimulatorWin.cpp",
145-
"SimulatorWin.h"
146-
]
147-
},
148120
{
149121
"from": "cocos/platform/android/java/src",
150122
"to": "cpp-template-binary/proj.android/src"
@@ -275,16 +247,6 @@
275247
"pattern": "\\\"modules\\\"[ \\t]*:[ \\t]*\\[(.*)\\]",
276248
"replace_string": "\"modules\" : [\\1, \"cocostudio\"]"
277249
},
278-
{
279-
"file_path": "js-template-binary/frameworks/runtime-src/Classes/ide-support/CodeIDESupport.h",
280-
"pattern": "#define CC_CODE_IDE_DEBUG_SUPPORT 1",
281-
"replace_string": "#define CC_CODE_IDE_DEBUG_SUPPORT 0"
282-
},
283-
{
284-
"file_path": "lua-template-binary/frameworks/runtime-src/Classes/ide-support/CodeIDESupport.h",
285-
"pattern": "#define CC_CODE_IDE_DEBUG_SUPPORT 1",
286-
"replace_string": "#define CC_CODE_IDE_DEBUG_SUPPORT 0"
287-
},
288250
{
289251
"file_path": "cpp-template-binary/proj.win32/cocos2dx.props",
290252
"pattern": "(libbox2d\\.lib;)|(libSpine\\.lib;)",

plugins/plugin_generate/gen_simulator.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,6 @@ def compile_for_win32(self):
269269
if not os.path.isdir(win32_output_dir):
270270
os.makedirs(win32_output_dir)
271271

272-
lang_file_path = os.path.join(self.simulator_abs_path, "frameworks/runtime-src/Classes/ide-support/lang")
273-
lang_copy_command = "xcopy /Y %s %s" % (self.convert_path_to_win32(lang_file_path), win32_output_dir)
274-
275272
# get the vs version should be used
276273
if self.vs_version is None:
277274
ver_param = ''
@@ -286,14 +283,10 @@ def compile_for_win32(self):
286283
" %s compile -p win32 -m debug --no-res --compile-script 0 %s" % (self.cocos_bin, ver_param),
287284
" && xcopy /Y %s*.dll %s" % (win32_src_dir, win32_output_dir),
288285
" && xcopy /Y %s*.exe %s" % (win32_src_dir, win32_output_dir),
289-
" && %s" % (lang_copy_command),
290286
" && if exist %s*.dll xcopy /Y %s*.dll %s" % (win32_dll_dir,win32_dll_dir,win32_output_dir)
291287
])
292288
else:
293-
command = ' '.join([
294-
" %s compile -p win32 -m release --no-res --compile-script 0 -o %s %s" % (self.cocos_bin,win32_output_dir,ver_param),
295-
" && %s" % (lang_copy_command),
296-
])
289+
command = " %s compile -p win32 -m release --no-res --compile-script 0 -o %s %s" % (self.cocos_bin,win32_output_dir,ver_param)
297290

298291
self._run_cmd(command, self.simulator_abs_path)
299292
self.build_log += MultiLanguage.get_string('GEN_SIM_BUILD_SUCCESS_FMT', ('Win32', self.mode))

plugins/plugin_generate/gen_templates.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ def gen_templates(self):
116116
self.modify_build_cfg()
117117

118118
self.modify_version_json(os.path.join(dst_dir, "lua-template-binary/.settings/version.json"))
119-
self.modify_version_json(os.path.join(dst_dir, "js-template-binary/.settings/version.json"))
120119

121120
self.gen_template_config(dst_dir, self.version)
122121

@@ -128,7 +127,8 @@ def modify_win32_maincpp(self):
128127
cpp_files = win32_cfg['main_cpps']
129128
link_libs_cfg = win32_cfg['link_libs']
130129

131-
check_pattern = r'^int[\s]+APIENTRY[\s]+_tWinMain'
130+
check_pattern1 = r'^int[\s]+APIENTRY[\s]+_tWinMain'
131+
check_pattern2 = r'^int[\s]+WINAPI[\s]+_tWinMain'
132132
for main_cpp in cpp_files:
133133
cpp_full_path = os.path.join(self.engine_template_dir, main_cpp)
134134

@@ -146,7 +146,7 @@ def modify_win32_maincpp(self):
146146
new_lines = []
147147
for line in old_lines:
148148
strip_line = line.strip()
149-
if re.match(check_pattern, strip_line):
149+
if re.match(check_pattern1, strip_line) or re.match(check_pattern2, strip_line):
150150
new_lines.append('#if _MSC_VER > 1800\n')
151151
for lib in link_libs:
152152
new_lines.append('%s\n' % self.get_lib_str(lib, 2015))

0 commit comments

Comments
 (0)