Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sophia-guo committed Oct 10, 2024
1 parent 48acf8d commit 968b5f3
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 72 deletions.
132 changes: 63 additions & 69 deletions tooling/reproducible/repro_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,9 @@ function removeSystemModulesHashBuilderParams() {
FILES=$(find "${JDK_DIR}" -type f -name "$systemModule")
for f in $FILES
do
ff=$f
if [[ "$OS" =~ CYGWIN* ]]; then
ff=$(cygpath -w $f)
else
ff=$f
fi
"${work_JDK}"/bin/javap -v -sysinfo -l -p -c -s -constants "$ff" > "$f.javap.tmp"
rm "$f"
Expand Down Expand Up @@ -256,80 +255,75 @@ function processModuleInfo() {
local OS="$2"
local work_JDK="$3"
echo "process Module Info from ${JDK_DIR}"
if [[ "$OS" =~ CYGWIN* ]] || [[ "$OS" =~ Darwin* ]]; then
echo "Normalizing ModuleAttributes order in module-info.class, converting to javap"

moduleAttr="ModuleResolution ModuleTarget"
echo "Normalizing ModuleAttributes order in module-info.class, converting to javap"
moduleAttr="ModuleResolution ModuleTarget"
FILES=$(find "${JDK_DIR}" -type f -name "module-info.class")
for f in $FILES
do
ff=$f
if [[ "$OS" =~ CYGWIN* ]]; then
ff=$(cygpath -w $f)
fi
"${work_JDK}"/bin/javap -v -sysinfo -l -p -c -s -constants "$ff" > "$f.javap.tmp"
rm "$f"

cc=99
foundAttr=false
attrName=""
# Clear any attr tmp files
for attr in $moduleAttr
do
rm -f "$f.javap.$attr"
done

FILES=$(find "${JDK_DIR}" -type f -name "module-info.class")
for f in $FILES
while IFS= read -r line
do
if [[ "$OS" =~ CYGWIN* ]]; then
ff=$(cygpath -w $f)
else
ff=$f
cc=$((cc+1))

# Module attr have only 1 line definition
if [[ "$foundAttr" = true ]] && [[ "$cc" -gt 1 ]]; then
foundAttr=false
attrName=""
fi
"${work_JDK}"/bin/javap -v -sysinfo -l -p -c -s -constants "$ff" > "$f.javap.tmp"
rm "$f"

cc=99
foundAttr=false
attrName=""
# Clear any attr tmp files
for attr in $moduleAttr
do
rm -f "$f.javap.$attr"
done

while IFS= read -r line
do
cc=$((cc+1))

# Module attr have only 1 line definition
if [[ "$foundAttr" = true ]] && [[ "$cc" -gt 1 ]]; then
foundAttr=false
attrName=""
fi

# If not processing an attr then check for attr
if [[ "$foundAttr" = false ]]; then
for attr in $moduleAttr
do
if [[ "$line" =~ .*"$attr:".* ]]; then
cc=0
foundAttr=true
attrName="$attr"
fi
done
fi

# Echo attr to attr tmp file, otherwise to tmp2
if [[ "$foundAttr" = true ]]; then
echo "$line" >> "$f.javap.$attrName"
else
echo "$line" >> "$f.javap.tmp2"
fi
done < "$f.javap.tmp"
rm "$f.javap.tmp"

# Remove javap Classfile and timestamp and SHA-256 hash
if [[ "$f" =~ .*"java.base".* ]]; then
grep -v "Last modified\|Classfile\|SHA-256 checksum\|hash:" "$f.javap.tmp2" > "$f.javap"
# If not processing an attr then check for attr
if [[ "$foundAttr" = false ]]; then
for attr in $moduleAttr
do
if [[ "$line" =~ .*"$attr:".* ]]; then
cc=0
foundAttr=true
attrName="$attr"
fi
done
fi

# Echo attr to attr tmp file, otherwise to tmp2
if [[ "$foundAttr" = true ]]; then
echo "$line" >> "$f.javap.$attrName"
else
grep -v "Last modified\|Classfile\|SHA-256 checksum" "$f.javap.tmp2" > "$f.javap"
echo "$line" >> "$f.javap.tmp2"
fi
done < "$f.javap.tmp"
rm "$f.javap.tmp"

# Remove javap Classfile and timestamp and SHA-256 hash
if [[ "$f" =~ .*"java.base".* ]]; then
grep -v "Last modified\|Classfile\|SHA-256 checksum\|hash:" "$f.javap.tmp2" > "$f.javap"
else
grep -v "Last modified\|Classfile\|SHA-256 checksum" "$f.javap.tmp2" > "$f.javap"
fi
rm "$f.javap.tmp2"

# Append any ModuleAttr tmp files
for attr in $moduleAttr
do
if [[ -f "$f.javap.$attr" ]]; then
cat "$f.javap.$attr" >> "$f.javap"
fi
rm "$f.javap.tmp2"

# Append any ModuleAttr tmp files
for attr in $moduleAttr
do
if [[ -f "$f.javap.$attr" ]]; then
cat "$f.javap.$attr" >> "$f.javap"
fi
rm -f "$f.javap.$attr"
done
rm -f "$f.javap.$attr"
done
fi
done
}

# Remove windowns generate classes jdk/bin/server/classes.jsa & jdk/bin/server/classes_nocoops.jsa
Expand Down
3 changes: 1 addition & 2 deletions tooling/reproducible/repro_compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,10 @@ do

if [[ "$OS" =~ CYGWIN* ]] || [[ "$OS" =~ Darwin* ]]; then
removeSystemModulesHashBuilderParams "${JDK_DIR}" "${OS}" "${BK_JDK_DIR}"
processModuleInfo "${JDK_DIR}" "${OS}" "${BK_JDK_DIR}"
fi
processModuleInfo "${JDK_DIR}" "${OS}" "${BK_JDK_DIR}"
done


files1=$(find "${JDK_DIR1}" -type f | wc -l)
echo "Number of files: ${files1}"
rc=0
Expand Down
2 changes: 1 addition & 1 deletion tooling/reproducible/repro_process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# ********************************************************************************

# shellcheck disable=SC1091
source $(dirname "$0")/repro_common.sh
source "$(dirname "$0")"/repro_common.sh

JDK_DIR="$1"
OS="$2"
Expand Down

0 comments on commit 968b5f3

Please sign in to comment.