Without a goog.require(), the .js file for the extern does not seem to be
copied to the output folder, and Closure renames its APIs.

How the compiler behaved *before* my change:

* If I reference the extern in a library, the compiler did not add a
goog.require() for it.
* If I reference the extern in an application, *the compiler added a
goog.require() for it.*

How it works after my change:

* If I reference the extern in a library, the compiler adds a
goog.require() for it.
* If I reference the extern in an application, the compiler adds a
goog.require() for it.

I made the compiler's behavior more consistent because the it was already
adding goog.require() for externs in applications. If that's wrong, it was
already wrong before I made any changes.

--
Josh Tynjala
Bowler Hat LLC <https://bowlerhat.dev>


On Mon, Jul 8, 2019 at 11:26 PM Alex Harui <[email protected]> wrote:

> This doesn't seem right to me.  Externs should be representing JS files
> that don't have goog.provide in them.
>
> -Alex
>
> On 7/8/19, 1:40 PM, "[email protected]" <[email protected]>
> wrote:
>
>     This is an automated email from the ASF dual-hosted git repository.
>
>     joshtynjala pushed a commit to branch develop
>     in repository
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-compiler.git&amp;data=02%7C01%7Caharui%40adobe.com%7C98ea3f4308e6419aa4c908d703e48029%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%7C636982152277066484&amp;sdata=K7kYU5xaJKz%2BXluJl0gpl0N21%2FlV%2FS6Z%2BfPEqaVWipg%3D&amp;reserved=0
>
>
>     The following commit(s) were added to refs/heads/develop by this push:
>          new 942a423  PackageHeaderEmitter: output goog.require() for
> externs because release builds fail without it
>     942a423 is described below
>
>     commit 942a4235758020239eca707a5e5c73e94a63df8c
>     Author: Josh Tynjala <[email protected]>
>     AuthorDate: Mon Jul 8 13:40:05 2019 -0700
>
>         PackageHeaderEmitter: output goog.require() for externs because
> release builds fail without it
>     ---
>      .../royale/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
>  | 3 ---
>      1 file changed, 3 deletions(-)
>
>     diff --git
> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
>     index 7c8b9ac..57cfc76 100644
>     ---
> a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
>     +++
> b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/jx/PackageHeaderEmitter.java
>     @@ -380,9 +380,6 @@ public class PackageHeaderEmitter extends
> JSSubEmitter implements
>
>                      if (imp.equals(cname))
>                          continue;
>     -
>     -                if (project.sourceExterns.contains(imp))
>     -                   continue;
>
>                      if (NativeUtils.isNative(imp))
>                      {
>
>
>
>

Reply via email to