Genereate ref sub package for reference assemblies 61/127361/2 submit/tizen/20170427.082929
authorWonYoung Choi <wy80.choi@samsung.com>
Thu, 27 Apr 2017 05:23:17 +0000 (14:23 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Thu, 27 Apr 2017 08:23:31 +0000 (17:23 +0900)
Change-Id: Ib3379ca6e42ecaa6751b0d541279499ea3232a9b

GenAPI/GenAPI.exe [new file with mode: 0755]
GenAPI/GenAPI.runtimeconfig.json [new file with mode: 0644]
GenAPI/LICENSE [new file with mode: 0644]
GenAPI/Microsoft.Cci.Extensions.dll [new file with mode: 0755]
GenAPI/Microsoft.Cci.dll [new file with mode: 0755]
NuGet/LICENSE [moved from LICENSE.NuGet with 100% similarity]
Tizen.GBS.BuildTasks/Tizen.GBS.ImportAfter.targets
Tools/dotnet-build.sh
packaging/dotnet-build-tools.spec
packaging/macros.dotnet-build-tools

diff --git a/GenAPI/GenAPI.exe b/GenAPI/GenAPI.exe
new file mode 100755 (executable)
index 0000000..55a3548
Binary files /dev/null and b/GenAPI/GenAPI.exe differ
diff --git a/GenAPI/GenAPI.runtimeconfig.json b/GenAPI/GenAPI.runtimeconfig.json
new file mode 100644 (file)
index 0000000..9b04e48
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "runtimeOptions": {
+    "tfm": "netcoreapp2.0",
+    "framework": {
+      "name": "Microsoft.NETCore.App",
+      "version": "2.0.0-*"
+    }
+  }
+}
diff --git a/GenAPI/LICENSE b/GenAPI/LICENSE
new file mode 100644 (file)
index 0000000..56e51b1
--- /dev/null
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) .NET Foundation and Contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/GenAPI/Microsoft.Cci.Extensions.dll b/GenAPI/Microsoft.Cci.Extensions.dll
new file mode 100755 (executable)
index 0000000..aa7d7f8
Binary files /dev/null and b/GenAPI/Microsoft.Cci.Extensions.dll differ
diff --git a/GenAPI/Microsoft.Cci.dll b/GenAPI/Microsoft.Cci.dll
new file mode 100755 (executable)
index 0000000..0956d9a
Binary files /dev/null and b/GenAPI/Microsoft.Cci.dll differ
similarity index 100%
rename from LICENSE.NuGet
rename to NuGet/LICENSE
index 8483016..dbf32d5 100644 (file)
@@ -1,6 +1,6 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
-  <PropertyGroup>
+  <PropertyGroup Condition="'$(UseTizenGBSImportAfterTarget)' == ''">
     <UseTizenGBSImportAfterTarget>false</UseTizenGBSImportAfterTarget>
     <UseTizenGBSImportAfterTarget Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard' or '$(TargetFrameworkIdentifier)' == 'Tizen'">true</UseTizenGBSImportAfterTarget>
   </PropertyGroup>
@@ -34,6 +34,7 @@
       __AppendNuGetFiles;
       $(BuildDependsOn);
       __CleanUpIntemediate;
+      __GenerateReferenceAssembly;
     </BuildDependsOn>
   </PropertyGroup>
 
 
   <!-- Append _NuGetFiles to .nuspec file -->
   <Target Name="__AppendNuGetFiles" Condition="Exists('$(NuSpecFile)')">
+    <!--
     <Exec Command="dotnet-build nuspec_addfile &quot;$(NuSpecFile)&quot; &quot;%(NuGetAssemblyFile.Identity)&quot; &quot;lib/$(TargetFramework)&quot;" />
