You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/05/02 04:01:22 UTC

[royale-compiler] branch release_practice updated: use qnames for CompilationUnit names instead of absolutefilepath so the string is the same during all builds on all platforms and machines. This may be affecting the SWF order between machines. We want them to be the same for reproducible builds

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch release_practice
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/release_practice by this push:
     new efbbf18  use qnames for CompilationUnit names instead of absolutefilepath so the string is the same during all builds on all platforms and machines.  This may be affecting the SWF order between machines.  We want them to be the same for reproducible builds
efbbf18 is described below

commit efbbf18698034d3d0a5f6338d86ad8c42abdff09
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed May 1 21:01:10 2019 -0700

    use qnames for CompilationUnit names instead of absolutefilepath so the string is the same during all builds on all platforms and machines.  This may be affecting the SWF order between machines.  We want them to be the same for reproducible builds
---
 .../royale/compiler/internal/units/CompilationUnitBase.java   | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/units/CompilationUnitBase.java b/compiler/src/main/java/org/apache/royale/compiler/internal/units/CompilationUnitBase.java
index 9e680f6..0da5cb2 100644
--- a/compiler/src/main/java/org/apache/royale/compiler/internal/units/CompilationUnitBase.java
+++ b/compiler/src/main/java/org/apache/royale/compiler/internal/units/CompilationUnitBase.java
@@ -1005,9 +1005,14 @@ public abstract class CompilationUnitBase implements ICompilationUnit
      */
     private String computeName()
     {
-        final String filename = FilenameUtils.getName(getAbsoluteFilename()).replace('.', '_');
-        final String encodedAbsolutePath = StringEncoder.stringToHashCodeString(getAbsoluteFilename());
-        String encodedName = encodedAbsolutePath + ":" + filename;
+        String absoluteFileName = getAbsoluteFilename();
+        final String filename = FilenameUtils.getName(absoluteFileName).replace('.', '_');
+        // we used to use the absolute path, but it would be different
+        // on different machines and we want builds to be binary reproducible.
+        // So we will use the first definition's QName as that should be unique
+        IDefinition def0 = getDefinitionPromises().get(0);
+        final String encodedQName = StringEncoder.stringToHashCodeString(def0.getQualifiedName());
+        String encodedName = encodedQName + ":" + filename;
         if (definitionPromises.isEmpty())
         {
             return encodedName;