Skip to content

Commit b4a3102

Browse files
committed
Upgrade Windows build image from windows-2019 to windows-2022
1 parent 1ab6eaf commit b4a3102

File tree

13 files changed

+335
-24
lines changed

13 files changed

+335
-24
lines changed

.github/workflows/build-windows-vs2019.yaml renamed to .github/workflows/build-windows-vs2022.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: C/C++ CI on Windows (vs2019)
1+
name: C/C++ CI on Windows (vs2022)
22

33
on:
44
push:
@@ -16,7 +16,7 @@ on:
1616
jobs:
1717
build:
1818

19-
runs-on: windows-2019
19+
runs-on: windows-2022
2020
name: Build
2121

2222
steps:
@@ -29,7 +29,7 @@ jobs:
2929
env:
3030
SKIP_ARM_BUILD: 1
3131
SKIP_ARM64_BUILD: 1
32-
PlatformToolset: v142
33-
VSTOOLS_VERSION: vs2019
32+
PlatformToolset: v143
33+
VSTOOLS_VERSION: vs2022
3434
shell: cmd
3535
run: build-all.bat

.github/workflows/codeql-analysis.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
jobs:
1818
analyze:
1919
name: Analyze
20-
runs-on: windows-2019
20+
runs-on: windows-2022
2121
permissions:
2222
contents: read
2323
actions: read
@@ -28,7 +28,7 @@ jobs:
2828
matrix:
2929
# Override automatic language detection by changing the below list
3030
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
31-
language: ['cpp', 'csharp', 'javascript', 'python']
31+
language: ['cpp', 'javascript', 'python']
3232
# Learn more...
3333
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
3434

@@ -47,18 +47,17 @@ jobs:
4747
# Prefix the list here with "+" to use these queries and those in the config file.
4848
# queries: ./path/to/local/query, your-org/your-repo/queries@main
4949

50-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
50+
# Autobuild attempts to build any compiled languages (C/C++, or Java).
5151
# If this step fails, then you should remove it and run the build manually (see below)
52-
# - name: Autobuild
53-
# uses: github/codeql-action/autobuild@v3
54-
- name: Build
52+
- name: Build C++
5553
env:
5654
SKIP_ARM_BUILD: 1
5755
SKIP_ARM64_BUILD: 1
58-
PlatformToolset: v142
59-
VSTOOLS_VERSION: vs2019
56+
PlatformToolset: v143
57+
VSTOOLS_VERSION: vs2022
58+
WindowsSDKVersion: 10.0.22621.0
6059
shell: cmd
61-
if: matrix.language == 'cpp' || matrix.language == 'csharp'
60+
if: matrix.language == 'cpp'
6261
run: build-all.bat
6362

6463
# ℹ️ Command-line programs to run using the OS shell.

.github/workflows/test-win-latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
matrix:
2828
arch: [Win32, x64]
2929
build: [Release, Debug]
30-
os: [windows-2019]
30+
os: [windows-2022]
3131

3232
steps:
3333

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Other resources to learn how to setup the build system:
7474
| Ubuntu 18.04 LTS | GCC 7.5.x |
7575
| Windows 10 | Android Studio/Gradle |
7676
| Windows Server 2016 | Visual Studio 2017 (vc141) |
77-
| Windows Server 2019 | Visual Studio 2019 (vc142) |
77+
| Windows Server 2022 | Visual Studio 2022 (vc143) |
7878

7979
## Target Platforms
8080

@@ -96,7 +96,8 @@ Other resources to learn how to setup the build system:
9696
| Windows 10.x | :white_check_mark: | |
9797
| Windows Server 2012 | :white_check_mark: | |
9898
| Windows Server 2016 | :white_check_mark: | |
99-
| Windows Server 2019 | :white_check_mark: | :white_check_mark: |
99+
| Windows Server 2019 | :white_check_mark: | |
100+
| Windows Server 2022 | :white_check_mark: | :white_check_mark: |
100101

101102
* **Supported** - these platforms are known to work well with the SDK in
102103
production.