+  -->
+  </Target>
+
+  <PropertyGroup>
+    <_GenAPITargetDir>_ref</_GenAPITargetDir>
+    <_GenAPITargetSourcePath>$(_GenAPITargetDir)/$(TargetName).cs</_GenAPITargetSourcePath>
+    <_GenAPITargetAssemblyPath>$(_GenAPITargetDir)/$(TargetName).dll</_GenAPITargetAssemblyPath>
+    <_GenAPIPath Condition="'$(_GenAPIPath)' == ''">/usr/share/dotnet-build-tools/GenAPI/GenAPI.exe</_GenAPIPath>
+    <_GenAPICommand>dotnet $(_GenAPIPath)</_GenAPICommand>
+  </PropertyGroup>
+
+  <Target Name="__CreateAPIDirectory">
+    <MakeDir Directories="$(_GenAPITargetDir)" />
+  </Target>
+
+  <!-- Generate Reference Assembly .cs file -->
+  <Target Name="__GenerateReferenceAssemblySource"
+          Inputs="$(TargetPath)"
+          Outputs="$(_GenAPITargetSourcePath)"
+          DependsOnTargets="__CreateAPIDirectory">
+
+    <ItemGroup>
+      <_referencePathDirectoriesWithDuplicates Include="%(ReferencePath.RootDir)%(ReferencePath.Directory)" />
+      <_referencePathDirectories Include="%(_referencePathDirectoriesWithDuplicates.Identity)" />
+    </ItemGroup>
+
+    <Exec Command="$(_GenAPICommand) -assembly:&quot;$(TargetPath)&quot; -libPath:&quot;@(_referencePathDirectories)&quot; -out:&quot;$(_GenAPITargetSourcePath)&quot; -throw -global" />
+
+    <ItemGroup>
+      <FileWrites Include="$(_GenAPITargetSourcePath)"/>
+    </ItemGroup>
+  </Target>
+
+
+  <Target Name="__GenerateReferenceAssembly"
+          Inputs="$(_GenAPITargetSourcePath)"
+          Outputs="$(_GenAPITargetAssemblyPath)"
+          DependsOnTargets="__GenerateReferenceAssemblySource">
+
+    <Csc Condition="$(MSBuildToolsVersion) &lt; 15"
+        Sources="$(_GenAPITargetSourcePath)"
+        OutputAssembly="$(_GenAPITargetAssemblyPath)"
+        AdditionalLibPaths="$(AdditionalLibPaths)"
+        AllowUnsafeBlocks="$(AllowUnsafeBlocks)"
+        DefineConstants="$(DefineConstants)"
+        KeyFile="$(KeyOriginatorFile)"
+        TargetType="$(OutputType)"
+        NoStandardLib="$(NoCompilerStandardLib)"
+        References="@(ReferencePath)"
+        ToolExe="$(CscToolExe)"
+        ToolPath="$(CscToolPath)" />
+
+    <Csc Condition="$(MSBuildToolsVersion) &gt;= 15"
+        Sources="$(_GenAPITargetSourcePath)"
+        OutputAssembly="$(_GenAPITargetAssemblyPath)"
+        AdditionalLibPaths="$(AdditionalLibPaths)"
+        AllowUnsafeBlocks="$(AllowUnsafeBlocks)"
+        DefineConstants="$(DefineConstants)"
+        KeyFile="$(KeyOriginatorFile)"
+        PublicSign="$(PublicSign)"
+        TargetType="$(OutputType)"
+        NoStandardLib="$(NoCompilerStandardLib)"
+        References="@(ReferencePath)"
+        ToolExe="$(CscToolExe)"
+        ToolPath="$(CscToolPath)" />
+
+    <ItemGroup>
+      <FileWrites Include="$(_GenAPITargetAssemblyPath)"/>
+    </ItemGroup>
   </Target>
 
 </Project>
