Merged PR 1086962: Samples and build scripts clean-up
- Add sample app for compact SDK flavor (sample for MS Edge installer scenario) - Allow to build SDK without sudo / root - Remove unnecessary temporary auto-generated files - Move UTC sample to new location (in a private GitHub submodule)
This commit is contained in:
Родитель
c7f81bfc86
Коммит
31e42d3a02
|
@ -119,6 +119,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decoder", "..\lib\decoder\d
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleCppLogManagers", "..\examples\cpp\SampleCppLogManagers\SampleCppLogManagers.vcxproj", "{77053F92-F003-4D1C-A489-1DEB7CFEA4EC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleCppMini", "..\examples\cpp\SampleCppMini\SampleCppMini.vcxproj", "{86AC752C-5687-4377-841E-943D9BEEF361}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
..\lib\pal\universal\universal.vcxitems*{10e9165b-49d1-4d1c-8248-334b9905b9cc}*SharedItemsImports = 9
|
||||
|
@ -1095,6 +1097,48 @@ Global
|
|||
{77053F92-F003-4D1C-A489-1DEB7CFEA4EC}.Release|Win32.Build.0 = Release|Win32
|
||||
{77053F92-F003-4D1C-A489-1DEB7CFEA4EC}.Release|x64.ActiveCfg = Release|x64
|
||||
{77053F92-F003-4D1C-A489-1DEB7CFEA4EC}.Release|x64.Build.0 = Release|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.static|ARM.ActiveCfg = Debug.static|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.static|ARM64.ActiveCfg = Debug.static|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.static|ARM64.Build.0 = Debug.static|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.static|Win32.ActiveCfg = Debug.static|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.static|Win32.Build.0 = Debug.static|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.static|x64.ActiveCfg = Debug.static|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.static|x64.Build.0 = Debug.static|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.vs2015.MT-sqlite|ARM.ActiveCfg = Debug.vs2015.MT-sqlite|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.vs2015.MT-sqlite|ARM64.ActiveCfg = Debug.vs2015.MT-sqlite|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.vs2015.MT-sqlite|ARM64.Build.0 = Debug.vs2015.MT-sqlite|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.vs2015.MT-sqlite|Win32.ActiveCfg = Debug.vs2015.MT-sqlite|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.vs2015.MT-sqlite|Win32.Build.0 = Debug.vs2015.MT-sqlite|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.vs2015.MT-sqlite|x64.ActiveCfg = Debug.vs2015.MT-sqlite|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug.vs2015.MT-sqlite|x64.Build.0 = Debug.vs2015.MT-sqlite|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug|ARM.ActiveCfg = Debug|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Debug|x64.Build.0 = Debug|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.static|ARM.ActiveCfg = Release.static|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.static|ARM64.ActiveCfg = Release.static|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.static|ARM64.Build.0 = Release.static|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.static|Win32.ActiveCfg = Release.static|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.static|Win32.Build.0 = Release.static|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.static|x64.ActiveCfg = Release.static|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.static|x64.Build.0 = Release.static|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.vs2015.MT-sqlite|ARM.ActiveCfg = Release.vs2015.MT-sqlite|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.vs2015.MT-sqlite|ARM64.ActiveCfg = Release.vs2015.MT-sqlite|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.vs2015.MT-sqlite|ARM64.Build.0 = Release.vs2015.MT-sqlite|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.vs2015.MT-sqlite|Win32.ActiveCfg = Release.vs2015.MT-sqlite|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.vs2015.MT-sqlite|Win32.Build.0 = Release.vs2015.MT-sqlite|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.vs2015.MT-sqlite|x64.ActiveCfg = Release.vs2015.MT-sqlite|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release.vs2015.MT-sqlite|x64.Build.0 = Release.vs2015.MT-sqlite|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release|ARM.ActiveCfg = Release|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release|Win32.Build.0 = Release|Win32
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release|x64.ActiveCfg = Release|x64
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1121,6 +1165,7 @@ Global
|
|||
{65AFA0E2-F9A2-4309-87E7-E419D59583C1} = {11A3C4B2-1800-4A80-9771-E92E98B9485B}
|
||||
{F797B22C-A1C4-4136-9DCC-0682A183A4DA} = {11A3C4B2-1800-4A80-9771-E92E98B9485B}
|
||||
{77053F92-F003-4D1C-A489-1DEB7CFEA4EC} = {D31B3404-AE47-4D0A-9A59-C321164F945C}
|
||||
{86AC752C-5687-4377-841E-943D9BEEF361} = {D31B3404-AE47-4D0A-9A59-C321164F945C}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7EE8585B-C10F-4DAC-BDAF-3726EDF8FCD7}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
cd "$(dirname "$0")"
|
||||
cd `dirname $0`
|
||||
cd googletest
|
||||
set -evx
|
||||
env | sort
|
||||
rm -rf build
|
||||
mkdir -p build || true
|
||||
cd build
|
||||
cmake -Dgtest_build_samples=ON \
|
||||
|
|
12
build.sh
12
build.sh
|
@ -6,6 +6,8 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
echo "Current directory: $DIR"
|
||||
cd $DIR
|
||||
|
||||
export NOROOT=$NOROOT
|
||||
|
||||
if [ "$1" == "clean" ]; then
|
||||
rm -f CMakeCache.txt *.cmake
|
||||
rm -rf out
|
||||
|
@ -13,13 +15,17 @@ if [ "$1" == "clean" ]; then
|
|||
# make clean
|
||||
fi
|
||||
|
||||
if [ "$1" == "noroot" ] || [ "$2" == "noroot" ]; then
|
||||
export NOROOT=true
|
||||
fi
|
||||
|
||||
# Install build tools and recent sqlite3
|
||||
FILE=.buildtools
|
||||
OS_NAME=`uname -a`
|
||||
if [ ! -f $FILE ]; then
|
||||
case "$OS_NAME" in
|
||||
*Darwin*) tools/setup-buildtools-mac.sh ;;
|
||||
*Linux*) sudo tools/setup-buildtools.sh ;;
|
||||
*Linux*) [[ -z "$NOROOT" ]] && sudo tools/setup-buildtools.sh || echo "No root: skipping build tools installation." ;;
|
||||
*) echo "WARNING: unsupported OS $OS_NAME , skipping build tools installation.."
|
||||
esac
|
||||
# Assume that the build tools have been successfully installed
|
||||
|
@ -83,12 +89,12 @@ make package
|
|||
# Debian / Ubuntu / Raspbian
|
||||
if [ -f /usr/bin/dpkg ]; then
|
||||
# Install new package
|
||||
sudo dpkg -i *.deb
|
||||
[[ -z "$NOROOT" ]] && sudo dpkg -i *.deb || echo "No root: skipping package deployment."
|
||||
fi
|
||||
|
||||
# RedHat / CentOS
|
||||
if [ -f /usr/bin/rpmbuild ]; then
|
||||
sudo rpm -i --force -v *.rpm
|
||||
[[ -z "$NOROOT" ]] && sudo rpm -i --force -v *.rpm || echo "No root: skipping package deployment."
|
||||
fi
|
||||
|
||||
# Install SDK headers and lib to /usr/local
|
||||
|
|
|
@ -1,238 +0,0 @@
|
|||
# CMAKE generated file: DO NOT EDIT!
|
||||
# Generated by "Unix Makefiles" Generator, CMake Version 3.12
|
||||
|
||||
# Default target executed when no arguments are given to make.
|
||||
default_target: all
|
||||
|
||||
.PHONY : default_target
|
||||
|
||||
# Allow only one "make -f Makefile2" at a time, but pass parallelism.
|
||||
.NOTPARALLEL:
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Special targets provided by cmake.
|
||||
|
||||
# Disable implicit rules so canonical targets will work.
|
||||
.SUFFIXES:
|
||||
|
||||
|
||||
# Remove some rules from gmake that .SUFFIXES does not remove.
|
||||
SUFFIXES =
|
||||
|
||||
.SUFFIXES: .hpux_make_needs_suffix_list
|
||||
|
||||
|
||||
# Suppress display of executed commands.
|
||||
$(VERBOSE).SILENT:
|
||||
|
||||
|
||||
# A target that is always out of date.
|
||||
cmake_force:
|
||||
|
||||
.PHONY : cmake_force
|
||||
|
||||
#=============================================================================
|
||||
# Set environment variables for the build.
|
||||
|
||||
# The shell in which to execute make rules.
|
||||
SHELL = /bin/sh
|
||||
|
||||
# The CMake executable.
|
||||
CMAKE_COMMAND = /usr/local/Cellar/cmake/3.12.4/bin/cmake
|
||||
|
||||
# The command to remove a file.
|
||||
RM = /usr/local/Cellar/cmake/3.12.4/bin/cmake -E remove -f
|
||||
|
||||
# Escaping for special characters.
|
||||
EQUALS = =
|
||||
|
||||
# The top-level source directory on which CMake was run.
|
||||
CMAKE_SOURCE_DIR = /build/Aria.SDK.Cpp/examples/Cpp/SampleCpp
|
||||
|
||||
# The top-level build directory on which CMake was run.
|
||||
CMAKE_BINARY_DIR = /build/Aria.SDK.Cpp/examples/Cpp/SampleCpp/out
|
||||
|
||||
#=============================================================================
|
||||
# Targets provided globally by CMake.
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
|
||||
/usr/local/Cellar/cmake/3.12.4/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||
.PHONY : rebuild_cache
|
||||
|
||||
# Special rule for the target rebuild_cache
|
||||
rebuild_cache/fast: rebuild_cache
|
||||
|
||||
.PHONY : rebuild_cache/fast
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache:
|
||||
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
|
||||
/usr/local/Cellar/cmake/3.12.4/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
|
||||
.PHONY : edit_cache
|
||||
|
||||
# Special rule for the target edit_cache
|
||||
edit_cache/fast: edit_cache
|
||||
|
||||
.PHONY : edit_cache/fast
|
||||
|
||||
# The main all target
|
||||
all: cmake_check_build_system
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /build/Aria.SDK.Cpp/examples/Cpp/SampleCpp/out/CMakeFiles /build/Aria.SDK.Cpp/examples/Cpp/SampleCpp/out/CMakeFiles/progress.marks
|
||||
$(MAKE) -f CMakeFiles/Makefile2 all
|
||||
$(CMAKE_COMMAND) -E cmake_progress_start /build/Aria.SDK.Cpp/examples/Cpp/SampleCpp/out/CMakeFiles 0
|
||||
.PHONY : all
|
||||
|
||||
# The main clean target
|
||||
clean:
|
||||
$(MAKE) -f CMakeFiles/Makefile2 clean
|
||||
.PHONY : clean
|
||||
|
||||
# The main clean target
|
||||
clean/fast: clean
|
||||
|
||||
.PHONY : clean/fast
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall: all
|
||||
$(MAKE) -f CMakeFiles/Makefile2 preinstall
|
||||
.PHONY : preinstall
|
||||
|
||||
# Prepare targets for installation.
|
||||
preinstall/fast:
|
||||
$(MAKE) -f CMakeFiles/Makefile2 preinstall
|
||||
.PHONY : preinstall/fast
|
||||
|
||||
# clear depends
|
||||
depend:
|
||||
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
|
||||
.PHONY : depend
|
||||
|
||||
#=============================================================================
|
||||
# Target rules for targets named SampleCpp
|
||||
|
||||
# Build rule for target.
|
||||
SampleCpp: cmake_check_build_system
|
||||
$(MAKE) -f CMakeFiles/Makefile2 SampleCpp
|
||||
.PHONY : SampleCpp
|
||||
|
||||
# fast build rule for target.
|
||||
SampleCpp/fast:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/build
|
||||
.PHONY : SampleCpp/fast
|
||||
|
||||
DebugCallback.o: DebugCallback.cpp.o
|
||||
|
||||
.PHONY : DebugCallback.o
|
||||
|
||||
# target to build an object file
|
||||
DebugCallback.cpp.o:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/DebugCallback.cpp.o
|
||||
.PHONY : DebugCallback.cpp.o
|
||||
|
||||
DebugCallback.i: DebugCallback.cpp.i
|
||||
|
||||
.PHONY : DebugCallback.i
|
||||
|
||||
# target to preprocess a source file
|
||||
DebugCallback.cpp.i:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/DebugCallback.cpp.i
|
||||
.PHONY : DebugCallback.cpp.i
|
||||
|
||||
DebugCallback.s: DebugCallback.cpp.s
|
||||
|
||||
.PHONY : DebugCallback.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
DebugCallback.cpp.s:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/DebugCallback.cpp.s
|
||||
.PHONY : DebugCallback.cpp.s
|
||||
|
||||
demo.o: demo.c.o
|
||||
|
||||
.PHONY : demo.o
|
||||
|
||||
# target to build an object file
|
||||
demo.c.o:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/demo.c.o
|
||||
.PHONY : demo.c.o
|
||||
|
||||
demo.i: demo.c.i
|
||||
|
||||
.PHONY : demo.i
|
||||
|
||||
# target to preprocess a source file
|
||||
demo.c.i:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/demo.c.i
|
||||
.PHONY : demo.c.i
|
||||
|
||||
demo.s: demo.c.s
|
||||
|
||||
.PHONY : demo.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
demo.c.s:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/demo.c.s
|
||||
.PHONY : demo.c.s
|
||||
|
||||
main.o: main.cpp.o
|
||||
|
||||
.PHONY : main.o
|
||||
|
||||
# target to build an object file
|
||||
main.cpp.o:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/main.cpp.o
|
||||
.PHONY : main.cpp.o
|
||||
|
||||
main.i: main.cpp.i
|
||||
|
||||
.PHONY : main.i
|
||||
|
||||
# target to preprocess a source file
|
||||
main.cpp.i:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/main.cpp.i
|
||||
.PHONY : main.cpp.i
|
||||
|
||||
main.s: main.cpp.s
|
||||
|
||||
.PHONY : main.s
|
||||
|
||||
# target to generate assembly for a file
|
||||
main.cpp.s:
|
||||
$(MAKE) -f CMakeFiles/SampleCpp.dir/build.make CMakeFiles/SampleCpp.dir/main.cpp.s
|
||||
.PHONY : main.cpp.s
|
||||
|
||||
# Help Target
|
||||
help:
|
||||
@echo "The following are some of the valid targets for this Makefile:"
|
||||
@echo "... all (the default if no target is provided)"
|
||||
@echo "... clean"
|
||||
@echo "... depend"
|
||||
@echo "... rebuild_cache"
|
||||
@echo "... edit_cache"
|
||||
@echo "... SampleCpp"
|
||||
@echo "... DebugCallback.o"
|
||||
@echo "... DebugCallback.i"
|
||||
@echo "... DebugCallback.s"
|
||||
@echo "... demo.o"
|
||||
@echo "... demo.i"
|
||||
@echo "... demo.s"
|
||||
@echo "... main.o"
|
||||
@echo "... main.i"
|
||||
@echo "... main.s"
|
||||
.PHONY : help
|
||||
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Special targets to cleanup operation of make.
|
||||
|
||||
# Special rule to run CMake to check the build system integrity.
|
||||
# No rule that depends on this can have commands that come from listfiles
|
||||
# because they might be regenerated.
|
||||
cmake_check_build_system:
|
||||
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
|
||||
.PHONY : cmake_check_build_system
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
# Install script for directory: /build/Aria.SDK.Cpp/examples/Cpp/SampleCpp
|
||||
|
||||
# Set the install prefix
|
||||
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local")
|
||||
endif()
|
||||
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# Set the install configuration name.
|
||||
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||
if(BUILD_TYPE)
|
||||
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_CONFIG_NAME "")
|
||||
endif()
|
||||
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
||||
endif()
|
||||
|
||||
# Set the component getting installed.
|
||||
if(NOT CMAKE_INSTALL_COMPONENT)
|
||||
if(COMPONENT)
|
||||
message(STATUS "Install component: \"${COMPONENT}\"")
|
||||
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
|
||||
else()
|
||||
set(CMAKE_INSTALL_COMPONENT)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Is this installation the result of a crosscompile?
|
||||
if(NOT DEFINED CMAKE_CROSSCOMPILING)
|
||||
set(CMAKE_CROSSCOMPILING "FALSE")
|
||||
endif()
|
||||
|
||||
if(CMAKE_INSTALL_COMPONENT)
|
||||
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
|
||||
else()
|
||||
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
|
||||
"${CMAKE_INSTALL_MANIFEST_FILES}")
|
||||
file(WRITE "/build/Aria.SDK.Cpp/examples/Cpp/SampleCpp/out/${CMAKE_INSTALL_MANIFEST}"
|
||||
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
|
|
@ -0,0 +1,49 @@
|
|||
cmake_minimum_required(VERSION 3.1.0)
|
||||
project(SampleCppMini)
|
||||
|
||||
# Uncomment for building i386 binary on x86_64 system
|
||||
#set(CMAKE_SYSTEM_PROCESSOR i386)
|
||||
|
||||
# For ARM / Raspberry Pi 3 cross-compile
|
||||
# set(MAT_SDK_LIB /usr/local/lib/armv7l-linux-gnu)
|
||||
|
||||
# Point example to SDK dirs for x86_64 Desktop
|
||||
if(EXISTS "/usr/local/lib/libmat.a")
|
||||
# Use local libmat.a
|
||||
set(MAT_SDK_LIB /usr/local/lib/)
|
||||
else()
|
||||
# Use architecture-specific libmat.a
|
||||
set(MAT_SDK_LIB /usr/local/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu)
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
|
||||
|
||||
find_package (Threads)
|
||||
|
||||
set(MAT_SDK_INCLUDE /usr/local/include/aria)
|
||||
|
||||
# Aria SDK to include dirs
|
||||
include_directories( . ${MAT_SDK_INCLUDE} )
|
||||
|
||||
# Link main.cpp to executable
|
||||
add_executable(SampleCppMini main.cpp DebugCallback.cpp demo.c)
|
||||
source_group(" " REGULAR_EXPRESSION "")
|
||||
|
||||
# Prefer linking to more recent local sqlite3
|
||||
if(EXISTS "/usr/local/lib/libsqlite3.a")
|
||||
set (SQLITE3_LIB "/usr/local/lib/libsqlite3.a")
|
||||
else()
|
||||
set (SQLITE3_LIB "sqlite3")
|
||||
endif()
|
||||
|
||||
set (PLATFORM_LIBS "")
|
||||
# Add flags for obtaining system UUID via IOKit
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set (PLATFORM_LIBS "-framework CoreFoundation -framework IOKit")
|
||||
endif()
|
||||
|
||||
#tcmalloc turned off by default
|
||||
#target_link_libraries(SampleCppMini ${MAT_SDK_LIB}/libmat.a curl z ${CMAKE_THREAD_LIBS_INIT} ${SQLITE3_LIB} dl tcmalloc)
|
||||
|
||||
target_link_libraries(SampleCppMini ${MAT_SDK_LIB}/libmat.a curl z ${CMAKE_THREAD_LIBS_INIT} ${SQLITE3_LIB} ${PLATFORM_LIBS} dl)
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="demo.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="deploy-dll.cmd" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
mkdir -p out
|
||||
cd out
|
||||
cmake ..
|
||||
make
|
||||
# Strip for release
|
||||
# strip SampleCppMini
|
|
@ -0,0 +1,66 @@
|
|||
#include "mat.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void test_c_api(const char * token)
|
||||
{
|
||||
|
||||
#if 0 /* No JSON parser in smallest SKU */
|
||||
static const char* config_template =
|
||||
"{"
|
||||
"\"cacheFilePath\":\"MyOfflineStorage.db\"," // Custom storage path
|
||||
"\"config\":{\"host\": \"*\"}," // Attach as guest to any host
|
||||
"\"name\":\"C-API-Client-0\"," // Module ID
|
||||
"\"version\":\"1.0.0\"," // Module semver
|
||||
"\"primaryToken\":\"%s\"," // Primary Token
|
||||
"\"maxTeardownUploadTimeInSec\":5," // Allow up to 5 seconds for upload
|
||||
"\"hostMode\":false," // Explicitly declare yourself as guest
|
||||
"\"minimumTraceLevel\":0," // Debug printout level
|
||||
"\"sdkmode\":0" // SDK direct-upload mode
|
||||
"}";
|
||||
static char config[1024] = { 0 };
|
||||
snprintf(config, sizeof(config), config_template, token);
|
||||
#endif
|
||||
|
||||
printf("Testing C API...\t");
|
||||
|
||||
#if 1 // Initialize using TOKEN
|
||||
evt_handle_t handle = evt_open(token);
|
||||
#else // Initialize using ILogConfiguration in JSON format
|
||||
evt_handle_t handle = evt_open((const char *)config);
|
||||
#endif
|
||||
|
||||
// Ref. https://docs.microsoft.com/en-us/windows/privacy/basic-level-windows-diagnostic-events-and-fields for description of Common Schema fields
|
||||
evt_prop event[] = TELEMETRY_EVENT
|
||||
(
|
||||
// Common Data Extensions.Envelope - reserved keywords that C API should not use.
|
||||
// Alternate solution is to declare a special macro for envelope 'root' namespace props,
|
||||
// such as $STR, $INT, etc.
|
||||
_STR("name", "Event.Name.Pure.C"), // Represents the uniquely qualified name for the event
|
||||
_STR("ver", "3.0"), // Represents the major and minor version of the extension
|
||||
_STR("time", "1979-08-12"), // Represents the event date time in Coordinated Universal Time(UTC) when the event was generated on the client.This should be in ISO 8601 format
|
||||
_INT("popSample", 100), // Represents the effective sample rate for this event at the time it was generated by a client
|
||||
// FIXME: [MG] - iKey should only be needed if logging to alternate token, otherwise we should use the primaryToken by default
|
||||
_STR("iKey", token), // Represents an ID for applications or other logical groupings of events.
|
||||
_INT("flags", 0xffffffff), // Represents a collection of bits that describe how the event should be processed ...
|
||||
_STR("cV", "12345"), // Represents the Correlation Vector : A single field for tracking partial order of related telemetry events across component boundaries.
|
||||
// Customer Data fields go as part of userdata
|
||||
_STR("strKey", "value1"),
|
||||
_INT("intKey", 12345),
|
||||
PII_STR("piiKey", "secret", 1), // TODO: copy-paste-translate the Pii Kind enum from C++ to C
|
||||
// Part "X" demo - populating CS extension props
|
||||
// Common Data Extensions.App
|
||||
PII_STR("ext.app.userId", "jackfrost@microsoft.com", 1),
|
||||
_STR("ext.app.ver", "1.0.0")
|
||||
);
|
||||
|
||||
evt_log(handle, event);
|
||||
evt_flush(handle);
|
||||
// FIXME: [MG] - default settings are optimized for 'fast shutdown' and not giving enough time for SDK to upload the event logged.
|
||||
// However, if you restart this sample - events from a previous run get uploaded. Modify the
|
||||
evt_upload(handle);
|
||||
evt_close(handle);
|
||||
|
||||
printf("[ DONE ]\n");
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
copy %3\..\win32-mini-dll\*.dll %3
|
||||
copy %3\..\win32-mini-dll\*.pdb %3
|
||||
exit /b 0
|
|
@ -0,0 +1,111 @@
|
|||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#define API_KEY "99999999999999999999999999999999-99999999-9999-9999-9999-999999999999-9999"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "LogManager.hpp"
|
||||
|
||||
using namespace MAT;
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma comment(lib, "Ole32.Lib") /* needed for CoCreateGuid */
|
||||
#pragma comment(lib, "Advapi32.Lib") /* needed for RegGetValueA */
|
||||
#endif
|
||||
|
||||
LOGMANAGER_INSTANCE
|
||||
|
||||
extern "C" void test_c_api(const char *token);
|
||||
|
||||
void test_cpp_api(const char * token, int ticketType, const char *ticket)
|
||||
{
|
||||
printf("Testing C++ API...\t");
|
||||
|
||||
// LogManager configuration
|
||||
auto& config = LogManager::GetLogConfiguration();
|
||||
// config[CFG_INT_SDK_MODE] = SdkModeTypes::SdkModeTypes_UTCCommonSchema;
|
||||
|
||||
// LogManager initialization
|
||||
ILogger *logger = LogManager::Initialize(token);
|
||||
|
||||
if (ticket != nullptr)
|
||||
{
|
||||
const char *ticketNames[7] =
|
||||
{
|
||||
"TicketType_MSA_Device",
|
||||
"TicketType_MSA_User",
|
||||
"TicketType_XAuth_Device",
|
||||
"TicketType_XAuth_User",
|
||||
"TicketType_AAD",
|
||||
"TicketType_AAD_User",
|
||||
"TicketType_AAD_JWT",
|
||||
};
|
||||
printf("\nSet ticket %s=%s\n", ticketNames[ticketType], ticket);
|
||||
auto tc = LogManager::GetAuthTokensController();
|
||||
tc->SetStrictMode(true);
|
||||
tc->SetTicketToken((TicketType)ticketType, ticket);
|
||||
}
|
||||
|
||||
// Log simple event without any properties
|
||||
logger->LogEvent("MyApp.simple_event");
|
||||
|
||||
ISemanticContext *global_ctx = LogManager::GetSemanticContext();
|
||||
auto local_ctx = logger->GetSemanticContext();
|
||||
logger->SetContext("Local.Context.Variable", "value");
|
||||
|
||||
// Log detailed event with various properties
|
||||
EventProperties detailed_event("MyApp.detailed_event",
|
||||
{
|
||||
// Log compiler version
|
||||
{ "_MSC_VER", _MSC_VER },
|
||||
// Pii-typed fields
|
||||
{ "piiKind.None", EventProperty("field_value", PiiKind_None) },
|
||||
{ "piiKind.DistinguishedName", EventProperty("/CN=Jack Frost,OU=PIE,DC=REDMOND,DC=COM", PiiKind_DistinguishedName) },
|
||||
{ "piiKind.GenericData", EventProperty("generic_data", PiiKind_GenericData) },
|
||||
{ "piiKind.IPv4Address", EventProperty("127.0.0.1", PiiKind_IPv4Address) },
|
||||
{ "piiKind.IPv6Address", EventProperty("2001:0db8:85a3:0000:0000:8a2e:0370:7334", PiiKind_IPv6Address) },
|
||||
{ "piiKind.MailSubject", EventProperty("RE: test", PiiKind_MailSubject) },
|
||||
{ "piiKind.PhoneNumber", EventProperty("+1-425-829-5875", PiiKind_PhoneNumber) },
|
||||
{ "piiKind.QueryString", EventProperty("a=1&b=2&c=3", PiiKind_QueryString) },
|
||||
{ "piiKind.SipAddress", EventProperty("sip:info@microsoft.com", PiiKind_SipAddress) },
|
||||
{ "piiKind.SmtpAddress", EventProperty("Jack Frost <jackfrost@fabrikam.com>", PiiKind_SmtpAddress) },
|
||||
{ "piiKind.Identity", EventProperty("Jack Frost", PiiKind_Identity) },
|
||||
{ "piiKind.Uri", EventProperty("http://www.microsoft.com", PiiKind_Uri) },
|
||||
{ "piiKind.Fqdn", EventProperty("www.microsoft.com", PiiKind_Fqdn) },
|
||||
// Various typed key-values
|
||||
{ "strKey1", "hello1" },
|
||||
{ "strKey2", "hello2" },
|
||||
{ "int64Key", 1L },
|
||||
{ "dblKey", 3.14 },
|
||||
{ "boolKey", false },
|
||||
{ "guidKey0", GUID_t("00000000-0000-0000-0000-000000000000") },
|
||||
{ "guidKey1", GUID_t("00010203-0405-0607-0809-0A0B0C0D0E0F") },
|
||||
{ "guidKey2", GUID_t("00010203-0405-0607-0809-0A0B0C0D0E0F") },
|
||||
{ "timeKey1", time_ticks_t((uint64_t)0) }, // time in .NET ticks
|
||||
});
|
||||
logger->LogEvent(detailed_event);
|
||||
|
||||
// Shutdown
|
||||
LogManager::FlushAndTeardown();
|
||||
|
||||
printf("[ DONE ]\n");
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
printf("Microsoft Event Analytics 1DS pipe test tool \n");
|
||||
printf("=============================================\n");
|
||||
|
||||
const char *token = (argc > 1) ? argv[1] : API_KEY;
|
||||
int type = (argc > 2) ? atoi(argv[2]) : TicketType::TicketType_MSA_Device;
|
||||
const char *ticket = (argc > 3) ? argv[3] : nullptr;
|
||||
|
||||
// Send event using C API
|
||||
test_c_api(token);
|
||||
|
||||
// Send event using C++ API
|
||||
test_cpp_api(token, type, ticket);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
|
||||
##
|
||||
## Clean-up previous results
|
||||
##
|
||||
#sudo rm /tmp/aria*.log
|
||||
#sudo rm offline*
|
||||
#sudo rm -f heap*
|
||||
|
||||
BIN=./out/SampleCppMini
|
||||
|
||||
case $1 in
|
||||
|
||||
"")
|
||||
echo "Running basic test..."
|
||||
$BIN
|
||||
;;
|
||||
|
||||
1)
|
||||
echo "Running heap check..."
|
||||
export PPROF_PATH=/usr/local/bin
|
||||
export HEAPCHECK=normal
|
||||
$BIN
|
||||
;;
|
||||
|
||||
2)
|
||||
echo "Running gdb..."
|
||||
gdb -ex=r --args $BIN
|
||||
;;
|
||||
|
||||
3)
|
||||
echo "Running valgrind..."
|
||||
valgrind -v $BIN
|
||||
;;
|
||||
|
||||
4)
|
||||
echo "Running valgrind leak check..."
|
||||
valgrind -v --track-origins=yes --leak-check=full $BIN
|
||||
;;
|
||||
|
||||
5)
|
||||
echo "Running cgroups 300MB memory test..."
|
||||
cgcreate -g memory:/300MB
|
||||
echo $(( 300 * 1024 * 1024 )) > /sys/fs/cgroup/memory/300MB/memory.limit_in_bytes
|
||||
cgexec -g memory:/300MB $BIN
|
||||
;;
|
||||
|
||||
esac
|
|
@ -3,8 +3,8 @@
|
|||
#define MAT_VERSION_HPP
|
||||
// WARNING: DO NOT MODIFY THIS FILE!
|
||||
// This file has been automatically generated, manual changes will be lost.
|
||||
#define BUILD_VERSION_STR "3.2.143.1"
|
||||
#define BUILD_VERSION 3,2,143,1
|
||||
#define BUILD_VERSION_STR "3.2.170.1"
|
||||
#define BUILD_VERSION 3,2,170,1
|
||||
|
||||
#ifndef RESOURCE_COMPILER_INVOKED
|
||||
#include <stdint.h>
|
||||
|
@ -30,7 +30,7 @@ namespace ARIASDK_NS_BEGIN {
|
|||
uint64_t const Version =
|
||||
((uint64_t)3 << 48) |
|
||||
((uint64_t)2 << 32) |
|
||||
((uint64_t)143 << 16) |
|
||||
((uint64_t)170 << 16) |
|
||||
((uint64_t)1);
|
||||
|
||||
} ARIASDK_NS_END
|
||||
|
|
|
@ -0,0 +1,330 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
**/Properties/launchSettings.json
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
|
@ -0,0 +1,5 @@
|
|||
include
|
||||
lib
|
||||
offlinestorage*.*
|
||||
Release
|
||||
x64
|
|
@ -0,0 +1,150 @@
|
|||
#include "DebugCallback.hpp"
|
||||
|
||||
unsigned latency[MAX_LATENCY_SAMPLES] = { 0 };
|
||||
|
||||
std::atomic<size_t> eps(0);
|
||||
std::atomic<size_t> numLogged0(0);
|
||||
std::atomic<size_t> numLogged(0);
|
||||
std::atomic<size_t> numSent(0);
|
||||
std::atomic<size_t> numDropped(0);
|
||||
std::atomic<size_t> numReject(0);
|
||||
std::atomic<size_t> numCached(0);
|
||||
std::atomic<size_t> logLatMin(100);
|
||||
std::atomic<size_t> logLatMax(0);
|
||||
unsigned long testStartMs;
|
||||
|
||||
/// <summary>
|
||||
/// The network cost names
|
||||
/// </summary>
|
||||
const char* networkCostNames[] = {
|
||||
"Unknown",
|
||||
"Unmetered",
|
||||
"Metered",
|
||||
"Roaming",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Resets this instance.
|
||||
/// </summary>
|
||||
void MyDebugEventListener::reset()
|
||||
{
|
||||
testStartMs = (unsigned long) (std::chrono::system_clock::now().time_since_epoch() / std::chrono::milliseconds(1));
|
||||
eps = 0;
|
||||
numLogged0 = 0;
|
||||
numLogged = 0;
|
||||
numSent = 0;
|
||||
numDropped = 0;
|
||||
numReject = 0;
|
||||
numCached = 0;
|
||||
logLatMin = 100;
|
||||
logLatMax = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The DebugEventListener constructor.
|
||||
/// </summary>
|
||||
/// <param name="evt"></param>
|
||||
void MyDebugEventListener::OnDebugEvent(DebugEvent &evt)
|
||||
{
|
||||
// lock for the duration of the print, so that we don't mess up the prints
|
||||
std::lock_guard<std::mutex> lock(dbg_callback_mtx);
|
||||
unsigned long ms;
|
||||
|
||||
switch (evt.type) {
|
||||
case EVT_LOG_EVENT:
|
||||
// Track LogEvent latency here
|
||||
if (evt.param1 < logLatMin)
|
||||
logLatMin = evt.param1;
|
||||
if (evt.param1 > logLatMax)
|
||||
logLatMax = evt.param1;
|
||||
case EVT_LOG_LIFECYCLE:
|
||||
case EVT_LOG_FAILURE:
|
||||
case EVT_LOG_PAGEVIEW:
|
||||
case EVT_LOG_PAGEACTION:
|
||||
case EVT_LOG_SAMPLEMETR:
|
||||
case EVT_LOG_AGGRMETR:
|
||||
case EVT_LOG_TRACE:
|
||||
case EVT_LOG_USERSTATE:
|
||||
case EVT_LOG_SESSION:
|
||||
// printf("OnEventLogged: seq=%llu, ts=%llu, type=0x%08x, p1=%u, p2=%u\n", evt.seq, evt.ts, evt.type, evt.param1, evt.param2);
|
||||
numLogged++;
|
||||
ms = (unsigned long) (std::chrono::system_clock::now().time_since_epoch() / std::chrono::milliseconds(1));
|
||||
{
|
||||
eps = (1000 * numLogged) / (ms - testStartMs);
|
||||
if ((numLogged % 500) == 0)
|
||||
{
|
||||
printf("EPS=%zu\n", eps.load() );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EVT_REJECTED:
|
||||
numReject++;
|
||||
if ((numReject % 10) == 0)
|
||||
printf("R10\n");
|
||||
// printf("OnEventRejected: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", evt.seq, evt.ts, evt.type, evt.param1, evt.param2);
|
||||
break;
|
||||
case EVT_ADDED:
|
||||
printf("+");
|
||||
// printf("OnEventAdded: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", evt.seq, evt.ts, evt.type, evt.param1, evt.param2);
|
||||
break;
|
||||
case EVT_CACHED:
|
||||
numCached += evt.param1;
|
||||
printf("OnEventCached: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", evt.seq, evt.ts, evt.type, evt.param1, evt.param2);
|
||||
break;
|
||||
case EVT_DROPPED:
|
||||
numDropped += evt.param1;
|
||||
if ((numDropped % 10) == 0)
|
||||
printf("D10\n");
|
||||
// printf("OnEventDropped: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", evt.seq, evt.ts, evt.type, evt.param1, evt.param2);
|
||||
break;
|
||||
case EVT_SENT:
|
||||
numSent += evt.param1;
|
||||
printf("OnEventsSent: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", evt.seq, evt.ts, evt.type, evt.param1, evt.param2);
|
||||
break;
|
||||
case EVT_STORAGE_FULL:
|
||||
printf("OnStorageFull: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", evt.seq, evt.ts, evt.type, evt.param1, evt.param2);
|
||||
if (evt.param1 >= 75) {
|
||||
// UploadNow must NEVER EVER be called from SDK callback thread, so either use this structure below
|
||||
// or notify the main app that it has to do the profile timers housekeeping / force the upload...
|
||||
std::thread([]() { LogManager::UploadNow(); }).detach();
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_CONN_FAILURE:
|
||||
case EVT_HTTP_FAILURE:
|
||||
case EVT_COMPRESS_FAILED:
|
||||
case EVT_UNKNOWN_HOST:
|
||||
case EVT_SEND_FAILED:
|
||||
printf("OnEventsSendFailed: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", evt.seq, evt.ts, evt.type, evt.param1, evt.param2);
|
||||
break;
|
||||
case EVT_HTTP_ERROR:
|
||||
printf("OnHttpError: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu, data=%p, size=%zu\n",
|
||||
evt.seq, evt.ts, evt.type, evt.param1, evt.param2, evt.data, evt.size);
|
||||
break;
|
||||
case EVT_HTTP_OK:
|
||||
printf("OnHttpOK: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu, data=%p, size=%zu\n",
|
||||
evt.seq, evt.ts, evt.type, evt.param1, evt.param2, evt.data, evt.size);
|
||||
break;
|
||||
case EVT_SEND_RETRY:
|
||||
printf("OnSendRetry: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu, data=%p, size=%zu\n",
|
||||
evt.seq, evt.ts, evt.type, evt.param1, evt.param2, evt.data, evt.size);
|
||||
break;
|
||||
case EVT_SEND_RETRY_DROPPED:
|
||||
printf("OnSendRetryDropped: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu, data=%p, size=%zu\n",
|
||||
evt.seq, evt.ts, evt.type, evt.param1, evt.param2, evt.data, evt.size);
|
||||
break;
|
||||
case EVT_NET_CHANGED:
|
||||
printf("OnNetChanged: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu [%s]\n",
|
||||
evt.seq, evt.ts, evt.type, evt.param1, evt.param2, networkCostNames[evt.param1]);
|
||||
if (evt.param2)
|
||||
{
|
||||
printf("Malwarebytes Antiexploit has been detected! Network cost is unknown.\n");
|
||||
}
|
||||
break;
|
||||
case EVT_UNKNOWN:
|
||||
default:
|
||||
printf("OnEventUnknown: seq=%llu, ts=%llu, type=0x%08x, p1=%zu, p2=%zu\n", evt.seq, evt.ts, evt.type, evt.param1, evt.param2);
|
||||
break;
|
||||
};
|
||||
|
||||
};
|
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include "LogManager.hpp"
|
||||
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <thread>
|
||||
|
||||
using namespace MAT;
|
||||
|
||||
static const constexpr size_t MAX_LATENCY_SAMPLES = 10;
|
||||
|
||||
class MyDebugEventListener : public DebugEventListener {
|
||||
std::mutex dbg_callback_mtx;
|
||||
|
||||
public:
|
||||
MyDebugEventListener() : DebugEventListener()
|
||||
{
|
||||
reset();
|
||||
}
|
||||
virtual void OnDebugEvent(DebugEvent &evt);
|
||||
virtual void reset();
|
||||
};
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
set PROJECT_DIR=%~dp0
|
||||
|
||||
@mkdir %PROJECT_DIR%\include
|
||||
copy %PROJECT_DIR%..\..\..\lib\include\public\*.* %PROJECT_DIR%\include
|
||||
|
||||
@mkdir %PROJECT_DIR%\lib\%1\%2
|
||||
copy %PROJECT_DIR%..\..\..\Solutions\out\%1\%2\win32-dll\*.lib %PROJECT_DIR%\lib\%1\%2
|
||||
|
||||
@mkdir %PROJECT_DIR%\%1\%2
|
||||
copy %PROJECT_DIR%..\..\
|
||||
copy %PROJECT_DIR%..\..\..\Solutions\out\%1\%2\win32-dll\*.* %PROJECT_DIR%\lib\%1\%2
|
||||
copy %PROJECT_DIR%..\..\..\Solutions\out\%1\%2\win32-dll\*.* %3
|
||||
exit /b 0
|
|
@ -0,0 +1,106 @@
|
|||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#pragma warning(suppress:4447) // 'main' signature found without threading mode. Consider using 'int main(Platform::Array<Platform::String^>^ args)'.
|
||||
|
||||
#include "LogManager.hpp"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
#include "CommonFields.h"
|
||||
|
||||
LOGMANAGER_INSTANCE
|
||||
|
||||
using namespace MAT;
|
||||
|
||||
#define TENANT_TOKEN "99999999999999999999999999999999-99999999-9999-9999-9999-999999999999-9999"
|
||||
|
||||
void forwardEventToUTC()
|
||||
{
|
||||
printf("LogManager init\n");
|
||||
ILogger *logger = LogManager::Initialize(TENANT_TOKEN);
|
||||
|
||||
printf("Updating LogManager context \n");
|
||||
ISemanticContext* semanticContext = LogManager::GetSemanticContext();
|
||||
semanticContext->SetAppId("MyAppName"); // caller must obtain this from app manifest, e.g. .plist on Mac OS X
|
||||
semanticContext->SetAppVersion("1.0.1"); // caller must obtain this from app manifest, e.g. .plist on Mac OS X
|
||||
semanticContext->SetAppLanguage("en-US"); // caller must obtain this from app manifest, e.g. .plist on Mac OS X
|
||||
semanticContext->SetUserLanguage("en-US"); // caller must obtain the user language from preferences
|
||||
|
||||
#ifndef _WIN32
|
||||
// Platforms other than Windows currently do not have automatic network detection implemented,
|
||||
// so the caller must populate these fields using semantic context API
|
||||
semanticContext->SetNetworkCost(MAT::NetworkCost::NetworkCost_Unmetered);
|
||||
semanticContext->SetNetworkType(MAT::NetworkType::NetworkType_Wired);
|
||||
#endif
|
||||
|
||||
// Ingest 5 sample events.
|
||||
for(size_t i = 1; i <= 5; i++)
|
||||
{
|
||||
EventLatency latency = EventLatency_Normal;
|
||||
std::string eventName("Microsoft.Applications.Telemetry.ControlOptIn.sample_event");
|
||||
eventName += std::to_string((unsigned)i);
|
||||
|
||||
EventProperties event(eventName);
|
||||
|
||||
std::string evtType = "My.Record.BaseType"; // default v1 legacy behaviour: custom.my_record_basetype
|
||||
event.SetType(evtType);
|
||||
event.SetLatency(latency);
|
||||
|
||||
// To make event observable in DDV (Diagnostic Data Viewer)
|
||||
event.SetProperty(COMMONFIELDS_METADATA_VIEWINGPRODUCERID, "MyAppName");
|
||||
event.SetProperty(COMMONFIELDS_METADATA_VIEWINGCATEGORY, "Category1|Category2");
|
||||
|
||||
// Any extra DDV related information
|
||||
event.SetProperty(COMMONFIELDS_METADATA_VIEWINGPAYLOADDECODERPATH,"EnterPathOrRegistryKey");
|
||||
event.SetProperty(COMMONFIELDS_METADATA_VIEWINGPAYLOADENCODEDFIELDNAME,"EnterEncodedFieldName");
|
||||
event.SetProperty(COMMONFIELDS_METADATA_VIEWINGEXTRA1, "ExtraDataField1");
|
||||
event.SetProperty(COMMONFIELDS_METADATA_VIEWINGEXTRA2, "ExtraDataField2");
|
||||
event.SetProperty(COMMONFIELDS_METADATA_VIEWINGEXTRA3, "ExtraDataField3");
|
||||
|
||||
logger->LogEvent(event);
|
||||
}
|
||||
|
||||
printf("LogManager::FlushAndTeardown\n");
|
||||
LogManager::FlushAndTeardown();
|
||||
}
|
||||
|
||||
void setupConfigs()
|
||||
{
|
||||
auto& config = LogManager::GetLogConfiguration();
|
||||
|
||||
// Specify Provider-Group for event
|
||||
// NB: Defaults to ARIA
|
||||
// config[CFG_STR_UTC][CFG_STR_PROVIDER_GROUP_ID] = "5ECB0BAC-B930-47F5-A8A4-E8253529EDB7";
|
||||
|
||||
// Set Telemetry System to UTC.
|
||||
config[CFG_INT_SDK_MODE] = SdkModeTypes::SdkModeTypes_UTCCommonSchema;
|
||||
|
||||
// Other Configs.
|
||||
config[CFG_INT_TRACE_LEVEL_MASK] = 0; // 0xFFFFFFFF ^ 128;
|
||||
config[CFG_INT_TRACE_LEVEL_MIN] = ACTTraceLevel_Warn; // ACTTraceLevel_Info; // ACTTraceLevel_Debug;
|
||||
config[CFG_INT_MAX_TEARDOWN_TIME] = 10;
|
||||
config[CFG_INT_RAM_QUEUE_SIZE] = 32 * 1024 * 1024; // 32 MB heap limit for sqlite3
|
||||
config[CFG_INT_CACHE_FILE_SIZE] = 16 * 1024 * 1024; // 16 MB storage file limit
|
||||
|
||||
#ifdef __APPLE__
|
||||
config[CFG_STR_CACHE_FILE_PATH] = "/tmp/offlinestorage.db";
|
||||
#else
|
||||
config[CFG_STR_CACHE_FILE_PATH] = "offlinestorage.db";
|
||||
#endif
|
||||
#ifdef USE_INVALID_URL /* Stress-test for the case when collector is unreachable */
|
||||
config[CFG_STR_COLLECTOR_URL] = "https://127.0.0.1/invalid/url";
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("ControlOptIn Aria 1DS Sample App\n\n");
|
||||
|
||||
printf("Setting up configuration...\n");
|
||||
setupConfigs();
|
||||
|
||||
forwardEventToUTC();
|
||||
|
||||
return 0;
|
||||
}
|
Загрузка…
Ссылка в новой задаче