changeset 25:16cbc6c62174

Use checksum to ensure correct asm dependency is used, contributed by: erik.helin@oracle.com
author afedorch
date Tue, 26 Sep 2017 17:24:04 -0700
parents 90d3688075fe
children 1bfff4a9a00a
files build/build.properties build/build.xml
diffstat 2 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/build/build.properties	Fri Sep 22 11:50:23 2017 -0700
+++ b/build/build.properties	Tue Sep 26 17:24:04 2017 -0700
@@ -23,6 +23,10 @@
 
 # path to asm6 library
 asmjar = asm-all-6.0_BETA.jar
+
+# sha1 checksum for asm6 library
+asmjar.checksum = 535f141f6c8fc65986a3469839a852a3266d1025
+
 # path to javatest library (empty value allowed if you do not need jtobserver.jar)
 javatestjar = javatest.jar
 
--- a/build/build.xml	Fri Sep 22 11:50:23 2017 -0700
+++ b/build/build.xml	Tue Sep 26 17:24:04 2017 -0700
@@ -94,11 +94,27 @@
 
     </target>
 
-    <target name="prepare" depends="clean" description="checks dependencies">
+    <target name="compare-checksum">
 
         <available file="${asmjar}" property="asm.present"/>
         <fail unless="asm.present" message="Please, specify asm library"/>
 
+        <checksum file="${asmjar}" algorithm="sha1" property="${asmjar.checksum}" verifyproperty="asm.checksum.matches" />
+        <condition property="checksum.differs">
+            <equals arg1="${asm.checksum.matches}" arg2="false" />
+        </condition>
+    </target>
+
+    <target name="fail-if-checksum-differs" if="verify.strict" unless="verify.off">
+        <fail if="checksum.differs" message="wrong checksum for ASM dependency" />
+    </target>
+
+    <target name="verify-checksum" depends="compare-checksum, fail-if-checksum-differs" if="checksum.differs" unless="verify.off">
+        <echo message="warning: wrong checksum for ASM dependency" level="warning" />
+    </target>
+
+    <target name="prepare" depends="clean, verify-checksum" description="checks dependencies">
+
         <condition property="javatest.present">
             <and>
                 <isset property="javatestjar"/>
@@ -304,4 +320,4 @@
             description="Creates the build-distribution.">
     </target>
 
-</project>
\ No newline at end of file
+</project>