Add ref assemblies to nupkg file 68/127768/2 accepted/tizen/unified/20170502.041128 submit/tizen/20170501.063951
authorWonYoung Choi <wy80.choi@samsung.com>
Mon, 1 May 2017 05:43:44 +0000 (14:43 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Mon, 1 May 2017 05:46:26 +0000 (14:46 +0900)
Change-Id: Iec2ce510e213c974dc66df2826d5e9f3059a7634

GenAPI/Microsoft.Cci.Extensions.dll
Tizen.GBS.BuildTasks/Tizen.GBS.ImportAfter.targets
Tools/dotnet-build.sh
packaging/macros.dotnet-build-tools

index aa7d7f8..fa29934 100755 (executable)
Binary files a/GenAPI/Microsoft.Cci.Extensions.dll and b/GenAPI/Microsoft.Cci.Extensions.dll differ
index dbf32d5..57ad2a0 100644 (file)
@@ -1,16 +1,12 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
+  <!-- UseTizenGBSImportAfterTarget -->
   <PropertyGroup Condition="'$(UseTizenGBSImportAfterTarget)' == ''">
     <UseTizenGBSImportAfterTarget>false</UseTizenGBSImportAfterTarget>
     <UseTizenGBSImportAfterTarget Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard' or '$(TargetFrameworkIdentifier)' == 'Tizen'">true</UseTizenGBSImportAfterTarget>
   </PropertyGroup>
 
-  <!-- Set DocumentationFile -->
-  <PropertyGroup Condition="'$(UseTizenGBSImportAfterTarget)' == 'true'">
-    <DocumentationFile Condition="'$(DocumentationFile)' == ''">$(OutputPath)$(AssemblyName).xml</DocumentationFile>
-  </PropertyGroup>
-
-  <!-- Set TargetFramework -->
+  <!-- TargetFramework -->
   <PropertyGroup Condition="'$(TargetFramework)' == ''">
     <_ShortTargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">netstandard</_ShortTargetFrameworkIdentifier>
     <_ShortTargetFrameworkIdentifier Condition="'$(TargetFrameworkIdentifier)' == 'Tizen'">tizen</_ShortTargetFrameworkIdentifier>
     <TargetFramework Condition="'$(_ShortTargetFrameworkIdentifier)' != ''">$(_ShortTargetFrameworkIdentifier)$(_TargetFrameworkVersionWithoutV)</TargetFramework>
   </PropertyGroup>
 
-  <!-- NuSpec File -->
-  <PropertyGroup>
-    <NuSpecFile>$(MSBuildProjectDirectory)/$(AssemblyName).nuspec</NuSpecFile>
-  </PropertyGroup>
-
-  <!-- Additional files to append to .nuspec -->
-  <ItemGroup>
-    <NuGetAssemblyFile Include="$(OutputPath)$(TargetFileName)" />
-    <NuGetAssemblyFile Include="$(DocumentationFile)" />
-  </ItemGroup>
-
+  <!-- Modify BuildDependsOn -->
   <PropertyGroup Condition="'$(UseTizenGBSImportAfterTarget)' == 'true'">
     <BuildDependsOn>
-      __AppendNuGetFiles;
       $(BuildDependsOn);
-      __CleanUpIntemediate;
       __GenerateReferenceAssembly;
+      __AppendNuGetAssemblyFiles;
     </BuildDependsOn>
   </PropertyGroup>
 
-  <!-- Cleanup Intermediate files after build -->
-       <Target Name="__CleanUpIntemediate">
-               <RemoveDir Directories="$(BaseIntermediateOutputPath)" />
-  </Target>
-
-  <!-- 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>
+  <!-- DocumentationFile -->
+  <PropertyGroup Condition="'$(UseTizenGBSImportAfterTarget)' == 'true'">
+    <DocumentationFile Condition="'$(DocumentationFile)' == ''">$(OutputPath)$(AssemblyName).xml</DocumentationFile>
+  </PropertyGroup>
 
+  <!-- GenAPI Properties -->
   <PropertyGroup>
     <_GenAPITargetDir>_ref</_GenAPITargetDir>
     <_GenAPITargetSourcePath>$(_GenAPITargetDir)/$(TargetName).cs</_GenAPITargetSourcePath>
+    <_GenAPITargetAssemblyInfoPath>$(_GenAPITargetDir)/$(TargetName).AssemblyInfo.cs</_GenAPITargetAssemblyInfoPath>
     <_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)" />
