Skip to content

Commit

Permalink
Merge pull request torizon#289 from torizon/dev
Browse files Browse the repository at this point in the history
Release templates for v2.8.0
  • Loading branch information
microhobby authored Jan 2, 2025
2 parents 2fca557 + b6837af commit 4540a74
Show file tree
Hide file tree
Showing 17 changed files with 251 additions and 63 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ We encourage you to also contribute templates. The community supported templates
| ![](https://raw.githubusercontent.com/toradex/vscode-torizon-templates-documentation/refs/heads/main/thumbnails/unogtk5.png?raw=true) | .NET 8 C# Uno 5 Platform Skia.GTK | .NET 8.0 | C# | ![](assets/img/arm32.png?raw=true&id=2) ![](assets/img/arm64.png?raw=true&id=2) | [dotnetUno5](./dotnetUno5) | ![](https://avatars.githubusercontent.com/u/2633321?v=4&s=64) [@microhobby](https://www.github.com/microhobby) |
| ![](https://raw.githubusercontent.com/toradex/vscode-torizon-templates-documentation/refs/heads/main/thumbnails/unofbdrm5.png?raw=true) | .NET 8 C# Uno 5 Platform Frame Buffer | .NET 8.0 | C# | ![](assets/img/arm32.png?raw=true&id=2) ![](assets/img/arm64.png?raw=true&id=2) | [dotnetUno5FrameBuffer](./dotnetUno5FrameBuffer) | ![](https://avatars.githubusercontent.com/u/2633321?v=4&s=64) [@microhobby](https://www.github.com/microhobby) |

## Templates Status

It's possible to check the current status of a template at the [templates.json](./templates.json) file, in the status property of the respective template.
There, the status can be:

- `ok`: Which means the template is ready to be used on any of SoM, without any major known issues (but not necessarily tested on every SoM). There may still be some minor issue on the template, which can be found in the [issues part of the repository](https://github.com/torizon/vscode-torizon-templates/issues).

- `incomplete`: Which means that the template may have a known issue that affects it's usability for some SoMs. A summarized description of the issue can be found in the `customMessage` property of the template, but also a more detailed description will be at the [issues part of the repository](https://github.com/torizon/vscode-torizon-templates/issues).

- `notok`: Which means that the template may have an issue that affects it's usability for most or all SoMs, and therefore should not be used or updated to yet. A summarized description of the issue can be found in the `customMessage` property of the template, but also a more detailed description will be at the [issues part of the repository](https://github.com/torizon/vscode-torizon-templates/issues).

Also, the template can be deprecated. In this case, it will be at the [deprecatedTemplates.json](./deprecatedTemplates.json) file, and it's status will be `deprecated`.


# List of Deprecated templates

| TEMPLATE | DESCRIPTION | RUNTIME | LANGUAGE | HW ARCH | FOLDER | CONTRIBUTOR |
Expand Down
2 changes: 1 addition & 1 deletion cppSlint/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Base container version
# Using Slint v1.7.2 base images
##
ARG CROSS_SDK_BASE_TAG=3.3.1-bookworm-1.7.2
ARG CROSS_SDK_BASE_TAG=3.3.1-bookworm-1.9.1
ARG BASE_VERSION=3.3.1

##
Expand Down
2 changes: 1 addition & 1 deletion cppSlint/Dockerfile.debug
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG IMAGE_ARCH=
# Base container version
# Using the Slint v1.7.2 base images
##
ARG BASE_VERSION=3.3.1-bookworm-1.7.2
ARG BASE_VERSION=3.3.1-bookworm-1.9.1

##
# Application root directory inside the container
Expand Down
2 changes: 1 addition & 1 deletion cppSlint/Dockerfile.sdk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##
# Using the Slint v1.7.2 base images
##
ARG CROSS_SDK_BASE_TAG=3.3.1-bookworm-1.7.2
ARG CROSS_SDK_BASE_TAG=3.3.1-bookworm-1.9.1

##
# Board architecture
Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"Fleetid",
"listenport",
"netsh",
"notok",
"Oster",
"ostree",
"portproxy",
Expand Down
28 changes: 28 additions & 0 deletions deprecatedTemplates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"DeprecatedTemplates": [
{
"img": "unogtk.png",
"folder": "dotnetUno",
"description": ".NET 6 C# Uno Platform Skia.GTK",
"runtime": ".net 6.0",
"language": "C#",
"debugSSHPort": "2225",
"multiContainer": true,
"support": "Toradex",
"status": "deprecated",
"customMessage": "Deprecated due to the EOL of .NET 6.0"
},
{
"img": "unofbdrm.png",
"folder": "dotnetUnoFrameBuffer",
"description": ".NET 6 C# Uno Platform Frame Buffer",
"runtime": ".net 6.0",
"language": "C#",
"debugSSHPort": "2226",
"multiContainer": true,
"support": "Community",
"status": "deprecated",
"customMessage": "Deprecated due to the EOL of .NET 6.0"
}
]
}
4 changes: 2 additions & 2 deletions rustSlint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
slint = { version = "1.7.*", features = [ "backend-linuxkms-noseat", "renderer-skia" ] }
slint = { version = "1.9.*", features = [ "backend-linuxkms-noseat", "renderer-skia" ] }

[build-dependencies]
slint-build = { version = "1.7.*" }
slint-build = { version = "1.9.*" }
2 changes: 1 addition & 1 deletion rustSlint/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Base container version
# Using Slint v1.7.2 base images
##
ARG CROSS_SDK_BASE_TAG=3.3.1-bookworm-1.7.2
ARG CROSS_SDK_BASE_TAG=3.3.1-bookworm-1.9.1
ARG BASE_VERSION=3.3.1

##
Expand Down
2 changes: 1 addition & 1 deletion rustSlint/Dockerfile.debug
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG IMAGE_ARCH=
# Base container version
# Using Slint v1.7.2 base images
##
ARG BASE_VERSION=3.3.1-bookworm-1.7.2
ARG BASE_VERSION=3.3.1-bookworm-1.9.1

##
# Directory of the application inside container
Expand Down
2 changes: 1 addition & 1 deletion rustSlint/Dockerfile.sdk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG IMAGE_ARCH=
# Base container version
# Using Slint v1.7.2 base images
##
ARG CROSS_SDK_BASE_TAG=3.3.1-bookworm-1.7.2
ARG CROSS_SDK_BASE_TAG=3.3.1-bookworm-1.9.1

##
# Directory of the application inside container
Expand Down
18 changes: 13 additions & 5 deletions scripts/createFromTemplate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ Write-Host "Project Name -> $projectName"
Write-Host "Container Name -> $containerName"

# get the metadata
$_metadata = Get-Content "$templateFolder/../templates.json" | ConvertFrom-Json
$_templatesJson = Get-Content "$templateFolder/../templates.json" | ConvertFrom-Json
$_templateMetadata =
$_metadata.Templates |
$_templatesJson.Templates |
Where-Object { $_.folder -eq $template }

# send telemetry
Expand Down Expand Up @@ -211,9 +211,17 @@ if (-not (Test-Path "$location/.gitlab-ci.yml")) {
Copy-Item "$templateFolder/../assets/gitlab/.gitlab-ci.yml" "$location/.gitlab-ci.yml"
}

# create a dot file to store the template that was used
Write-Output "$template" | Out-File -FilePath "$location/.conf/.template"
Write-Output "$containerName" | Out-File -FilePath "$location/.conf/.container"
# create a metadata.json to store the name of the template, the name of the container, and the base Torizon OS Version
$_metadataJson = New-Object PSObject

$_metadataJson | Add-Member -MemberType NoteProperty -Name "templateName" -Value $template
$_metadataJson | Add-Member -MemberType NoteProperty -Name "containerName" -Value $containerName
$_torizonOSMajor = $_templatesJson.TorizonOSMajor
$_metadataJson | Add-Member -MemberType NoteProperty -Name "torizonOSMajor" -Value $_torizonOSMajor


# Save the modified JSON object to a file
Set-Content -Path "$location/.conf/metadata.json" -Value ($_metadataJson | ConvertTo-Json) -Encoding UTF8

Write-Host -ForegroundColor DarkGreen "✅ Scripts copy done"

Expand Down
2 changes: 1 addition & 1 deletion scripts/initWorkspace.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if (!(Test-Path $env:HOME/.tcd/target.json)) {
}

# check if the workspace is valid
if (!(Test-Path ./.conf/.template)) {
if (!(Get-Content ./.conf/metadata.json | ConvertFrom-Json).templateName -and !(Test-Path ./.conf/.template)) {
Write-Host -ForegroundColor Red "❌ :: This folder does not have a valid Torizon project Workspace :: ❌"
Write-Host ""
exit 400
Expand Down
118 changes: 95 additions & 23 deletions scripts/projectUpdater.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,7 @@ if ([string]::IsNullOrEmpty($acceptAll)) {
}
}

# copy the new one and make the subs
$templateName = Get-Content $projectFolder/.conf/.template
$containerName = Get-Content $projectFolder/.conf/.container

# check first if the folder already exists
if (-not (Test-Path $projectFolder/.conf/tmp)) {
mkdir $projectFolder/.conf/tmp
}

# get the metadata
$_metadata = Get-Content "$Env:HOME/.apollox/templates.json" | ConvertFrom-Json
$_templateMetadata =
$_metadata.Templates |
Where-Object { $_.folder -eq $templateName }

# ----------------------------------------------------------- ALWAYS ACCEPT NEW
# UPDATE.JSON:
Copy-Item `
$Env:HOME/.apollox/$templateName/.conf/update.json `
$projectFolder/.conf/update.json


# PROJECT UPDATER:
# PROJECT UPDATER - The first thing is to update it
if (
-not (_checkIfFileContentIsEqual `
$Env:HOME/.apollox/scripts/projectUpdater.ps1 `
Expand All @@ -150,6 +128,100 @@ if (
exit $LASTEXITCODE
}

# get the metadata of templates.json
$_templatesJson = Get-Content "$Env:HOME/.apollox/templates.json" | ConvertFrom-Json

# Replace the the .template and .container with metadata.json
if ((Test-Path "$projectFolder/.conf/.template") -and (Test-Path "$projectFolder/.conf/.container")) {
$templateName = Get-Content $projectFolder/.conf/.template
$containerName = Get-Content $projectFolder/.conf/.container

$_metadataJson = New-Object PSObject
$_metadataJson | Add-Member -MemberType NoteProperty -Name "templateName" -Value $templateName
$_metadataJson | Add-Member -MemberType NoteProperty -Name "containerName" -Value $containerName
# If this property doesn't exist, then we are on Torizon 6
if ($null -eq $_templatesJson.TorizonOSMajor) {
$_torizonOSMajor = "6"
} else {
$_torizonOSMajor = $_templatesJson.TorizonOSMajor
}
$_metadataJson | Add-Member -MemberType NoteProperty -Name "torizonOSMajor" -Value $_torizonOSMajor

# Save the modified JSON object to a file
Set-Content -Path "$projectFolder/.conf/metadata.json" -Value ($_metadataJson | ConvertTo-Json) -Encoding UTF8

Remove-Item -Path $projectFolder/.conf/.template -Force
Remove-Item -Path $projectFolder/.conf/.container -Force
}

# get the metadata of the project
$_metadataJson = Get-Content "$projectFolder/.conf/metadata.json" | ConvertFrom-Json
$templateName = $_metadataJson.templateName
$containerName = $_metadataJson.containerName
$_torizonOSMajor = $_metadataJson.TorizonOSMajor

# If it's not the current version, it's because the person has torizon.templatesBranch setting set
if ($_templatesJson.TorizonOSMajor -ne "7") {
Write-Host -ForegroundColor DarkYellow "The current Torizon OS version is 7. If you want to upgrade to the current version, remove the torizon.templatesBranch setting."
}

$_templatesJsonTorizonMajor = $_templatesJson.TorizonOSMajor

# Major update on the template
if ($_torizonOSMajor -ne $_templatesJsonTorizonMajor) {

Write-Host -ForegroundColor DarkRed "Your template is on Torizon OS version ${_torizonOSMajor} and you are updating it to a template in Torizon OS version ${_templatesJsonTorizonMajor}"
$_sure = Read-Host -Prompt "Are you sure you want to proceed with the update? [y/n]"

if ($_sure -ne "y") {
Write-Host -ForegroundColor DarkRed "If you want to stick to a specific Torizon OS version, set the torizon.templatesBranch on settings.json: https://developer.toradex.com/torizon/application-development/ide-extension/reference-documentation/workspace-settings#torizontemplatesbranch"
exit 0
}
}

# check first if the folder already exists
if (-not (Test-Path $projectFolder/.conf/tmp)) {
mkdir $projectFolder/.conf/tmp
}

# get the metadata of deprecatedTemplates.json
$_deprecatedMetadata = Get-Content "$Env:HOME/.apollox/deprecatedTemplates.json" | ConvertFrom-Json
$_deprecatedTemplateMetadata =
$_deprecatedMetadata.DeprecatedTemplates |
Where-Object { $_.folder -eq $templateName }

# If the template is deprecated or broken, it cannot be updated. If it is incomplete the user should be made aware of the problem and choose to proceed or not.
if ($null -ne $_deprecatedTemplateMetadata) {
Write-Host -ForegroundColor DarkRed "This template is deprecated in the most recent version of the Torizon IDE Extension. For details, check https://github.com/torizon/vscode-torizon-templates/blob/dev/DEPRECATED.md"
exit 69
}

$_templateMetadata =
$_templatesJson.Templates |
Where-Object { $_.folder -eq $templateName }

if ($_templateMetadata.status -eq "notok") {
Write-Host -ForegroundColor DarkRed "This template is broken in the most recent version of the Torizon IDE Extension. Reason:"
Write-Host -ForegroundColor DarkRed $_templateMetadata.customMessage
exit 69

} elseif ($_templateMetadata.status -eq "incomplete") {
Write-Host -ForegroundColor DarkRed "This template is incomplete in the most recent version of the Torizon IDE Extension. Reason:"
Write-Host -ForegroundColor DarkRed $_templateMetadata.customMessage
$_sure = Read-Host -Prompt "Are you sure you want to proceed with the update? [y/n]"

if ($_sure.ToLower() -ne "y") {
exit 0
}
}

# ----------------------------------------------------------- ALWAYS ACCEPT NEW
# UPDATE.JSON:
Copy-Item `
$Env:HOME/.apollox/$templateName/.conf/update.json `
$projectFolder/.conf/update.json


# TASKS.PS1:
Copy-Item `
$Env:HOME/.apollox/scripts/tasks.ps1 `
Expand Down
2 changes: 2 additions & 0 deletions tcb/.conf/bashrc.tcb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source .conf/tcb-env-setup.sh -s ${STORAGE_DIR} -t ${TCB_VERSION}
source ~/.bashrc
4 changes: 4 additions & 0 deletions tcb/.conf/update.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
{
"source": "tcbuild.yaml",
"target": "tcbuild.yaml"
},
{
"source": ".conf/bashrc.tcb",
"target": ".conf/bashrc.tcb"
}
]
34 changes: 34 additions & 0 deletions tcb/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,40 @@
"panel": "dedicated"
}
},
{
"label": "run-tcb-in-terminal",
"detail": "",
"hide": false,
"command": "DOCKER_HOST=",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}",
"env": {
"TCB_VERSION": "${config:tcb.version}",
"STORAGE_DIR": "${workspaceFolder}/storage",
}
},
"args": [
"bash",
"--init-file",
".conf/bashrc.tcb",
],
"problemMatcher": [
"$tsc"
],
"dependsOrder": "sequence",
"icon": {
"id": "note",
"color": "terminal.ansiYellow"
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"group": "tcb-setup",
}
},
],
"inputs": [
{
Expand Down
Loading

0 comments on commit 4540a74

Please sign in to comment.