@@ -566,8 +566,8 @@ isProject() {
566566 test " $1 " = " LOCAL/PROJECT" -o " $a " = " $( basename " $1 " ) " && echo 1
567567}
568568
569- # Generates melt.sh and helper scripts for all modules in the current directory.
570- generateScripts () {
569+ # Generates melt.sh, covering all projects in the current directory.
570+ generateMeltScript () {
571571 echo ' #!/bin/sh' > melt.sh
572572 echo ' trap "exit" INT' >> melt.sh
573573 echo ' echo "Melting the pot..."' >> melt.sh
@@ -607,8 +607,11 @@ generateScripts() {
607607 echo ' test "$failCount" -gt 255 && failCount=255' >> melt.sh
608608 echo ' exit "$failCount"' >> melt.sh
609609 chmod +x melt.sh
610+ }
610611
611- cat << \PRIOR > prior-success.sh
612+ # Generates helper scripts, including prior-success.sh and record-success.sh.
613+ generateHelperScripts () {
614+ cat << \PRIOR > prior-success.sh
612615#!/bin/sh
613616test "$1 " || { echo "[ERROR] Please specify project to check."; exit 1; }
614617
@@ -671,7 +674,7 @@ echo "$success"
671674PRIOR
672675 chmod +x prior-success.sh
673676
674- cat << \RECORD > record-success.sh
677+ cat << \RECORD > record-success.sh
675678#!/bin/sh
676679test "$1 " || { echo "[ERROR] Please specify project to update."; exit 1; }
677680
@@ -738,6 +741,10 @@ meltDown() {
738741 local deps=" $( deps " $projectDir " ) "
739742 test " $deps " || die " Cannot glean project dependencies" 7
740743
744+ # Generate helper scripts. We need prior-success.sh
745+ # to decide whether to include each component.
746+ generateHelperScripts
747+
741748 local args=" -Denforcer.skip"
742749
743750 # Process the dependencies.
@@ -754,12 +761,6 @@ meltDown() {
754761
755762 test -z " $( isChanged " $gav " ) " &&
756763 args=" $args \\\\ \n -D$g .$a .version=$v -D$a .version=$v "
757-
758- if [ " $( isIncluded " $gav " ) " ]
759- then
760- info " $g :$a : resolving source for version $v "
761- resolveSource " $gav " > /dev/null
762- fi
763764 done
764765
765766 # Override versions of changed GAVs.
@@ -774,15 +775,40 @@ meltDown() {
774775 done
775776 unset TLS
776777
777- # Prune the build, if applicable.
778- test " $prune " && pruneReactor
779-
780- # Generate build scripts.
781- info " Generating build scripts"
778+ # Generate build script.
779+ info " Generating build.sh script"
782780 echo " #!/bin/sh" > build.sh
783781 echo " mvn $args \\\\ \n dependency:list test \$ @" >> build.sh
784782 chmod +x build.sh
785- generateScripts
783+
784+ # Clone source code.
785+ info " Cloning source code"
786+ for dep in $deps
787+ do
788+ local g=" $( groupId " $dep " ) "
789+ local a=" $( artifactId " $dep " ) "
790+ local v=" $( version " $dep " ) "
791+ local c=" $( classifier " $dep " ) "
792+ test -z " $c " || continue # skip secondary artifacts
793+ local gav=" $g :$a :$v "
794+ if [ " $( isIncluded " $gav " ) " ]
795+ then
796+ if [ " $( ./prior-success.sh " $g /$a " ) " ]
797+ then
798+ info " $g :$a : skipping version $v due to prior successful build"
799+ continue
800+ fi
801+ info " $g :$a : resolving source for version $v "
802+ resolveSource " $gav " > /dev/null
803+ fi
804+ done
805+
806+ # Prune the build, if applicable.
807+ test " $prune " && pruneReactor
808+
809+ # Generate melt script.
810+ info " Generating melt.sh script"
811+ generateMeltScript
786812
787813 # Build everything.
788814 if [ " $skipBuild " ]
0 commit comments