[Build] Add GenDummy Tool and environment 58/157758/14
authorJoonghyun Cho <jh5.cho@samsung.com>
Thu, 26 Oct 2017 05:56:17 +0000 (14:56 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Mon, 20 Nov 2017 05:10:41 +0000 (05:10 +0000)
    - GenDummy tool is added.
    - Environment for generating dummy dll is set to fit GenDummy tool.
    - GenAPI tool is removed.

Change-Id: I4bb6ba6acdb65d1bfad422b71a49e42b00b9af7d

23 files changed:
build.cmd
build.sh
build/build.dummy.csproj [deleted file]
build/build.proj
build/directories.props
tools/GenAPI/GenAPI.exe [deleted file]
tools/GenAPI/Microsoft.Cci.Extensions.dll [deleted file]
tools/GenAPI/Microsoft.Cci.dll [deleted file]
tools/GenDummy/GenDummy.dll [new file with mode: 0644]
tools/GenDummy/GenDummy.runtimeconfig.json [moved from tools/GenAPI/GenAPI.runtimeconfig.json with 98% similarity]
tools/GenDummy/Microsoft.CodeAnalysis.CSharp.Workspaces.dll [new file with mode: 0755]
tools/GenDummy/Microsoft.CodeAnalysis.CSharp.dll [new file with mode: 0755]
tools/GenDummy/Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll [new file with mode: 0755]
tools/GenDummy/Microsoft.CodeAnalysis.VisualBasic.dll [new file with mode: 0755]
tools/GenDummy/Microsoft.CodeAnalysis.Workspaces.dll [new file with mode: 0755]
tools/GenDummy/Microsoft.CodeAnalysis.dll [new file with mode: 0755]
tools/GenDummy/System.Composition.AttributedModel.dll [new file with mode: 0755]
tools/GenDummy/System.Composition.Convention.dll [new file with mode: 0755]
tools/GenDummy/System.Composition.Hosting.dll [new file with mode: 0755]
tools/GenDummy/System.Composition.Runtime.dll [new file with mode: 0755]
tools/GenDummy/System.Composition.TypedParts.dll [new file with mode: 0755]
tools/GenDummy/runtimes/unix/lib/netstandard1.3/System.Text.Encoding.CodePages.dll [new file with mode: 0755]
tools/GenDummy/runtimes/win/lib/netstandard1.3/System.Text.Encoding.CodePages.dll [new file with mode: 0755]

index 8755816..efd589e 100644 (file)
--- a/build.cmd
+++ b/build.cmd
@@ -37,7 +37,8 @@ call dotnet msbuild %~dp0build\build.proj /nologo /t:build
 goto :EOF
 
 :DummyBuild
-call dotnet build %~dp0build\build.dummy.csproj
+call dotnet msbuild %~dp0build\build.proj /nologo /t:dummy
+call dotnet msbuild %~dp0build\build.proj /nologo /t:afterdummy
 goto :EOF
 
 :Pack
index bcc2fee..f6317bc 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -11,7 +11,6 @@ TIMEOUT_CMD="$SCRIPT_DIR/tools/timeout.sh"
 DOTNET_CMD="$RETRY_CMD $TIMEOUT_CMD 600 dotnet"
 
 RUN_BUILD="$DOTNET_CMD msbuild $SCRIPT_DIR/build/build.proj /nologo"
-RUN_BUILD_DUMMY="$DOTNET_CMD build $SCRIPT_DIR/build/build.dummy.csproj"
 
 usage() {
   echo "Usage: %0 [command] [args]"
@@ -48,7 +47,8 @@ cmd_dummy_build() {
   if [ -d /nuget ]; then
     NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
   fi
-  $RUN_BUILD_DUMMY $NUGET_SOURCE_OPT
+  $RUN_BUILD /t:dummy $NUGET_SOURCE_OPT
+  $RUN_BUILD /t:afterdummy
 }
 
 cmd_pack() {
diff --git a/build/build.dummy.csproj b/build/build.dummy.csproj
deleted file mode 100644 (file)
index 48bb206..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-<Project DefaultTargets="Build">
-
-  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
-
-  <Import Project="$(MSBuildThisFileDirectory)directories.props" />
-  <Import Project="$(MSBuildThisFileDirectory)version.props" />
-
-  <PropertyGroup>
-    <TargetFramework>netstandard2.0</TargetFramework>
-    <GenerateDependencyFile>false</GenerateDependencyFile>
-    <DummyAssemblyVersion>$(VersionPrefix)</DummyAssemblyVersion>
-    <OutDir>$(OutputDummyDir)</OutDir>
-  </PropertyGroup>
-
-  <!-- Properties for directories -->
-  <PropertyGroup>
-    <IntermediateLibDir>$(BaseIntermediateOutputPath)_ref_lib\</IntermediateLibDir>
-    <IntermediateAPIDir>$(BaseIntermediateOutputPath)_ref_api\</IntermediateAPIDir>
-  </PropertyGroup>
-
-  <!-- Properties for GenAPI tool -->
-  <PropertyGroup>
-    <GenAPICommand>dotnet $(GenAPIDir)GenAPI.exe</GenAPICommand>
-  </PropertyGroup>
-
-  <!-- Source assemblies -->
-  <ItemGroup>
-    <TizenAssemblies Include="$(OutputPublicDir)\*.dll" />
-    <TizenAssemblies Include="$(OutputInternalDir)\*.dll" />
-  </ItemGroup>
-
-  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
-
-  <Target Name="Compile" />
-  <Target Name="CopyFilesToOutputDirectory" />
-
-  <!-- Target for preparing reference lib directory -->
-  <Target Name="Prepare" DependsOnTargets="ResolveAssemblyReferences">
-    <ItemGroup>
-      <ReferencePath Include="@(TizenAssemblies)" />
-    </ItemGroup>
-    <MakeDir Directories="$(IntermediateLibDir);$(IntermediateAPIDir)" />
-    <Copy SourceFiles="@(ReferencePath)" DestinationFolder="$(IntermediateLibDir)" />
-    <RemoveDir Directories="$(OutputDummyDir)" />
-    <MakeDir Directories="$(OutputDummyDir)" />
-  </Target>
-
-  <!-- Target for generating *.AssemblyInfo.cs files -->
-  <Target Name="GenerateAsmInfo"
-          Inputs="@(TizenAssemblies)" Outputs="$(IntermediateAPIDir)%(Filename).AssemblyInfo.cs">
-
-    <PropertyGroup>
-      <GeneratedAssemblyInfoSource>$(IntermediateAPIDir)%(TizenAssemblies.Filename).AssemblyInfo.cs</GeneratedAssemblyInfoSource>
-    </PropertyGroup>
-
-    <ItemGroup>
-      <AssemblyInfoLines Include="[assembly:System.Reflection.AssemblyVersion(&quot;$(DummyAssemblyVersion)&quot;)]" />
-    </ItemGroup>
-
-    <WriteLinesToFile
-      File="$(GeneratedAssemblyInfoSource)"
-      Lines="@(AssemblyInfoLines)"
-      Overwrite="true" />
-
-    <ItemGroup>
-      <FileWrites Include="$(GeneratedAssemblyInfoSource)" />
-    </ItemGroup>
-
-  </Target>
-
-  <!-- Target for generating reference source files using GenAPI -->
-  <Target Name="GenerateAPI"
-          Inputs="@(TizenAssemblies)" Outputs="$(IntermediateAPIDir)%(Filename).cs">
-    <PropertyGroup>
-      <GeneratedReferenceAssemblySource>$(IntermediateAPIDir)%(TizenAssemblies.Filename).cs</GeneratedReferenceAssemblySource>
-    </PropertyGroup>
-
-    <Message Text="[GenAPI] %(TizenAssemblies.Filename) -> $(GeneratedReferenceAssemblySource)" Importance="High" />
-
-    <Exec Command='$(GenAPICommand) -assembly:&quot;%(TizenAssemblies.Identity)&quot; -libPath:$(IntermediateLibDir) -out:$(GeneratedReferenceAssemblySource) -throw:&quot;Not Supported Feature&quot; -global' />
-  </Target>
-
-
-  <Target Name="GenerateDummy"
-          DependsOnTargets="GenerateAsmInfo;GenerateAPI"
-          Inputs="@(TizenAssemblies)" Outputs="$(OutputDummyDir)%(TizenAssemblies.Filename).dll">
-    <PropertyGroup>
-      <ThisAssemblyFilename>%(TizenAssemblies.Filename)</ThisAssemblyFilename>
-      <GeneratedAssemblyInfoSource>$(IntermediateAPIDir)%(TizenAssemblies.Filename).AssemblyInfo.cs</GeneratedAssemblyInfoSource>
-      <GeneratedReferenceAssemblySource>$(IntermediateAPIDir)%(TizenAssemblies.Filename).cs</GeneratedReferenceAssemblySource>
-      <GeneratedReferenceAssembly>$(OutputDummyDir)%(TizenAssemblies.Filename).dll</GeneratedReferenceAssembly>
-    </PropertyGroup>
-
-    <Message Text="[Compile] %(TizenAssemblies.Filename) -> $(GeneratedReferenceAssembly)" Importance="High" />
-
-    <ItemGroup>
-      <FilteredReferencePath Include="@(ReferencePath)" Condition="%(Filename) != $(ThisAssemblyFilename)" />
-    </ItemGroup>
-
-    <Csc
-        Sources="$(GeneratedReferenceAssemblySource);$(GeneratedAssemblyInfoSource)"
-        OutputAssembly="$(GeneratedReferenceAssembly)"
-        AdditionalLibPaths="$(AdditionalLibPaths)"
-        AllowUnsafeBlocks="true"
-        DefineConstants="$(DefineConstants)"
-        DisabledWarnings="$(NoWarn)"
-        TargetType="$(OutputType)"
-        NoStandardLib="$(NoCompilerStandardLib)"
-        References="@(FilteredReferencePath)"
-        Deterministic="true"
-        ToolExe="$(CscToolExe)"
-        ToolPath="$(CscToolPath)" />
-
-  </Target>
-
-  <Target Name="AfterBuild" DependsOnTargets="Prepare;GenerateDummy">
-    <RemoveDir Directories="$(BaseIntermediateOutputPath)" />
-  </Target>
-
-</Project>
-
index dc28ff4..05ffdcb 100644 (file)
@@ -5,13 +5,22 @@
   <!-- Build Properties -->
   <PropertyGroup>
     <Configuration>Release</Configuration>
+    <GenDummyCommand>dotnet $(GenDummyDir)\GenDummy.dll</GenDummyCommand>
+    <PublicDummyProjectDir>$(ProjectRootDir).dummy\</PublicDummyProjectDir>
+    <InternalDummyProjectDir>$(ProjectRootDir)internal\.dummy\</InternalDummyProjectDir>
   </PropertyGroup>
 
   <!-- Projects to build -->
   <ItemGroup>
-    <ProjectToBuild Include="$(ProjectSrcDir)\$(Project)\$(Project).csproj" Condition="'$(Project)' != ''" />
-    <ProjectToBuild Include="$(ProjectSrcDir)**\*.csproj" Condition="'$(Project)' == ''" />
-    <ProjectToBuild Include="$(InternalProjectSrcDir)**\*.csproj" Condition="'$(Project)' == ''" />
+    <ProjectToBuild Include="$(ProjectSrcDir)\$(Project)\$(Project).csproj" Condition="'$(Project)' != ''">
+      <Visibility>Public</Visibility>
+    </ProjectToBuild>
+    <ProjectToBuild Include="$(ProjectSrcDir)**\*.csproj" Condition="'$(Project)' == ''">
+      <Visibility>Public</Visibility>
+    </ProjectToBuild>
+    <ProjectToBuild Include="$(InternalProjectSrcDir)**\*.csproj" Condition="'$(Project)' == ''">
+      <Visibility>Internal</Visibility>
+    </ProjectToBuild>
   </ItemGroup>
 
   <!--
@@ -31,6 +40,8 @@
     <ItemGroup>
       <DirToRemove Include="$(OutputBaseDir)" />
       <DirToRemove Include="@(ProjectIntermediateDir)" />
+      <DirToRemove Include="$(PublicDummyProjectDir)" />
+      <DirToRemove Include="$(InternalDummyProjectDir)" />
     </ItemGroup>
 
     <RemoveDir Directories="@(DirToRemove)" />
 
   </Target>
 
+  <!--
+    Target : Dummy
+    ==============
+    Generate dummy assemblies of all projects.
+  -->
+  <Target Name="Dummy" DependsOnTargets="GenerateDummyProject">
+
+    <ItemGroup>
+      <DummyProjectToBuild Include="$(PublicDummyProjectDir)**\*.csproj" />
+      <DummyProjectToBuild Include="$(InternalDummyProjectDir)**\*.csproj" />
+    </ItemGroup>
+
+    <MSBuild Projects="@(DummyProjectToBuild)"
+             Properties="Configuration=$(Configuration);RestoreSources=$(RestoreSources)"
+             BuildInParallel="false"
+             Targets="Restore" />
+
+    <MSBuild Projects="@(DummyProjectToBuild)"
+             Properties="Configuration=$(Configuration);WarningLevel=0;OutDir=$(OutputDummyDir);ProduceReferenceAssembly=False"
+             BuildInParallel="true"
+             UseResultsCache="true"
+             Targets="Build" />
+
+  </Target>
+
+
+  <Target Name="GenerateDummyProject" Inputs="@(ProjectToBuild)" Outputs="%(Filename)" >
+
+    <PropertyGroup>
+      <GeneratedDummyAssembly>$(OutputDummyDir)%(ProjectToBuild.Filename).dll</GeneratedDummyAssembly>
+      <ClonedProjectsDir Condition="'%(ProjectToBuild.Visibility)' == 'Public'" >$(PublicDummyProjectDir)</ClonedProjectsDir>
+      <ClonedProjectsDir Condition="'%(ProjectToBuild.Visibility)' == 'Internal'" >$(InternalDummyProjectDir)</ClonedProjectsDir>
+    </PropertyGroup>
+
+    <Message Text="[GenDummy] %(ProjectToBuild.Filename)" Importance="High" />
+    <Message Text="Directory = %(ProjectToBuild.Directory)" Importance="High" />
+
+    <Exec Command='$(GenDummyCommand) -project %(ProjectToBuild.Filename) -source %(ProjectToBuild.RootDir)%(ProjectToBuild.Directory).. -clonePath $(ClonedProjectsDir)' />
+
+  </Target>
+
+  <Target Name="AfterDummy">
+    <Message Text="Clean Directory" Importance="High" />
+    <RemoveDir Directories="$(PublicDummyProjectDir);$(InternalDummyProjectDir)" />
+  </Target>
+
 </Project>
index 28b5ed1..3df2856 100644 (file)
@@ -8,7 +8,7 @@
     <InternalProjectSrcDir>$(ProjectRootDir)\internal\src\</InternalProjectSrcDir>
 
     <ToolsDir>$(ProjectRootDir)tools\</ToolsDir>
-    <GenAPIDir>$(ToolsDir)GenAPI\</GenAPIDir>
+    <GenDummyDir>$(ToolsDir)GenDummy\</GenDummyDir>
 
     <OutputBaseDir>$(ProjectRootDir)Artifacts\</OutputBaseDir>
     <OutputPublicDir>$(OutputBaseDir)bin\public\</OutputPublicDir>
@@ -17,4 +17,4 @@
 
   </PropertyGroup>
 
-</Project>
\ No newline at end of file
+</Project>
diff --git a/tools/GenAPI/GenAPI.exe b/tools/GenAPI/GenAPI.exe
deleted file mode 100755 (executable)
index 53b1473..0000000
Binary files a/tools/GenAPI/GenAPI.exe and /dev/null differ
diff --git a/tools/GenAPI/Microsoft.Cci.Extensions.dll b/tools/GenAPI/Microsoft.Cci.Extensions.dll
deleted file mode 100644 (file)
index 2ce23b6..0000000
Binary files a/tools/GenAPI/Microsoft.Cci.Extensions.dll and /dev/null differ
diff --git a/tools/GenAPI/Microsoft.Cci.dll b/tools/GenAPI/Microsoft.Cci.dll
deleted file mode 100755 (executable)
index 0956d9a..0000000
Binary files a/tools/GenAPI/Microsoft.Cci.dll and /dev/null differ
diff --git a/tools/GenDummy/GenDummy.dll b/tools/GenDummy/GenDummy.dll
new file mode 100644 (file)
index 0000000..30fb4b6
Binary files /dev/null and b/tools/GenDummy/GenDummy.dll differ
similarity index 98%
rename from tools/GenAPI/GenAPI.runtimeconfig.json
rename to tools/GenDummy/GenDummy.runtimeconfig.json
index d5ff8e2..7539019 100644 (file)
@@ -6,4 +6,4 @@
       "version": "2.0.0"
     }
   }
-}
+}
\ No newline at end of file
diff --git a/tools/GenDummy/Microsoft.CodeAnalysis.CSharp.Workspaces.dll b/tools/GenDummy/Microsoft.CodeAnalysis.CSharp.Workspaces.dll
new file mode 100755 (executable)
index 0000000..c0af68b
Binary files /dev/null and b/tools/GenDummy/Microsoft.CodeAnalysis.CSharp.Workspaces.dll differ
diff --git a/tools/GenDummy/Microsoft.CodeAnalysis.CSharp.dll b/tools/GenDummy/Microsoft.CodeAnalysis.CSharp.dll
new file mode 100755 (executable)
index 0000000..f95ba4f
Binary files /dev/null and b/tools/GenDummy/Microsoft.CodeAnalysis.CSharp.dll differ
diff --git a/tools/GenDummy/Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll b/tools/GenDummy/Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll
new file mode 100755 (executable)
index 0000000..33e0fc9
Binary files /dev/null and b/tools/GenDummy/Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll differ
diff --git a/tools/GenDummy/Microsoft.CodeAnalysis.VisualBasic.dll b/tools/GenDummy/Microsoft.CodeAnalysis.VisualBasic.dll
new file mode 100755 (executable)
index 0000000..bc12eda
Binary files /dev/null and b/tools/GenDummy/Microsoft.CodeAnalysis.VisualBasic.dll differ
diff --git a/tools/GenDummy/Microsoft.CodeAnalysis.Workspaces.dll b/tools/GenDummy/Microsoft.CodeAnalysis.Workspaces.dll
new file mode 100755 (executable)
index 0000000..ffa110a
Binary files /dev/null and b/tools/GenDummy/Microsoft.CodeAnalysis.Workspaces.dll differ
diff --git a/tools/GenDummy/Microsoft.CodeAnalysis.dll b/tools/GenDummy/Microsoft.CodeAnalysis.dll
new file mode 100755 (executable)
index 0000000..860ad63
Binary files /dev/null and b/tools/GenDummy/Microsoft.CodeAnalysis.dll differ
diff --git a/tools/GenDummy/System.Composition.AttributedModel.dll b/tools/GenDummy/System.Composition.AttributedModel.dll
new file mode 100755 (executable)
index 0000000..4acc216
Binary files /dev/null and b/tools/GenDummy/System.Composition.AttributedModel.dll differ
diff --git a/tools/GenDummy/System.Composition.Convention.dll b/tools/GenDummy/System.Composition.Convention.dll
new file mode 100755 (executable)
index 0000000..ef3669b
Binary files /dev/null and b/tools/GenDummy/System.Composition.Convention.dll differ
diff --git a/tools/GenDummy/System.Composition.Hosting.dll b/tools/GenDummy/System.Composition.Hosting.dll
new file mode 100755 (executable)
index 0000000..a446fe6
Binary files /dev/null and b/tools/GenDummy/System.Composition.Hosting.dll differ
diff --git a/tools/GenDummy/System.Composition.Runtime.dll b/tools/GenDummy/System.Composition.Runtime.dll
new file mode 100755 (executable)
index 0000000..a05bfe9
Binary files /dev/null and b/tools/GenDummy/System.Composition.Runtime.dll differ
diff --git a/tools/GenDummy/System.Composition.TypedParts.dll b/tools/GenDummy/System.Composition.TypedParts.dll
new file mode 100755 (executable)
index 0000000..cfae95d
Binary files /dev/null and b/tools/GenDummy/System.Composition.TypedParts.dll differ
diff --git a/tools/GenDummy/runtimes/unix/lib/netstandard1.3/System.Text.Encoding.CodePages.dll b/tools/GenDummy/runtimes/unix/lib/netstandard1.3/System.Text.Encoding.CodePages.dll
new file mode 100755 (executable)
index 0000000..dd6b24c
Binary files /dev/null and b/tools/GenDummy/runtimes/unix/lib/netstandard1.3/System.Text.Encoding.CodePages.dll differ
diff --git a/tools/GenDummy/runtimes/win/lib/netstandard1.3/System.Text.Encoding.CodePages.dll b/tools/GenDummy/runtimes/win/lib/netstandard1.3/System.Text.Encoding.CodePages.dll
new file mode 100755 (executable)
index 0000000..0f2f447
Binary files /dev/null and b/tools/GenDummy/runtimes/win/lib/netstandard1.3/System.Text.Encoding.CodePages.dll differ