Skip to content

Commit dac0e07

Browse files
authored
Add support for generics <T> (#3137)
1 parent ee51647 commit dac0e07

File tree

349 files changed

+10951
-7682
lines changed

Some content is hidden

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

349 files changed

+10951
-7682
lines changed

.devcontainer/All/Dockerfile.All

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM ghcr.io/nanoframework/dev-container-all:v2.57
1+
FROM ghcr.io/nanoframework/dev-container-all:v3.0
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM ghcr.io/nanoframework/dev-container-azure-rtos:v1.34
1+
FROM ghcr.io/nanoframework/dev-container-azure-rtos:v3.0
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM ghcr.io/nanoframework/dev-container-chibios:v1.35
1+
FROM ghcr.io/nanoframework/dev-container-chibios:v3.0

.devcontainer/ESP32/Dockerfile.ESP32

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM ghcr.io/nanoframework/dev-container-esp32:v2.37
1+
FROM ghcr.io/nanoframework/dev-container-esp32:v3.0
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v1.07
1+
FROM ghcr.io/nanoframework/dev-container-freertos-nxp:v3.0

.devcontainer/TI/Dockerfile.TI

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM ghcr.io/nanoframework/dev-container-ti:v1.27
1+
FROM ghcr.io/nanoframework/dev-container-ti:v3.0

CMake/Modules/AzureRTOS_EFM32GG11_GCC_options.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ macro(nf_set_link_options)
6262

6363
# set optimization linker flags for RELEASE and MinSizeRel
6464
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
65-
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os -flto -fuse-linker-plugin ")
65+
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os")
6666
endif()
6767

6868
# request specs from newlib nano

CMake/Modules/FindNF_CoreCLR.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ set(NF_CoreCLR_SRCS
4949
CLR_RT_HeapBlock_Delegate.cpp
5050
CLR_RT_HeapBlock_Delegate_List.cpp
5151
CLR_RT_HeapBlock_Finalizer.cpp
52+
CLR_RT_HeapBlock_GenericInstance.cpp
5253
CLR_RT_HeapBlock_Lock.cpp
5354
CLR_RT_HeapBlock_LockRequest.cpp
5455
CLR_RT_HeapBlock_Node.cpp
@@ -129,7 +130,6 @@ set(NF_CoreCLR_SRCS
129130
# Runtime.Native
130131
nf_rt_native.cpp
131132
nf_rt_native_nanoFramework_Runtime_Hardware_SystemInfo.cpp
132-
nf_rt_native_nanoFramework_Runtime_Native_GC.cpp
133133
nf_rt_native_nanoFramework_Runtime_Native_ExecutionConstraint.cpp
134134
nf_rt_native_nanoFramework_Runtime_Native_Power.cpp
135135
nf_rt_native_nanoFramework_Runtime_Native_Rtc_stubs.cpp

CMake/Modules/TI_SimpleLink_CC13X2_GCC_options.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ macro(nf_set_link_options)
5151

5252
# set optimization linker flags for RELEASE and MinSizeRel
5353
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
54-
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os -flto -fuse-linker-plugin ")
54+
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os ")
5555
endif()
5656

5757
# request specs from newlib nano

CMake/binutils.AzureRTOS.cmake

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
#
55

66
include(binutils.common)
7-
# include(ChibiOS_HAL)
87

98
function(nf_set_optimization_options target)
109

1110
target_compile_options(${target} PRIVATE
1211
$<$<CONFIG:Debug>:-Og -ggdb>
13-
$<$<CONFIG:Release>:-O3 -flto>
14-
$<$<CONFIG:MinSizeRel>:-Os -flto>
12+
$<$<CONFIG:Release>:-O3>
13+
$<$<CONFIG:MinSizeRel>:-Os>
1514
$<$<CONFIG:RelWithDebInfo>:-Os -femit-class-debug-always -ggdb>
1615
)
1716

CMake/binutils.TI_SimpleLink.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ function(nf_set_optimization_options target)
1313
# debug compile options: -Og (optimize for debugging) and -ggdb (produce debug symbols specifically for gdb)
1414
target_compile_options(${target} PRIVATE
1515
$<$<CONFIG:Debug>:-Og -ggdb>
16-
$<$<CONFIG:Release>:-O3 -flto>
17-
$<$<CONFIG:MinSizeRel>:-Os -flto>
16+
$<$<CONFIG:Release>:-O3>
17+
$<$<CONFIG:MinSizeRel>:-Os>
1818
$<$<CONFIG:RelWithDebInfo>:-Os -ggdb>
1919
)
2020

InteropAssemblies/CLR_RT_InteropAssembliesTable.cpp.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const CLR_RT_NativeAssemblyData *g_CLR_InteropAssembliesNativeData[] =
1919
&g_CLR_AssemblyNative_mscorlib,
2020
&g_CLR_AssemblyNative_nanoFramework_Runtime_Native,
2121
@CLR_RT_NativeAssemblyDataTableEntries@
22-
NULL
22+
nullptr
2323
};
2424

2525
const uint16_t g_CLR_InteropAssembliesCount = (@CLR_RT_NativeAssembliesCount@ + 2);

azure-pipelines-nightly.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -283,18 +283,18 @@ jobs:
283283
NeedsSRECORD: false
284284
CMakePreset: ORGPAL_PALX
285285

286-
ST_NUCLEO64_F091RC:
287-
TargetBoard: ST_NUCLEO64_F091RC
288-
TargetSeries: "stm32f0xx"
289-
BuildOptions:
290-
NeedsDFU: false
291-
NeedsSRECORD: true
292-
CMakePreset: ST_NUCLEO64_F091RC
286+
# ST_NUCLEO64_F091RC:
287+
# TargetBoard: ST_NUCLEO64_F091RC
288+
# TargetSeries: "stm32f0xx"
289+
# BuildOptions:
290+
# NeedsDFU: false
291+
# NeedsSRECORD: true
292+
# CMakePreset: ST_NUCLEO64_F091RC
293293

294294
variables:
295295
DOTNET_NOLOGO: true
296296
# creates a counter and assigns it to the revision variable
297-
REVISION: $[counter('STM32_1_12_4_versioncounter', 0)]
297+
REVISION: $[counter('STM32_2_0_0_versioncounter', 0)]
298298
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
299299
TargetPlatform: "stm32"
300300

@@ -582,7 +582,7 @@ jobs:
582582
variables:
583583
DOTNET_NOLOGO: true
584584
# creates a counter and assigns it to the revision variable
585-
REVISION: $[counter('ESP32_1_12_4_versioncounter', 0)]
585+
REVISION: $[counter('ESP32_2_0_0_versioncounter', 0)]
586586
IDF_PATH: "D:/a/1/s/esp-idf"
587587
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
588588
TargetPlatform: "esp32"
@@ -665,7 +665,7 @@ jobs:
665665
variables:
666666
DOTNET_NOLOGO: true
667667
# creates a counter and assigns it to the revision variable
668-
REVISION: $[counter('TI_1_12_4_versioncounter', 0)]
668+
REVISION: $[counter('TI_2_0_0_versioncounter', 0)]
669669
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
670670
TargetPlatform: "ti_simplelink"
671671

@@ -717,7 +717,7 @@ jobs:
717717

718718
variables:
719719
# creates a counter and assigns it to the revision variable
720-
REVISION: $[counter('AZURERTOS_1_12_4_versioncounter', 0)]
720+
REVISION: $[counter('AZURERTOS_2_0_0_versioncounter', 0)]
721721
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
722722
TargetPlatform: "efm32"
723723

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Copyright (c) .NET Foundation and Contributors
2+
# See LICENSE file in the project root for full license information.
3+
4+
steps:
5+
- task: PowerShell@2
6+
displayName: Check MDP for build
7+
condition: ne(variables['System.PullRequest.PullRequestId'], '')
8+
inputs:
9+
failOnStderr: false
10+
targetType: "inline"
11+
script: |
12+
13+
# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
14+
# 'encoded token' is the Base64 of the string "nfbot:personal-token"
15+
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)")))"
16+
17+
# find PR
18+
"Getting PR#$env:System_PullRequest_PullRequestNumber details..." | Write-Host -ForegroundColor White -NoNewline
19+
$pr = Invoke-WebRequest "https://api.github.com/repos/$env:Build_Repository_Name/pulls/$env:System_PullRequest_PullRequestNumber" | ConvertFrom-Json
20+
21+
if($($pr.number) -eq "$env:System_PullRequest_PullRequestNumber")
22+
{
23+
'##[command] OK' | Write-Host -ForegroundColor Green
24+
}
25+
26+
# grab PR commit message
27+
$prCommitMessage = $($pr.body)
28+
29+
# look for test prompt in PR commit message
30+
# pattern is "[build with MDP buildId NNN]"
31+
32+
if($prCommitMessage -match "\[build with MDP buildId (\d+)\]")
33+
{
34+
$buildId = $matches[1]
35+
"AZDO build ID found: $buildId" | Write-Host -ForegroundColor White
36+
37+
echo "##vso[task.setvariable variable=MDP_BUILDID]$buildId"
38+
}
39+
else
40+
{
41+
"No build ID found" | Write-Host -ForegroundColor Red
42+
}
43+
env:
44+
GITHUB_TOKEN: $(GitHubToken)
45+
46+
- task: DownloadPipelineArtifact@2
47+
condition: >-
48+
and(
49+
eq(variables['DownloadMDP'], true),
50+
ne(variables['MDP_BUILDID'], '')
51+
)
52+
displayName: Download MDP
53+
inputs:
54+
buildType: specific
55+
project: 'metadata-processor'
56+
definition: '43'
57+
buildVersionToDownload: specific
58+
allowFailedBuilds: true
59+
pipelineId: $(MDP_BUILDID)
60+
artifactName: 'deployables'
61+
targetPath: '$(Pipeline.Workspace)/mdp'
62+
itemPattern: '*.MsBuildTask.dll'
63+
64+
- task: PowerShell@2
65+
condition: >-
66+
and(
67+
succeeded(),
68+
eq(variables['DownloadMDP'], true),
69+
ne(variables['MDP_BUILDID'], '')
70+
)
71+
displayName: Copy MDP to build tool
72+
inputs:
73+
targetType: 'inline'
74+
script: |
75+
# Find which VS version is installed
76+
$VsWherePath = "${env:PROGRAMFILES(X86)}\Microsoft Visual Studio\Installer\vswhere.exe"
77+
78+
Write-Output "VsWherePath is: $VsWherePath"
79+
80+
$VsInstance = & $VsWherePath -latest -property displayName
81+
82+
Write-Output "Latest VS is: $VsInstance"
83+
84+
# copy MDP file to msbuild location
85+
$VsPath = & $VSWherePath -latest -property installationPath
86+
87+
Write-Debug "Copy MDP DLL to msbuild location"
88+
89+
$msbuildPath = $VsPath + "\MSBuild"
90+
91+
$extensionPath = $msbuildPath + "\nanoFramework\v1.0"
92+
93+
Copy-Item -Path "$env:Pipeline_Workspace\mdp\*" -Destination $extensionPath -Force -Verbose

azure-pipelines.yml

+44-13
Original file line numberDiff line numberDiff line change
@@ -78,34 +78,60 @@ jobs:
7878
{
7979
# this is a release prep so NO build
8080
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true"
81-
81+
8282
Write-Host "##[command] Release preparation, skipping build."
8383
}
8484
else
8585
{
8686
# get commit details, if this is a PR
8787
if($env:System_PullRequest_PullRequestId -ne $null)
8888
{
89-
Write-Host "##[command] **This is a PR build**"
89+
Write-Host "**This is a PR build**"
90+
91+
# compute authorization header in format "AUTHORIZATION: basic 'encoded token'"
92+
# 'encoded token' is the Base64 of the string "nfbot:personal-token"
93+
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("nfbot:$(GitHubToken)")))"
9094
9195
$commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-interpreter/commits/$(Build.SourceVersion)" -ContentType "application/json" -Method GET
9296
9397
if( ($commit.commit.author.name -eq "nfbot") -and ($commit.commit.message -like "*[version update]*") )
9498
{
95-
Write-Host "##[command] **version update commit, skipping build**"
96-
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true"
99+
Write-Host "**version update commit, skipping build**"
100+
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]true"
97101
}
98102
else
99103
{
100-
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false"
104+
echo "##vso[task.setvariable variable=SKIP_BUILD;isOutput=true]false"
101105
}
102106
107+
# find PR
108+
"Getting PR #$env:System_PullRequest_PullRequestNumber details..." | Write-Host -ForegroundColor White -NoNewline
109+
$pr = Invoke-WebRequest "https://api.github.com/repos/$env:Build_Repository_Name/pulls/$env:System_PullRequest_PullRequestNumber" | ConvertFrom-Json
110+
111+
if($($pr.number) -eq "$env:System_PullRequest_PullRequestNumber")
112+
{
113+
'OK' | Write-Host -ForegroundColor Green
114+
}
115+
116+
# grab PR commit message
117+
$prCommitMessage = $($pr.body)
118+
119+
# debug output
120+
# echo "=====`r`n$($prCommitMessage)`r`n====="
121+
103122
# check if Unit Tests for mscorlib should be run
104-
if(($commit.commit.message -like "*[run mscorlib tests]*") -or ($commit.commit.message -match "Tested against nanoframework/CoreLibrary#(\d+)"))
123+
if(($prCommitMessage -like "*[run mscorlib tests]*") -or ($prCommitMessage -match "Tested against nanoframework/CoreLibrary#(\d+)"))
105124
{
106-
Write-Host "##[command] **mscorlib tests are to be runned**"
125+
Write-Host "##[command] >> mscorlib tests are to be run"
107126
echo "##vso[task.setvariable variable=RUN_MSCORLIB_TESTS;isOutput=true]true"
108127
}
128+
129+
# check if should use specific MDP for mscorlib
130+
if($prCommitMessage -match "\[build with MDP buildId (\d+)\]")
131+
{
132+
Write-Host "##[command] >> Using specific MDP for mscorlib build"
133+
echo "##vso[task.setvariable variable=USE_SPECIFIC_MDP;isOutput=true]true"
134+
}
109135
}
110136
else
111137
{
@@ -409,7 +435,7 @@ jobs:
409435
variables:
410436
DOTNET_NOLOGO: true
411437
# creates a counter and assigns it to the revision variable
412-
REVISION: $[counter('STM32_1_12_4_versioncounter', 0)]
438+
REVISION: $[counter('STM32_2_0_0_versioncounter', 0)]
413439
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
414440
TargetPlatform: "stm32"
415441

@@ -524,7 +550,7 @@ jobs:
524550
variables:
525551
DOTNET_NOLOGO: true
526552
# creates a counter and assigns it to the revision variable
527-
REVISION: $[counter('ESP32_1_12_4_versioncounter', 0)]
553+
REVISION: $[counter('ESP32_2_0_0_versioncounter', 0)]
528554
IDF_PATH: "D:/a/1/s/esp-idf"
529555
PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
530556
TargetPlatform: "esp32"
@@ -612,7 +638,7 @@ jobs:
612638
variables:
613639
DOTNET_NOLOGO: true
614640
# creates a counter and assigns it to the revision variable
615-
REVISION: $[counter('NXP_1_12_4_versioncounter', 0)]
641+
REVISION: $[counter('NXP_2_0_0_versioncounter', 0)]
616642
GIT_LFS_SKIP_SMUDGE: 1
617643
TargetPlatform: "freertos"
618644

@@ -691,7 +717,7 @@ jobs:
691717
variables:
692718
DOTNET_NOLOGO: true
693719
# creates a counter and assigns it to the revision variable
694-
REVISION: $[counter('TI_1_12_4_versioncounter', 0)]
720+
REVISION: $[counter('TI_2_0_0_versioncounter', 0)]
695721
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
696722
TargetPlatform: "ti_simplelink"
697723

@@ -763,7 +789,7 @@ jobs:
763789

764790
variables:
765791
# creates a counter and assigns it to the revision variable
766-
REVISION: $[counter('AZURERTOS_1_12_4_versioncounter', 0)]
792+
REVISION: $[counter('AZURERTOS_2_0_0_versioncounter', 0)]
767793
HelperPackageVersion: $[counter('HelperPackageVersioncounter', 0)]
768794
TargetPlatform: "efm32"
769795

@@ -815,7 +841,7 @@ jobs:
815841
value: true
816842
# creates a counter and assigns it to the revision variable
817843
- name: REVISION
818-
value: $[counter('WIN32_1_12_4_versioncounter', 0)]
844+
value: $[counter('WIN32_2_0_0_versioncounter', 0)]
819845
- name: LITTLEFS_PATH
820846
value: "D:/a/1/s/littlefs"
821847

@@ -1237,6 +1263,7 @@ jobs:
12371263
12381264
dependsOn:
12391265
- Build_nanoCLR_CLI
1266+
- Check_Build_Options
12401267

12411268
pool:
12421269
vmImage: "windows-latest"
@@ -1246,6 +1273,7 @@ jobs:
12461273
solution: "nanoFramework.CoreLibrary.sln"
12471274
buildPlatform: "Any CPU"
12481275
buildConfiguration: "Release"
1276+
DownloadMDP: $[ dependencies.Check_Build_Options.outputs['BuildOptions.USE_SPECIFIC_MDP'] ]
12491277

12501278
steps:
12511279
- checkout: self
@@ -1271,6 +1299,9 @@ jobs:
12711299
displayName: Install .NET nanoFramework MSBuild components
12721300
inputs:
12731301
GitHubToken: $(GitHubToken)
1302+
UsePreview: true
1303+
1304+
- template: azure-pipelines-templates/check-mdp-for-build.yml
12741305

12751306
- template: azure-pipelines-templates/install-nuget.yml@templates
12761307

0 commit comments

Comments
 (0)