blob: f3c57634f96b53a17ef0b9688b87f88dff9cad01 [file] [log] [blame]
Craig Tiller1ebb7c82015-08-31 15:53:36 -07001<%def name="get_name(vspackages, package)">${''.join('%s.%s' % (p.name, p.version) for p in vspackages if p.name == package)}</%def>
Jan Tattermusch8ab45382015-04-10 18:24:28 -07002<%def name="gen_packages_config(packages)">\
3<?xml version="1.0" encoding="utf-8"?>
4<packages>
Craig Tiller1ebb7c82015-08-31 15:53:36 -07005 % for package in vspackages:
6 % if packages == 'all' or package.name in packages:
7 <package id="${package.name}" version="${package.version}" targetFramework="Native" />
8 % if package.redist:
9 <package id="${package.name}.redist" version="${package.version}" targetFramework="Native" />
10 % endif
11 % endif
12 % endfor
Jan Tattermusch8ab45382015-04-10 18:24:28 -070013</packages>
Jan Tattermuschb5bf5742015-04-10 18:24:35 -070014</%def>\
Craig Tiller1ebb7c82015-08-31 15:53:36 -070015<%def name="gen_package_props(packages, repo_root)">\
16 % for package in vspackages:
17 % if packages == 'all' or package.name in packages:
18 % if package.props:
19 <Import Project="${repo_root}\vsprojects\packages\${package.name}.${package.version}\build\native\${package.name}.props" Condition="Exists('${repo_root}\vsprojects\packages\${package.name}.${package.version}\build\native\${package.version}.props')" />
20 % endif
21 % endif
22 % endfor
Jan Tattermuschb5bf5742015-04-10 18:24:35 -070023</%def>\
Craig Tiller1ebb7c82015-08-31 15:53:36 -070024<%def name="gen_package_targets(packages, repo_root)">\
25 % for package in vspackages:
26 % if packages == 'all' or package.name in packages:
27 % if package.redist:
28 <Import Project="${repo_root}\vsprojects\packages\${package.name}.redist.${package.version}\build\native\${package.name}.redist.targets" Condition="Exists('${repo_root}\vsprojects\packages\${package.name}.redist.${package.version}\build\native\grpc.dependencies\${package.name}.targets')" />
29 % endif
30 <Import Project="${repo_root}\vsprojects\packages\${package.name}.${package.version}\build\native\${package.name}.targets" Condition="Exists('${repo_root}\vsprojects\packages\${package.name}.${package.version}\build\native\grpc.dependencies\${package.name}.targets')" />
31 % endif
32 % endfor
Jan Tattermuschb5bf5742015-04-10 18:24:35 -070033</%def>\
Craig Tiller1ebb7c82015-08-31 15:53:36 -070034<%def name="check_file_inner(file)"><Error Condition="!Exists('${file}')" Text="$([System.String]::Format('$(ErrorText)', '${file}')" /></%def>\
35<%def name="check_file(file, repo_root, package)">${check_file_inner(file % {'root':repo_root, 'name':package.name, 'version':package.version})}</%def>\
36<%def name="gen_package_ensure(packages, repo_root)">\
Jan Tattermuschb5bf5742015-04-10 18:24:35 -070037 <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
38 <PropertyGroup>
39 <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
40 </PropertyGroup>
Craig Tiller1ebb7c82015-08-31 15:53:36 -070041 % for package in vspackages:
42 % if packages == 'all' or package.name in packages:
43 % if package.redist:
44 ${check_file('%(root)s\\vsprojects\\packages\\%(name)s.redist.%(version)s\\build\\native\\%(name)s.redist.targets', repo_root, package)}
45 % endif
46 % if package.props:
47 ${check_file('%(root)s\\vsprojects\\packages\\%(name)s.%(version)s\\build\\native\\%(name)s.props', repo_root, package)}
48 % endif
49 ${check_file('%(root)s\\vsprojects\\packages\\%(name)s.%(version)s\\build\\native\\%(name)s.targets', repo_root, package)}
50 % endif
51 % endfor
Jan Tattermuschb5bf5742015-04-10 18:24:35 -070052 </Target>
Jan Tattermuschb5bf5742015-04-10 18:24:35 -070053</%def>\