index 1190949..202aa24 100755 (executable)
@@ -126,6 +126,8 @@ cmd_install() {
 
   if [[ $TYPE == "assembly" ]]; then
     find $PROJECT/bin -name $PROJECT.dll -exec install -p -m 644 {} $DEST \;
+  elif [[ $TYPE == "reference" ]]; then
+    find $PROJECT/_ref -name $PROJECT.dll -exec install -p -m 644 {} $DEST \;
   elif [[ $TYPE == "nupkg" ]]; then
     find . -name "$PROJECT.[0-9]*.nupkg" -exec install -p -m 644 {} $DEST \;
   fi
index b4517d7..cc565e8 100644 (file)
@@ -28,10 +28,11 @@ Requires: xmlstarlet
 Build target files (.Targets) and Tools (including NuGet.exe) for building
 C# Deivce API with xbuild in GBS environment.
 
-%define XBuildDir /usr/lib/mono/xbuild
-%define NuGetDir %{_datadir}/NuGet
-%define ToolsDir %{_datadir}/dotnet-build-tools
-%define CLI_PATH %{_datadir}/dotnet-build-tools/cli
+%define XBUILD_PATH /usr/lib/mono/xbuild
+%define NUGET_PATH %{_datadir}/NuGet
+%define TOOLS_PATH %{_datadir}/dotnet-build-tools
+%define CLI_PATH %{TOOLS_PATH}/cli
+%define GENAPI_PATH %{TOOLS_PATH}/GenAPI
 
 %prep
 %setup -q
@@ -55,40 +56,44 @@ install -D -p -m 0644 %{S:1} %{buildroot}%{_sysconfdir}/rpm/macros.dotnet-build-
 
 # BuildTools
 mkdir -p %{buildroot}%{_bindir}
-mkdir -p %{buildroot}%{ToolsDir}
-install -p -m 755 Tools/* %{buildroot}%{ToolsDir}
-ln -s %{ToolsDir}/dotnet-build.sh %{buildroot}%{_bindir}/dotnet-build
+mkdir -p %{buildroot}%{TOOLS_PATH}
+install -p -m 755 Tools/* %{buildroot}%{TOOLS_PATH}
+ln -s %{TOOLS_PATH}/dotnet-build.sh %{buildroot}%{_bindir}/dotnet-build
 
 # dotnet-cli
 mkdir -p %{buildroot}%{CLI_PATH}
 cp -fr ./dotnet/* %{buildroot}%{CLI_PATH}
 ln -s %{CLI_PATH}/dotnet %{buildroot}%{_bindir}/dotnet
 
+# GenAPI
+mkdir -p %{buildroot}%{GENAPI_PATH}
+install -p -m 644 GenAPI/* %{buildroot}%{GENAPI_PATH}
+
 # Tizen.GBS.BuildTasks
-mkdir -p %{buildroot}%{XBuildDir}/14.0/Microsoft.Common.targets/ImportAfter
-install -p -m 644 Tizen.GBS.BuildTasks/Tizen.GBS.ImportAfter.targets %{buildroot}%{XBuildDir}/14.0/Microsoft.Common.targets/ImportAfter
+mkdir -p %{buildroot}%{XBUILD_PATH}/14.0/Microsoft.Common.targets/ImportAfter
+install -p -m 644 Tizen.GBS.BuildTasks/Tizen.GBS.ImportAfter.targets %{buildroot}%{XBUILD_PATH}/14.0/Microsoft.Common.targets/ImportAfter
 install -p -m 644 Tizen.GBS.BuildTasks/Tizen.GBS.ImportAfter.targets %{buildroot}%{CLI_PATH}/sdk/*/15.0/Microsoft.Common.targets/ImportAfter
 
 # NuGet
-mkdir -p %{buildroot}%{NuGetDir}
-install -p -m 755 NuGet/* %{buildroot}%{NuGetDir}
-ln -s %{NuGetDir}/nuget %{buildroot}%{_bindir}/nuget
-ln -s %{NuGetDir}/NuGet.exe %{buildroot}%{_bindir}/nuget.exe
+mkdir -p %{buildroot}%{NUGET_PATH}
+install -p -m 755 NuGet/* %{buildroot}%{NUGET_PATH}
+ln -s %{NUGET_PATH}/nuget %{buildroot}%{_bindir}/nuget
+ln -s %{NUGET_PATH}/NuGet.exe %{buildroot}%{_bindir}/nuget.exe
 
 # NuGet.BuildTasks
-mkdir -p %{buildroot}%{XBuildDir}/Microsoft/NuGet
-install -p -m 644 NuGet.BuildTasks/Microsoft.NuGet.targets %{buildroot}%{XBuildDir}/Microsoft/NuGet
-install -p -m 644 NuGet.BuildTasks/Microsoft.NuGet.Build.Tasks.dll %{buildroot}%{XBuildDir}/Microsoft/NuGet
-install -p -m 644 NuGet.BuildTasks/Microsoft.NuGet.props %{buildroot}%{XBuildDir}/Microsoft/NuGet
-mkdir -p %{buildroot}%{XBuildDir}/14.0/Microsoft.Common.targets/ImportBefore
-install -p -m 644 NuGet.BuildTasks/ImportBeforeAfter/Microsoft.NuGet.ImportBefore.props %{buildroot}%{XBuildDir}/14.0/Microsoft.Common.targets/ImportBefore
-mkdir -p %{buildroot}%{XBuildDir}/14.0/Microsoft.Common.targets/ImportAfter
-install -p -m 644 NuGet.BuildTasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter.targets %{buildroot}%{XBuildDir}/14.0/Microsoft.Common.targets/ImportAfter
+mkdir -p %{buildroot}%{XBUILD_PATH}/Microsoft/NuGet
+install -p -m 644 NuGet.BuildTasks/Microsoft.NuGet.targets %{buildroot}%{XBUILD_PATH}/Microsoft/NuGet
+install -p -m 644 NuGet.BuildTasks/Microsoft.NuGet.Build.Tasks.dll %{buildroot}%{XBUILD_PATH}/Microsoft/NuGet
+install -p -m 644 NuGet.BuildTasks/Microsoft.NuGet.props %{buildroot}%{XBUILD_PATH}/Microsoft/NuGet
+mkdir -p %{buildroot}%{XBUILD_PATH}/14.0/Microsoft.Common.targets/ImportBefore
+install -p -m 644 NuGet.BuildTasks/ImportBeforeAfter/Microsoft.NuGet.ImportBefore.props %{buildroot}%{XBUILD_PATH}/14.0/Microsoft.Common.targets/ImportBefore
+mkdir -p %{buildroot}%{XBUILD_PATH}/14.0/Microsoft.Common.targets/ImportAfter
+install -p -m 644 NuGet.BuildTasks/ImportBeforeAfter/Microsoft.NuGet.ImportAfter.targets %{buildroot}%{XBUILD_PATH}/14.0/Microsoft.Common.targets/ImportAfter
 
 %files
-%license LICENSE.NuGet
+%license NuGet/LICENSE GenAPI/LICENSE
 %config(noreplace) %{_sysconfdir}/rpm/macros.dotnet-build-tools
 %{_bindir}/*
-%{NuGetDir}/*
-%{XBuildDir}/*
-%{ToolsDir}/*
+%{NUGET_PATH}/*
+%{XBUILD_PATH}/*
+%{TOOLS_PATH}/*
index 6a0eb64..2e48d6a 100644 (file)
@@ -6,6 +6,7 @@
 
 %_with_corefx 1
 %_dotnet_assembly_path  /usr/share/dotnet.tizen/framework
+%_dotnet_assembly_ref_path  /usr/share/dotnet.tizen/framework/ref
 %_dotnet_nuget_source   /nuget
 
 ###############################################################
@@ -26,8 +27,36 @@ NuGet package for %{name}\
 /nuget/*.nupkg\
 %{nil}
 
+%dotnet_nuget_package(n:f:)\
+%package %{-n:-n %{-n*}-}nuget\
+Summary:   NuGet package for %{-n:%{-n*}}%{!-n:%{name}}\
+Group:     Development/Libraries\
+AutoReqProv: no\
+%description %{-n:-n %{-n*}-}nuget\
+NuGet package for %{-n:%{-n*}}%{!-n:%{name}} \
+%files %{-n:-n %{-n*}-}nuget\
+/nuget/%{-f:%{-f*}}%{!-f:*.nupkg}\
+%{nil}
+
+%dotnet_reference_package(n:)\
+%package %{-n:-n %{-n*}-}ref\
+Summary:   Reference package for %{-n:%{-n*}}%{!-n:%{name}}\
+Group:     Development/Libraries\
+AutoReqProv: no\
+%description %{-n:-n %{-n*}-}ref\
+Reference package for %{-n:%{-n*}}%{!-n:%{name}}\
+%files %{-n:-n %{-n*}-}ref\
+%{_dotnet_assembly_ref_path}/*.dll\
+%{nil}
+
 %dotnet_import_sub_packages \
-%_nuget_package \
+%dotnet_nuget_package \
+%dotnet_reference_package \
+%{nil}
+
+%dotnet_sub_packages(n:f:) \
+%dotnet_nuget_package %{-n:-n%{-n*}} %{-f:-f%{-f*}} \
+%dotnet_reference_package %{-n:-n%{-n*}} \
 %{nil}
 
 %dotnet_restore(s:) \
@@ -46,11 +75,15 @@ dotnet-build -c %{_dotnet_build_conf} %{?2:-v %{2}} pack %{1} %{?3} %{?4} %{?5}
 dotnet-build -t assembly install %{1} %{buildroot}%{_dotnet_assembly_path} \
 %{nil}
 
+%dotnet_install_reference() \
+dotnet-build -t reference install %{1} %{buildroot}%{_dotnet_assembly_ref_path} \
+
 %dotnet_install_nuget() \
 dotnet-build -t nupkg install %{1} %{buildroot}%{_dotnet_nuget_source} \
 %{nil}
 
 %dotnet_install() \
 dotnet-build -t assembly install %{1} %{buildroot}%{_dotnet_assembly_path} \
+dotnet-build -t reference install %{1} %{buildroot}%{_dotnet_assembly_ref_path} \
 dotnet-build -t nupkg install %{1} %{buildroot}%{_dotnet_nuget_source} \
 %{nil}