You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Maria Jose Esteve <mj...@iest.com> on 2021/10/10 17:24:31 UTC

COMPILE::SWF, COMPILE::JS

Hi, I have a recurring problem with my libraries that I need to understand...
In principle, I understand the concept of the COMPILE::SWF and COMPILE::JS directives but I don't quite understand when to apply them "compulsorily" and when not to.
So far I follow the clues and act with "trial and error". For example, when I see this warning:

Warning: Definition org.apache.royale.core.IBead could not be found.
import org.apache.royale.core.IBead;
                            ^
… I know that I have to specify them ☹

All the example and working projects I have implemented I compile with "SDK only JS" and my first thought was that "I don't need to differentiate the code for COMPILE::JS" BUT the reality is that I always have to create a "class for COMPILE::JS" and another "class for COMPILE:SWF" or separate the functions/blocks of code why?

For example, in the pom's I only add dependencies <classifier>js</classifier>, I add the mxml embeddable components in the xxxx-manifest.xml file, in the internal LIBRERYClasses linking class I have a block with the COMPILE::JS directive for all classes that should only be added if the compilation is JS (for example the @externs classes).

What do I have to take into account?

Thx.
Hiedra.








RE: COMPILE::SWF, COMPILE::JS

Posted by Maria Jose Esteve <mj...@iest.com>.
(FORGIVE ME)
This is a fragment of the pom.xml of a library, which I'm working on together with Alina, for the Inspire-Tree JS component via @externs:

  <build>
    <sourceDirectory>src/main/royale</sourceDirectory>

    <plugins>

      <plugin>
        <groupId>org.apache.royale.compiler</groupId>
        <artifactId>royale-maven-plugin</artifactId>
        <version>${royale.compiler.version}</version>
        <extensions>true</extensions>

        <configuration>
          <targets>JSRoyale</targets>
          <skipExtern>true</skipExtern>
          <includeLookupOnly>true</includeLookupOnly>
          <allowSubclassOverrides>true</allowSubclassOverrides>

          <namespaces>
            <!-- Make the classes listed in the manifest be available under the given namespace -->
            <namespace>
              <uri>library://ns.apache.org/royale/tree</uri>
              <manifest>${project.basedir}/src/main/resources/tree-manifest.xml</manifest>
            </namespace>
            <namespace>
              <type>as</type>
              <uri>library://ns.apache.org/royale/tree</uri>
              <manifest>${project.basedir}/src/main/resources/tree-as-manifest.xml</manifest>
            </namespace>
          </namespaces>
          <!-- Tell the compiler which classes to compile and include -->
          <includeClasses>
            <includeClass>TREEClasses</includeClass>
          </includeClasses>

          <includeFiles>
            <include-file>
              <name>js/*</name>
              <path>../src/main/resources/js/*</path>
            </include-file>
          </includeFiles>

          <additionalCompilerOptions>
            -js-default-initializers=true;
            -source-map=true;
            -source-map-source-root=${project.basedir}/src/main/royale/;
            -keep-as3-metadata+=Inject,EventHandler,Event,Bindable;
            -keep-code-with-metadata=Inject;
            -show-binding-warnings=false;
          </additionalCompilerOptions>

        </configuration>

        <dependencies>
          <dependency>
            <groupId>org.apache.royale.compiler</groupId>
            <artifactId>compiler-jx</artifactId>
            <version>${royale.compiler.version}</version>
          </dependency>
        </dependencies>

      </plugin>
    </plugins>
  </build>



Hiedra.



-----Mensaje original-----
De: Maria Jose Esteve <mj...@iest.com> Enviado el: domingo, 10 de octubre de 2021 19:25
Para: dev@royale.apache.org
Asunto: COMPILE::SWF, COMPILE::JS



Hi, I have a recurring problem with my libraries that I need to understand...

In principle, I understand the concept of the COMPILE::SWF and COMPILE::JS directives but I don't quite understand when to apply them "compulsorily" and when not to.

So far I follow the clues and act with "trial and error". For example, when I see this warning:



Warning: Definition org.apache.royale.core.IBead could not be found.

import org.apache.royale.core.IBead;

                            ^

… I know that I have to specify them ☹



All the example and working projects I have implemented I compile with "SDK only JS" and my first thought was that "I don't need to differentiate the code for COMPILE::JS" BUT the reality is that I always have to create a "class for COMPILE::JS" and another "class for COMPILE:SWF" or separate the functions/blocks of code why?



For example, in the pom's I only add dependencies <classifier>js</classifier>, I add the mxml embeddable components in the xxxx-manifest.xml file, in the internal LIBRERYClasses linking class I have a block with the COMPILE::JS directive for all classes that should only be added if the compilation is JS (for example the @externs classes).



What do I have to take into account?



Thx.

Hiedra.















RE: COMPILE::SWF, COMPILE::JS

Posted by Maria Jose Esteve <mj...@iest.com>.
Este es un fragmento del pom.xml de una librería, en la que estoy trabajando junto a Alina, para el componente Inspire-Tree JS a través de @externs:



  <build>
    <sourceDirectory>src/main/royale</sourceDirectory>

    <plugins>

      <plugin>
        <groupId>org.apache.royale.compiler</groupId>
        <artifactId>royale-maven-plugin</artifactId>
        <version>${royale.compiler.version}</version>
        <extensions>true</extensions>

        <configuration>
          <targets>JSRoyale</targets>
          <skipExtern>true</skipExtern>
          <includeLookupOnly>true</includeLookupOnly>
          <allowSubclassOverrides>true</allowSubclassOverrides>

          <namespaces>
            <!-- Make the classes listed in the manifest be available under the given namespace -->
            <namespace>
              <uri>library://ns.apache.org/royale/tree</uri>
              <manifest>${project.basedir}/src/main/resources/tree-manifest.xml</manifest>
            </namespace>
            <namespace>
              <type>as</type>
              <uri>library://ns.apache.org/royale/tree</uri>
              <manifest>${project.basedir}/src/main/resources/tree-as-manifest.xml</manifest>
            </namespace>
          </namespaces>
          <!-- Tell the compiler which classes to compile and include -->
          <includeClasses>
            <includeClass>TREEClasses</includeClass>
          </includeClasses>

          <includeFiles>
            <include-file>
              <name>js/*</name>
              <path>../src/main/resources/js/*</path>
            </include-file>
          </includeFiles>

          <additionalCompilerOptions>
            -js-default-initializers=true;
            -source-map=true;
            -source-map-source-root=${project.basedir}/src/main/royale/;
            -keep-as3-metadata+=Inject,EventHandler,Event,Bindable;
            -keep-code-with-metadata=Inject;
            -show-binding-warnings=false;
          </additionalCompilerOptions>

        </configuration>

        <dependencies>
          <dependency>
            <groupId>org.apache.royale.compiler</groupId>
            <artifactId>compiler-jx</artifactId>
            <version>${royale.compiler.version}</version>
          </dependency>
        </dependencies>

      </plugin>
    </plugins>
  </build>



Hiedra.



-----Mensaje original-----
De: Maria Jose Esteve <mj...@iest.com>
Enviado el: domingo, 10 de octubre de 2021 19:25
Para: dev@royale.apache.org
Asunto: COMPILE::SWF, COMPILE::JS



Hi, I have a recurring problem with my libraries that I need to understand...

In principle, I understand the concept of the COMPILE::SWF and COMPILE::JS directives but I don't quite understand when to apply them "compulsorily" and when not to.

So far I follow the clues and act with "trial and error". For example, when I see this warning:



Warning: Definition org.apache.royale.core.IBead could not be found.

import org.apache.royale.core.IBead;

                            ^

… I know that I have to specify them ☹



All the example and working projects I have implemented I compile with "SDK only JS" and my first thought was that "I don't need to differentiate the code for COMPILE::JS" BUT the reality is that I always have to create a "class for COMPILE::JS" and another "class for COMPILE:SWF" or separate the functions/blocks of code why?



For example, in the pom's I only add dependencies <classifier>js</classifier>, I add the mxml embeddable components in the xxxx-manifest.xml file, in the internal LIBRERYClasses linking class I have a block with the COMPILE::JS directive for all classes that should only be added if the compilation is JS (for example the @externs classes).



What do I have to take into account?



Thx.

Hiedra.