Add tizenfx_use_prebuilt flag to packaging spec file
authorWonYoung Choi <wy80.choi@samsung.com>
Wed, 23 Aug 2017 00:45:45 +0000 (09:45 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Wed, 23 Aug 2017 00:45:45 +0000 (09:45 +0900)
Change-Id: I543257f634fd681259be2746fe6370b613e748be

16 files changed:
.gitwork/publish.sh
build.sh
packaging/csapi-tizenfx.spec
packaging/csapi-tizenfx.spec.in
pkg/PlatformFileList.txt [moved from filelist.txt with 99% similarity]
pkg/Tizen.NET.Dummy.csproj
scripts/filelist.sh [deleted file]
src/ElmSharp/ElmSharp/EvasCanvas.cs
src/ElmSharp/Interop/Interop.Evas.cs
tools/GenAPI/GenAPI.exe [new file with mode: 0755]
tools/GenAPI/GenAPI.runtimeconfig.json [new file with mode: 0644]
tools/GenAPI/Microsoft.Cci.Extensions.dll [new file with mode: 0644]
tools/GenAPI/Microsoft.Cci.dll [new file with mode: 0755]
tools/NuGet.exe [new file with mode: 0644]
tools/add_module.sh [new file with mode: 0755]
tools/module.csproj.template [new file with mode: 0644]

index 0647687..ee98d58 100755 (executable)
@@ -46,9 +46,11 @@ git fetch origin master
 git rm -fr src
 git rm -fr pkg
 git rm -fr build
+git rm -fr tools
 git checkout $VERSION_VCS -- src 
 git checkout $VERSION_VCS -- pkg
 git checkout $VERSION_VCS -- build
+git checkout $VERSION_VCS -- tools
 git checkout $VERSION_VCS -- build.sh
 
 git commit -m "Release $VERSION_STRING"
index 6da5b28..a31b94f 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -5,8 +5,7 @@ SCRIPT_DIR=$(dirname $SCRIPT_FILE)
 
 # Properties
 OUTDIR=$SCRIPT_DIR/Artifacts
-
-
+NUGET_CMD="mono $SCRIPT_DIR/tools/NuGet.exe"
 
 usage() {
   echo "Usage: $0 [options] [args]"
@@ -15,6 +14,7 @@ usage() {
   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 "        -p, --pack            Make nuget packages"
   echo "        -c, --clean           Clean all artifacts"
 }
 
@@ -36,15 +36,24 @@ cmd_build() {
 
 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_pack() {
+  VERSION_FILE=$OUTDIR/Version.txt
+  if [ -f $VERSION_FILE ]; then
+    NUGET_VERSION_PREFIX=$(cat $VERSION_FILE | grep Prefix | cut -d: -f2 | sed 's/\r$//')
+    NUGET_VERSION_SUFFIX=$(cat $VERSION_FILE | grep Suffix | cut -d: -f2 | sed 's/\r$//')
+         NUGET_VERSION_OPT="-Version $NUGET_VERSION_PREFIX-$NUGET_VERSION_SUFFIX"
+  fi
+  $NUGET_CMD pack $SCRIPT_DIR/pkg/Tizen.NET.Private.nuspec -Symbols -NoPackageAnalysis $NUGET_VERSION_OPT -BasePath $OUTDIR -OutputDirectory $OUTDIR
+  $NUGET_CMD pack $SCRIPT_DIR/pkg/Tizen.NET.nuspec -Symbols -NoPackageAnalysis $NUGET_VERSION_OPT -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' -- "$@"`
+OPTS=`getopt -o hcbfpd --long help,clean,build,full,pack,dummy -n 'build' -- "$@"`
 if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; usage; exit 1 ; fi
 eval set -- "$OPTS"
 
@@ -53,6 +62,7 @@ FLAG_FULL=false
 FLAG_BUILD=false
 FLAG_CLEAN=false
 FLAG_DUMMY=false
+FLAG_PACK=false
 
 while true; do
   case "$1" in
@@ -60,16 +70,18 @@ while true; do
     -b|--build) FLAG_BUILD=true; shift ;;
     -f|--full) FLAG_FULL=true; shift ;;
     -d|--dummy) FLAG_DUMMY=true; shift ;;
+    -p|--pack) FLAG_PACK=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
+if $FLAG_HELP; then usage; exit 0; fi
+if $FLAG_CLEAN; then cmd_clean; exit 0; fi
+if $FLAG_FULL; then cmd_full_build; exit 0; fi
+if $FLAG_BUILD; then cmd_build $@; exit 0; fi
+if $FLAG_PACK; then cmd_pack $@; exit 0; fi
+if $FLAG_DUMMY; then cmd_dummy_build; exit 0; fi
 
