#
#
# BuildLatest
#
# by Steven Glass
# 24 Jan 89
#
# This script does everything it needs to do to checkout and build
# the latests sources for the system disk.
#
# It starts by mounting the projects (if they are not already mounted).
# It then uses CheckOutAll to check out all modified sources since last checkout.
# It then uses BuildAll to build everything.
# Finally, it uses CopyAll to put it on to A2CE_Sources.
#
###############################################################################
set GSProjects D:GSProjects:

open {worksheet}

delete -i A2CE_Sources:__ImageValid
delete -i A2CE_Sources:__BuildingSD
newfolder A2CE_Sources:__BuildingSD

# find out whether we need to access any of the projects
set exit 0
Confirm -t "Do I need to check out the latest sources from the projects?"
set Confirmation {status}
exit "-9"	if {Confirmation}==5	# returned status = user abort

if {Confirmation}4	# Yes was selected
	Mount6.0Projects	# so go ahead and mount everything
	# Check out the latest stuff
	echo "Checking out latests..."
	CheckOutAll -newer
	Delete -i "{Makefiles}"Make.QuickConsole	# this shouldn't get built for the system disk
	Delete -i "{Makefiles}"Make.ExpressLoad		# this shouldn't get built for the system disk
end

# Build the latest Stuff
echo "Building everything..."
BuildAll


# search through the worksheet to see if any errors occurred.  If so,
# then leave the first error selected.  Otherwise, put together the
# disk images and then prompt for the NameRevisions sequence.

# move to beginning of worksheet
find  "{worksheet}"

# position to beginning of build sequence
find /Building everything.../ "{worksheet}"

# try to find any errors.  If none are found, then the disk layouts are built
# on a local hard drive, and then copied up to A2CE_Sources.  Then a script is
# executed to perform a NameRevisions on the projects.  If an error IS found,
# this script simply terminates with the first error found highlighted on
# the worksheet.
(find /###/ "{worksheet}") dev:null || Begin
	# Copy the latest stuff to hd: and then to A2CE_Sources
	echo "Copying stuff to A2CE_Sources..."
	Copyall {GSProjects} "HD:System Disk 6.0"
	
	duplicate "Hd:System Disk 6.0:" A2CE_Sources: -y
	setprivilege -r -d O -f O -m O A2CE_Sources:"System Disk 6.0"
	
	delete -i A2CE_Sources:__BuildingSD
	newfolder A2CE_Sources:__ImageValid
	
	setRevisionName	# call the script to perform a NameRevisions
end	# of Begin block