Craig Tiller | 1ebb7c8 | 2015-08-31 15:53:36 -0700 | [diff] [blame] | 1 | <%def name="get_name(vspackages, package)">${''.join('%s.%s' % (p.name, p.version) for p in vspackages if p.name == package)}</%def> |
Jan Tattermusch | 8ab4538 | 2015-04-10 18:24:28 -0700 | [diff] [blame] | 2 | <%def name="gen_packages_config(packages)">\ |
| 3 | <?xml version="1.0" encoding="utf-8"?> |
| 4 | <packages> |
Craig Tiller | 1ebb7c8 | 2015-08-31 15:53:36 -0700 | [diff] [blame] | 5 | % 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 Tattermusch | 8ab4538 | 2015-04-10 18:24:28 -0700 | [diff] [blame] | 13 | </packages> |
Jan Tattermusch | b5bf574 | 2015-04-10 18:24:35 -0700 | [diff] [blame] | 14 | </%def>\ |
Craig Tiller | 1ebb7c8 | 2015-08-31 15:53:36 -0700 | [diff] [blame] | 15 | <%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 Tattermusch | b5bf574 | 2015-04-10 18:24:35 -0700 | [diff] [blame] | 23 | </%def>\ |
Craig Tiller | 1ebb7c8 | 2015-08-31 15:53:36 -0700 | [diff] [blame] | 24 | <%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 Tattermusch | b5bf574 | 2015-04-10 18:24:35 -0700 | [diff] [blame] | 33 | </%def>\ |
Craig Tiller | 1ebb7c8 | 2015-08-31 15:53:36 -0700 | [diff] [blame] | 34 | <%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 Tattermusch | b5bf574 | 2015-04-10 18:24:35 -0700 | [diff] [blame] | 37 | <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 Tiller | 1ebb7c8 | 2015-08-31 15:53:36 -0700 | [diff] [blame] | 41 | % 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 Tattermusch | b5bf574 | 2015-04-10 18:24:35 -0700 | [diff] [blame] | 52 | </Target> |
Jan Tattermusch | b5bf574 | 2015-04-10 18:24:35 -0700 | [diff] [blame] | 53 | </%def>\ |