8000 feat: create TTXCMetrics client with plugins by DiegoDiaz-TomTom · Pull Request #4 · tomtom-forks/XCMetrics · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: create TTXCMetrics client with plugins #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
8000 Expand Up @@ -32,7 +32,7 @@ jobs:
linux:
runs-on: ubuntu-latest
container:
image: swift:5.7
image: swift:5.9-jammy
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
14 changes: 12 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ let package = Package(
platforms: [
.macOS(.v13),
], products: [
.executable(name: "TTXCMetrics", targets: ["TTXCMetricsApp"]),
.library(name: "TTXCMetricsClient", targets: ["TTXCMetricsClient"]),
.executable(name: "XCMetrics", targets: ["XCMetricsApp"]),
.executable(name: "XCMetricsBackend", targets: ["XCMetricsBackend"]),
.library(name: "XCMetricsBackendLib", targets: ["XCMetricsBackendLib"]),
Expand Down Expand Up @@ -53,6 +55,14 @@ let package = Package(
.product(name: "ArgumentParser", package: "swift-argument-parser"),
]
),
.target(
name: "TTXCMetricsClient",
dependencies: ["XCMetricsClient", "XCMetricsPlugins"]
),
.executableTarget(
name: "TTXCMetricsApp",
dependencies: ["TTXCMetricsClient"]
),
.target(
name: "XCMetricsPlugins",
dependencies: [
Expand All @@ -73,7 +83,7 @@ let package = Package(
.product(name: "NIOHTTP2", package: "swift-nio-http2")
]
),
.target(
.executableTarget(
name: "XCMetricsApp",
dependencies: ["XCMetricsClient"]
),
Expand Down Expand Up @@ -103,7 +113,7 @@ let package = Package(
.unsafeFlags(["-cross-module-optimization"], .when(configuration: .release))
]
),
.target(name: "XCMetricsBackend", dependencies: [.target(name: "XCMetricsBackendLib")]),
.executableTarget(name: "XCMetricsBackend", dependencies: [.target(name: "XCMetricsBackendLib")]),
.testTarget(
name: "XCMetricsTests",
dependencies: [
Expand Down
4 changes: 4 additions & 0 deletions Sources/TTXCMetricsApp/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Foundation
import TTXCMetricsClient

TTXCMetrics.main()
19 changes: 19 additions & 0 deletions Sources/TTXCMetricsClient/TTXCMetrics.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Foundation
import XCMetricsClient
import XCMetricsPlugins

public struct TTXCMetrics {
public static func main() {
let metrics = XCMetrics.parseOrExit()
let configuration = XCMetricsConfiguration()
configuration.add(plugin: ThermalThrottlingPlugin().create())

// The git directory is usually Xcode's `$SRCROOT` environment variable
let gitDirectory: String? = ProcessInfo.processInfo.environment["SRCROOT"]
if let gitDirectory {
configuration.add(plugin: GitPlugin(gitDirectoryPath: gitDirectory).create())
}

metrics.run(with: configuration)
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// +HTTPHeaders.swift
//
//
// Created by Diego Otero Díaz on 18/10/24.
//

import Foundation
import Vapor

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// AzureSharedKeyAuthorization.swift
//
//
// Created by Diego Otero Díaz on 18/10/24.
//

import CryptoSwift
import Foundation
import Vapor
Expand Down
9 changes: 9 additions & 0 deletions docs/Getting Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ One of the pre-requisites is to get a binary release of XCMetrics directly from

>If you're downloading a pre-built executable version of XCMetrics, you can skip the following section.

#### Compile TomTom's TTXCMetrics Executable
In a terminal window inside the `XCMetrics` repo, run the following:

```shell
swift build --product TTXCMetrics -c release
```

An executable named `TTXCMetrics` will be placed inside `.build/release/TTXCMetrics`. This is the executable that manages the metrics collection for you.

#### Compile XCMetrics Executable
In a terminal window inside the `XCMetrics` repo, run the following:

Expand Down
0