compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCNative.java [166:258]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        workspace = new Workspace();
        workspace.setASDocDelegate(new RoyaleASDocDelegate());
        project = new RoyaleJSProject(workspace, backend);
        problems = new ProblemQuery(); // this gets replaced in configure().  Do we need it here?
        asFileHandler = backend.getSourceFileHandlerInstance();
    }

    /**
     * Main body of this program. This method is called from the public static
     * method's for this program.
     * 
     * @return true if compiler succeeds
     * @throws IOException
     * @throws InterruptedException
     */
    @Override
    protected boolean compile()
    {
        boolean compilationSuccess = false;

        try
        {
            project.getSourceCompilationUnitFactory().addHandler(asFileHandler);

            if (setupTargetFile())
                buildArtifact();

            if (jsTarget != null)
            {
                if (!writeSWC())
                {
                    return false;
                }
                compilationSuccess = true;
            }
        }
        catch (Exception e)
        {
            System.out.println(e);
            final ICompilerProblem problem = new InternalCompilerProblem(e);
            problems.add(problem);
        }

        return compilationSuccess;
    }

    private boolean writeSWC() throws IOException, InterruptedException
    {
        Collection<ICompilerProblem> errors = new ArrayList<ICompilerProblem>();
        Collection<ICompilerProblem> warnings = new ArrayList<ICompilerProblem>();

        if (!config.getCreateTargetWithErrors())
        {
            problems.getErrorsAndWarnings(errors, warnings);
            if (errors.size() > 0)
                return false;
        }

        boolean packingSWC = false;
        String outputFolderName = getOutputFilePath();
        File swcFile = new File(outputFolderName);
        File jsOut = new File("js/out");
        File externsOut = new File("externs");
        ZipFile zipFile = null;
        ZipOutputStream zipOutputStream = null;
        String catalog = null;
        StringBuilder fileList = new StringBuilder();
        if (outputFolderName.endsWith(".swc"))
        {
            packingSWC = true;
            if (!swcFile.exists())
            {
                problems.add(new LibraryNotFoundProblem(outputFolderName));
                return false;
            }
            zipFile = new ZipFile(swcFile, ZipFile.OPEN_READ);
            final InputStream catalogInputStream = SWCReader.getInputStream(zipFile, SWCReader.CATALOG_XML);
            
            catalog = IOUtils.toString(catalogInputStream);
            catalogInputStream.close();
            zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outputFolderName + ".new")));
            zipOutputStream.setLevel(Deflater.NO_COMPRESSION);
            for (final Enumeration<? extends ZipEntry> entryEnum = zipFile.entries(); entryEnum.hasMoreElements();)
            {
                final ZipEntry entry = entryEnum.nextElement();
                if (!entry.getName().contains("js/out") &&
                    !entry.getName().contains(SWCReader.CATALOG_XML))
                {
                    if (config.isVerbose())
                    {
                        System.out.println("Copy " + entry.getName());
                    }
                    InputStream input = zipFile.getInputStream(entry);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



compiler-jx/src/main/java/org/apache/royale/compiler/clients/COMPJSCRoyale.java [159:251]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        workspace = new Workspace();
        workspace.setASDocDelegate(new RoyaleASDocDelegate());
        project = new RoyaleJSProject(workspace, backend);
        problems = new ProblemQuery(); // this gets replaced in configure().  Do we need it here?
        asFileHandler = backend.getSourceFileHandlerInstance();
    }

    /**
     * Main body of this program. This method is called from the public static
     * method's for this program.
     * 
     * @return true if compiler succeeds
     * @throws IOException
     * @throws InterruptedException
     */
    @Override
    protected boolean compile()
    {
        boolean compilationSuccess = false;

        try
        {
            project.getSourceCompilationUnitFactory().addHandler(asFileHandler);

            if (setupTargetFile())
                buildArtifact();

            if (jsTarget != null)
            {
                if (!writeSWC())
                {
                    return false;
                }
                compilationSuccess = true;
            }
        }
        catch (Exception e)
        {
            System.out.println(e);
            final ICompilerProblem problem = new InternalCompilerProblem(e);
            problems.add(problem);
        }

        return compilationSuccess;
    }

    private boolean writeSWC() throws IOException, InterruptedException
    {
        Collection<ICompilerProblem> errors = new ArrayList<ICompilerProblem>();
        Collection<ICompilerProblem> warnings = new ArrayList<ICompilerProblem>();

        if (!config.getCreateTargetWithErrors())
        {
            problems.getErrorsAndWarnings(errors, warnings);
            if (errors.size() > 0)
                return false;
        }

        boolean packingSWC = false;
        String outputFolderName = getOutputFilePath();
        File swcFile = new File(outputFolderName);
        File jsOut = new File("js/out");
        File externsOut = new File("externs");
        ZipFile zipFile = null;
        ZipOutputStream zipOutputStream = null;
        String catalog = null;
        StringBuilder fileList = new StringBuilder();
        if (outputFolderName.endsWith(".swc"))
        {
            packingSWC = true;
            if (!swcFile.exists())
            {
                problems.add(new LibraryNotFoundProblem(outputFolderName));
                return false;
            }
            zipFile = new ZipFile(swcFile, ZipFile.OPEN_READ);
            final InputStream catalogInputStream = SWCReader.getInputStream(zipFile, SWCReader.CATALOG_XML);
            
            catalog = IOUtils.toString(catalogInputStream);
            catalogInputStream.close();
            zipOutputStream = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outputFolderName + ".new")));
            zipOutputStream.setLevel(Deflater.NO_COMPRESSION);
            for (final Enumeration<? extends ZipEntry> entryEnum = zipFile.entries(); entryEnum.hasMoreElements();)
            {
                final ZipEntry entry = entryEnum.nextElement();
                if (!entry.getName().contains("js/out") &&
                    !entry.getName().contains(SWCReader.CATALOG_XML))
                {
                    if (config.isVerbose())
                    {
                        System.out.println("Copy " + entry.getName());
                    }
                    InputStream input = zipFile.getInputStream(entry);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



