3 Replies Latest reply on Mar 2, 2015 8:21 AM by shanna

    I can't get the same result when I build FORMS App

    shanna

      I pulled the FORMS app from GitHub, named it "IdeaForm", built an add-on wrapper around it and load it onto the Jive Sandbox. All that works well.

       

      Next, I tried to build it locally with no changes and load it onto the Jive Sandbox and it didn't work. I noticed that the problem is with the "compile-soy" target. That target compiles the soy file in the template directory and create .js file in /target/soy. The /target/soy/fbldr.js file that came down from GitHub shows this (line 9):

       

      
      jive.fbldr.soy.attachments = function(opt_data, opt_sb) {
        var output = opt_sb || new soy.StringBuilder();
        output.append('<div class="fbldr-attachments"><div class="fbldr-attach-head"><p>Use the following form to upload file attachments and, optionally, include a variable to reference the uploaded file in the form\'s HTML source.</p><p>Multiple files may be attached, but only one at a time.  Click "Finished" when all files have been attached.</p></div><div class="fbldr-attach-field"><label>Link to HTML Variable (optional) : </label></div><div class="fbldr-attach-field"><select id="fbldr-attach-link"><option value="" selected="selected">Select HTML variable...</option>');
        var optionList34 = opt_data.variables;
        var optionListLen34 = optionList34.length;
        for (var optionIndex34 = 0; optionIndex34 < optionListLen34; optionIndex34++) {
          var optionData34 = optionList34[optionIndex34];
          output.append('<option value="', soy.$$escapeHtml(optionData34), '">', soy.$$escapeHtml(optionData34), '</option>');
        }
      
      
      
      
      

       

      The /target/soy/fbldr.js file I got after running "compile-soy" shows:

       

      
      jive.fbldr.soy.attachments = function(opt_data, opt_ignored) {
        var output = '<div class="fbldr-attachments"><div class="fbldr-attach-head"><p>Use the following form to upload file attachments and, optionally, include a variable to reference the uploaded file in the form\'s HTML source.</p><p>Multiple files may be attached, but only one at a time.  Click "Finished" when all files have been attached.</p></div><div class="fbldr-attach-field"><label>Link to HTML Variable (optional) : </label></div><div class="fbldr-attach-field"><select id="fbldr-attach-link"><option value="" selected="selected">Select HTML variable...</option>';
        var optionList34 = opt_data.variables;
        var optionListLen34 = optionList34.length;
        for (var optionIndex34 = 0; optionIndex34 < optionListLen34; optionIndex34++) {
          var optionData34 = optionList34[optionIndex34];
          output += '<option value="' + soy.$$escapeHtml(optionData34) + '">' + soy.$$escapeHtml(optionData34) + '</option>';
        }
      
      
      
      
      

       

      Notice the second parameter of the function is opt_sb vs opt_ignored. The next line of code (var output) is completely different. I suspect there are other differences. What I don't understand is why. "compile-soy" depends on SoyToJsSrcCompiler.jar, is there a specific version of the jar I need?

       

      With the files I built locally, the add-on loaded fine but the form UI is blank.

        • Re: I can't get the same result when I build FORMS App
          shanna

          BTW, I should have said I named the add-on "Idea Form" and loaded it onto the Jive Sandbox without any problem. Then I tried to build the Forms App using the build.xml file that came from GitHub but couldn't get the same result. I narrowed the problem down to the "compile-js" task. Perhaps I need a specific version of SoyToJsSrcCompiler.jar which wasn't specified in the readme nor kept in GitHub. Anyone able to build the Forms App locally and could send me a version of their SoyToJsSrcCompiler.jar?

            • Re: I can't get the same result when I build FORMS App
              shanna

              And for anyone who tries to do this down the road, the FORMS App depends on yuicompressor-2.4.7.jar for now. The project won't build with the latest release of yuicompressor-2.4.8.jar; complains something about file path not found on Windows. It was mentioned in another technical site. I found a 2.4.7 version and got pass that error.

               

              yuicompressor-2.4.7.jar was also not in GitHub and the version requirement was not mentioned in the readme of FORMS but luckily, the file name contains the version number and I could see it in build.xml. It may be good for all the popular Apps in GitHub to include the last known good version numbers of the dependent third party jars. That way, when in doubt, we could at least try an old jar for a sanity check.

              • Re: I can't get the same result when I build FORMS App
                shanna

                Turns out the problem I was observing with opt_ignored is indeed a compiler version issue (as I suspected). When you download the new SoyToJsSrcCompiler.jar nowadays, there is an undocumented change in the compiler (strictly speaking, a Google Closure documentation bug). To build the FORMS App properly (and hence, successfully run your changes locally), you must build with the new option --codeStyle stringbuilder. Below is my posting in Stack Overflow and the full explanations.

                 

                Closure Templates generates code that does not use StringBuilder - Stack Overflow