build-cmake-clang-vs2022.cmd

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
@echo off
2+
3+
set VSTOOLS_VERSION=vs2022
4+
cd %~dp0
5+
6+
echo Update all public submodules...
7+
git -c submodule."lib/modules".update=none submodule update --init --recursive
8+
9+
if DEFINED GIT_PULL_TOKEN (
10+
rd /s /q lib\modules
11+
git clone https://%GIT_PULL_TOKEN%:x-oauth-basic@github.com/microsoft/cpp_client_telemetry_modules.git lib\modules
12+
)
13+
14+
call tools\vcvars.cmd
15+
16+
setlocal enableextensions
17+
setlocal enabledelayedexpansion
18+
set ROOT=%~dp0
19+
20+
REM ********************************************************************
21+
REM Use cmake
22+
REM ********************************************************************
23+
set "PATH=C:\Program Files\CMake\bin\;%PATH%"
24+
25+
REM ********************************************************************
26+
REM Use clang compiler
27+
REM ********************************************************************
28+
set CLANG_PATH="C:\Program Files\LLVM\bin"
29+
set CC=%CLANG_PATH%\clang.exe
30+
set CXX=%CLANG_PATH%\clang++.exe
31+
set LLVM_VER=ClangCL
32+
33+
REM ********************************************************************
34+
REM Set output directory, clean and/or create as-needed
35+
REM ********************************************************************
36+
set OUTDIR=%ROOT%\Solutions\out
37+
if "%1" == "clean" (
38+
@rmdir /s /q %OUTDIR%
39+
)
40+
if not exist "%OUTDIR%" mkdir %OUTDIR%
41+
42+
REM ********************************************************************
43+
REM Build all deps using MSVC - Visual Studio 2022 (17)
44+
REM ********************************************************************
45+
if "%1" == "nodeps" goto NODEPS
46+
call tools\build-deps.cmd
47+
:NODEPS
48+
49+
cd %OUTDIR%
50+
51+
REM ********************************************************************
52+
REM Invoke the build script
53+
REM ********************************************************************
54+
set CMAKE_PACKAGE_TYPE=tgz
55+
for %%a in ( m32 m64 ) do (
56+
for %%c in ( Release ) do (
57+
if "%%a"=="m32" (
58+
set ARCH=Win32
59+
set ARCH_GEN= Win32
60+
)
61+
if "%%a"=="m64" (
62+
set ARCH=x64
63+
set ARCH_GEN= x64
64+
)
65+
@mkdir %OUTDIR%\%%c\!ARCH!
66+
cd %OUTDIR%\%%c\!ARCH!
67+
set "CFLAGS=-%%a"
68+
set "CXXFLAGS=-%%a -Wc++11-compat-pedantic -Wno-c++98-compat -Wno-everything"
69+
cmake -G"Visual Studio 17 2022" -A !ARCH_GEN! ^
70+
-T"%LLVM_VER%" ^
71+
-DTARGET_ARCH=!ARCH! ^
72+
-DBUILD_SHARED_LIBS=OFF ^
73+
-DCMAKE_BUILD_TYPE=%%c ^
74+
-DCMAKE_PACKAGE_TYPE=%CMAKE_PACKAGE_TYPE% ^
75+
-DDEFAULT_PAL_IMPLEMENTATION=WIN32 ^
76+
%ROOT%
77+
cmake --build . --config %%c -- /p:Configuration=%%c
78+
)
79+
)
80+
81+
cd %ROOT%

docs/cpp-start-windows.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If your project requires the Universal Telemetry Client (a.k.a. UTC) to send tel
1616

1717
## **Windows prerequisites and dependencies for building from source**
1818

19-
* Visual Studio 2017 or 2019 (2019 is recommended).
19+
* Visual Studio 2019 or 2022 (2022 is recommended).
2020
* C++ Dev Tools
2121

2222
## **Option 1: Build the SDK from source using Visual Studio**
@@ -58,11 +58,11 @@ Make sure you can build a simple "Hello World" using CMake before proceeding to
5858

5959
To build SDK using cmake with clang on Windows, run:
6060

61-
```build-cmake-clang-vs2017.cmd```
61+
```build-cmake-clang-vs2019.cmd```
6262

6363
or
6464

