Skip to content

Commit 01814f0

Browse files
author
Bin Zhang
authored
Merge pull request #366 from hylthink/v3
fault-tolerant. call encrypt if and only if used cocos package to import plugin
2 parents 5ef24d4 + 4202fb8 commit 01814f0

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version":"v3-console-13",
3-
"zip_file_size":"42887049",
3+
"zip_file_size":"42887263",
44
"repo_name":"console-binary",
55
"repo_parent":"https://github.com/natural-law/"
66
}

plugins/plugin_compile/build_android.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,14 +493,15 @@ def do_build_apk(self, build_mode, no_apk, output_dir, custom_step_args, compile
493493

494494
##cocospackage
495495
try:
496-
path = ''
497-
if getattr(sys, 'frozen', None):
498-
path = os.path.realpath(os.path.dirname(sys.executable))
499-
else:
500-
path = os.path.realpath(os.path.dirname(__file__))
501-
path = os.path.join(path, '../plugin_package/cocospackage')
502-
cmd = '%s encrypt -p %s --runincocos --runinbuild --noupdate' % (path, self.app_android_root)
503-
self._run_cmd(cmd)
496+
if os.path.exists(os.path.join(self._project.get_project_dir(), '.cocos-package.json')):
497+
path = ''
498+
if getattr(sys, 'frozen', None):
499+
path = os.path.realpath(os.path.dirname(sys.executable))
500+
else:
501+
path = os.path.realpath(os.path.dirname(__file__))
502+
path = os.path.join(path, '../plugin_package/cocospackage')
503+
cmd = '%s encrypt -p %s --mode %s --runincocos --runinbuild --noupdate' % (path, self.app_android_root, build_mode)
504+
self._run_cmd(cmd)
504505
except:
505506
pass
506507

plugins/plugin_compile/project_compile.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -642,14 +642,15 @@ def build_ios(self):
642642

643643
#cocospackage
644644
try:
645-
path = ''
646-
if getattr(sys, 'frozen', None):
647-
path = os.path.realpath(os.path.dirname(sys.executable))
648-
else:
649-
path = os.path.realpath(os.path.dirname(__file__))
650-
path = os.path.join(path, '../plugin_package/cocospackage')
651-
cmd = '%s encrypt -p %s --platform ios --runincocos --runinbuild --noupdate' % (path, self._project.get_project_dir())
652-
self._run_cmd(cmd)
645+
if os.path.exists(os.path.join(self._project.get_project_dir(), '.cocos-package.json')):
646+
path = ''
647+
if getattr(sys, 'frozen', None):
648+
path = os.path.realpath(os.path.dirname(sys.executable))
649+
else:
650+
path = os.path.realpath(os.path.dirname(__file__))
651+
path = os.path.join(path, '../plugin_package/cocospackage')
652+
cmd = '%s encrypt -p %s --mode %s --platform ios --runincocos --runinbuild --noupdate' % (path, self._project.get_project_dir(), self._mode)
653+
self._run_cmd(cmd)
653654
except:
654655
pass
655656

0 commit comments

Comments
 (0)