Skip to content

Commit

Permalink
[Build] Set TFM supported by Tizen to vconf (Samsung#2026)
Browse files Browse the repository at this point in the history
* Added to update TFM with maketfm.py

Co-authored-by: Hyungju Lee <[email protected]>
  • Loading branch information
JongHeonChoi and HJLeee authored Sep 24, 2020
1 parent a9420fe commit b10f9f9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packaging/csapi-tizenfx.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
%define DOTNET_NUGET_SOURCE /nuget

%define TIZEN_NET_RUNTIME_IDENTIFIERS 4.0.0:5.0.0:5.5.0:6.0.0
%define TIZEN_NET_TARGET_FRAMEWORK_MONIKERS tizen80:tizen70:tizen60:tizen50:tizen40:netstandard2.0

Name: csapi-tizenfx
Summary: Assemblies of Tizen .NET
Expand Down Expand Up @@ -210,6 +211,7 @@ install -p -m 644 tools/bin/* %{buildroot}%{DOTNET_TOOLS_PATH}
/usr/bin/vconftool set -t int db/dotnet/tizen_api_version %{TIZEN_NET_API_VERSION} -f
/usr/bin/vconftool set -t string db/dotnet/tizen_api_path %{DOTNET_ASSEMBLY_PATH} -f
/usr/bin/vconftool set -t string db/dotnet/tizen_rid_version %{TIZEN_NET_RUNTIME_IDENTIFIERS} -f
/usr/bin/vconftool set -t string db/dotnet/tizen_tfm_support %{TIZEN_NET_TARGET_FRAMEWORK_MONIKERS} -f

%files
%license LICENSE
Expand Down
2 changes: 2 additions & 0 deletions packaging/csapi-tizenfx.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
%define DOTNET_NUGET_SOURCE /nuget

%define TIZEN_NET_RUNTIME_IDENTIFIERS @rid_version@
%define TIZEN_NET_TARGET_FRAMEWORK_MONIKERS @tfm_support@

Name: csapi-tizenfx
Summary: Assemblies of Tizen .NET
Expand Down Expand Up @@ -209,6 +210,7 @@ install -p -m 644 tools/bin/* %{buildroot}%{DOTNET_TOOLS_PATH}
/usr/bin/vconftool set -t int db/dotnet/tizen_api_version %{TIZEN_NET_API_VERSION} -f
/usr/bin/vconftool set -t string db/dotnet/tizen_api_path %{DOTNET_ASSEMBLY_PATH} -f
/usr/bin/vconftool set -t string db/dotnet/tizen_rid_version %{TIZEN_NET_RUNTIME_IDENTIFIERS} -f
/usr/bin/vconftool set -t string db/dotnet/tizen_tfm_support %{TIZEN_NET_TARGET_FRAMEWORK_MONIKERS} -f

%files
%license LICENSE
Expand Down
3 changes: 3 additions & 0 deletions packaging/makespec.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ sed -i -e "s/@nuget_version@/$NUGET_VERSION/g" $RPMSPEC

# Update RID
python $SCRIPT_DIR/makerid.py

# Update TFM
python $SCRIPT_DIR/maketfm.py
32 changes: 32 additions & 0 deletions packaging/maketfm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
import xml.etree.ElementTree as ET

scrpit_dir = os.path.dirname(os.path.abspath(__file__))
spec_dir = os.path.join(scrpit_dir, "csapi-tizenfx.spec")
tree = ET.parse("../pkg/Tizen.NET/Tizen.NET.nuspec")
root = tree.getroot()

tfm_list = []
for meta_child in root.iter():
if meta_child.tag == "{http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd}metadata":
for depen_child in meta_child:
if depen_child.tag == "{http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd}dependencies":
for group in depen_child:
tfm = group.attrib["targetFramework"].lower()
tfm = tfm.replace(".", "")
tfm = tfm.replace("20", "2.0")
if tfm.strip():
tfm_list.append(tfm)

tfm_list = list(set(tfm_list))
tfm_list.sort(reverse=True)

f = open(spec_dir,'r')
origin_data = f.read()
f.close()

new_data = origin_data.replace("@tfm_support@", ':'.join(tfm_list))

f = open(spec_dir, 'w')
f.write(new_data)
f.close()

0 comments on commit b10f9f9

Please sign in to comment.