apache / apache/royale-compiler
Unneeded dependency on XML in every JS file
- Dominant language
- Java
- Stars
- 113
- Forks
- 54
- PR merge metrics
- No merged PRs in 30d
Description
If a project has a dependency on `XML` in any class, that dependency is appended to every JS files.
Option `-remove-circulars` should be set to `false` to reproduce that.
Also sometimes line with dependency `goog.require('XML');` placed incorrectly at file tail (1 line before last)
That happened when `goog.provide` is not present in JS file (expected for files with `@externs`)
```
package {
/**
* @externs
*/
public interface ExternalWithoutDependency {
function doSomething():void;
}
}
```
```
/**
* Generated by Apache Royale Compiler from ExternalWithoutDependency.as
* ExternalWithoutDependency
*
* @fileoverview
* @externs
*
* @suppress {checkTypes|accessControls}
*/
/**
* @interface
*/
ExternalWithoutDependency = function() {
};
ExternalWithoutDependency.prototype.doSomething = function() {
goog.require('XML');
};
```
When `-remove-circulars` set to `true` dependencies on `XML` removed except incorrectly placed.
In that case building with **closure compiler** for release will fail in most cases with messages:
```
SEVERE: .../out/bin/js-debug/ExternalWithoutDependency.js:18: ERROR - Closure primitive methods (goog.provide, goog.require, goog.define, etc) must be called at file scope.
goog.require('XML');
^^^^^^^^^^^^^^^^^^^
```
A minimal project to reproduce that could be found at [mrchnk/royale-compiler-problems](https://github.com/mrchnk/royale-compiler-problems/tree/master/goog-require-xml)
Found that behavior in nightly [Jenkins builds](http://apacheroyaleci.westus2.cloudapp.azure.com:8080/).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.