Skip to content

Commit 6fc9083

Browse files
authored
Merge branch 'PokemonAutomation:main' into main
2 parents ca87cb6 + 345be78 commit 6fc9083

119 files changed

Lines changed: 12988 additions & 2535 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.azure-pipelines/templates/update-github-telemetry.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,22 +186,53 @@ stages:
186186
$newContent = ($updatedLines -join "`n")
187187
$contentBytes = [System.Text.Encoding]::UTF8.GetBytes($newContent)
188188
$contentBase64 = [System.Convert]::ToBase64String($contentBytes)
189-
$commitMessage = "Add $versionKey to Telemetry JSON via Azure Pipeline"
190-
189+
$commitMessage = "Add $versionKey to Telemetry JSON via Azure Pipelines"
190+
$newBranch = "telemetry-update-$($versionKey.Replace('.', '-'))"
191+
192+
### Create a new branch and open a PR
193+
# Fetch latest commit SHA for the base branch
194+
Write-Host "Fetching latest commit SHA for branch $branch..."
195+
$refUrl = "https://api.github.com/repos/$repo/git/refs/heads/$branch"
196+
$refInfo = Invoke-RestMethod -Uri $refUrl -Headers $headers -Method Get
197+
$latestCommitSha = $refInfo.object.sha
198+
Write-Host "Latest commit SHA: $latestCommitSha"
199+
200+
# Create new branch from latest commit
201+
Write-Host "Creating new branch $newBranch..."
202+
$newRefBody = @{
203+
ref = "refs/heads/$newBranch"
204+
sha = $latestCommitSha
205+
} | ConvertTo-Json
206+
Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/git/refs" -Headers $headers -Method Post -Body $newRefBody -ContentType "application/json"
207+
Write-Host "✓ Created branch $newBranch"
208+
209+
# Update the file in the new branch
191210
$updateBody = @{
192211
message = $commitMessage
193212
content = $contentBase64
194213
sha = $fileInfo.sha
195-
branch = $branch
214+
branch = $newBranch
196215
} | ConvertTo-Json -Depth 10
197216
198-
Write-Host "Pushing changes to GitHub..."
217+
Write-Host "Pushing changes to $newBranch..."
199218
$putUrl = "https://api.github.com/repos/$repo/contents/$filePath"
200-
$response = Invoke-RestMethod -Uri $putUrl -Headers $headers -Method Put -Body $updateBody -ContentType "application/json"
219+
Invoke-RestMethod -Uri $putUrl -Headers $headers -Method Put -Body $updateBody -ContentType "application/json"
220+
Write-Host "✓ Pushed changes to $newBranch"
221+
222+
# Create a pull request
223+
Write-Host "Creating pull request from $newBranch to $branch..."
224+
$prBody = @{
225+
title = $commitMessage
226+
head = $newBranch
227+
base = $branch
228+
body = "This PR was automatically generated by Azure Pipelines to add $versionKey to the Telemetry JSON file."
229+
} | ConvertTo-Json
230+
$pr = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/pulls" -Headers $headers -Method Post -Body $prBody -ContentType "application/json"
201231
202232
Write-Host ""
203233
Write-Host "================================================"
204-
Write-Host "✅ Successfully added $versionKey to Telemetry JSON"
234+
Write-Host "✅ Successfully created PR #$($pr.number) for $versionKey"
235+
Write-Host "PR URL: $($pr.html_url)"
205236
Write-Host "================================================"
206237
207238
} catch {

.azure-pipelines/templates/update-github-version.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,19 @@ stages:
4747
echo "✗ Failed to fetch ChangeLog.md or file is empty"
4848
exit 1
4949
fi
50-
5150
echo "✓ ChangeLog.md fetched successfully"
52-
CHANGELOG_CONTENT=$(cat changelog.md | base64 -w 0)
51+
52+
echo "Converting Markdown to HTML..."
53+
python3 -m pip install --quiet markdown
54+
python3 -c "import markdown; content = open('changelog.md', encoding='utf-8').read(); html = markdown.markdown(content, extensions=['fenced_code', 'tables', 'nl2br']); open('changelog.html', 'w', encoding='utf-8').write(html)"
55+
56+
if [ ! -s changelog.html ]; then
57+
echo "✗ Failed to convert ChangeLog.md to HTML"
58+
exit 1
59+
fi
60+
echo "✓ ChangeLog.md converted to HTML"
61+
62+
CHANGELOG_CONTENT=$(base64 -w 0 changelog.html)
5363
echo "##vso[task.setvariable variable=CHANGELOG_B64]$CHANGELOG_CONTENT"
5464
displayName: 'Fetch ChangeLog.md'
5565
condition: succeeded()
@@ -173,7 +183,7 @@ stages:
173183
-replace '\\', '\\' `
174184
-replace '"', '\"' `
175185
-replace "`n", '\n' `
176-
-replace "`r", '\r' `
186+
-replace "`r", '' `
177187
-replace "`t", '\t'
178188
$line = $indent + '"Changes": "' + $escaped + '"'
179189
}
@@ -189,7 +199,7 @@ stages:
189199
$newContent = ($updatedLines -join "`n")
190200
$contentBytes = [System.Text.Encoding]::UTF8.GetBytes($newContent)
191201
$contentBase64 = [System.Convert]::ToBase64String($contentBytes)
192-
$commitMessage = "Update $buildType to v$versionMajor.$versionMinor.$versionPatch via Azure Pipeline"
202+
$commitMessage = "Update $buildType to v$versionMajor.$versionMinor.$versionPatch via Azure Pipelines"
193203
194204
$updateBody = @{
195205
message = $commitMessage

.azure-pipelines/templates/upload-symbols.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parameters:
77
dependsOn: []
88
platforms: []
99
buildType: ''
10+
poolName: ''
1011
versionMajor: 0
1112
versionMinor: 0
1213
versionPatch: 0

.github/workflows/cpp-ci-serial-programs-base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
cd Arduino-Source
6565
sudo apt update
6666
sudo apt upgrade
67-
sudo apt install clang-tools libopencv-dev
67+
sudo apt install clang-tools libopencv-dev libsystemd-dev
6868
6969
sudo apt install ./3rdPartyBinaries/libdpp-10.0.28-linux-x64.deb
7070
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
/**
2+
* (C) 2016 - 2021 KISTLER INSTRUMENTE AG, Winterthur, Switzerland
3+
* (C) 2016 - 2024 Stanislav Angelovic <stanislav.angelovic@protonmail.com>
4+
*
5+
* @file AdaptorInterfaces.h
6+
*
7+
* Created on: Nov 8, 2016
8+
* Project: sdbus-c++
9+
* Description: High-level D-Bus IPC C++ library based on sd-bus
10+
*
11+
* This file is part of sdbus-c++.
12+
*
13+
* sdbus-c++ is free software; you can redistribute it and/or modify it
14+
* under the terms of the GNU Lesser General Public License as published by
15+
* the Free Software Foundation, either version 2.1 of the License, or
16+
* (at your option) any later version.
17+
*
18+
* sdbus-c++ is distributed in the hope that it will be useful,
19+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
* GNU Lesser General Public License for more details.
22+
*
23+
* You should have received a copy of the GNU Lesser General Public License
24+
* along with sdbus-c++. If not, see <http://www.gnu.org/licenses/>.
25+
*/
26+
27+
#ifndef SDBUS_CXX_ADAPTORINTERFACES_H_
28+
#define SDBUS_CXX_ADAPTORINTERFACES_H_
29+
30+
#include <sdbus-c++/IObject.h>
31+
#include <cassert>
32+
#include <string>
33+
#include <memory>
34+
35+
// Forward declarations
36+
namespace sdbus {
37+
class IConnection;
38+
}
39+
40+
namespace sdbus {
41+
42+
/********************************************//**
43+
* @class ObjectHolder
44+
*
45+
* ObjectHolder is a helper that simply owns and provides
46+
* access to an object to other classes in the inheritance
47+
* hierarchy of an object based on generated interface classes.
48+
*
49+
***********************************************/
50+
class ObjectHolder
51+
{
52+
protected:
53+
ObjectHolder(std::unique_ptr<IObject>&& object)
54+
: object_(std::move(object))
55+
{
56+
}
57+
58+
const IObject& getObject() const
59+
{
60+
assert(object_ != nullptr);
61+
return *object_;
62+
}
63+
64+
IObject& getObject()
65+
{
66+
assert(object_ != nullptr);
67+
return *object_;
68+
}
69+
70+
private:
71+
std::unique_ptr<IObject> object_;
72+
};
73+
74+
/********************************************//**
75+
* @class AdaptorInterfaces
76+
*
77+
* AdaptorInterfaces is a helper template class that joins all interface classes of a remote
78+
* D-Bus object generated by sdbus-c++-xml2cpp to be used on the server (the adaptor) side,
79+
* including some auxiliary classes. AdaptorInterfaces is the class that native-like object
80+
* implementation classes written by users should inherit from and implement all pure virtual
81+
* methods. So the _Interfaces template parameter is a list of sdbus-c++-xml2cpp-generated
82+
* adaptor-side interface classes representing interfaces (with methods, signals and properties)
83+
* of the D-Bus object.
84+
*
85+
* In the final adaptor class inherited from AdaptorInterfaces, one needs to make sure:
86+
* 1. to call `registerAdaptor();` in the class constructor, and, conversely,
87+
* 2. to call `unregisterAdaptor();` in the class destructor,
88+
* so that the object API vtable is registered and unregistered at the proper time.
89+
*
90+
***********************************************/
91+
template <typename... _Interfaces>
92+
class AdaptorInterfaces
93+
: protected ObjectHolder
94+
, public _Interfaces...
95+
{
96+
public:
97+
/*!
98+
* @brief Creates object instance
99+
*
100+
* @param[in] connection D-Bus connection where the object will publish itself
101+
* @param[in] objectPath Path of the D-Bus object
102+
*
103+
* For more information, consult @ref createObject(sdbus::IConnection&,std::string)
104+
*/
105+
AdaptorInterfaces(IConnection& connection, ObjectPath objectPath)
106+
: ObjectHolder(createObject(connection, std::move(objectPath)))
107+
, _Interfaces(getObject())...
108+
{
109+
}
110+
111+
/*!
112+
* @brief Adds object vtable (i.e. D-Bus API) definitions for all interfaces it implements
113+
*
114+
* This function must be called in the constructor of the final adaptor class that implements AdaptorInterfaces.
115+
*
116+
* See also @ref IObject::addVTable()
117+
*/
118+
void registerAdaptor()
119+
{
120+
(_Interfaces::registerAdaptor(), ...);
121+
}
122+
123+
/*!
124+
* @brief Unregisters adaptors's API and removes it from the bus
125+
*
126+
* This function must be called in the destructor of the final adaptor class that implements AdaptorInterfaces.
127+
*
128+
* For more information, see underlying @ref IObject::unregister()
129+
*/
130+
void unregisterAdaptor()
131+
{
132+
getObject().unregister();
133+
}
134+
135+
/*!
136+
* @brief Returns reference to the underlying IObject instance
137+
*/
138+
using ObjectHolder::getObject;
139+
140+
protected:
141+
using base_type = AdaptorInterfaces;
142+
143+
AdaptorInterfaces(const AdaptorInterfaces&) = delete;
144+
AdaptorInterfaces& operator=(const AdaptorInterfaces&) = delete;
145+
AdaptorInterfaces(AdaptorInterfaces&&) = delete;
146+
AdaptorInterfaces& operator=(AdaptorInterfaces&&) = delete;
147+
~AdaptorInterfaces() = default;
148+
};
149+
150+
}
151+
152+
#endif /* SDBUS_CXX_ADAPTORINTERFACES_H_ */

0 commit comments

Comments
 (0)