From 3bf9df6b2785fa6d951086978a3e66f49427166a Mon Sep 17 00:00:00 2001 From: FluorescentCIAAfricanAmerican <0934gj3049fk@protonmail.com> Date: Wed, 22 Apr 2020 12:56:21 -0400 Subject: 1 --- devtools/mapbuild/syncChangedMaps.pl | 103 +++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 devtools/mapbuild/syncChangedMaps.pl (limited to 'devtools/mapbuild/syncChangedMaps.pl') diff --git a/devtools/mapbuild/syncChangedMaps.pl b/devtools/mapbuild/syncChangedMaps.pl new file mode 100644 index 0000000..9122947 --- /dev/null +++ b/devtools/mapbuild/syncChangedMaps.pl @@ -0,0 +1,103 @@ +use strict; + +my $forceBuild = 0; +if ( $ARGV[1] =~ /-forcebuild/ ) +{ + $forceBuild = 1; +} + +# Read in the list of changed maps + +my $filename = "buildlist.txt"; + +open(INFILE, $filename); +my @maps = ; +close( INFILE ); + +# forcelist.txt allows maps to be manually added to the build. + +open(INFILE, "forcelist.txt"); +my @forcemaps = ; +close( INFILE ); + +my $retval = 1; + +system( "echo. > $filename" ); +system( "echo. > forcelist.txt" ); + +# Run through the list of maps to see if any should be built + +for( @maps) +{ + if( /updating (.*)|adding (.*)/ ) + { + # Check if this map should be built now + if ( shouldBuild( $1 ) == 0 ) + { + next; + } + + # Add this map name to the build list + + system( "p4 sync -f $1 >> $filename" ); + system( "echo Adding to the build list: $1 >> log.txt" ); + $retval = 0; + } +} + +for( @forcemaps ) +{ + if ( /\.vmf/ ) + { + # Add this map name to the build list + + $_ =~ /(.*)/; + system( "p4 sync -f $1 >> $filename" ); + system( "echo Forcing add to the build list: $1 >> log.txt" ); + $retval = 0; + } +} + +exit $retval; + +#----------------------------------- +# Check if this map should build now +#----------------------------------- +sub shouldBuild +{ + my $map = shift; + + # if command line flag was set, build the map + + if ( $forceBuild == 1 ) + { + return 1; + } + + # if the map line contains the force flag, build the map + + if ( $map =~ /-forcebuild/ ) + { + return 1; + } + + # Dump the comments from the last checkin of this map + + system( "p4 changes -m 1 -s submitted -l $map > comments.txt" ); + + # parse comments for the autocompile keyword + + open(INFILE, "comments.txt"); + my @comments = ; + close(INFILE); + + for( @comments ) + { + if ( /autocompile/i ) + { + return 1; + } + } + + return 0; +} -- cgit v1.2.3