7
7
"""
8
8
9
9
import argparse
10
- import json
11
10
import os
12
11
from os import path
13
12
import shutil
14
13
import subprocess
15
14
import sys
15
+ import xml .etree .ElementTree as ET
16
16
17
17
# Display the docstring if the user passes -h|--help
18
18
argparse .ArgumentParser (description = __doc__ ).parse_args ()
24
24
assert path .exists (NUGET_SRC_DIR ), \
25
25
"Expected %s to exist; please check whether REPO_ROOT is really %s" % (NUGET_SRC_DIR , REPO_ROOT )
26
26
27
- ORIGIN_FILE = path .join (SCRIPT_ROOT , 'project.json ' )
28
- TARGET_FILE = path .join (NUGET_SRC_DIR , 'optdata' , 'project.json ' )
27
+ ORIGIN_FILE = path .join (SCRIPT_ROOT , 'optdata.csproj ' )
28
+ TARGET_FILE = path .join (NUGET_SRC_DIR , 'optdata' , 'optdata.csproj ' )
29
29
30
30
ARCH_LIST = ['x64' , 'x86' ]
31
31
TOOL_LIST = ['IBC' , 'PGO' ]
@@ -40,9 +40,12 @@ def get_buildos():
40
40
41
41
def get_optdata_version (tool ):
42
42
"""Returns the version string specified in project.json for the given tool."""
43
- package_name = 'optimization.%s.CoreCLR' % (tool )
44
- with open (ORIGIN_FILE ) as json_file :
45
- return json .load (json_file )['dependencies' ][package_name ]
43
+ element_name = {
44
+ 'IBC' : 'IbcDataPackageVersion' ,
45
+ 'PGO' : 'PgoDataPackageVersion' ,
46
+ }[tool ]
47
+ root = ET .parse (ORIGIN_FILE )
48
+ return root .findtext ('./PropertyGroup/{}' .format (element_name ))
46
49
47
50
def get_optdata_dir (tool , arch ):
48
51
"""Returns an absolute path to the directory that should contain optdata given a tool,arch"""
0 commit comments