Skip to content

Commit abeb611

Browse files
jpgxsjgriffiths-od
authored andcommitted
Fix non-determinism in build-data.properties file
Invoke singlejar with a relative path to the output JAR, preventing the build-data.properties file from containing the absolute path.
1 parent 39179b9 commit abeb611

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

springboot/springboot_pkg.sh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,21 @@ fi
272272
cd $working_dir
273273

274274

275-
# Use Bazel's singlejar to re-jar it which normalizes timestamps as Jan 1 2010
276-
# note that it does not use the manifest from the jar file, which is a bummer
277-
# so we have to respecify the manifest data
278-
# TODO we should rewrite write_manfiest.sh to produce inputs compatible for singlejar (Issue #27)
279-
singlejar_options="--normalize --dont_change_compression" # add in --verbose for more details from command
280-
singlejar_mainclass="--main_class org.springframework.boot.loader.JarLauncher"
281-
$singlejar_cmd $singlejar_options $singlejar_mainclass \
282-
--deploy_manifest_lines "Start-Class: $mainclass" \
283-
--sources $raw_output_jar \
284-
--output $ruledir/$outputjar 2>&1 | tee -a $debugfile
275+
(
276+
# Use Bazel's singlejar to re-jar it which normalizes timestamps as Jan 1 2010
277+
# note that it does not use the manifest from the jar file, which is a bummer
278+
# so we have to respecify the manifest data
279+
# TODO we should rewrite write_manfiest.sh to produce inputs compatible for singlejar (Issue #27)
280+
singlejar_options="--normalize --dont_change_compression" # add in --verbose for more details from command
281+
singlejar_mainclass="--main_class org.springframework.boot.loader.JarLauncher"
282+
# #205: Execute the singlejar command from the original ruledir, so the build-data.properties file
283+
# contains a deterministic, relative path for 'build.target'.
284+
cd "$ruledir"
285+
$singlejar_cmd $singlejar_options $singlejar_mainclass \
286+
--deploy_manifest_lines "Start-Class: $mainclass" \
287+
--sources $raw_output_jar \
288+
--output "$outputjar" 2>&1 | tee -a $debugfile
289+
)
285290

286291
if [ $? -ne 0 ]; then
287292
echo "ERROR: Failed creating the JAR file $working_dir." | tee -a $debugfile

0 commit comments

Comments
 (0)