diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
new file mode 100644
index 0000000..d3c43c2
--- /dev/null
+++ b/.config/dotnet-tools.json
@@ -0,0 +1,11 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "gitversion.tool": {
+ "version": "6.0.2",
+ "commands": ["dotnet-gitversion"],
+ "rollForward": false
+ }
+ }
+}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index df64cd4..7c61e55 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -7,9 +7,9 @@ name: MSBuild
on:
push:
- branches: [ "main" ]
+ branches: ["main"]
pull_request:
- branches: [ "main" ]
+ branches: ["main"]
permissions:
contents: read
@@ -22,39 +22,40 @@ jobs:
runs-on: windows-latest
steps:
- - uses: actions/checkout@v4
- with:
- path: speckle-cpp-connectors
- - uses: actions/checkout@v4
- with:
- repository: r-wessel/ActiveLib
- path: ActiveLib
+ - uses: actions/checkout@v4
+ with:
+ path: speckle-cpp-connectors
+ - uses: actions/checkout@v4
+ with:
+ repository: r-wessel/ActiveLib
+ path: ActiveLib
- - name: Download zip file
- run: |
- New-Item -ItemType Directory -Path "Archicad 27" -Force
- Invoke-WebRequest -Uri "https://github.com/GRAPHISOFT/archicad-api-devkit/releases/download/27.3001/API.Development.Kit.WIN.27.3001.zip" -OutFile "file.zip"
+ - name: Download zip file
+ run: |
+ New-Item -ItemType Directory -Path "Archicad 27" -Force
+ Invoke-WebRequest -Uri "https://github.com/GRAPHISOFT/archicad-api-devkit/releases/download/27.3001/API.Development.Kit.WIN.27.3001.zip" -OutFile "file.zip"
- - name: Extract zip file to Archicad 27 folder
- run: |
- Add-Type -AssemblyName System.IO.Compression.FileSystem
- [System.IO.Compression.ZipFile]::ExtractToDirectory("file.zip", "Archicad 27")
+ - name: Extract zip file to Archicad 27 folder
+ run: |
+ Add-Type -AssemblyName System.IO.Compression.FileSystem
+ [System.IO.Compression.ZipFile]::ExtractToDirectory("file.zip", "Archicad 27")
- - name: Add MSBuild to PATH
- uses: microsoft/setup-msbuild@v2
-
- - name: Build
- run: msbuild /m /p:Configuration=ReleaseAC27 speckle-cpp-connectors/SpeckleConnector/Connector.sln
+ - name: Add MSBuild to PATH
+ uses: microsoft/setup-msbuild@v2
- - uses: actions/upload-artifact@v4
- with:
- name: output-${{ env.GitVersion_FullSemVer }}
- path: speckle-cpp-connectors\SpeckleConnector\x64\ReleaseAC27\Speckle Connector.apx
- retention-days: 1
-
- - id: set-version
- name: Set version to output
- run: echo "version=${{ env.GitVersion_FullSemVer }}" >> "$Env:GITHUB_OUTPUT"
+ - name: Build
+ working-directory: speckle-cpp-connectors
+ run: ./build.ps1
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: output-${{ env.GitVersion_FullSemVer }}
+ path: output/*
+ retention-days: 1
+
+ - id: set-version
+ name: Set version to output
+ run: echo "version=${{ env.GitVersion_FullSemVer }}" >> "$Env:GITHUB_OUTPUT"
deploy-installers:
runs-on: ubuntu-latest
@@ -80,4 +81,4 @@ jobs:
# - uses: geekyeggo/delete-artifact@v5
# with:
- # name: output-*
\ No newline at end of file
+ # name: output-*
diff --git a/.gitignore b/.gitignore
index c182158..23ed75b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,4 +25,6 @@ XCBuildData/
*.log
.idea
*.mui
-*.aps
\ No newline at end of file
+*.aps
+**/obj
+**/bin
\ No newline at end of file
diff --git a/SpeckleConnector/Connector.sln b/SpeckleConnector/Connector.sln
index 57c7d5a..904cbd1 100644
--- a/SpeckleConnector/Connector.sln
+++ b/SpeckleConnector/Connector.sln
@@ -13,6 +13,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ActiveLib17", "..\..\Active
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SpeckleLib17", "..\SpeckleLib\SpeckleLib17.vcxproj", "{942743B7-B3CB-4F91-BE46-28937F5E3FD1}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "..\ci-build\Build.csproj", "{702DE13A-1CCF-485D-A50D-846F645F07D3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug16|x64 = Debug16|x64
@@ -143,6 +145,40 @@ Global
{942743B7-B3CB-4F91-BE46-28937F5E3FD1}.ReleaseVS2022|x64.Build.0 = ReleaseAC27|x64
{942743B7-B3CB-4F91-BE46-28937F5E3FD1}.ReleaseVS2022|x86.ActiveCfg = ReleaseAC27|Win32
{942743B7-B3CB-4F91-BE46-28937F5E3FD1}.ReleaseVS2022|x86.Build.0 = ReleaseAC27|Win32
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug16|x64.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug16|x64.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug16|x86.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug16|x86.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug17|x64.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug17|x64.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug17|x86.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug17|x86.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugAC27|x64.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugAC27|x86.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugAC27|x86.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugVS2022|x64.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugVS2022|x64.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugVS2022|x86.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugVS2022|x86.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Release16|x64.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Release16|x64.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Release16|x86.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Release16|x86.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Release17|x64.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Release17|x64.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Release17|x86.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.Release17|x86.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseAC27|x86.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseAC27|x86.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2019|x64.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2019|x64.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2019|x86.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2019|x86.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2022|x64.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2022|x64.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2022|x86.ActiveCfg = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2022|x86.Build.0 = Debug|Any CPU
+ {702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseAC27|x64.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/build.ps1 b/build.ps1
new file mode 100644
index 0000000..e63b7aa
--- /dev/null
+++ b/build.ps1
@@ -0,0 +1,3 @@
+$ErrorActionPreference = "Stop";
+
+dotnet run --project ci-build/build.csproj -- $args
\ No newline at end of file
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..f75ab37
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+dotnet run --project Build/Build.csproj -- "$@"
diff --git a/ci-build/Build.csproj b/ci-build/Build.csproj
new file mode 100644
index 0000000..49cf624
--- /dev/null
+++ b/ci-build/Build.csproj
@@ -0,0 +1,16 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ Debug;Release;Local
+ true
+
+
+
+
+
+
+
+
diff --git a/ci-build/Consts.cs b/ci-build/Consts.cs
new file mode 100644
index 0000000..003e035
--- /dev/null
+++ b/ci-build/Consts.cs
@@ -0,0 +1,18 @@
+namespace Build;
+
+public static class Consts
+{
+ public static readonly string[] Solutions = ["SpeckleConnector/Connector.sln"];
+
+ public static readonly InstallerProject[] InstallerManifests =
+ {
+ new("archicad", [new("SpeckleConnector", "x64/ReleaseAC27/net6.0-windows")])
+ };
+}
+
+public readonly record struct InstallerProject(string HostAppSlug, IReadOnlyList Projects)
+{
+ public override string ToString() => $"{HostAppSlug}";
+}
+
+public readonly record struct InstallerAsset(string ProjectPath, string TargetName);
diff --git a/ci-build/Program.cs b/ci-build/Program.cs
new file mode 100644
index 0000000..cfb82fe
--- /dev/null
+++ b/ci-build/Program.cs
@@ -0,0 +1,137 @@
+using System.IO.Compression;
+using Build;
+using GlobExpressions;
+using static Bullseye.Targets;
+using static SimpleExec.Command;
+
+const string CLEAN = "clean";
+const string RESTORE = "restore";
+const string BUILD = "build";
+const string ZIP = "zip";
+const string RESTORE_TOOLS = "restore-tools";
+const string BUILD_SERVER_VERSION = "build-server-version";
+
+//need to pass arguments
+/*var arguments = new List();
+if (args.Length > 1)
+{
+ arguments = args.ToList();
+ args = new[] { arguments.First() };
+ //arguments = arguments.Skip(1).ToList();
+}*/
+
+Target(
+ CLEAN,
+ ForEach("**/output"),
+ dir =>
+ {
+ IEnumerable GetDirectories(string d)
+ {
+ return Glob.Directories(".", d);
+ }
+
+ void RemoveDirectory(string d)
+ {
+ if (Directory.Exists(d))
+ {
+ Console.WriteLine(d);
+ Directory.Delete(d, true);
+ }
+ }
+
+ foreach (var d in GetDirectories(dir))
+ {
+ RemoveDirectory(d);
+ }
+ }
+);
+
+Target(
+ RESTORE_TOOLS,
+ () =>
+ {
+ Run("dotnet", "tool restore");
+ }
+);
+
+
+
+Target(
+ RESTORE,
+ Consts.Solutions,
+ s =>
+ {
+ Run("dotnet", $"restore {s}");
+ }
+);
+
+Target(
+ BUILD_SERVER_VERSION,
+ DependsOn(RESTORE_TOOLS),
+ () =>
+ {
+ Run("dotnet", "tool run dotnet-gitversion /output json /output buildserver");
+ }
+);
+
+Target(
+ BUILD,
+ DependsOn(RESTORE),
+ Consts.Solutions,
+ s =>
+ {
+ //var version = Environment.GetEnvironmentVariable("GitVersion_FullSemVer") ?? "3.0.0-localBuild";
+ //var fileVersion = Environment.GetEnvironmentVariable("GitVersion_AssemblySemFileVer") ?? "3.0.0.0";
+ //Console.WriteLine($"Version: {version} & {fileVersion}");
+ //Run("dotnet", $"build {s} -c Release --no-restore -p:Version={version} -p:FileVersion={fileVersion} -v:m");
+ Run("msbuild", $"{s} /p:Configuration=ReleaseAC27");
+ }
+);
+
+Target(
+ ZIP,
+ DependsOn(BUILD),
+ Consts.InstallerManifests,
+ x =>
+ {
+ var outputDir = Path.Combine(".", "output");
+ var slugDir = Path.Combine(outputDir, x.HostAppSlug);
+
+ Directory.CreateDirectory(outputDir);
+ Directory.CreateDirectory(slugDir);
+
+ foreach (var asset in x.Projects)
+ {
+ var fullPath = Path.Combine(".", asset.ProjectPath, "bin", "Release", asset.TargetName);
+ if (!Directory.Exists(fullPath))
+ {
+ throw new InvalidOperationException("Could not find: " + fullPath);
+ }
+
+ var assetName = Path.GetFileName(asset.ProjectPath);
+ var connectorDir = Path.Combine(slugDir, assetName);
+
+ Directory.CreateDirectory(connectorDir);
+ foreach (var directory in Directory.EnumerateDirectories(fullPath, "*", SearchOption.AllDirectories))
+ {
+ Directory.CreateDirectory(directory.Replace(fullPath, connectorDir));
+ }
+
+ foreach (var file in Directory.EnumerateFiles(fullPath, "*", SearchOption.AllDirectories))
+ {
+ Console.WriteLine(file);
+ File.Copy(file, file.Replace(fullPath, connectorDir), true);
+ }
+ }
+
+ var outputPath = Path.Combine(outputDir, $"{x.HostAppSlug}.zip");
+ File.Delete(outputPath);
+ Console.WriteLine($"Zipping: '{slugDir}' to '{outputPath}'");
+ ZipFile.CreateFromDirectory(slugDir, outputPath);
+ // Directory.Delete(slugDir, true);
+ }
+);
+
+Target("default", DependsOn(ZIP), () => Console.WriteLine("Done!"));
+
+await RunTargetsAndExitAsync(args).ConfigureAwait(true);