blob: f103ebe01a926af84bf8cfa61bff257b39d936eb [file] [log] [blame]
Nicolas "Pixel" Noble7bf50922015-05-09 03:17:21 +02001#!/bin/sh
2
Craig Tillerd4db33d2015-05-21 15:27:05 -07003# Copyright 2015, Google Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met:
9#
10# * Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer.
12# * Redistributions in binary form must reproduce the above
13# copyright notice, this list of conditions and the following disclaimer
14# in the documentation and/or other materials provided with the
15# distribution.
16# * Neither the name of Google Inc. nor the names of its
17# contributors may be used to endorse or promote products derived from
18# this software without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
Nicolas "Pixel" Noble6c8717d2015-05-09 09:06:07 +020032# To properly use this, you'll need to add:
33#
34# "debug": true
35#
36# to build.json
37
Nicolas "Pixel" Noble7bf50922015-05-09 03:17:21 +020038cd `dirname $0`/../..
39
Michael Larson1ee691d2015-07-19 10:49:59 -070040git add . #because we're using "git diff" to find changes to grpc.sln and then make files based on those changes, this prevents this file or other files from possibly being found in the diff
41
42./tools/buildgen/generate_projects-old.sh
43
44line_number=0
Nicolas "Pixel" Noble6c8717d2015-05-09 09:06:07 +020045
46git diff |
Michael Larson1ee691d2015-07-19 10:49:59 -070047grep -A2 \\+Project | #find "Project" immediately after a backslash (escaped), plus 2 additional lines to capture the "libs = ", plus 1 line of "--". matches will come from the generated grpc.sln
Nicolas "Pixel" Noble6c8717d2015-05-09 09:06:07 +020048while read p ; do
Michael Larson1ee691d2015-07-19 10:49:59 -070049 line_number=$((line_number + 1))
50 if [ "$line_number" -gt "4" ]; then
51 line_number=1;
52 fi
53 echo $line_number
54 echo $p
55 if [ "$line_number" -eq "1" ]; then
56 project_name=$(echo "$p" | cut -d\" -f 4) #sed: extract line N only; cut with delimiter: ". select only field 4
57 fi
58 if [ "$line_number" -eq "3" ]; then
59 lib_setting=$(echo "$p" | cut -d\" -f 2) #
60 echo "project_name"
61 echo $project_name
62 echo "lib_setting"
63 echo $lib_setting
64 mkdir -p templates/vsprojects/$project_name
65 if [ "$lib_setting" = "True" ]; then
66 echo "lib: true"
67 echo '<%namespace file="../vcxproj_defs.include" import="gen_project"/>${gen_project("'$project_name'", libs)}' > templates/vsprojects/$project_name/$project_name.vcxproj.template
68 else
69 echo "lib: not true"
70 echo '<%namespace file="../vcxproj_defs.include" import="gen_project"/>${gen_project("'$project_name'", targets)}' > templates/vsprojects/$project_name/$project_name.vcxproj.template
71 fi
72 fi
73 # sleep .5 #for testing
Nicolas "Pixel" Noble6c8717d2015-05-09 09:06:07 +020074done
75
Michael Larson1ee691d2015-07-19 10:49:59 -070076./tools/buildgen/generate_projects-old.sh