3.5版本的 cocos jscompile 后的jsc文件仍然可以看到源代码!!!

无论是从Cocos IDE打包或者命令行cocos compile -p android -m release 生成的apk中的jsc文件的源代码和注释完全可见!

我也提过这个问题,根本无人问津

请问是windows平台还是Mac平台下?

我在mac平台上测试,没有问题,所有jsc文件都是不可读的二进制文件,目前正在测试Windows平台上的安卓编译

Mac平台,官网上下载的版本 cocos2d-x-3.5 和 cocos2d-js-v3.5都试过

是所有的函数都能看到呢,还是只是字符串能看到的?

所有函数,copy出来把乱码去掉直接能跑

请问,我clone了这个项目(https://github.com/cocos2d-html5/JSCompiler),改了源码,生成jsbcc去解决这个问题。

虽然能够正常扰乱和正常跑,但因为有两个顾虑,想问下可能会有什么问题?
1)生成的jsbcc比原文件少了2m,生成的是5m 原来的是7m
2)项目已经半年没更新了

命令行 cocos compile -p android -m release , win7 平台, 编译出来的apk包没有问题,jsc是二进制文件,不可读

如果是windows平台的话,你在命令行里面输入where cocos看下cocos命令指向的位置对不对,mac下使用which cocos

sorry,没用win好久了,win下什么情况我不太清楚,我的经验用UltraEdit是能够看的
mac下用TextWrangler或者其他文本编辑工具强行阅读jsc文件是可以看到文件内容: 例如main.jsc可以看到这样:

,¿sπ+π∑/**

  • A brief explanation for “project.json”:

  • Here is the content of project.json file, this is the global configuration for your game, you can modify it to customize some behavior.

  • The detail of each field is under it.
    {
    “project_type”: “javascript”,
    // “project_type” indicate the program language of your project, you can ignore this field

    “debugMode” : 1,
    // “debugMode” possible values :
    // 0 - No message will be printed.
    // 1 - cc.error, cc.assert, cc.warn, cc.log will print in console.
    // 2 - cc.error, cc.assert, cc.warn will print in console.
    // 3 - cc.error, cc.assert will print in console.
    // 4 - cc.error, cc.assert, cc.warn, cc.log will print on canvas, available only on web.
    // 5 - cc.error, cc.assert, cc.warn will print on canvas, available only on web.
    // 6 - cc.error, cc.assert will print on canvas, available only on web.

    “showFPS” : true,
    // Left bottom corner fps information will show when “showFPS” equals true, otherwise it will be hide.

    “frameRate” : 60,
    // “frameRate” set the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.

    “id” : “gameCanvas”,
    // “gameCanvas” sets the id of your canvas element on the web page, it’s useful only on web.

    “renderMode” : 0,
    // “renderMode” sets the renderer type, only useful on web :
    // 0 - Automatically chosen by engine
    // 1 - Forced to use canvas renderer
    // 2 - Forced to use WebGL renderer, but this will be ignored on mobile browsers

    “engineDir” : “frameworks/cocos2d-html5/”,
    // In debug mode, if you use the whole engine to develop your game, you should specify its relative path with “engineDir”,
    // but if you are using a single engine file, you can ignore it.

    “modules” : “cocos2d”],
    // “modules” defines which modules you will need in your game, it’s useful only on web,
    // using this can greatly reduce your game’s resource size, and the cocos console tool can package your game with only the modules you set.
    // For details about modules definitions, you can refer to “…/…/frameworks/cocos2d-html5/modulesConfig.json”.

    “jsList” :
    ]
    // “jsList” sets the list of js files in your game.
    }

*/

cc.game.onStart = function(){
cc.view.adjustViewPort(true);

看 连注释都有哦。用3.5版本引擎的同学们快去检查下吧

你拿个文本编辑器打开看看,开头就是完整的源代码,后面是字节码,mac下是这样的,win没看过

,¿sπo
π 2ô
var HelloWorldLayer = cc.Layer.extend({
sprite:null,
ctor:function () {
//////////////////////////////
// 1. super init first
this._super();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.
    // ask the window size
    var size = cc.winSize;

    // add a "close" icon to exit the progress. it's an autorelease object
    var closeItem = new cc.MenuItemImage(
        res.CloseNormal_png,
        res.CloseSelected_png,
        function () {
            cc.log("Menu is clicked!");
        }, this);
    closeItem.attr({
        x: size.width - 20,
        y: 20,
        anchorX: 0.5,
        anchorY: 0.5
    });

    var menu = new cc.Menu(closeItem);
    menu.x = 0;
    menu.y = 0;
    this.addChild(menu, 1);

    /////////////////////////////
    // 3. add your codes below...
    // add a label shows "Hello World"
    // create and initialize a label
    var helloLabel = new cc.LabelTTF("Hello World", "Arial", 38);
    // position the label on the center of the screen
    helloLabel.x = size.width / 2;
    helloLabel.y = 0;
    // add the label as a child to this layer
    this.addChild(helloLabel, 5);

    // add "HelloWorld" splash screen"
    this.sprite = new cc.Sprite(res.HelloWorld_png);
    this.sprite.attr({
        x: size.width / 2,
        y: size.height / 2,
        scale: 0.5,
        rotation: 180
    });
    this.addChild(this.sprite, 0);

    this.sprite.runAction(
        cc.sequence(
            cc.rotateTo(2, 0),
            cc.scaleTo(2, 1, 1)
        )
    );
    helloLabel.runAction(
        cc.spawn(
            cc.moveBy(2.5, cc.p(0, size.height - 40)),
            cc.tintTo(2.5,255,125,0)
        )
    );
    return true;
}

});

var HelloWorldScene = cc.Scene.extend({
onEnter:function () {
this._super();
var layer = new HelloWorldLayer();
this.addChild(layer);
}
});

src/app.jsôÅÅn;5∏
Y@]Ç]:oQn;5∏
YÇ]:oQôêàùGàùêà

字节码被截断了,复杂不了完整的

谢谢各位,这个问题已经确认,我们会尽快解决,感谢各位的反馈

用这个仓库v3分支的替换了你的jsbcc就好了https://github.com/joshuastray/console-binary

zip包下载地址:https://github.com/joshuastray/console-binary/archive/v3.zip

解压后,将https://github.com/joshuastray/console-binary/tree/v3/plugins/https://github.com/joshuastray/console-binary/tree/v3/plugins/plugin_jscompile/bin 目录下的文件覆盖到cocos2d-js/tools/cocos2d-console/plugins/plugin_jscompile/bin目录下