65-
```build-cmake-clang-vs2019.cmd```
65+
```build-cmake-clang-vs2022.cmd```
6666

6767
depending on what Visual Studio version you are using.
6868

@@ -113,6 +113,6 @@ More examples can be found under *examples* folder.
113113
- [CMake Tutorial](https://cmake.org/cmake/help/latest/guide/tutorial/index.html)
114114
- [Runtime Library Variants: static vs dynamic runtime](https://www.oreilly.com/library/view/c-cookbook/0596007612/ch01s24.html)
115115
116-
If you encounter troubles building the project, please refer to our CI/Build pipeline settings [here](../.github/workflows/build-windows-vs2019.yaml). This pipeline runs on a standard GitHub image with a standard Visual Studio 2019 installation. If you are still stuck, please log your build question as [GitHub issue](https://github.com/microsoft/cpp_client_telemetry/issues) with labels `question` and `build infra`. We would be glad to help and adjust documentation accordingly.
116+
If you encounter troubles building the project, please refer to our CI/Build pipeline settings [here](../.github/workflows/build-windows-vs2022.yaml). This pipeline runs on a standard GitHub image with a standard Visual Studio 2022 installation. If you are still stuck, please log your build question as [GitHub issue](https://github.com/microsoft/cpp_client_telemetry/issues) with labels `question` and `build infra`. We would be glad to help and adjust documentation accordingly.
117117
118118
If you find that some documentation is incorrect, please send a PR to fix it. We ❤️ community contributions!

lib/android_build/maesdk/src/main/cpp/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ set(CMAKE_CXX_STANDARD 11)
1010
option(BUILD_AZMON "Build for Azure Monitor" YES)
1111
option(BUILD_PRIVACYGUARD "Build Privacy Guard" YES)
1212
option(BUILD_SIGNALS "Build Signals" YES)
13+
option(BUILD_SANITIZER "Build Sanitizer" YES)
1314

1415
if(ENABLE_CAPI_HTTP_CLIENT)
1516
add_definitions(-DENABLE_CAPI_HTTP_CLIENT)
@@ -113,6 +114,22 @@ if (EXISTS ${SDK_ROOT}/lib/modules/signals/ AND BUILD_SIGNALS)
113114
)
114115
endif()
115116

117+
if (EXISTS ${SDK_ROOT}/lib/modules/sanitizer/ AND BUILD_SANITIZER)
118+
list(APPEND SRCS
119+
${SDK_ROOT}/lib/jni/Sanitizer_jni.cpp
120+
${SDK_ROOT}/lib/modules/sanitizer/detectors/EmailAddressDetector.cpp
121+
${SDK_ROOT}/lib/modules/sanitizer/detectors/JwtDetector.cpp
122+
${SDK_ROOT}/lib/modules/sanitizer/detectors/SPOPassword.cpp
123+
${SDK_ROOT}/lib/modules/sanitizer/detectors/UrlDetector.cpp
124+
${SDK_ROOT}/lib/modules/sanitizer/Sanitizer.cpp
125+
${SDK_ROOT}/lib/modules/sanitizer/SanitizerProvider.cpp
126+
${SDK_ROOT}/lib/modules/sanitizer/SanitizerStringUtils.cpp
127+
${SDK_ROOT}/lib/modules/sanitizer/SanitizerTargets.cpp
128+
${SDK_ROOT}/lib/modules/sanitizer/SanitizerTrie.cpp
129+
${SDK_ROOT}/lib/modules/sanitizer/SanitizerTrieNode.cpp
130+
)
131+
endif()
132+
116133
if (USE_ROOM)
117134
add_definitions("-DUSE_ROOM")
118135
list(APPEND SRCS ${SDK_ROOT}/lib/offline/OfflineStorage_Room.cpp)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
package com.microsoft.applications.events;
6+
7+
public class Sanitizer {
8+
9+
/**
10+
* Initializes the sanitizer with the provided configuration.
11+
*
12+
* @param config The configuration object containing logger and event name.
13+
* @return true if initialization succeeds, false otherwise.
14+
* @throws IllegalArgumentException if config or any required field is null or invalid.
15+
*/
16+
public static boolean initialize(SanitizerConfiguration config) {
17+
18+
// Validate that the configuration object is not null
19+
if(config == null) {
20+
throw new IllegalArgumentException("initConfig cannot be null");
21+
}
22+
23+
// Ensure the logger instance is provided
24+
if(config.loggerInstance == null) {
25+
throw new IllegalArgumentException(("loggerInstance cannot be null in config."));
26+
}
27+
28+
// Ensure the notification event name is not null or empty
29+
if (config.notificationEventName == null || config.notificationEventName.isEmpty()) {
30+
throw new IllegalArgumentException(("notificationEventName cannot be null in config."));
31+
}
32+
33+
return nativeInitialize(config.loggerInstance.getNativeILoggerPtr(), config.notificationEventName);
34+
}
35+
36+
/**
37+
* Checks if the sanitizer is initialized.
38+
*
39+
* @return true if initialized, false otherwise.
40+
*/
41+
public static native boolean isInitialized();
42+
43+
/**
44+
* Initializes the sanitizer with the given logger pointer and optional notification event name.
45+
*
46+
* @param loggerNativePtr Native pointer to ILogger.
47+
* @param notificationEventName Optional event name for sanitizer notifications.
48+
* @return true if initialization was successful, false otherwise.
49+
*/
50+
public static native boolean nativeInitialize(long loggerNativePtr, String notificationEventName);
51+
52+
/**
53+
* Uninitializes the sanitizer.
54+
*
55+
* @return true if uninitialization was successful, false otherwise.
56+
*/
57+
public static native boolean uninitialize();
58+
59+
/**
60+
* Checks if the sanitizer is currently enabled.
61+
*
62+
* @return true if enabled, false otherwise.
63+
*/
64+
public static native boolean isEnabled();
65+
66+
/**
67+
* Enables or disables the sanitizer.
68+
*
69+
* @param enabled true to enable, false to disable.
70+
* @return true if the operation was successful, false otherwise.
71+
*/
72+
public static native boolean setEnabled(boolean enabled);
73+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// Copyright (c) Microsoft Corporation. All rights reserved.
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
package com.microsoft.applications.events;
6+
7+
/**
8+
* Represents the configuration settings used to initialize a sanitizer instance.
9+
*/
10+
11+
public class SanitizerConfiguration {
12+
13+
/**
14+
* The logger instance used to record privacy concern events.
15+
* This field is required.
16+
*/
17+
public final ILogger loggerInstance;
18+
19+
/**
20+
     * The custom event name used when logging sanitizer concerns.
21+
     * Optional. Defaults to "SanitizerConcerns" if not specified.
22+
     */
23+
public String notificationEventName = "SanitizerConcerns";
24+
25+
/**
26+
     * Constructs a new SanitizerConfiguration with the specified logger.
27+
     *
28+
     * @param logger The ILogger implementation used to log privacy concern events.
29+
     * @throws IllegalArgumentException if the logger is null.
30+
     */
31+
public SanitizerConfiguration(ILogger logger) {
32+
33+
if(logger == null) {
34+
throw new IllegalArgumentException("logger cannot be null");
35+
}
36+
37+
this.loggerInstance = logger;
38+
}
39+
}

lib/include/public/Version.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#define MAT_VERSION_HPP
77
// WARNING: DO NOT MODIFY THIS FILE!
88
// This file has been automatically generated, manual changes will be lost.
9-
#define BUILD_VERSION_STR "3.9.163.1"
10-
#define BUILD_VERSION 3,9,163,1
9+
#define BUILD_VERSION_STR "3.9.205.1"
10+
#define BUILD_VERSION 3,9,205,1
1111

1212
#ifndef RESOURCE_COMPILER_INVOKED
1313
#include "ctmacros.hpp"
@@ -18,7 +18,7 @@ namespace MAT_NS_BEGIN {
1818
uint64_t const Version =
1919
((uint64_t)3 << 48) |
2020
((uint64_t)9 << 32) |
21-
((uint64_t)163 << 16) |
21+
((uint64_t)205 << 16) |
2222
((uint64_t)1);
2323

2424
} MAT_NS_END

0 commit comments

Comments
 (0)