VS SLN script: Automatically determine which folder to use/copy

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=5009

Change-Id: Ic7765cf23191af840935f7181579e04d62de23af
Reviewed-on: https://skia-review.googlesource.com/5009
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2016-11-18 13:38:13 -05:00 committed by Skia Commit-Bot
parent c89e2438ae
commit 06e539ad12

View File

@ -7,16 +7,30 @@ import glob
import sys
from shutil import copyfile
srcDir = sys.argv[1]
# Get list of existing directories to use as configs
configs = []
configsWithSln = []
srcDir = ""
newestSlnTimestamp = 0
for root, dirs, files in os.walk("out"):
for outDir in dirs:
if os.path.exists("out/" + outDir + "/build.ninja.d"):
gnFile = os.path.join("out", outDir, "build.ninja.d")
slnFile = os.path.join("out", outDir, "all.sln")
if os.path.exists(gnFile):
configs.append(outDir)
if os.path.exists(slnFile):
configsWithSln.append(outDir)
slnTimestamp = os.path.getmtime(slnFile)
if slnTimestamp > newestSlnTimestamp:
newestSlnTimestamp = slnTimestamp
srcDir = outDir
break
# We need at least one config with a solution
if len(configsWithSln) == 0:
print "ERROR: At least one GN directory must have been built with --ide=vs"
sys.exit()
# Ensure directories exist
try:
os.makedirs("out/sln/obj")