3 Replies Latest reply on May 12, 2010 1:10 PM by smagfx2

    Conditional compilation clarification

    smagfx2 Level 1

      Is it possible to do this with conditional compilation?

       

      !CONFIG::debugging {
          // Execute NOT-debugging code here.
      }
      

       

      as well as

       

      !CONFIG::debugging {
          include ReleaseIncludes.inc
      }
      

       

      I tried this and it seems like it doesn't work. (With both CONFIG::debugging=true and CONFIG::debugging=false the file was included.)

        • 1. Re: Conditional compilation clarification
          kubens Level 2

          You can use additional compiler arguments:

           

          +=CONFIG::environment,'dev'

           

          Then you will be able to use this config setting:

           

          switch (CONFIG::environment)
          {
              case 'prod':
                  BASEURL = 'http://www.woocoom.net/db/';
                  ENVIRONMENT = 'prod';
                  break;
             
              case 'dev':
                  BASEURL =  'http://www.woocoom.net.localhost/db/';
                  ENVIRONMENT = 'dev';
                  break;
          }

          1 person found this helpful
          • 2. Re: Conditional compilation clarification
            smagfx2 Level 1

            Thank you for the reply.

             

            For a couple reasons, I would like to know if in your example the 'prod' case would be compiled out of the final SWF. For my dev build there are certain things which absolutely must not end up in release versions. (They must not be able to be pulled out of the SWF it is decompiled.)

             

            Also, there are also many instances of debug/testing code that should not be in release versions. Trace statements, etc. I would like these to be completely left out of the compiled release SWF, not just wrapped in an if (!CONFIG::release) {} statement.

             

            Also, I have methods and includes which should also be left out of release versions (so I am unable to put these inside a switch or if-statement).

             

            I am defining these constants in a config XML file with -load-config+=PATH. I am mainly wondering if I will have to add an additional <define> tag in that

            XML for CONFIG::notRelease in addition to CONFIG::release instead of just using !CONFIG::release as in my original example.

            • 3. Re: Conditional compilation clarification
              smagfx2 Level 1

              I went ahead and resorted to using multiple defines, but I'm still wondering if this is possible (and I'm doing something wrong somewhere).