summaryrefslogtreecommitdiff
path: root/tests/scripts/optdata
diff options
context:
space:
mode:
Diffstat (limited to 'tests/scripts/optdata')
-rwxr-xr-xtests/scripts/optdata/bootstrap.py15
-rw-r--r--tests/scripts/optdata/optdata.csproj29
-rw-r--r--tests/scripts/optdata/project.json12
3 files changed, 38 insertions, 18 deletions
diff --git a/tests/scripts/optdata/bootstrap.py b/tests/scripts/optdata/bootstrap.py
index 1cf55fa70c..8dcecca779 100755
--- a/tests/scripts/optdata/bootstrap.py
+++ b/tests/scripts/optdata/bootstrap.py
@@ -7,12 +7,12 @@
"""
import argparse
-import json
import os
from os import path
import shutil
import subprocess
import sys
+import xml.etree.ElementTree as ET
# Display the docstring if the user passes -h|--help
argparse.ArgumentParser(description=__doc__).parse_args()
@@ -24,8 +24,8 @@ NUGET_SRC_DIR = path.join(REPO_ROOT, 'src', '.nuget')
assert path.exists(NUGET_SRC_DIR), \
"Expected %s to exist; please check whether REPO_ROOT is really %s" % (NUGET_SRC_DIR, REPO_ROOT)
-ORIGIN_FILE = path.join(SCRIPT_ROOT, 'project.json')
-TARGET_FILE = path.join(NUGET_SRC_DIR, 'optdata', 'project.json')
+ORIGIN_FILE = path.join(SCRIPT_ROOT, 'optdata.csproj')
+TARGET_FILE = path.join(NUGET_SRC_DIR, 'optdata', 'optdata.csproj')
ARCH_LIST = ['x64', 'x86']
TOOL_LIST = ['IBC', 'PGO']
@@ -40,9 +40,12 @@ def get_buildos():
def get_optdata_version(tool):
"""Returns the version string specified in project.json for the given tool."""
- package_name = 'optimization.%s.CoreCLR' % (tool)
- with open(ORIGIN_FILE) as json_file:
- return json.load(json_file)['dependencies'][package_name]
+ element_name = {
+ 'IBC': 'IbcDataPackageVersion',
+ 'PGO': 'PgoDataPackageVersion',
+ }[tool]
+ root = ET.parse(ORIGIN_FILE)
+ return root.findtext('./PropertyGroup/{}'.format(element_name))
def get_optdata_dir(tool, arch):
"""Returns an absolute path to the directory that should contain optdata given a tool,arch"""
diff --git a/tests/scripts/optdata/optdata.csproj b/tests/scripts/optdata/optdata.csproj
new file mode 100644
index 0000000000..ac7360643f
--- /dev/null
+++ b/tests/scripts/optdata/optdata.csproj
@@ -0,0 +1,29 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+
+ <PropertyGroup>
+ <TargetFramework>netstandard</TargetFramework>
+ <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
+ <RuntimeIdentifiers>win7-x64;win7-x86;linux-x64</RuntimeIdentifiers>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <PgoDataPackageVersion>99.99.99-test</PgoDataPackageVersion>
+ <IbcDataPackageVersion>99.99.99-test</IbcDataPackageVersion>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="optimization.PGO.CoreCLR" Version="$(PgoDataPackageVersion)" Condition="'$(PgoDataPackageVersion)'!=''" />
+ <PackageReference Include="optimization.IBC.CoreCLR" Version="$(IbcDataPackageVersion)" Condition="'$(IbcDataPackageVersion)'!=''" />
+ </ItemGroup>
+
+ <Target Name="DumpPgoDataPackageVersion">
+ <Message Importance="high" Text="$(PgoDataPackageVersion)" />
+ </Target>
+
+ <Target Name="DumpIbcDataPackageVersion">
+ <Message Importance="high" Text="$(IbcDataPackageVersion)" />
+ </Target>
+
+</Project>
diff --git a/tests/scripts/optdata/project.json b/tests/scripts/optdata/project.json
deleted file mode 100644
index ae8f9463c4..0000000000
--- a/tests/scripts/optdata/project.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "dependencies": {
- "optimization.IBC.CoreCLR": "99.99.99-test",
- "optimization.PGO.CoreCLR": "99.99.99-test"
- },
- "frameworks": {
- "netstandard": {}
- },
- "runtimes": {
- "win7-x64": {}
- }
-}