-usage;
\ No newline at end of file
+usage;
index fad9bc0..cae33b4 100644 (file)
@@ -3,6 +3,11 @@
 %define DOTNET_ASSEMBLY_RES_PATH %{DOTNET_ASSEMBLY_PATH}/res
 %define DOTNET_NUGET_SOURCE /nuget
 
+# If tizenfx_use_prebuilt is 1, use prebuilt binaries instead of building source at gbs build.
+# Default value is 1, if want to build source at gbs build, set tizenfx_use_prebuilt to 0.
+%define _tizenfx_use_prebuilt %{?tizenfx_use_prebuilt:%{tizenfx_use_prebuilt}}%{!?tizenfx_use_prebuilt:1}
+%define _tizenfx_bin_path Artifacts
+
 Name:       csapi-tizenfx
 Summary:    Assemblies of Tizen .NET
 Version:    4.0.0.97
@@ -13,6 +18,8 @@ URL:        https://www.tizen.org
 Source0:    %{name}-%{version}.tar.gz
 Source1:    %{name}.manifest
 
+BuildRequires: dotnet-build-tools
+
 BuildArch: noarch
 AutoReqProv: no
 
@@ -110,12 +117,26 @@ Tizen .NET assemblies for Wearable profile
 cp %{SOURCE1} .
 
 %build
