Junos Space Developer
Reply
Contributor
fuyuki
Posts: 14
Registered: ‎05-23-2011
0
Accepted Solution

"Obfuscate" issue for building package for distribution

Hi,

 

When building the package for the distribution by the Linux Eclipse Junos Space SDK plug-in, even though the "Obfuscate javascript" check box is checked, the minified file does not contain the java script files, which are specified by the "Edit module.xml". (i.e although "Obfuscate javascript" check box is checked, it does not obfuscate)

 

When building the package for the distribution by the Windows Eclipse Junos Space SDK plug-in, even though the "Obfuscate javascript" check box is cleared, the minified file contain the java script files, which are specified by the "Edit module.xml".

(i.e although "Obfuscate javascript" check box is cleared, it obfuscates.)

 

I use the Junos Space SDK 11.3 for both the Linux and Windows.

 

Regards

Fuyuki

Super Contributor
vimala.srinivasa
Posts: 209
Registered: ‎10-07-2010
0

Re: "Obfuscate" issue for building package for distribution

Hi Fuyu,

 

    I will test this and get back to you on this.  

 

 

 

Regards,

 

Vimala.

Super Contributor
vimala.srinivasa
Posts: 209
Registered: ‎10-07-2010
0

Re: "Obfuscate" issue for building package for distribution

Hi Fuyu,

 

   I verified the same on 11.3 Space SDK on Linux and Windows platform.  You will see a file ViewDevice-min.js created under HelloSpaceWeb->Web->tasks.  This file is got no comments and white space when checked the Obfuscate.

 

    Can you please do a build/deploy package for distribution and check the "Obfuscate Javascript" and send me copy of ViewDevice-min.js after application deployment is successfull. 

 

 

 

 

Thanks,

 

Vimala.

 

 

Contributor
fuyuki
Posts: 14
Registered: ‎05-23-2011
0

Re: "Obfuscate" issue for building package for distribution

Hi Vimala,

 

Could you check until the end of the line of your minified files ?

 

The "Building/Deploying and Packaging for Distribution" in the Junos Space SDK's Eclipse Help describes that

"4. Click the Obfuscate javascript check box. It allows you to compress Module.xml task related JavaScript files into a single JS minified file".

 

When I build on the Windows, regardless of checking the box, always all related files (i.e. ViewDevices.js, hellospace.DeviceMasterDetail.js, hellospace.DeviceMasterDetailUi.js, hellospace.DeviceStore.js) are minified and placed into a ViewDevice-min.js.

 

When I build on the Linux, even though checking the Obfuscate  box, only the ViewDevices.js is minified and placed into a ViewDevice-min.js.

 

Please compare attached two files.

The Window's ViewDevice-min.js ends with  "a.update(g.device)}})}}); " whilest the Linux's ViewDevice-min.js ends with "return new hellospace.DeviceMasterDetail(a)};".

 

( As the file with 'js' extension is not allowed to attach in this web site, I chagne the file name and put the extension 'txt'.)

Regards

Fuyuki

Super Contributor
vimala.srinivasa
Posts: 209
Registered: ‎10-07-2010
0

Re: "Obfuscate" issue for building package for distribution

Hi Fuyu,

 

         I just verified this on my setup and it looked the similiar files that the module.xml tasks were all bundled in ViewDevices.min.js file which is working as expected. Attached are the files from my setup.  

 

        But there is one issue for which i will raise the PR.  Check or uncheck Obfuscate Javascript it still creates  *.min.js file.  

 

 

 

Regards,

 

 

Vimala.

Contributor
fuyuki
Posts: 14
Registered: ‎05-23-2011
0

Re: "Obfuscate" issue for building package for distribution

Hi Vimala,

 

I checked your results and found that they are similar with mines.

The viewDevices-window.txt is expected results ( all related files are minified and bundled) but the linux-viewDevices.txt is not expected one (only one file is minified.)

 

I am afraid that you read only the section 3 of the "Building/Deploying and Packaging for distribution" but not read the section 4 of the Eclipse Help. They will really confuse readers. The section 3 describes "obfuscate javascript checkbox" as the function of minification. However the section 4 describes "obfuscate javascript checkbox" as the function to bundle all related files into a single file.

 

The section 4 also describes:

if "Obfuscate javascript " check box is checked, it will minify and obfuscate.

if "Obfuscate javascript " check box is cleared, it will only minify and not obfuscate.

 

