Skip to content
Closed
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
48 changes: 48 additions & 0 deletions .github/workflows/osx-nanoclr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: osx-nanoclr

on:
push:
paths:
- "targets/osx/**"
- ".github/workflows/osx-nanoclr.yml"
pull_request:
paths:
- "targets/osx/**"
- ".github/workflows/osx-nanoclr.yml"

jobs:
build-osx-nanoclr:
runs-on: macos-14

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Ninja (if missing)
run: |
if ! command -v ninja >/dev/null 2>&1; then
brew install ninja
fi

- name: Configure
run: |
cmake -S targets/osx -B build/osx -G Ninja \
-DNANO_OSX_ARCH=arm64 \
-DNANO_OSX_ENABLE_SMOKE=ON

- name: Build
run: cmake --build build/osx --verbose

- name: Smoke Run
run: |
set -euo pipefail
./build/osx/bin/nanoFramework.nanoCLR --version | tee build/osx/smoke.log

- name: Upload Artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: osx-nanoclr
path: |
build/osx/bin/nanoFramework.nanoCLR
build/osx/smoke.log
68 changes: 67 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ jobs:
echo "##vso[task.setvariable variable=BUILD_TI;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_THREADX;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_WIN32;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_OSX;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_NANOCLR_CLI;isOutput=true]false"
echo "##vso[task.setvariable variable=BUILD_ALL;isOutput=true]false"

Expand Down Expand Up @@ -250,6 +251,14 @@ jobs:

Write-host "##[command] Building nanoCLR target"
}

if( ($files.where{$_.Contains('targets/osx')}).Count -gt 0)
{
# files at OSX folder
echo "##vso[task.setvariable variable=BUILD_OSX;isOutput=true]true"

Write-host "##[command] Building OSX nanoCLR target"
}

if(
(($files.where{$_.Contains('targets/netcore/nanoFramework.nanoCLR.CLI')}).Count -gt 0) -Or
Expand Down Expand Up @@ -345,7 +354,8 @@ jobs:
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_FREERTOS'], true),
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_TI'], true),
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_THREADX'], true),
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_WIN32'], true)
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_WIN32'], true),
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_OSX'], true)
)
)

Expand Down Expand Up @@ -1008,6 +1018,60 @@ jobs:

- template: azure-pipelines-templates/publish-nanoclr.yml

#################
# OSX host target
- job: Build_OSX_nanoCLR
condition: >-
or(
and(
succeeded('Check_Code_Style'),
ne( dependencies.Check_Build_Options.outputs['BuildOptions.SKIP_BUILD'], true ),
or(
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_ALL'], true),
eq(dependencies.Check_Build_Options.outputs['TargetsToBuild.BUILD_OSX'], true)
)
),
and(
eq(variables['Build.Reason'], 'Manual'),
or(
eq(variables['BUILD_ALL__'], 'true'),
eq(variables['BUILD_OSX__'], 'true')
)
)
)

dependsOn:
- Check_Build_Options
- Check_Code_Style

pool:
vmImage: "macos-14"

steps:
- checkout: self

- bash: |
set -euo pipefail

AGENT_ARCH="$(uname -m)"
if [ "${AGENT_ARCH}" = "arm64" ]; then
NANO_OSX_ARCH="arm64"
else
NANO_OSX_ARCH="x86_64"
fi

echo "Agent architecture: ${AGENT_ARCH}"
echo "Using NANO_OSX_ARCH=${NANO_OSX_ARCH}"

cmake -S targets/osx -B build/osx -G Ninja -DNANO_OSX_ARCH="${NANO_OSX_ARCH}" -DNANO_OSX_ENABLE_SMOKE=ON
cmake --build build/osx
./build/osx/bin/nanoFramework.nanoCLR --version | tee build/osx/smoke.log
if ! grep -Eq '[0-9]+\.[0-9]+\.[0-9]+' build/osx/smoke.log; then
echo "ERROR: smoke output validation failed, expected semantic version in --version output."
exit 1
fi
displayName: Build and smoke run OSX nanoCLR

#################
# nanoCLR CLI tool
- job: Build_nanoCLR_CLI
Expand Down Expand Up @@ -1322,6 +1386,7 @@ jobs:
- Build_TI_SimpleLink_targets
- Build_ThreadX_targets
- Build_WIN32_nanoCLR
- Build_OSX_nanoCLR
- Build_nanoCLR_CLI
- Check_Code_Style
condition: >-
Expand All @@ -1334,6 +1399,7 @@ jobs:
failed('Build_TI_SimpleLink_targets'),
failed('Build_ThreadX_targets'),
failed('Build_WIN32_nanoCLR'),
failed('Build_OSX_nanoCLR'),
failed('Build_nanoCLR_CLI')
)
)
Expand Down
12 changes: 2 additions & 10 deletions targets/netcore/nanoFramework.nanoCLR.CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ static int Main(string[] args)
_copyrightInfo = new CopyrightInfo(true, ".NET Foundation and nanoFramework project contributors", 2021);

// need this to be able to use ProcessStart at the location where the .NET Core CLI tool is running from
string codeBase = Assembly.GetExecutingAssembly().Location;
var uri = new UriBuilder(codeBase);
var fullPath = Uri.UnescapeDataString(uri.Path);
ExecutingPath = Path.GetDirectoryName(fullPath);
string assemblyLocation = Assembly.GetExecutingAssembly().Location;
ExecutingPath = Path.GetDirectoryName(Path.GetFullPath(assemblyLocation));

// check for empty argument collection
if (!args.Any())
Expand Down Expand Up @@ -93,9 +91,6 @@ static int Main(string[] args)
VirtualSerialDeviceManager virtualSerialBridgeManager = new();
virtualSerialBridgeManager.Initialize();

// need to set DLL directory to HHD interop DLL
SetDllDirectory(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Vendor"));

var parsedArguments = Parser.Default.ParseArguments<ExecuteCommandLineOptions, ClrInstanceOperationsOptions, VirtualSerialDeviceCommandLineOptions>(args);

Console.ForegroundColor = ConsoleColor.White;
Expand Down Expand Up @@ -240,8 +235,5 @@ private static void LogErrors(Action scope)
}
}

[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetDllDirectory(string lpPathName);

}
}
Loading
Loading