Add dummy build stuffs
authorWonYoung Choi <wy80.choi@samsung.com>
Thu, 17 Aug 2017 01:01:52 +0000 (10:01 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Thu, 17 Aug 2017 01:23:43 +0000 (10:23 +0900)
Change-Id: Ib266ccd6488cedc0b92dc39f8f0d41c3129f18be

build.sh
pkg/Tizen.NET.Dummy.csproj [new file with mode: 0644]
tools/GenAPI.exe [new file with mode: 0755]
tools/GenAPI.runtimeconfig.json [new file with mode: 0644]
tools/Microsoft.Cci.Extensions.dll [new file with mode: 0644]
tools/Microsoft.Cci.dll [new file with mode: 0755]

index bf8542a..6da5b28 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -6,13 +6,70 @@ SCRIPT_DIR=$(dirname $SCRIPT_FILE)
 # Properties
 OUTDIR=$SCRIPT_DIR/Artifacts
 
-# clean
-rm -fr $OUTDIR
-dotnet clean $SCRIPT_DIR/pkg/Tizen.NET.Private.sln
 
-# build
-dotnet build $SCRIPT_DIR/pkg/Tizen.NET.Private.sln --configuration=Release --output=$OUTDIR/bin
 
-# pack
-nuget pack pkg/Tizen.NET.Private.nuspec -Symbols -NoPackageAnalysis -BasePath $OUTDIR -OutputDirectory $OUTDIR
-nuget pack pkg/Tizen.NET.nuspec -Symbols -NoPackageAnalysis -BasePath $OUTDIR -OutputDirectory $OUTDIR
+usage() {
+  echo "Usage: $0 [options] [args]"
+  echo "    Options:"
+  echo "        -h, --help            Show this usages message"
+  echo "        -b, --build [module]  Build a module"
+  echo "        -f, --full            Build all modules in src/ directory. The module should be added in pkg/Tizen.NET.Private.sln"
+  echo "        -d, --dummy           Build dummy modules"
+  echo "        -c, --clean           Clean all artifacts"
+}
+
+cmd_clean() {
+  rm -fr $OUTDIR
+  LIST=$(find $SCRIPT_DIR -type d -a -name bin -o -name obj)
+  for d in $LIST; do
+    rm -fr $d
+  done
+}
+
+cmd_build() {
+  if [ -z "$1" ]; then
+    echo "No module specified."
+    exit 1
+  fi
+  dotnet build $SCRIPT_DIR/src/$1 --configuration=Release --output=$OUTDIR/bin
+}
+
+cmd_full_build() {
+  dotnet build $SCRIPT_DIR/pkg/Tizen.NET.Private.sln --configuration=Release --output=$OUTDIR/bin
+  nuget pack $SCRIPT_DIR/pkg/Tizen.NET.Private.nuspec -Symbols -NoPackageAnalysis -BasePath $OUTDIR -OutputDirectory $OUTDIR
+  nuget pack $SCRIPT_DIR/pkg/Tizen.NET.nuspec -Symbols -NoPackageAnalysis -BasePath $OUTDIR -OutputDirectory $OUTDIR
+}
+
+cmd_dummy_build() {
+  dotnet build $SCRIPT_DIR/pkg/Tizen.NET.Dummy.csproj --configuration=Release
+}
+
+OPTS=`getopt -o hcbfd --long help,clean,build,full,dummy -n 'build' -- "$@"`
+if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; usage; exit 1 ; fi
+eval set -- "$OPTS"
+
+FLAG_HELP=false
+FLAG_FULL=false
+FLAG_BUILD=false
+FLAG_CLEAN=false
+FLAG_DUMMY=false
+
+while true; do
+  case "$1" in
+    -h|--help) FLAG_HELP=true; shift ;;
+    -b|--build) FLAG_BUILD=true; shift ;;
+    -f|--full) FLAG_FULL=true; shift ;;
+    -d|--dummy) FLAG_DUMMY=true; shift ;;
+    -c|--clean) FLAG_CLEAN=true; shift ;;
+    --) shift; break ;;
+    *) break ;;
+  esac
+done
+
+if $FLAG_HELP; then usage; exit 1; fi
+if $FLAG_CLEAN; then cmd_clean; exit 1; fi
+if $FLAG_FULL; then cmd_full_build; exit 1; fi
+if $FLAG_BUILD; then cmd_build $@; exit 1; fi
+if $FLAG_DUMMY; then cmd_dummy_build; exit 1; fi
+
+usage;
\ No newline at end of file
diff --git a/pkg/Tizen.NET.Dummy.csproj b/pkg/Tizen.NET.Dummy.csproj
new file mode 100644 (file)
index 0000000..a215da7
--- /dev/null
@@ -0,0 +1,124 @@
+<Project DefaultTargets="Build">
+
+  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
+
+  <PropertyGroup>
+    <TargetFramework>netstandard1.6</TargetFramework>
+    <GenerateDependencyFile>false</GenerateDependencyFile>
+    <DummyAssemblyVersion>99.0.0</DummyAssemblyVersion>
+  </PropertyGroup>
+
+  <!-- Properties for directories -->
+  <PropertyGroup>
+    <ToolsDir>$(MSBuildThisFileDirectory)..\tools\</ToolsDir>
+    <GenAPISourceDir>$(MSBuildThisFileDirectory)\..\Artifacts\bin\</GenAPISourceDir>
+    <GenAPILibDir>$(MSBuildThisFileDirectory)obj\_ref_lib\</GenAPILibDir>
+    <GenAPITargetDir>$(MSBuildThisFileDirectory)obj\_ref_api\</GenAPITargetDir>
+    <DummyOutputPath>$(MSBuildThisFileDirectory)\..\Artifacts\bin_dummy</DummyOutputPath>
+  </PropertyGroup>
+
+  <!-- Properties for GenAPI tool -->
+  <PropertyGroup>
+    <GenAPIPath>$(ToolsDir)GenAPI.exe</GenAPIPath>
+    <GenAPICommand>dotnet $(GenAPIPath)</GenAPICommand>
+  </PropertyGroup>
+
+  <!-- Source assemblies -->
+  <ItemGroup>
+    <TizenAssemblies Include="$(GenAPISourceDir)*.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">
+    <ItemGroup>
+      <ReferencePath Include="@(TizenAssemblies)" />
+    </ItemGroup>
+    <MakeDir Directories="$(GenAPILibDir);$(GenAPITargetDir)" />
+    <Copy SourceFiles="@(ReferencePath)" DestinationFolder="$(GenAPILibDir)" />
+  </Target>
+
+  <!-- Target for generating *.AssemblyInfo.cs files -->
+  <Target Name="GenerateAsmInfo"
+          Inputs="@(TizenAssemblies)" Outputs="$(GenAPITargetDir)%(Filename).AssemblyInfo.cs">
+
+    <PropertyGroup>
+      <GeneratedAssemblyInfoSource>$(GenAPITargetDir)%(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="$(GenAPITargetDir)%(Filename).cs">
+    <PropertyGroup>
+      <GeneratedReferenceAssemblySource>$(GenAPITargetDir)%(TizenAssemblies.Filename).cs</GeneratedReferenceAssemblySource>
+    </PropertyGroup>
+
+    <Message Text="[GenAPI] %(TizenAssemblies.Filename) -> $(GeneratedReferenceAssemblySource)" Importance="High" />
+
+    <Exec Command='$(GenAPICommand) -assembly:&quot;%(TizenAssemblies.Identity)&quot; -libPath:&quot;$(GenAPILibDir)&quot; -out:&quot;$(GeneratedReferenceAssemblySource)&quot; -throw:&quot;Not Supported Feature&quot; -global' />
+  </Target>
+
+
+  <Target Name="GenerateDummy"
+          DependsOnTargets="GenerateAsmInfo;GenerateAPI"
+          Inputs="@(TizenAssemblies)" Outputs="$(OutputPath)%(TizenAssemblies.Filename).dll">
+    <PropertyGroup>
+      <ThisAssemblyFilename>%(TizenAssemblies.Filename)</ThisAssemblyFilename>
+      <GeneratedAssemblyInfoSource>$(GenAPITargetDir)%(TizenAssemblies.Filename).AssemblyInfo.cs</GeneratedAssemblyInfoSource>
+      <GeneratedReferenceAssemblySource>$(GenAPITargetDir)%(TizenAssemblies.Filename).cs</GeneratedReferenceAssemblySource>
+      <GeneratedReferenceAssembly>$(OutputPath)%(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)"
+        ToolExe="$(CscToolExe)"
+        ToolPath="$(CscToolPath)" />
+
+  </Target>
+
+  <Target Name="AfterBuild" DependsOnTargets="Prepare;GenerateDummy">
+    <RemoveDir Directories="$(DummyOutputPath)" />
+    <MakeDir Directories="$(DummyOutputPath)" />
+
+    <ItemGroup>
+      <TizenRefAssemblies Include="$(OutDir)/*.dll" />
+    </ItemGroup>
+
+    <Copy SourceFiles="@(TizenRefAssemblies)" DestinationFolder="$(DummyOutputPath)" />
+  </Target>
+
+</Project>
+
diff --git a/tools/GenAPI.exe b/tools/GenAPI.exe
new file mode 100755 (executable)
index 0000000..53b1473
Binary files /dev/null and b/tools/GenAPI.exe differ
diff --git a/tools/GenAPI.runtimeconfig.json b/tools/GenAPI.runtimeconfig.json
new file mode 100644 (file)
index 0000000..d5ff8e2
--- /dev/null
@@ -0,0 +1,9 @@
+{
+  "runtimeOptions": {
+    "tfm": "netcoreapp2.0",
+    "framework": {
+      "name": "Microsoft.NETCore.App",
+      "version": "2.0.0"
+    }
+  }
+}
diff --git a/tools/Microsoft.Cci.Extensions.dll b/tools/Microsoft.Cci.Extensions.dll
new file mode 100644 (file)
index 0000000..2ce23b6
Binary files /dev/null and b/tools/Microsoft.Cci.Extensions.dll differ
diff --git a/tools/Microsoft.Cci.dll b/tools/Microsoft.Cci.dll
new file mode 100755 (executable)
index 0000000..0956d9a
Binary files /dev/null and b/tools/Microsoft.Cci.dll differ