Therefore, according to the section 4,

"Check or uncheck Obfuscate Javascript it still creates  *.min.js file." is expected results and not the issue.

(The section 4 describes that for both cases, "minify" is carried out.)

 

The issue is:

When using the windows plug-in, regardless of check or uncheck, allways all related javascript files are minified and bundled.

When using the linux plug-in, regardless of check or uncheck, allways only one file, which is under the task directory,  is minified.

 

Regards

Fuyuki

Contributor
fuyuki
Posts: 14
Registered: ‎05-23-2011
0

Re: "Obfuscate" issue for building package for distribution

Hi Vimala,

 

I forgot to say another inconsistance between Windows and Linux plug-in.

By the "Edit module xml",  as you know, you can upload the required java scripts for a task. And when saving the module xml file, a java script for the task is created under the sub-directory of the task directory.

 

Once I exit the Eclipse then run it again, if using the Windows plug-in, sitll I can see the list of the uploaded java script files in the JS List area at the "Edit module xml". But if I use the linux plug-in, after exiting the Eclipse and  run it again, I can not see the list of the files in the JS List area anymore.

 

At first, I assume that this is the reason why the Linux Eclipse minifies only one file but not bundle all related files even though checking "Obfuscate check box". Hence, I uploaded the java script files again, saved the module xml and confirmed the list of the files stillwas in the JS List area then I built the distribution package.  But the created minified file ( xx-min.js) contained only the file, under the task's sub-directory, and NOT bundled the files in the JS List area.

 

Fuyuki

Super Contributor
vimala.srinivasa
Posts: 209
Registered: ‎10-07-2010
0

Re: "Obfuscate" issue for building package for distribution

Hi Fuyu,

 

   Agree. I will raise the bug report for the same.

 

 

 

Regards,

 

 

Vimala.

Contributor
fuyuki
Posts: 14
Registered: ‎05-23-2011
0

Re: "Obfuscate" issue for building package for distribution

Hi Vimala,

Sorry, although you agreed and I click the the "Accept As solution" but ...

I reconsider about the meaning of  'if "Obfuscate javascript " check box is cleared, it will only minify and not obfuscate.' in the section 4.

I can not imagine the practical purpose of the "only minify and not obfuscate". Do you know what is the purpose of this ?

Now I feel that the when clearing the check box, not minify is more helpful option for debugging purpose.

If you have the option "not minify" for the distribution package, you can easily debug the java script even using the space appliance. For example, if there are such option, you can debug ViewDevice.js easily as well as other java script (e.g.hellospace.DeviceMasterDetail.js) even using the space appliance.

Could you find the purpose of "only minify and not obfuscate" ?

Besides, if you build the hello space distribution package using the Linux plug-in, which only minifies one file and not bundle related java scripts, the hello space does not work on the space appliance without modifying the ViewDevice.js.
Please try.

As the minified file ViewDevice-min.js, created by Linux plug-in, includes only the content of the ViewDevice.js, you have to intentionally push the other java script files. Therefore, you need the following modification against the ViewDevice.js before building the distribution package.

if(config.debug)

       this.jsFiles.push(

This has to be changed to:

if(true)

       this.jsFiles.push


Therefore, please discuss with Junos Spacwe SDK design team for the best option.

 

Regards
Fuyuki

Super Contributor
vimala.srinivasa
Posts: 209
Registered: ‎10-07-2010
0

Re: "Obfuscate" issue for building package for distribution

Hi Fuyu,

 

    Developer comments on this.

 

 

The only possible reason to have minify and not obfuscate is for performance reasons (faster script loading).  However, I don't believe that there should be a feature where you should be able to debug in production environment.

However, I do agree with you that the checkbox for obfuscate should be removed, and it should do both for production and neither for debug mode. We have raised the PR for this.  Also, I don't understand what you mean by the last

Comment:

 

As the minified file ViewDevice-min.js, created by Linux plug-in, includes only the content of the ViewDevice.js, you have to intentionally push the other java script files. Therefore, you need the following modification against the ViewDevice.js before building the distribution package.

if(config.debug)

       this.jsFiles.push(

This has to be changed to:

if(true)

       this.jsFiles.push

 

The config.debug flag will be set in module.xml by the plugin, so it will always be false in production & true for simple build/deploy.

 

 

Regards,

 

Vimala.

Copyright© 1999-2013 Juniper Networks, Inc. All rights reserved.