Skip to main content
April 17, 2009
Question

How to get -services into non-framework project?

  • April 17, 2009
  • 1 reply
  • 843 views

Hi.

I was looking for this information as well as trying to research the issue, but I keep hitting the wall and would appreciete your help.

What am I trying to do:

I want services_config.xml that is passed as an argument to MXMLC.EXE -services services_config.xml to be compiled into non-framework class.

What I did / discovered so far:

  • There is a ServicesConfig class that is meant to receive this info.
  • This info is written into generated Application class in compile time in this form:

ServicesConfig.xml =

<services>

...

</services>;

  • I can replace ServicesConfig with my custom class with the same name.
  • I can replace generated Application class with any name I want.
  • I can replace SystemManager class with my class with the same name.

The problem is that in order to actually compile my custom Application class together with my custom SystemManager class I need to use [Frame] tag.

If I use that tag, inspite of that I have removed other framework classes from the framework.swc, removed flex.swc from the project classpath, removed rpc.swc from the project classpath it will compile all the framework classes into my intended to be non-framework project...

I have restarted FSCH, restarted the OS, made triple sure I have framework classes removed from the accessible classpaths, but it will in some miracleous way find them an force compilation of all the stuff I don't need in the project...

So, please if you happen to know either one of these things:

  • How to make the compiler think that my document class qualifies for writting into it info() function and other generated SystemManager's overrides
  • How to make the compiler write services XML into my document class / any other class that should be compiled with my project (given it has no framework dependencies)
  • Or, how to make -services parameter work with non-framework classes in general

I will appreciate it very much.

Thank you for your time.

This topic has been closed for replies.

1 reply

April 18, 2009

I'm reporting my findings:

FlexMovie.java :


    // shouldn't need swcContext at this point - units should have all referenced defs by now.
    public void generate(List<CompilationUnit> units) throws LinkerException
    {
        try
        {
            prelink( units );
        }
        catch (LinkerException e)
        {
            // You can't actually throw a LinkerException from generate,
            // because an assert fires downstream that expects errorcount > 0!
            // So, we have to warn here and then rethrow.

            ThreadLocalToolkit.log( e );
            throw e;
        }

        List<CULinkable> linkables = new LinkedList<CULinkable>();

        //    TODO remove - see note below
        String serverConfigDef = null;

        CULinkable mainLinkable = null;
        for (Iterator<CompilationUnit> it = units.iterator(); it.hasNext();)
        {
            CompilationUnit unit = it.next();

            //    NOTE Here we watch for specific generated loose code units we have carnal knowledge of, and add their
            //    definitions as deps to the main unit.
            //     TODO Remove once serverconfigdata is handled within the standard bootstrap setup.
            //
            Source source = unit.getSource();
            String sourceName = source.getName();

           if (sourceName.equals("serverConfigData.as"))
            {
                serverConfigDef = unit.topLevelDefinitions.first().toString();
            }

            CULinkable linkable = new CULinkable( unit );
            if (unit.isRoot())
                mainLinkable = linkable;

            if (source.isInternal())
            {
                externs.addAll( unit.topLevelDefinitions.getStringSet() );
            }

            linkables.add( linkable );           
        }

        frames = new ArrayList<Frame>();

        // FIXME - hook serverconfigdata to FlexInit mixin
        if (mainLinkable != null)
        {
            if (serverConfigDef != null)
                mainLinkable.addDep(serverConfigDef);
        }

I'm not proficient with Java let alone the MXMLC structure but, from what I can understand, this part is addressing my problem. So, it seems like it's going to be fixed some time, and I can hope I'll be able to get what I want working...

But, If someone could help me explaining that how can I get access to serverConfigDef (or, more preciesly, it's content) outside of this function, preferably, on the more earlier stages of Application class generation, I would really appreciate it.