From 53e272e12de4ef947c49b2bacf247a78d20fa31a Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Wed, 30 Nov 2016 14:01:19 +0900 Subject: [PATCH 01/16] Update version to 1.0.9 Change-Id: I036d9006f2fdd0f1d153b67a77d7332baaa511c0 --- packaging/dotnet-build-tools.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/dotnet-build-tools.spec b/packaging/dotnet-build-tools.spec index dcb3fac7..2e04b196 100644 --- a/packaging/dotnet-build-tools.spec +++ b/packaging/dotnet-build-tools.spec @@ -1,6 +1,6 @@ Name: dotnet-build-tools Summary: Tools for building C# API projects -Version: 1.0.8 +Version: 1.0.9 Release: 1 Group: Development/Libraries License: MIT and Apache-2.0 -- 2.34.1 From 9bd9aac39ca07cab5c1836cf94057ebe0b8f71d0 Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Thu, 1 Dec 2016 14:27:44 +0900 Subject: [PATCH 02/16] Add corefx-managed-ref Requires for building C# APIs corefx-managed-ref installs nupkgs that depend on C# APIs. Signed-off-by: Jiyoung Yun Change-Id: Ia1c82676402b30f523e771c4903fafc8763b751b --- packaging/dotnet-build-tools.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/dotnet-build-tools.spec b/packaging/dotnet-build-tools.spec index 2e04b196..73be84ac 100644 --- a/packaging/dotnet-build-tools.spec +++ b/packaging/dotnet-build-tools.spec @@ -9,6 +9,7 @@ Source0: %{name}-%{version}.tar.gz AutoReqProv: no +Requires: corefx-managed-ref Requires: mono-compat %description -- 2.34.1 From 7134ca181da19339cfd83d0ad4488559506567c5 Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Fri, 9 Dec 2016 21:19:45 +0900 Subject: [PATCH 03/16] Rename corefx-managed-ref to corefx-managed-ref-noarch on armv7l Signed-off-by: Jiyoung Yun Change-Id: I8f1a99d7539c08bb3b037f06719e25878c8af60e --- packaging/dotnet-build-tools.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packaging/dotnet-build-tools.spec b/packaging/dotnet-build-tools.spec index 73be84ac..4027e401 100644 --- a/packaging/dotnet-build-tools.spec +++ b/packaging/dotnet-build-tools.spec @@ -9,7 +9,11 @@ Source0: %{name}-%{version}.tar.gz AutoReqProv: no +%ifarch armv7l +Requires: corefx-managed-ref-noarch +%else Requires: corefx-managed-ref +%endif Requires: mono-compat %description -- 2.34.1 From e5cf2f0291a0e04a3f2f1851c9497392bf89f49e Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Mon, 12 Dec 2016 14:58:58 +0900 Subject: [PATCH 04/16] Add RPM Macros Change-Id: Icfc3d25ad9bf0c30641eefa728e899248f8134cb --- packaging/dotnet-build-tools.spec | 10 ++++- packaging/macros.dotnet-build-tools | 58 +++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 packaging/macros.dotnet-build-tools diff --git a/packaging/dotnet-build-tools.spec b/packaging/dotnet-build-tools.spec index 4027e401..80703235 100644 --- a/packaging/dotnet-build-tools.spec +++ b/packaging/dotnet-build-tools.spec @@ -1,11 +1,12 @@ Name: dotnet-build-tools Summary: Tools for building C# API projects -Version: 1.0.9 +Version: 1.0.10 Release: 1 Group: Development/Libraries License: MIT and Apache-2.0 URL: https://www.tizen.org Source0: %{name}-%{version}.tar.gz +Source1: macros.dotnet-build-tools AutoReqProv: no @@ -14,7 +15,10 @@ Requires: corefx-managed-ref-noarch %else Requires: corefx-managed-ref %endif + Requires: mono-compat +Requires: mono-devel +Requires: mono-compiler %description Build target files (.Targets) and Tools (including NuGet.exe) for building @@ -55,8 +59,12 @@ install -p -m 644 NuGet.BuildTasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter mkdir -p %{buildroot}/nuget install -p -m 644 LocalPackages/*.nupkg %{buildroot}/nuget +# RPM Macros +install -D -p -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/rpm/macros.dotnet-build-tools + %files %license LICENSE.Mono.Cecil LICENSE.NuGet +%config(noreplace) %{_sysconfdir}/rpm/macros.dotnet-build-tools %{_bindir}/* %{NuGetDir}/* %{XBuildDir}/* diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools new file mode 100644 index 00000000..f279f316 --- /dev/null +++ b/packaging/macros.dotnet-build-tools @@ -0,0 +1,58 @@ +# Macro definitions for CSAPI Build + +%_dotnet_build_conf %{lua:if tonumber(rpm.expand("0%{?tizen_build_devel_mode}")) == 1 then print "Debug" else print "Release" end} + +%dotnet_assembly_path %{!?dotnet_assembly_path:/opt/usr/share/dotnet.tizen/framework} +%_mono_assembly_path /opt/usr/lib/assembly + +%dotnet_assembly_files %{dotnet_assembly_path}/*.dll + +%_nuget_package \ +%package nuget\ +Summary: NuGet package for %{name}\ +Group: Development/Libraries\ +%description nuget\ +NuGet package for %{name}\ +%files nuget\ +/nuget/*.nupkg\ +%{nil} + +%_mono_package \ +%package mono\ +Summary: %{name} for Mono Runtime\ +Group: Development/Libraries\ +%description mono\ +%{name} for Mono Runtime\ +%files mono\ +%manifest %{name}.manifest\ +%%license LICENSE\ +%attr(644,root,root) %{_mono_assembly_path}/*.dll\ +%{nil} + +%dotnet_subpackages \ +%_nuget_package \ +%_mono_package \ +%{nil} + +%dotnet_build() \ +find %{1}/*.project.json -print0 | xargs -n1 -0 nuget restore \ +find %{1}/*.csproj -print0 | xargs -n1 -0 xbuild /p:Configuration=%{_dotnet_build_conf} \ +%{nil} + +%dotnet_pack() \ +nuget pack %{1}/%{1}.nuspec -Version %{?2}%{!?2:%{version}} -Properties Configuration=%{_dotnet_build_conf} \ +%{nil} + +%dotnet_install() \ +%if 0%{?_with_corefx} \ +mkdir -p %{buildroot}%{dotnet_assembly_path} \ +mkdir -p %{buildroot}%{_mono_assembly_path} \ +mkdir -p %{buildroot}/nuget \ +install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/%{1}.dll %{buildroot}%{dotnet_assembly_path} \ +%else \ + install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{dotnet_assembly_path} \ +%endif \ +install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{_mono_assembly_path} \ +install -p -m 644 %{1}*.nupkg %{buildroot}/nuget \ +%{nil} + -- 2.34.1 From 3806d4bc0c7e40d3fe9fc7d6bf7ddbef373b368c Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Wed, 14 Dec 2016 10:22:37 +0900 Subject: [PATCH 05/16] Revert "Rename corefx-managed-ref to corefx-managed-ref-noarch on armv7l" This reverts commit 7134ca181da19339cfd83d0ad4488559506567c5. Conflicts: packaging/dotnet-build-tools.spec Change-Id: Iacb4b8d5076743be00b4f8ead3bd4df59e4a0075 --- packaging/dotnet-build-tools.spec | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packaging/dotnet-build-tools.spec b/packaging/dotnet-build-tools.spec index 80703235..54646430 100644 --- a/packaging/dotnet-build-tools.spec +++ b/packaging/dotnet-build-tools.spec @@ -10,11 +10,7 @@ Source1: macros.dotnet-build-tools AutoReqProv: no -%ifarch armv7l -Requires: corefx-managed-ref-noarch -%else Requires: corefx-managed-ref -%endif Requires: mono-compat Requires: mono-devel -- 2.34.1 From 4856f26446ad00e6bac32a1a02e298e4ea4810bc Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Thu, 15 Dec 2016 13:26:29 +0900 Subject: [PATCH 06/16] Set _with_corefx to 1 in macros.dotnet-build-tools Change-Id: I11c1de7c0500b568938a01ce1cb76311b3b882d8 --- packaging/macros.dotnet-build-tools | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index f279f316..7f65b184 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -7,6 +7,8 @@ %dotnet_assembly_files %{dotnet_assembly_path}/*.dll +%_with_corefx 1 + %_nuget_package \ %package nuget\ Summary: NuGet package for %{name}\ -- 2.34.1 From 41b0a295aa2d48eb693f312aed69e1183ca34fac Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Thu, 15 Dec 2016 14:35:52 +0900 Subject: [PATCH 07/16] Fix dotnet_assembly_path in macros.dotnet-build-tools Change-Id: If972309cc3f9fbd09146319553cf66f0290853ca --- packaging/macros.dotnet-build-tools | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index 7f65b184..1c9ba8af 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -2,12 +2,12 @@ %_dotnet_build_conf %{lua:if tonumber(rpm.expand("0%{?tizen_build_devel_mode}")) == 1 then print "Debug" else print "Release" end} -%dotnet_assembly_path %{!?dotnet_assembly_path:/opt/usr/share/dotnet.tizen/framework} +%_dotnet_assembly_path %{?dotnet_assembly_path:%{dotnet_assembly_path}}%{!?dotnet_assembly_path:/opt/usr/share/dotnet.tizen/framework} %_mono_assembly_path /opt/usr/lib/assembly -%dotnet_assembly_files %{dotnet_assembly_path}/*.dll +%dotnet_assembly_files %{_dotnet_assembly_path}/*.dll -%_with_corefx 1 +%_with_corefx 1 %_nuget_package \ %package nuget\ @@ -47,12 +47,12 @@ nuget pack %{1}/%{1}.nuspec -Version %{?2}%{!?2:%{version}} -Properties Configur %dotnet_install() \ %if 0%{?_with_corefx} \ -mkdir -p %{buildroot}%{dotnet_assembly_path} \ +mkdir -p %{buildroot}%{_dotnet_assembly_path} \ mkdir -p %{buildroot}%{_mono_assembly_path} \ mkdir -p %{buildroot}/nuget \ -install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/%{1}.dll %{buildroot}%{dotnet_assembly_path} \ +install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/%{1}.dll %{buildroot}%{_dotnet_assembly_path} \ %else \ - install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{dotnet_assembly_path} \ + install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{_dotnet_assembly_path} \ %endif \ install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{_mono_assembly_path} \ install -p -m 644 %{1}*.nupkg %{buildroot}/nuget \ -- 2.34.1 From 51fab1fc86005de500f962cf21afb289ce040d98 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Thu, 15 Dec 2016 15:00:01 +0900 Subject: [PATCH 08/16] Set dotnet_assembly_path to /opt/usr/share/dotnet.tizen/framework Change-Id: Ic6db4102854ecd922f6cd5df50e78ce2a21c84db --- packaging/macros.dotnet-build-tools | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index 1c9ba8af..4db10615 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -2,9 +2,10 @@ %_dotnet_build_conf %{lua:if tonumber(rpm.expand("0%{?tizen_build_devel_mode}")) == 1 then print "Debug" else print "Release" end} -%_dotnet_assembly_path %{?dotnet_assembly_path:%{dotnet_assembly_path}}%{!?dotnet_assembly_path:/opt/usr/share/dotnet.tizen/framework} +%_dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework %_mono_assembly_path /opt/usr/lib/assembly +%dotnet_assembly_path %{_dotnet_assembly_path} %dotnet_assembly_files %{_dotnet_assembly_path}/*.dll %_with_corefx 1 -- 2.34.1 From 0a9e3c72b351e6cfab2c2fd316cb6289a8fa272a Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Mon, 19 Dec 2016 14:36:01 +0900 Subject: [PATCH 09/16] fix macros.dotnet-build-tools Change-Id: I712be288b57409a5c8dedbdf79ae3e37b05a331c --- packaging/dotnet-build-tools.spec | 1 - packaging/macros.dotnet-build-tools | 38 ++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/packaging/dotnet-build-tools.spec b/packaging/dotnet-build-tools.spec index 54646430..c9eae0ba 100644 --- a/packaging/dotnet-build-tools.spec +++ b/packaging/dotnet-build-tools.spec @@ -28,7 +28,6 @@ C# Deivce API with xbuild in GBS environment. %install %define NuGetDir %{_datadir}/NuGet %define XBuildDir /usr/lib/mono/xbuild -%define PCLRefDir /usr/lib/mono/xbuild-frameworks/.NETPortable # Tizen.GBS.BuildTasks mkdir -p %{buildroot}%{XBuildDir}/14.0/Microsoft.Common.targets/ImportAfter diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index 4db10615..1712f9e1 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -1,14 +1,24 @@ -# Macro definitions for CSAPI Build +######################################### +## Macro definitions for CSAPI Build ## +######################################### -%_dotnet_build_conf %{lua:if tonumber(rpm.expand("0%{?tizen_build_devel_mode}")) == 1 then print "Debug" else print "Release" end} +## Configuration ############################################################### + +%_with_corefx 1 %_dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework -%_mono_assembly_path /opt/usr/lib/assembly +%_mono_assembly_path /usr/lib/assembly + +%_dotnet_exclude_arch aarch64 %ix86 + +%_mono_subrpm 0 + +################################################################################ %dotnet_assembly_path %{_dotnet_assembly_path} %dotnet_assembly_files %{_dotnet_assembly_path}/*.dll -%_with_corefx 1 +%_dotnet_build_conf %{lua:if tonumber(rpm.expand("0%{?tizen_build_devel_mode}")) == 1 then print "Debug" else print "Release" end} %_nuget_package \ %package nuget\ @@ -32,9 +42,16 @@ Group: Development/Libraries\ %attr(644,root,root) %{_mono_assembly_path}/*.dll\ %{nil} -%dotnet_subpackages \ +%dotnet_import_common \ +AutoReqProv: no \ +ExcludeArch: %{_dotnet_exclude_arch} \ +%{nil} + +%dotnet_import_sub_packages \ %_nuget_package \ +%if 0%{?_mono_subrpm} \ %_mono_package \ +%endif \ %{nil} %dotnet_build() \ @@ -43,19 +60,16 @@ find %{1}/*.csproj -print0 | xargs -n1 -0 xbuild /p:Configuration=%{_dotnet_buil %{nil} %dotnet_pack() \ -nuget pack %{1}/%{1}.nuspec -Version %{?2}%{!?2:%{version}} -Properties Configuration=%{_dotnet_build_conf} \ +nuget pack %{1} -Version %{?2}%{!?2:%{version}} -Properties Configuration=%{_dotnet_build_conf} \ %{nil} %dotnet_install() \ -%if 0%{?_with_corefx} \ mkdir -p %{buildroot}%{_dotnet_assembly_path} \ mkdir -p %{buildroot}%{_mono_assembly_path} \ mkdir -p %{buildroot}/nuget \ -install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/%{1}.dll %{buildroot}%{_dotnet_assembly_path} \ -%else \ - install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{_dotnet_assembly_path} \ +install -p -m 644 "%{1}/bin/%{_dotnet_build_conf}/%{1}.dll" %{buildroot}%{_dotnet_assembly_path} \ +%if 0%{?_mono_subrpm} \ +[ -f "%{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll" ] && install -p -m 644 "%{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll" %{buildroot}%{_mono_assembly_path} \ %endif \ -install -p -m 644 %{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll %{buildroot}%{_mono_assembly_path} \ install -p -m 644 %{1}*.nupkg %{buildroot}/nuget \ %{nil} - -- 2.34.1 From 58f9c4ce6c9c5c0e8574f6652561e1e2385b2086 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Mon, 19 Dec 2016 22:11:13 +0900 Subject: [PATCH 10/16] Remove %dotnet_import_common Change-Id: I9ed33bcbd6cdf9bf837e0c2eea7bb0dd3a8d3599 --- packaging/macros.dotnet-build-tools | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index 1712f9e1..cc47f640 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -9,8 +9,6 @@ %_dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework %_mono_assembly_path /usr/lib/assembly -%_dotnet_exclude_arch aarch64 %ix86 - %_mono_subrpm 0 ################################################################################ @@ -42,11 +40,6 @@ Group: Development/Libraries\ %attr(644,root,root) %{_mono_assembly_path}/*.dll\ %{nil} -%dotnet_import_common \ -AutoReqProv: no \ -ExcludeArch: %{_dotnet_exclude_arch} \ -%{nil} - %dotnet_import_sub_packages \ %_nuget_package \ %if 0%{?_mono_subrpm} \ -- 2.34.1 From c3134939a52da0def3241612e3914ca9910da8aa Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Thu, 29 Dec 2016 13:02:08 +0900 Subject: [PATCH 11/16] Change C# dll install path to /usr/share Signed-off-by: Jiyoung Yun Change-Id: I01cee0af4511095ab6baf3745f2dfa224bcb18b1 --- packaging/macros.dotnet-build-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index cc47f640..e7cb7dfa 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -6,7 +6,7 @@ %_with_corefx 1 -%_dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework +%_dotnet_assembly_path /usr/share/dotnet.tizen/framework %_mono_assembly_path /usr/lib/assembly %_mono_subrpm 0 -- 2.34.1 From afb5a3baed955e6fd4c110328b62c91b8424170b Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Mon, 2 Jan 2017 10:36:25 +0900 Subject: [PATCH 12/16] Revert "Change C# dll install path to /usr/share" This reverts commit c3134939a52da0def3241612e3914ca9910da8aa. Change-Id: Iff2851bc5f763223b522e4925b022b2859503f48 --- packaging/macros.dotnet-build-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index e7cb7dfa..cc47f640 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -6,7 +6,7 @@ %_with_corefx 1 -%_dotnet_assembly_path /usr/share/dotnet.tizen/framework +%_dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework %_mono_assembly_path /usr/lib/assembly %_mono_subrpm 0 -- 2.34.1 From ec387ebb8c8f011df339adf4c2de93e79e842b4a Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Thu, 5 Jan 2017 15:08:28 +0900 Subject: [PATCH 13/16] Add dotnet-build.sh and fix macros Change-Id: Ibd6034931d67d8f30af9b203f86f19cb2c2f926f --- Tools/dotnet-build.sh | 135 ++++++++++++++++++++++++++++ packaging/dotnet-build-tools.spec | 10 ++- packaging/macros.dotnet-build-tools | 10 ++- 3 files changed, 150 insertions(+), 5 deletions(-) create mode 100755 Tools/dotnet-build.sh diff --git a/Tools/dotnet-build.sh b/Tools/dotnet-build.sh new file mode 100755 index 00000000..c0fe8d14 --- /dev/null +++ b/Tools/dotnet-build.sh @@ -0,0 +1,135 @@ +#!/bin/bash + +# Usages: +# dotnet-build.sh build [Target] [Configuration] +# dotnet-build.sh pack [NuSpec] [Version] + +usage() { + echo "Usage:" + echo " $0 restore TARGET" + echo " - TARGET : Project Directory, Solution File(.sln), Project JSON(.project.json)" + echo " $0 build TARGET CONFIGURATION" + echo " - TARGET : Project Directory, Solution File(.sln), Project File(.csproj)" + echo " - CONFIGURATION : Configuration name defined in .csproj (Debug, Release)" + echo " $0 pack NUSPEC VERSION CONFIGURATION" + echo " - NUSPEC : .nuspec file path" + echo " - VERSION : Version of nuget package to be created" + echo " - CONFIGURATION : Configuration name defined in .csproj (Debug, Release)" +} + +exit_on_error() { + if [ $1 -ne 0 ]; then + echo "Error $1" + exit $1 + fi +} + +nuget_retry() { + local RETRY=3 + local RET=0 + local n=0 + until [ $n -ge $RETRY ]; do + if [ $n -gt 0 ]; then + sleep 2 + echo "Retry $n ....." + fi + echo "+ nuget $@" + nuget $@ + RET=$? + if [ $RET -eq 0 ]; then + break + fi + n=$[$n+1] + done + exit_on_error $RET +} + +cs_build() { + echo "+ xbuild $@" + xbuild $@ + exit_on_error $? +} + +restore() { + local TARGET=$1; shift + + if [[ $TARGET == *".sln" ]]; then + nuget_retry restore $TARGET $@ + elif [[ $TARGET == *".project.json" ]]; then + nuget_retry restore $TARGET $@ + else + local PROJFILES=$(find $TARGET -name "*.project.json") + for P in $PROJFILES; do + nuget_retry restore $P $@ + done + fi +} + +build_solution() { + local TARGET=$1; shift + local CONFIGURATION=$1; shift + + cs_build $TARGET /p:Configuration=$CONFIGURATION $@ +} + +build_project() { + local TARGET=$1; shift + local CONFIGURATION=$1; shift + + local PROJECT=${TARGET%.*} + local PROJECT_JSON=$PROJECT.project.json + if [ -f $PROJECT_JSON ]; then + restore $PROJECT_JSON + fi + cs_build $TARGET /p:Configuration=$CONFIGURATION $@ +} + +build() { + local TARGET=$1; shift + local CONFIGURATION=$1; shift + + if [[ $TARGET == *".sln" ]]; then + build_solution $TARGET $CONFIGURATION $@ + elif [[ $TARGET == *".csproj" ]]; then + build_project $TARGET $CONFIGURATION $@ + else + local PROJFILES=$(find $TARGET -name "*.csproj") + for P in $PROJFILES; do + build_project $P $CONFIGURATION $@ + done + fi +} + +pack() { + local NUSPEC=$1; shift + local VERSION=$1; shift + local CONFIGURATION=$1; shift + + if [ -f $NUSPEC ]; then + nuget_retry pack $NUSPEC -Version $VERSION -Properties Configuration=$CONFIGURATION + fi +} + +CMD=$1; shift +case $CMD in + restore) + if [ $# -ge 1 ]; then + restore $@ + exit 0 + fi + ;; + build) + if [ $# -ge 2 ]; then + build $@ + exit 0 + fi + ;; + pack) + if [ $# -ge 3 ]; then + pack $@ + exit 0 + fi + ;; +esac + +usage; exit 1 diff --git a/packaging/dotnet-build-tools.spec b/packaging/dotnet-build-tools.spec index c9eae0ba..2c3493c0 100644 --- a/packaging/dotnet-build-tools.spec +++ b/packaging/dotnet-build-tools.spec @@ -1,6 +1,6 @@ Name: dotnet-build-tools Summary: Tools for building C# API projects -Version: 1.0.10 +Version: 1.0.11 Release: 1 Group: Development/Libraries License: MIT and Apache-2.0 @@ -28,6 +28,7 @@ C# Deivce API with xbuild in GBS environment. %install %define NuGetDir %{_datadir}/NuGet %define XBuildDir /usr/lib/mono/xbuild +%define ToolsDir %{_datadir}/DotnetBuildTools # Tizen.GBS.BuildTasks mkdir -p %{buildroot}%{XBuildDir}/14.0/Microsoft.Common.targets/ImportAfter @@ -54,6 +55,11 @@ install -p -m 644 NuGet.BuildTasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter mkdir -p %{buildroot}/nuget install -p -m 644 LocalPackages/*.nupkg %{buildroot}/nuget +# BuildTools +mkdir -p %{buildroot}%{ToolsDir} +install -p -m 755 Tools/dotnet-build.sh %{buildroot}%{ToolsDir} +ln -s %{ToolsDir}/dotnet-build.sh %{buildroot}%{_bindir}/dotnet-build + # RPM Macros install -D -p -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/rpm/macros.dotnet-build-tools @@ -63,5 +69,5 @@ install -D -p -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/rpm/macros.dotnet-build- %{_bindir}/* %{NuGetDir}/* %{XBuildDir}/* +%{ToolsDir}/* /nuget/*.nupkg - diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index cc47f640..19d2f4ca 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -32,6 +32,7 @@ NuGet package for %{name}\ %package mono\ Summary: %{name} for Mono Runtime\ Group: Development/Libraries\ +AutoReqProv: no\ %description mono\ %{name} for Mono Runtime\ %files mono\ @@ -47,13 +48,16 @@ Group: Development/Libraries\ %endif \ %{nil} +%dotnet_restore() \ +dotnet-build restore %{1} \ +%{nil} + %dotnet_build() \ -find %{1}/*.project.json -print0 | xargs -n1 -0 nuget restore \ -find %{1}/*.csproj -print0 | xargs -n1 -0 xbuild /p:Configuration=%{_dotnet_build_conf} \ +dotnet-build build %{1} %{_dotnet_build_conf} %{?2} %{?3} %{?4} %{?5} %{?6} \ %{nil} %dotnet_pack() \ -nuget pack %{1} -Version %{?2}%{!?2:%{version}} -Properties Configuration=%{_dotnet_build_conf} \ +dotnet-build pack %{1} %{2} %{_dotnet_build_conf} %{?3} %{?4} %{?5} %{?6} %{?7} \ %{nil} %dotnet_install() \ -- 2.34.1 From 367c1ad146fb6f5a3281d139a021ed7ebb1a6834 Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Mon, 9 Jan 2017 17:07:08 +0900 Subject: [PATCH 14/16] Fix dotnet-build.sh to allow additional arguments of pack command Change-Id: I23a3aa8efbfe3b144c918a7e795e345b1bd52c75 --- Tools/dotnet-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/dotnet-build.sh b/Tools/dotnet-build.sh index c0fe8d14..f948cb16 100755 --- a/Tools/dotnet-build.sh +++ b/Tools/dotnet-build.sh @@ -106,7 +106,7 @@ pack() { local CONFIGURATION=$1; shift if [ -f $NUSPEC ]; then - nuget_retry pack $NUSPEC -Version $VERSION -Properties Configuration=$CONFIGURATION + nuget_retry pack $NUSPEC -Version $VERSION -Properties Configuration=$CONFIGURATION $@ fi } -- 2.34.1 From 01967105b3db51d864b20b6cd477f9242c29362a Mon Sep 17 00:00:00 2001 From: WonYoung Choi Date: Tue, 10 Jan 2017 13:28:04 +0900 Subject: [PATCH 15/16] Fix dotnet-build.sh to allow additional arguments of restore command Change-Id: I082579b2dcc01e4b3056e6b2b18ee91ba53da027 --- Tools/dotnet-build.sh | 11 ++++++----- packaging/macros.dotnet-build-tools | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Tools/dotnet-build.sh b/Tools/dotnet-build.sh index f948cb16..6c9b33aa 100755 --- a/Tools/dotnet-build.sh +++ b/Tools/dotnet-build.sh @@ -53,15 +53,16 @@ cs_build() { restore() { local TARGET=$1; shift - if [[ $TARGET == *".sln" ]]; then - nuget_retry restore $TARGET $@ - elif [[ $TARGET == *".project.json" ]]; then - nuget_retry restore $TARGET $@ - else + if [ -d $TARGET ]; then local PROJFILES=$(find $TARGET -name "*.project.json") for P in $PROJFILES; do nuget_retry restore $P $@ done + elif [ -f $TARGET ]; then + nuget_retry restore $TARGET $@ + else + echo "Invalid nuget restore target." + exit 1 fi } diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index 19d2f4ca..36717bef 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -18,6 +18,8 @@ %_dotnet_build_conf %{lua:if tonumber(rpm.expand("0%{?tizen_build_devel_mode}")) == 1 then print "Debug" else print "Release" end} +%dotnet_nuget_source /nuget + %_nuget_package \ %package nuget\ Summary: NuGet package for %{name}\ @@ -49,7 +51,7 @@ AutoReqProv: no\ %{nil} %dotnet_restore() \ -dotnet-build restore %{1} \ +dotnet-build restore %{1} %{?2} %{?3} %{?4} %{?5} %{?6} \ %{nil} %dotnet_build() \ @@ -60,13 +62,27 @@ dotnet-build build %{1} %{_dotnet_build_conf} %{?2} %{?3} %{?4} %{?5} %{?6} \ dotnet-build pack %{1} %{2} %{_dotnet_build_conf} %{?3} %{?4} %{?5} %{?6} %{?7} \ %{nil} -%dotnet_install() \ +%dotnet_install_assembly() \ mkdir -p %{buildroot}%{_dotnet_assembly_path} \ mkdir -p %{buildroot}%{_mono_assembly_path} \ +install -p -m 644 "%{1}/bin/%{_dotnet_build_conf}/%{1}.dll" %{buildroot}%{_dotnet_assembly_path} \ +%if 0%{?_mono_subrpm} \ +[ -f "%{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll" ] && install -p -m 644 "%{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll" %{buildroot}%{_mono_assembly_path} \ +%endif \ +%{nil} + +%dotnet_install_nuget() \ mkdir -p %{buildroot}/nuget \ +install -p -m 644 %{1}*.nupkg %{buildroot}/nuget \ +%{nil} + +%dotnet_install() \ +mkdir -p %{buildroot}%{_dotnet_assembly_path} \ +mkdir -p %{buildroot}%{_mono_assembly_path} \ install -p -m 644 "%{1}/bin/%{_dotnet_build_conf}/%{1}.dll" %{buildroot}%{_dotnet_assembly_path} \ %if 0%{?_mono_subrpm} \ [ -f "%{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll" ] && install -p -m 644 "%{1}/bin/%{_dotnet_build_conf}/Net45/%{1}.dll" %{buildroot}%{_mono_assembly_path} \ %endif \ +mkdir -p %{buildroot}/nuget \ install -p -m 644 %{1}*.nupkg %{buildroot}/nuget \ %{nil} -- 2.34.1 From 65cb2467fc9b451a5f157e6dbda3703aac148c6f Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Wed, 1 Feb 2017 11:13:47 +0900 Subject: [PATCH 16/16] Move the location of .NET module to %{_datadir} Signed-off-by: Jiyoung Yun Change-Id: I047f2931104a9cb6a5052c36de2fd89891df653c --- packaging/macros.dotnet-build-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/macros.dotnet-build-tools b/packaging/macros.dotnet-build-tools index 36717bef..964f6f23 100644 --- a/packaging/macros.dotnet-build-tools +++ b/packaging/macros.dotnet-build-tools @@ -6,7 +6,7 @@ %_with_corefx 1 -%_dotnet_assembly_path /opt/usr/share/dotnet.tizen/framework +%_dotnet_assembly_path /usr/share/dotnet.tizen/framework %_mono_assembly_path /usr/lib/assembly %_mono_subrpm 0 -- 2.34.1