Unneeded dependency on XML in every JS file
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
Found that behavior in nightly Jenkins builds.
I fixed the issue where goog.require('XML') was being incorrectly added to externs.
The behavior where it is being added to all other files still remains. I'd need to dig in compiler and figure out if it's doing that on purpose or not. I see that it's inserting goog.require('org.apache.royale.utils.Language') only in files where that one is necessary, and I would have expected that these two would be handled in the same way. The fact that they're not means that XML may have some complicated reason why it's being required everywhere.
However, I also don't think that adding goog.require('XML') has any bad side effects. It's just some extra unnecessary code that gets cleaned up in a release build anyway. With that in mind, it's probably not a very high priority.
I checked that using latest Jenkins release (2705). Nothing added to externs files now.
/**
* Generated by Apache Royale Compiler from ExternalWithoutDependency.as
* ExternalWithoutDependency
*
* @fileoverview
* @externs
*
* @suppress {checkTypes|accessControls}
*/
/**
* @interface
*/
ExternalWithoutDependency = function() {
};
ExternalWithoutDependency.prototype.doSomething = function() {
};
But that dependency still preserve in other classes