mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8240734: ModuleHashes attribute not reproducible between builds
Reviewed-by: alanb
This commit is contained in:
parent
aac5b27b6a
commit
f4b5488181
2 changed files with 6 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -34,6 +34,7 @@ import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -134,7 +135,7 @@ public final class ModuleHashes {
|
||||||
* @return ModuleHashes that encapsulates the hashes
|
* @return ModuleHashes that encapsulates the hashes
|
||||||
*/
|
*/
|
||||||
public static ModuleHashes generate(Map<String, Path> map, String algorithm) {
|
public static ModuleHashes generate(Map<String, Path> map, String algorithm) {
|
||||||
Map<String, byte[]> nameToHash = new HashMap<>();
|
Map<String, byte[]> nameToHash = new TreeMap<>();
|
||||||
for (Map.Entry<String, Path> entry: map.entrySet()) {
|
for (Map.Entry<String, Path> entry: map.entrySet()) {
|
||||||
String name = entry.getKey();
|
String name = entry.getKey();
|
||||||
Path path = entry.getValue();
|
Path path = entry.getValue();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -34,6 +34,7 @@ import java.util.ArrayDeque;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -98,7 +99,7 @@ public class ModuleHashesBuilder {
|
||||||
// the modules to record the hashes - it is the first matching
|
// the modules to record the hashes - it is the first matching
|
||||||
// module and has not been hashed during the traversal.
|
// module and has not been hashed during the traversal.
|
||||||
Set<String> mods = new HashSet<>();
|
Set<String> mods = new HashSet<>();
|
||||||
Map<String, ModuleHashes> hashes = new HashMap<>();
|
Map<String, ModuleHashes> hashes = new TreeMap<>();
|
||||||
builder.build()
|
builder.build()
|
||||||
.orderedNodes()
|
.orderedNodes()
|
||||||
.filter(mn -> roots.contains(mn) && !mods.contains(mn))
|
.filter(mn -> roots.contains(mn) && !mods.contains(mn))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue