This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 8edd854cf8efb9cec50d999a689645de64f891ab Author: Josh Tynjala <joshtynj...@apache.org> AuthorDate: Wed Mar 25 09:24:38 2020 -0700 Revert "New compiler options: -rename-public-symbols and -rename-protected-symbols" It turns out that Closure compiler specifically says not to do it this way. This reverts commit 52a8c279180ce9c57741e57c14c72a91a8915d62. --- .../apache/royale/compiler/clients/MXMLJSC.java | 10 +-- .../royale/compiler/clients/MXMLJSCNative.java | 11 +-- .../royale/compiler/clients/MXMLJSCNode.java | 11 +-- .../royale/compiler/clients/MXMLJSCRoyale.java | 12 ++-- .../compiler/clients/MXMLJSCRoyaleCordova.java | 11 +-- .../compiler/codegen/js/goog/IJSGoogPublisher.java | 33 --------- .../codegen/js/royale/JSRoyaleDocEmitter.java | 2 +- .../codegen/mxml/royale/MXMLRoyaleEmitter.java | 2 +- .../codegen/mxml/royale/MXMLRoyalePublisher.java | 12 +--- .../driver/js/goog/JSGoogConfiguration.java | 41 +---------- .../apache/royale/compiler/utils/ClosureUtils.java | 81 ---------------------- .../compiler/utils/JSClosureCompilerWrapper.java | 34 +-------- 12 files changed, 24 insertions(+), 236 deletions(-) diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java index 748c169..5bed5df 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSC.java @@ -35,8 +35,8 @@ import org.apache.royale.compiler.clients.problems.ProblemPrinter; import org.apache.royale.compiler.clients.problems.ProblemQuery; import org.apache.royale.compiler.clients.problems.ProblemQueryProvider; import org.apache.royale.compiler.clients.problems.WorkspaceProblemFormatter; +import org.apache.royale.compiler.codegen.js.IJSPublisher; import org.apache.royale.compiler.codegen.js.IJSWriter; -import org.apache.royale.compiler.codegen.js.goog.IJSGoogPublisher; import org.apache.royale.compiler.common.VersionInfo; import org.apache.royale.compiler.config.CommandLineConfigurator; import org.apache.royale.compiler.config.CompilerDiagnosticsConstants; @@ -75,7 +75,6 @@ import org.apache.royale.compiler.targets.ITarget; import org.apache.royale.compiler.targets.ITarget.TargetType; import org.apache.royale.compiler.targets.ITargetSettings; import org.apache.royale.compiler.units.ICompilationUnit; -import org.apache.royale.compiler.utils.ClosureUtils; import org.apache.royale.swf.ISWF; import org.apache.royale.swf.SWF; import org.apache.royale.swf.types.RGB; @@ -273,7 +272,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider, protected ITarget target; protected ITargetSettings targetSettings; protected IJSApplication jsTarget; - private IJSGoogPublisher jsPublisher; + private IJSPublisher jsPublisher; protected MXMLC mxmlc; protected JSCompilerEntryPoint lastCompiler; public boolean noLink; @@ -533,8 +532,7 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider, return false; } - Set<String> closurePropNamesToKeep = new HashSet<String>(); - jsPublisher = (IJSGoogPublisher) project.getBackend().createPublisher( + jsPublisher = (IJSPublisher) project.getBackend().createPublisher( project, errors, config); File outputFolder = jsPublisher.getOutputFolder(); @@ -619,13 +617,11 @@ public class MXMLJSC implements JSCompilerEntryPoint, ProblemQueryProvider, outputClassFile.setLastModified(fileDate); } } - ClosureUtils.collectPropertyNamesToKeep(cu, project, closurePropNamesToKeep); } } if (jsPublisher != null) { - jsPublisher.setClosurePropertyNamesToKeep(closurePropNamesToKeep); compilationSuccess = jsPublisher.publish(problems); } else diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNative.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNative.java index 9b54b1e..1c4474f 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNative.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNative.java @@ -27,7 +27,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -37,8 +36,8 @@ import org.apache.royale.compiler.clients.problems.ProblemPrinter; import org.apache.royale.compiler.clients.problems.ProblemQuery; import org.apache.royale.compiler.clients.problems.ProblemQueryProvider; import org.apache.royale.compiler.clients.problems.WorkspaceProblemFormatter; +import org.apache.royale.compiler.codegen.js.IJSPublisher; import org.apache.royale.compiler.codegen.js.IJSWriter; -import org.apache.royale.compiler.codegen.js.goog.IJSGoogPublisher; import org.apache.royale.compiler.config.Configuration; import org.apache.royale.compiler.config.ConfigurationBuffer; import org.apache.royale.compiler.config.Configurator; @@ -73,7 +72,6 @@ import org.apache.royale.compiler.targets.ITarget.TargetType; import org.apache.royale.compiler.targets.ITargetSettings; import org.apache.royale.compiler.units.ICompilationUnit; import org.apache.royale.compiler.units.ICompilationUnit.UnitType; -import org.apache.royale.compiler.utils.ClosureUtils; import org.apache.flex.tools.FlexTool; import org.apache.royale.utils.ArgumentUtil; import org.apache.royale.utils.FilenameNormalization; @@ -171,7 +169,7 @@ public class MXMLJSCNative implements JSCompilerEntryPoint, ProblemQueryProvider protected ITarget target; protected ITargetSettings targetSettings; protected IJSApplication jsTarget; - private IJSGoogPublisher jsPublisher; + private IJSPublisher jsPublisher; public MXMLJSCNative() { @@ -317,8 +315,7 @@ public class MXMLJSCNative implements JSCompilerEntryPoint, ProblemQueryProvider return false; } - Set<String> closurePropNamesToKeep = new HashSet<String>(); - jsPublisher = (IJSGoogPublisher) project.getBackend().createPublisher( + jsPublisher = (IJSPublisher) project.getBackend().createPublisher( project, errors, config); File outputFolder = jsPublisher.getOutputFolder(); @@ -384,13 +381,11 @@ public class MXMLJSCNative implements JSCompilerEntryPoint, ProblemQueryProvider } writer.close(); } - ClosureUtils.collectPropertyNamesToKeep(cu, project, closurePropNamesToKeep); } } if (jsPublisher != null) { - jsPublisher.setClosurePropertyNamesToKeep(closurePropNamesToKeep); compilationSuccess = jsPublisher.publish(problems); } else diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNode.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNode.java index a1111b0..bb83228 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNode.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCNode.java @@ -27,7 +27,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -37,8 +36,8 @@ import org.apache.royale.compiler.clients.problems.ProblemPrinter; import org.apache.royale.compiler.clients.problems.ProblemQuery; import org.apache.royale.compiler.clients.problems.ProblemQueryProvider; import org.apache.royale.compiler.clients.problems.WorkspaceProblemFormatter; +import org.apache.royale.compiler.codegen.js.IJSPublisher; import org.apache.royale.compiler.codegen.js.IJSWriter; -import org.apache.royale.compiler.codegen.js.goog.IJSGoogPublisher; import org.apache.royale.compiler.config.Configuration; import org.apache.royale.compiler.config.ConfigurationBuffer; import org.apache.royale.compiler.config.Configurator; @@ -73,7 +72,6 @@ import org.apache.royale.compiler.targets.ITarget.TargetType; import org.apache.royale.compiler.targets.ITargetSettings; import org.apache.royale.compiler.units.ICompilationUnit; import org.apache.royale.compiler.units.ICompilationUnit.UnitType; -import org.apache.royale.compiler.utils.ClosureUtils; import org.apache.flex.tools.FlexTool; import org.apache.royale.utils.ArgumentUtil; import org.apache.royale.utils.FilenameNormalization; @@ -170,7 +168,7 @@ public class MXMLJSCNode implements JSCompilerEntryPoint, ProblemQueryProvider, protected ITarget target; protected ITargetSettings targetSettings; protected IJSApplication jsTarget; - private IJSGoogPublisher jsPublisher; + private IJSPublisher jsPublisher; public MXMLJSCNode() { @@ -319,8 +317,7 @@ public class MXMLJSCNode implements JSCompilerEntryPoint, ProblemQueryProvider, return false; } - Set<String> closurePropNamesToKeep = new HashSet<String>(); - jsPublisher = (IJSGoogPublisher) project.getBackend().createPublisher( + jsPublisher = (IJSPublisher) project.getBackend().createPublisher( project, errors, config); File outputFolder = jsPublisher.getOutputFolder(); @@ -386,13 +383,11 @@ public class MXMLJSCNode implements JSCompilerEntryPoint, ProblemQueryProvider, } writer.close(); } - ClosureUtils.collectPropertyNamesToKeep(cu, project, closurePropNamesToKeep); } } if (jsPublisher != null) { - jsPublisher.setClosurePropertyNamesToKeep(closurePropNamesToKeep); compilationSuccess = jsPublisher.publish(problems); } else diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java index 576bf05..1236ef2 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyale.java @@ -38,8 +38,8 @@ import org.apache.royale.compiler.clients.problems.ProblemPrinter; import org.apache.royale.compiler.clients.problems.ProblemQuery; import org.apache.royale.compiler.clients.problems.ProblemQueryProvider; import org.apache.royale.compiler.clients.problems.WorkspaceProblemFormatter; +import org.apache.royale.compiler.codegen.js.IJSPublisher; import org.apache.royale.compiler.codegen.js.IJSWriter; -import org.apache.royale.compiler.codegen.js.goog.IJSGoogPublisher; import org.apache.royale.compiler.config.Configuration; import org.apache.royale.compiler.config.ConfigurationBuffer; import org.apache.royale.compiler.config.Configurator; @@ -86,7 +86,6 @@ import org.apache.royale.compiler.targets.ITarget.TargetType; import org.apache.royale.compiler.targets.ITargetSettings; import org.apache.royale.compiler.units.ICompilationUnit; import org.apache.royale.compiler.units.ICompilationUnit.UnitType; -import org.apache.royale.compiler.utils.ClosureUtils; import org.apache.flex.tools.FlexTool; import org.apache.royale.swc.ISWC; import org.apache.royale.swc.ISWCFileEntry; @@ -189,7 +188,7 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider protected ITarget target; protected ITargetSettings targetSettings; protected IJSApplication jsTarget; - private IJSGoogPublisher jsPublisher; + private IJSPublisher jsPublisher; public MXMLJSCRoyale() { @@ -338,8 +337,7 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider return false; } - Set<String> closurePropNamesToKeep = new HashSet<String>(); - jsPublisher = (IJSGoogPublisher) project.getBackend().createPublisher( + jsPublisher = (IJSPublisher) project.getBackend().createPublisher( project, errors, config); File outputFolder = jsPublisher.getOutputFolder(); @@ -414,9 +412,8 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider sourceMapOut.flush(); sourceMapOut.close(); } - writer.close(); + writer.close(); } - ClosureUtils.collectPropertyNamesToKeep(cu, project, closurePropNamesToKeep); } File externsReportFile = googConfiguration.getExternsReport(); if (externsReportFile != null) @@ -434,7 +431,6 @@ public class MXMLJSCRoyale implements JSCompilerEntryPoint, ProblemQueryProvider if (jsPublisher != null) { - jsPublisher.setClosurePropertyNamesToKeep(closurePropNamesToKeep); compilationSuccess = jsPublisher.publish(problems); } else diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyaleCordova.java b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyaleCordova.java index 80bca1a..378339c 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyaleCordova.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/clients/MXMLJSCRoyaleCordova.java @@ -27,7 +27,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.TreeSet; @@ -37,8 +36,8 @@ import org.apache.royale.compiler.clients.problems.ProblemPrinter; import org.apache.royale.compiler.clients.problems.ProblemQuery; import org.apache.royale.compiler.clients.problems.ProblemQueryProvider; import org.apache.royale.compiler.clients.problems.WorkspaceProblemFormatter; +import org.apache.royale.compiler.codegen.js.IJSPublisher; import org.apache.royale.compiler.codegen.js.IJSWriter; -import org.apache.royale.compiler.codegen.js.goog.IJSGoogPublisher; import org.apache.royale.compiler.config.Configuration; import org.apache.royale.compiler.config.ConfigurationBuffer; import org.apache.royale.compiler.config.Configurator; @@ -73,7 +72,6 @@ import org.apache.royale.compiler.targets.ITarget.TargetType; import org.apache.royale.compiler.targets.ITargetSettings; import org.apache.royale.compiler.units.ICompilationUnit; import org.apache.royale.compiler.units.ICompilationUnit.UnitType; -import org.apache.royale.compiler.utils.ClosureUtils; import org.apache.flex.tools.FlexTool; import org.apache.royale.utils.ArgumentUtil; import org.apache.royale.utils.FilenameNormalization; @@ -173,7 +171,7 @@ public class MXMLJSCRoyaleCordova implements JSCompilerEntryPoint, ProblemQueryP protected ITarget target; protected ITargetSettings targetSettings; protected IJSApplication jsTarget; - private IJSGoogPublisher jsPublisher; + private IJSPublisher jsPublisher; public MXMLJSCRoyaleCordova() { @@ -322,8 +320,7 @@ public class MXMLJSCRoyaleCordova implements JSCompilerEntryPoint, ProblemQueryP return false; } - Set<String> closurePropNamesToKeep = new HashSet<String>(); - jsPublisher = (IJSGoogPublisher) project.getBackend().createPublisher( + jsPublisher = (IJSPublisher) project.getBackend().createPublisher( project, errors, config); File outputFolder = jsPublisher.getOutputFolder(); @@ -389,13 +386,11 @@ public class MXMLJSCRoyaleCordova implements JSCompilerEntryPoint, ProblemQueryP } writer.close(); } - ClosureUtils.collectPropertyNamesToKeep(cu, project, closurePropNamesToKeep); } } if (jsPublisher != null) { - jsPublisher.setClosurePropertyNamesToKeep(closurePropNamesToKeep); compilationSuccess = jsPublisher.publish(problems); } else diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/codegen/js/goog/IJSGoogPublisher.java b/compiler-jx/src/main/java/org/apache/royale/compiler/codegen/js/goog/IJSGoogPublisher.java deleted file mode 100644 index eaa3bad..0000000 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/codegen/js/goog/IJSGoogPublisher.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.royale.compiler.codegen.js.goog; - -import java.util.Set; - -import org.apache.royale.compiler.codegen.js.IJSPublisher; - -/** - * The {@link IJSGoogPublisher} interface allows the abstraction of project output - * generation. - */ -public interface IJSGoogPublisher extends IJSPublisher -{ - void setClosurePropertyNamesToKeep(Set<String> propertyNames); -} \ No newline at end of file diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/royale/JSRoyaleDocEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/royale/JSRoyaleDocEmitter.java index 7af2c0e..d9b4c0a 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/royale/JSRoyaleDocEmitter.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/royale/JSRoyaleDocEmitter.java @@ -557,7 +557,7 @@ public class JSRoyaleDocEmitter extends JSGoogDocEmitter else { RoyaleJSProject fjp = (RoyaleJSProject)project; - boolean warnPublicVars = fjp.config != null && fjp.config.getRenamePublicSymbols() && fjp.config.getWarnPublicVars(); + boolean warnPublicVars = fjp.config != null && fjp.config.getWarnPublicVars(); IMetaTagsNode meta = node.getMetaTags(); boolean bindable = false; if (meta != null) diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java index 47162b7..cff5c9a 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyaleEmitter.java @@ -2878,7 +2878,7 @@ public class MXMLRoyaleEmitter extends MXMLEmitter implements MXMLDescriptorSpecifier currentPropertySpecifier = new MXMLDescriptorSpecifier(); currentPropertySpecifier.isProperty = true; - currentPropertySpecifier.useGoogReflectObjectProperty = project.config != null && project.config.getRenamePublicSymbols() && project.config.getMxmlReflectObjectProperty(); + currentPropertySpecifier.useGoogReflectObjectProperty = project.config != null && project.config.getMxmlReflectObjectProperty(); currentPropertySpecifier.name = cdef != null ? cdef.getQualifiedName() : node.getName(); currentPropertySpecifier.parent = currentInstance; diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java index d823a33..77abfad 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/mxml/royale/MXMLRoyalePublisher.java @@ -28,7 +28,7 @@ import org.apache.commons.io.filefilter.FileFileFilter; import org.apache.commons.io.filefilter.FileFilterUtils; import org.apache.commons.io.filefilter.IOFileFilter; import org.apache.royale.compiler.clients.problems.ProblemQuery; -import org.apache.royale.compiler.codegen.js.goog.IJSGoogPublisher; +import org.apache.royale.compiler.codegen.js.IJSPublisher; import org.apache.royale.compiler.config.Configuration; import org.apache.royale.compiler.css.ICSSPropertyValue; import org.apache.royale.compiler.definitions.IClassDefinition; @@ -40,6 +40,7 @@ import org.apache.royale.compiler.internal.codegen.js.goog.JarSourceFile; import org.apache.royale.compiler.internal.css.CSSArrayPropertyValue; import org.apache.royale.compiler.internal.css.CSSFontFace; import org.apache.royale.compiler.internal.css.CSSFunctionCallPropertyValue; +import org.apache.royale.compiler.internal.definitions.ClassDefinition; import org.apache.royale.compiler.internal.driver.js.royale.JSCSSCompilationSession; import org.apache.royale.compiler.internal.driver.js.goog.JSGoogConfiguration; import org.apache.royale.compiler.internal.graph.GoogDepsWriter; @@ -57,7 +58,7 @@ import java.net.URLDecoder; import java.nio.charset.Charset; import java.util.*; -public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSGoogPublisher +public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSPublisher { public static final String ROYALE_OUTPUT_DIR_NAME = "bin"; @@ -102,7 +103,6 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSGoogPubli private String moduleOutput; private boolean useStrictPublishing; private List<String> additionalHTML = new ArrayList<String>(); - private Set<String> closurePropertyNamesToKeep; private GoogDepsWriter getGoogDepsWriter(File intermediateDir, String mainClassQName, @@ -183,11 +183,6 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSGoogPubli return outputFolder; } - public void setClosurePropertyNamesToKeep(Set<String> propertyNames) - { - closurePropertyNamesToKeep = propertyNames; - } - @Override public boolean publish(ProblemQuery problems) throws IOException { @@ -386,7 +381,6 @@ public class MXMLRoyalePublisher extends JSGoogPublisher implements IJSGoogPubli if (configuration.release()) { compilerWrapper = new JSClosureCompilerWrapper(googConfiguration.getJSCompilerOptions()); - compilerWrapper.setPropertyNamesToKeep(closurePropertyNamesToKeep); } if (compilerWrapper != null) diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java index 3c941d0..d06475c 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/driver/js/goog/JSGoogConfiguration.java @@ -447,45 +447,6 @@ public class JSGoogConfiguration extends JSConfiguration } // - // 'rename-public-symbols' - // - - private boolean renamePublicSymbols = false; - - public boolean getRenamePublicSymbols() - { - return renamePublicSymbols; - } - - @Config - @Mapping("rename-public-symbols") - public void setRenamePublicSymbols(ConfigurationValue cv, boolean value) - throws ConfigurationException - { - renamePublicSymbols = value; - } - - - // - // 'rename-protected-symbols' - // - - private boolean renameProtectedSymbols = false; - - public boolean getRenameProtectedSymbols() - { - return renameProtectedSymbols; - } - - @Config - @Mapping("rename-protected-symbols") - public void setRenameProtectedSymbols(ConfigurationValue cv, boolean value) - throws ConfigurationException - { - renameProtectedSymbols = value; - } - - // // 'mxml-reflect-object-property' // @@ -509,7 +470,7 @@ public class JSGoogConfiguration extends JSConfiguration // 'warn-public-vars' // - private boolean warnPublicVars = true; + private boolean warnPublicVars = false; public boolean getWarnPublicVars() { diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/ClosureUtils.java b/compiler-jx/src/main/java/org/apache/royale/compiler/utils/ClosureUtils.java deleted file mode 100644 index fa5df55..0000000 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/ClosureUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.royale.compiler.utils; - -import java.util.Set; - -import org.apache.royale.compiler.definitions.IDefinition; -import org.apache.royale.compiler.definitions.ITypeDefinition; -import org.apache.royale.compiler.definitions.IVariableDefinition; -import org.apache.royale.compiler.internal.projects.RoyaleJSProject; -import org.apache.royale.compiler.internal.scopes.ASProjectScope.DefinitionPromise; -import org.apache.royale.compiler.units.ICompilationUnit; - -public class ClosureUtils -{ - public static void collectPropertyNamesToKeep(ICompilationUnit cu, RoyaleJSProject project, Set<String> result) - { - if (project.isExternalLinkage(cu)) - { - return; - } - for (IDefinition def : cu.getDefinitionPromises()) - { - if(def instanceof DefinitionPromise) - { - def = ((DefinitionPromise) def).getActualDefinition(); - } - if (def instanceof ITypeDefinition) - { - if (def.isImplicit() || def.isNative()) - { - continue; - } - boolean renamePublic = project.config.getRenamePublicSymbols(); - boolean renameProtected = project.config.getRenameProtectedSymbols(); - ITypeDefinition typeDef = (ITypeDefinition) def; - for (IDefinition localDef : typeDef.getContainedScope().getAllLocalDefinitions()) - { - if (localDef.isImplicit()) - { - continue; - } - if (!localDef.isPublic() && !localDef.isProtected()) - { - continue; - } - if (localDef.isProtected() && renameProtected) - { - continue; - } - if (localDef.isPublic() && renamePublic) - { - continue; - } - if (!(localDef instanceof IVariableDefinition)) - { - continue; - } - result.add(localDef.getBaseName()); - } - } - } - } -} \ No newline at end of file diff --git a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java b/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java index 382f78b..ae3d614 100644 --- a/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java +++ b/compiler-jx/src/main/java/org/apache/royale/compiler/utils/JSClosureCompilerWrapper.java @@ -25,10 +25,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.Set; import java.util.logging.Level; import com.google.javascript.jscomp.CheckLevel; @@ -91,7 +88,6 @@ public class JSClosureCompilerWrapper private String propertyMapOutputPath; private String variableMapInputPath; private String propertyMapInputPath; - private Set<String> propertyNamesToKeep; private boolean skipTypeInference; private boolean sourceMap = false; private boolean verbose = false; @@ -127,11 +123,6 @@ public class JSClosureCompilerWrapper { verbose = enabled; } - - public void setPropertyNamesToKeep(Set<String> propertyNames) - { - propertyNamesToKeep = propertyNames; - } public boolean compile() { @@ -155,38 +146,17 @@ public class JSClosureCompilerWrapper } } - Map<String, String> propertyMap = null; - if (propertyNamesToKeep != null) - { - if (propertyMap == null) - { - propertyMap = new HashMap<String, String>(); - } - for (String name : propertyNamesToKeep) - { - propertyMap.put(name, name); - } - } if (propertyMapInputPath != null) { - if (propertyMap == null) - { - propertyMap = new HashMap<String, String>(); - } File inputFile = new File(outputFolder, propertyMapInputPath); try { - VariableMap inputMap = VariableMap.load(inputFile.getAbsolutePath()); - propertyMap.putAll(inputMap.getOriginalNameToNewNameMap()); + VariableMap map = VariableMap.load(inputFile.getAbsolutePath()); + CompilerMapFetcher.setPropertyMap(options_, map); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - if (propertyMap != null) - { - VariableMap map = VariableMap.fromMap(propertyMap); - CompilerMapFetcher.setPropertyMap(options_, map); - } compiler_.setPassConfig(new RoyaleClosurePassConfig(options_, jsSourceFiles_.get(jsSourceFiles_.size() - 1).getName(),