+  <!-- NuSpec File -->
+  <PropertyGroup>
+    <NuSpecFile>$(MSBuildProjectDirectory)/$(AssemblyName).nuspec</NuSpecFile>
+  </PropertyGroup>
+
+  <!-- Additional files to append to .nuspec -->
+  <ItemGroup>
+    <NuGetAssemblyFile Include="$(DocumentationFile)">
+      <TargetPath>ref/$(TargetFramework)</TargetPath>
+    </NuGetAssemblyFile>
+    <NuGetAssemblyFile Include="$(OutputPath)$(TargetFileName)">
+      <TargetPath>lib/$(TargetFramework)</TargetPath>
+    </NuGetAssemblyFile>
+    <NuGetAssemblyFile Include="$(_GenAPITargetAssemblyPath)">
+      <TargetPath>ref/$(TargetFramework)</TargetPath>
+    </NuGetAssemblyFile>
+  </ItemGroup>
+
+  <!-- Append _NuGetFiles to .nuspec file -->
+  <Target Name="__AppendNuGetAssemblyFiles" Condition="Exists('$(NuSpecFile)')">
+    <Exec Command="dotnet-build nuspec_addfile &quot;$(NuSpecFile)&quot; &quot;%(NuGetAssemblyFile.Identity)&quot; &quot;%(NuGetAssemblyFile.TargetPath)&quot;" />
   </Target>
 
   <!-- Generate Reference Assembly .cs file -->
   <Target Name="__GenerateReferenceAssemblySource"
           Inputs="$(TargetPath)"
-          Outputs="$(_GenAPITargetSourcePath)"
-          DependsOnTargets="__CreateAPIDirectory">
+          Outputs="$(_GenAPITargetSourcePath)">
+
+    <MakeDir Directories="$(_GenAPITargetDir)" />
 
     <ItemGroup>
       <_referencePathDirectoriesWithDuplicates Include="%(ReferencePath.RootDir)%(ReferencePath.Directory)" />
     <Exec Command="$(_GenAPICommand) -assembly:&quot;$(TargetPath)&quot; -libPath:&quot;@(_referencePathDirectories)&quot; -out:&quot;$(_GenAPITargetSourcePath)&quot; -throw -global" />
 
     <ItemGroup>
+      <__RefCompile Include="$(_GenAPITargetSourcePath)"/>
       <FileWrites Include="$(_GenAPITargetSourcePath)"/>
     </ItemGroup>
+
   </Target>
 
+  <!-- Generate AssemblyInfo.cs file -->
+  <Target Name="__GenerateAssemblyInfoSource"
+          Inputs="$(TargetPath)"
+          Outputs="$(_GenAPITargetAssemblyInfoPath)">
+
+    <GetAssemblyIdentity AssemblyFiles="$(TargetPath)" Condition="'$(AssemblyVersion)' == ''">
+      <Output TaskParameter="Assemblies" ItemName="__AssemblyInfo" />
+    </GetAssemblyIdentity>
+
+    <ItemGroup Condition="'$(AssemblyVersion)' == ''">
+      <AssemblyInfoLines Include="[assembly:System.Reflection.AssemblyVersion(&quot;%(__AssemblyInfo.Version)&quot;)]" />
+    </ItemGroup>
+    <ItemGroup Condition="'$(AssemblyVersion)' != ''">
+      <AssemblyInfoLines Include="[assembly:System.Reflection.AssemblyVersion(&quot;$(AssemblyVersion)&quot;)]" />
+    </ItemGroup>
+
+    <WriteLinesToFile
+      File="$(_GenAPITargetAssemblyInfoPath)"
+      Lines="@(AssemblyInfoLines)"
+      Overwrite="true" />
+
+    <ItemGroup>
+      <__RefCompile Include="$(_GenAPITargetAssemblyInfoPath)" />
+      <FileWrites Include="$(_GenAPITargetAssemblyInfoPath)" />
+    </ItemGroup>
+
+  </Target>
 