-./scripts/filelist.sh common > common.filelist
-./scripts/filelist.sh mobile > mobile.filelist
-./scripts/filelist.sh mobile-emul > mobile-emul.filelist
-./scripts/filelist.sh tv > tv.filelist
-./scripts/filelist.sh ivi > ivi.filelist
-./scripts/filelist.sh wearable > wearable.filelist
+
+GetFileList() {
+  PROFILE=$1
+  cat pkg/PlatformFileList.txt | grep -E "#$PROFILE[[:space:]]|#$PROFILE$" | cut -d# -f1 | sed "s#^#%{DOTNET_ASSEMBLY_PATH}/#"
+}
+
+GetFileList common > common.filelist
+GetFileList mobile > mobile.filelist
+GetFileList mobile-emul > mobile-emul.filelist
+GetFileList tv > tv.filelist
+GetFileList ivi > ivi.filelist
+GetFileList wearable > wearable.filelist
+
+%if ! %{_tizenfx_use_prebuilt}
+  rm -fr %{_tizenfx_bin_path}/bin
+  rm -f %{_tizenfx_bin_path}/*.nupkg
+  export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
+  ./build.sh --full
+  ./build.sh --pack
+%endif
 
 %install
 mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_PATH}
@@ -123,11 +144,11 @@ mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_DUMMY_PATH}
 mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_RES_PATH}
 mkdir -p %{buildroot}%{DOTNET_NUGET_SOURCE}
 
-install -p -m 644 binaries/frameworks/*.dll %{buildroot}%{DOTNET_ASSEMBLY_PATH}
-install -p -m 644 binaries/frameworks/*.pdb %{buildroot}%{DOTNET_ASSEMBLY_PATH}
-install -p -m 644 binaries/frameworks/res/* %{buildroot}%{DOTNET_ASSEMBLY_RES_PATH}
-install -p -m 644 binaries/frameworks_dummy/*.dll %{buildroot}%{DOTNET_ASSEMBLY_DUMMY_PATH}
-install -p -m 644 binaries/*.nupkg %{buildroot}%{DOTNET_NUGET_SOURCE}
+install -p -m 644 %{_tizenfx_bin_path}/bin/*.dll %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/bin/*.pdb %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/bin/res/* %{buildroot}%{DOTNET_ASSEMBLY_RES_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/bin_dummy/*.dll %{buildroot}%{DOTNET_ASSEMBLY_DUMMY_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/*.nupkg %{buildroot}%{DOTNET_NUGET_SOURCE}
 
 %files nuget
 %{DOTNET_NUGET_SOURCE}/*.nupkg
index e30a418..bedff01 100644 (file)
@@ -3,6 +3,11 @@
 %define DOTNET_ASSEMBLY_RES_PATH %{DOTNET_ASSEMBLY_PATH}/res
 %define DOTNET_NUGET_SOURCE /nuget
 
+# If tizenfx_use_prebuilt is 1, use prebuilt binaries instead of building source at gbs build.
+# Default value is 1, if want to build source at gbs build, set tizenfx_use_prebuilt to 0.
+%define _tizenfx_use_prebuilt %{?tizenfx_use_prebuilt:%{tizenfx_use_prebuilt}}%{!?tizenfx_use_prebuilt:1}
+%define _tizenfx_bin_path Artifacts
+
 Name:       csapi-tizenfx
 Summary:    Assemblies of Tizen .NET
 Version:    %rpm_version%
@@ -13,6 +18,8 @@ URL:        https://www.tizen.org
 Source0:    %{name}-%{version}.tar.gz
 Source1:    %{name}.manifest
 
+BuildRequires: dotnet-build-tools
+
 BuildArch: noarch
 AutoReqProv: no
 
@@ -110,12 +117,26 @@ Tizen .NET assemblies for Wearable profile
 cp %{SOURCE1} .
 
 %build
-./scripts/filelist.sh common > common.filelist
-./scripts/filelist.sh mobile > mobile.filelist
-./scripts/filelist.sh mobile-emul > mobile-emul.filelist
-./scripts/filelist.sh tv > tv.filelist
-./scripts/filelist.sh ivi > ivi.filelist
-./scripts/filelist.sh wearable > wearable.filelist
+
+GetFileList() {
+  PROFILE=$1
+  cat pkg/PlatformFileList.txt | grep -E "#$PROFILE[[:space:]]|#$PROFILE$" | cut -d# -f1 | sed "s#^#%{DOTNET_ASSEMBLY_PATH}/#"
+}
+
+GetFileList common > common.filelist
+GetFileList mobile > mobile.filelist
+GetFileList mobile-emul > mobile-emul.filelist
+GetFileList tv > tv.filelist
+GetFileList ivi > ivi.filelist
+GetFileList wearable > wearable.filelist
+
+%if ! %{_tizenfx_use_prebuilt}
+  rm -fr %{_tizenfx_bin_path}/bin
+  rm -f %{_tizenfx_bin_path}/*.nupkg
+  export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
+  ./build.sh --full
+  ./build.sh --pack
+%endif
 
 %install
 mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_PATH}
@@ -123,11 +144,11 @@ mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_DUMMY_PATH}
 mkdir -p %{buildroot}%{DOTNET_ASSEMBLY_RES_PATH}
 mkdir -p %{buildroot}%{DOTNET_NUGET_SOURCE}
 
-install -p -m 644 binaries/frameworks/*.dll %{buildroot}%{DOTNET_ASSEMBLY_PATH}
-install -p -m 644 binaries/frameworks/*.pdb %{buildroot}%{DOTNET_ASSEMBLY_PATH}
-install -p -m 644 binaries/frameworks/res/* %{buildroot}%{DOTNET_ASSEMBLY_RES_PATH}
-install -p -m 644 binaries/frameworks_dummy/*.dll %{buildroot}%{DOTNET_ASSEMBLY_DUMMY_PATH}
-install -p -m 644 binaries/*.nupkg %{buildroot}%{DOTNET_NUGET_SOURCE}
+install -p -m 644 %{_tizenfx_bin_path}/bin/*.dll %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/bin/*.pdb %{buildroot}%{DOTNET_ASSEMBLY_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/bin/res/* %{buildroot}%{DOTNET_ASSEMBLY_RES_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/bin_dummy/*.dll %{buildroot}%{DOTNET_ASSEMBLY_DUMMY_PATH}
+install -p -m 644 %{_tizenfx_bin_path}/*.nupkg %{buildroot}%{DOTNET_NUGET_SOURCE}
 
 %files nuget
 %{DOTNET_NUGET_SOURCE}/*.nupkg
similarity index 99%
rename from filelist.txt
rename to pkg/PlatformFileList.txt
index d3267fc..dc86dc1 100644 (file)
@@ -48,13 +48,13 @@ Tizen.Multimedia.Remoting.dll                      #common #mobile #mobile-emul
 Tizen.Multimedia.StreamRecorder.dll                #common #mobile #mobile-emul #tv #ivi
 Tizen.Multimedia.Util.dll                          #common #mobile #mobile-emul #tv #ivi
 Tizen.Multimedia.Vision.dll                        #common #mobile #mobile-emul #tv #ivi
-Tizen.Network.Bluetooth.dll                        #common #mobile #tv #ivi
+Tizen.Network.Bluetooth.dll                        #common #mobile #tv #ivi #wearable
 Tizen.Network.Connection.dll                       #common #mobile #mobile-emul #tv #ivi #wearable
 Tizen.Network.IoTConnectivity.dll                  #common #mobile #mobile-emul #tv #ivi #wearable
 Tizen.Network.Mtp.dll
-Tizen.Network.Nfc.dll                              #mobile #mobile-emul #ivi
+Tizen.Network.Nfc.dll                              #mobile #mobile-emul #ivi #wearable
 Tizen.Network.Nsd.dll                              #common #mobile #mobile-emul #wearable
-Tizen.Network.Smartcard.dll                        #mobile #mobile-emul #ivi
+Tizen.Network.Smartcard.dll                        #mobile #mobile-emul #ivi #wearable
 Tizen.Network.WiFi.dll                             #common #mobile #mobile-emul #tv #ivi #wearable
 Tizen.Network.WiFiDirect.dll                       #mobile #tv #ivi
 Tizen.NUI.dll                                      #common #mobile #mobile-emul #tv
index d6db19f..33ec2b3 100644 (file)
@@ -10,7 +10,7 @@
 
   <!-- Properties for directories -->
   <PropertyGroup>
-    <ToolsDir>$(MSBuildThisFileDirectory)..\tools\</ToolsDir>
+    <ToolsDir>$(MSBuildThisFileDirectory)..\tools\GenAPI\</ToolsDir>
     <GenAPISourceDir>$(MSBuildThisFileDirectory)\..\Artifacts\bin\</GenAPISourceDir>
     <GenAPILibDir>$(MSBuildThisFileDirectory)obj\_ref_lib\</GenAPILibDir>
     <GenAPITargetDir>$(MSBuildThisFileDirectory)obj\_ref_api\</GenAPITargetDir>
diff --git a/scripts/filelist.sh b/scripts/filelist.sh
deleted file mode 100755 (executable)
index 110aa5c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-
-SCRIPT_FILE=$(readlink -f $0)
-SCRIPT_DIR=$(dirname $SCRIPT_FILE)
-
-LISTFILE=$(readlink -f $SCRIPT_DIR/../filelist.txt)
-
-PATH_PREFIX="/usr/share/dotnet.tizen/framework"
-
-if [ ! -f $LISTFILE ]; then
-       echo "No filelist.txt"
-       exit 1
-fi
-
-PROFILE=$1; shift
-if [ -z "$PROFILE" ]; then
-       echo "No profile specified."
-       exit 1
-fi
-
-LIST=$(cat $LISTFILE | grep -E "#$PROFILE[[:space:]]|#$PROFILE$" | cut -d# -f1)
-
-for f in $LIST; do
-  echo "$PATH_PREFIX/$f"
-done
index 6f778c6..6355890 100644 (file)
@@ -40,6 +40,20 @@ namespace ElmSharp
         }
 
         /// <summary>
+        /// Gets the current known default pointer coordinates.
+        /// This function returns the current known canvas unit coordinates of the mouse pointer.
+        /// </summary>
+        public Point Pointer
+        {
+            get
+            {
+                int mx, my;
+                Interop.Evas.evas_pointer_canvas_xy_get(_handle, out mx, out my);
+                return new Point { X = mx, Y = my };
+            }
+        }
+
+        /// <summary>
         /// Gets or sets the image cache.
         /// This function returns the image cache size of canvas in bytes.
         /// </summary>
index 60e3d16..3dfd188 100644 (file)
@@ -465,6 +465,9 @@ internal static partial class Interop
         [DllImport(Libraries.Evas)]
         internal static extern void evas_image_cache_set(IntPtr obj, int size);
 
+        [DllImport(Libraries.Evas)]
+        internal static extern void evas_pointer_canvas_xy_get(IntPtr obj, out int mx, out int my);
+
         [DllImport(Libraries.Evas, EntryPoint = "evas_load_error_str")]
         internal static extern IntPtr _evas_load_error_str(LoadError error);
 
@@ -815,4 +818,4 @@ internal static partial class Interop
             evas_object_color_set(obj, r * a / 255, g * a / 255, b * a / 255, a);
         }
     }
-}
+}
\ No newline at end of file
diff --git a/tools/GenAPI/GenAPI.exe b/tools/GenAPI/GenAPI.exe
new file mode 100755 (executable)
index 0000000..53b1473
Binary files /dev/null and b/tools/GenAPI/GenAPI.exe differ
diff --git a/tools/GenAPI/GenAPI.runtimeconfig.json b/tools/GenAPI/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/GenAPI/Microsoft.Cci.Extensions.dll b/tools/GenAPI/Microsoft.Cci.Extensions.dll
new file mode 100644 (file)
index 0000000..2ce23b6
Binary files /dev/null and b/tools/GenAPI/Microsoft.Cci.Extensions.dll differ
diff --git a/tools/GenAPI/Microsoft.Cci.dll b/tools/GenAPI/Microsoft.Cci.dll
new file mode 100755 (executable)
index 0000000..0956d9a
Binary files /dev/null and b/tools/GenAPI/Microsoft.Cci.dll differ
diff --git a/tools/NuGet.exe b/tools/NuGet.exe
new file mode 100644 (file)
index 0000000..ec1309c
Binary files /dev/null and b/tools/NuGet.exe differ
diff --git a/tools/add_module.sh b/tools/add_module.sh
new file mode 100755 (executable)
index 0000000..57ea615
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+SCRIPT_FILE=$(readlink -f $0)
+SCRIPT_DIR=$(dirname $SCRIPT_FILE)
+ROOT_DIR=$(readlink -f $SCRIPT_DIR/..)
+
+MODULE_NAME=$1; shift
+
+if [ -z "$MODULE_NAME" ]; then
+  echo "No module name specified."
+  exit 1
+fi
+
+if [ -d "$ROOT_DIR/src/$MODULE_NAME" ]; then
+  echo "The module '$MODULE_NAME' already exists."
+fi
+
+mkdir -p $ROOT_DIR/src/$MODULE_NAME
+cp -f $SCRIPT_DIR/module.csproj.template $ROOT_DIR/src/$MODULE_NAME/$MODULE_NAME.csproj
+cd $ROOT_DIR/src/$MODULE_NAME
+dotnet new sln
+dotnet sln add $MODULE_NAME.csproj
+
+echo "New module [$ROOT_DIR/src/$MODULE_NAME] has been created."
\ No newline at end of file
diff --git a/tools/module.csproj.template b/tools/module.csproj.template
new file mode 100644 (file)
index 0000000..f79dd15
--- /dev/null
@@ -0,0 +1,11 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <Import Project="../../build/common.props" />
+
+  <PropertyGroup>
+    <TargetFramework>netstandard1.6</TargetFramework>
+  </PropertyGroup>
+
+
+
+  <Import Project="../../build/common.targets" />
+</Project>