+  <!-- Generate Reference Assembly .dll file -->
   <Target Name="__GenerateReferenceAssembly"
-          Inputs="$(_GenAPITargetSourcePath)"
+          Inputs="@(__RefCompile)"
           Outputs="$(_GenAPITargetAssemblyPath)"
-          DependsOnTargets="__GenerateReferenceAssemblySource">
+          DependsOnTargets="__GenerateReferenceAssemblySource;__GenerateAssemblyInfoSource">
 
-    <Csc Condition="$(MSBuildToolsVersion) &lt; 15"
-        Sources="$(_GenAPITargetSourcePath)"
+    <!-- for ToolVersion 4.0 -->
+    <Csc Condition="'$(MSBuildAssemblyVersion)' == ''"
+        Sources="@(__RefCompile)"
         OutputAssembly="$(_GenAPITargetAssemblyPath)"
         AdditionalLibPaths="$(AdditionalLibPaths)"
         AllowUnsafeBlocks="$(AllowUnsafeBlocks)"
         ToolExe="$(CscToolExe)"
         ToolPath="$(CscToolPath)" />
 
-    <Csc Condition="$(MSBuildToolsVersion) &gt;= 15"
-        Sources="$(_GenAPITargetSourcePath)"
+    <!-- for ToolVersion 15.0 -->
+    <Csc Condition="'$(MSBuildAssemblyVersion)' != ''"
+        Sources="@(__RefCompile)"
         OutputAssembly="$(_GenAPITargetAssemblyPath)"
         AdditionalLibPaths="$(AdditionalLibPaths)"
         AllowUnsafeBlocks="$(AllowUnsafeBlocks)"
index 202aa24..1190949 100755 (executable)
@@ -126,8 +126,6 @@ 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 2e48d6a..9cd4b95 100644 (file)
@@ -6,7 +6,6 @@
 
 %_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
 
 ###############################################################
 
 %_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\
-Summary:   NuGet package for %{name}\
-Group:     Development/Libraries\
-%description nuget\
-NuGet package for %{name}\
-%files nuget\
-/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}} \
+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\
+%dotnet_sub_packages(n:f:) \
+%dotnet_nuget_package %{-n:-n %{-n*}} %{-f:-f %{-f*}} \
 %{nil}
 
+######### keep for backward compatibilities ###########
 %dotnet_import_sub_packages \
-%dotnet_nuget_package \
-%dotnet_reference_package \
+%dotnet_sub_packages \
 %{nil}
 
-%dotnet_sub_packages(n:f:) \
-%dotnet_nuget_package %{-n:-n%{-n*}} %{-f:-f%{-f*}} \
-%dotnet_reference_package %{-n:-n%{-n*}} \
+%_nuget_package \
+%dotnet_nuget_package \
 %{nil}
+#######################################################
 
 %dotnet_restore(s:) \
 dotnet-build -s %{-s:%{-s*}}%{!-s:%{_dotnet_nuget_source}} restore %{1} %{?2} %{?3} %{?4} %{?5} %{?6} \
@@ -75,15 +57,11 @@ 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} \
+%{expand: %dotnet_install_assembly %%{1}} \
+%{expand: %dotnet_install_nuget %%{1}} \
 %{nil}