This repository has been archived by the owner on Feb 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
9 create scaffolding cli for templates (#15)
* cake build added * Create draft PR for #3 * Create draft PR for #9 * scaffolding cli with basic functionality * scafollding folder structure reorginized * fixed folder names in test folder * added inpch into option for wpf update * additions to readme * gh action files added * build * asp builds * asp * [mts-s-tempate][cake] fixed in issue with retrieval of ivc * asp * asp * asp * test onagent fixies * relase only from dev branch * asp * wip * [mts-s-template][fix] cu create script fixed paths * cake unified into single project * [wip] scaffolder runs using updater * various improvement to build, version bump for further updater testing * um batch file added to .tools folder * [mts-s-tempalte] implements embedded ravendb * raven directed to bin folder * [mts-s-template][test-fix] after raven embedded * [scaffolder] gets location form executing assembly instead of entry assembly to determine the location. * [scaffold][fix] attempt to solve updater path Co-authored-by: PTKu <[email protected]>
- Loading branch information
Showing
37 changed files
with
679 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,3 +240,7 @@ nugets/ | |
|
||
# VSCode | ||
.vscode/ | ||
|
||
# CI/CD | ||
artifacts/ | ||
.tools/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0"?> | ||
<TcRegistry> | ||
<Key Name="HKLM"> | ||
<Key Name="Software"> | ||
<Key Name="Beckhoff"> | ||
<Key Name="TwinCAT3"> | ||
<Value Name="CurrentVersion" Type="SZ">3.1</Value> | ||
<Key Name="System"> | ||
<Value Name="RunAsDevice" Type="DW">1</Value> | ||
<Value Name="AmsNetId" Type="BIN">C0A804010101</Value> | ||
<Value Name="LockedMemSize" Type="DW">33554432</Value> | ||
</Key> | ||
<Key Name="3.1"> | ||
<Value Name="BootDir" Type="SZ">.\3.1\Boot\</Value> | ||
<Value Name="ConfigDir" Type="SZ">.\3.1\Config\</Value> | ||
<Value Name="InstallDir" Type="SZ">.\3.1\</Value> | ||
<Value Name="TargetDir" Type="SZ">.\3.1\Target\</Value> | ||
<Value Name="DriverAutoLoadDir" Type="SZ">.\3.1\Driver\AutoLoad\</Value> | ||
</Key> | ||
<Key Name="EventLogger"> | ||
<Value Name="LastUniqueId" Type="DW">0</Value> | ||
</Key> | ||
</Key> | ||
</Key> | ||
</Key> | ||
<Key Name="Ident"> | ||
<Value Name="DeviceType" Type="SZ">PC-WIN-U</Value> | ||
</Key> | ||
</Key> | ||
</TcRegistry> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@echo off | ||
|
||
set TC_RT_INST_NETID=192.168.4.1.1.1 | ||
set TC_RT_INST_BUILD=4024.22 | ||
|
||
for %%I in (.) do set TC_INST_NAME=%%~nxI | ||
%TWINCAT3DIR%Runtimes\bin\Build_%TC_RT_INST_BUILD%\TcSystemServiceUm.exe -i %TC_RT_INST_NETID% -n %TC_INST_NAME% -c ".\3.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
mode: ContinuousDeployment | ||
next-version: 0.1.0 | ||
next-version: 0.1.1 | ||
branches: {} | ||
ignore: | ||
sha: [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
$root = Get-Location | ||
Set-Location .\templates\mts-s-template\ | ||
./build.ps1 | ||
Set-Location $root | ||
# dotnet run --project cake/Build.csproj -- $args | ||
# We need to use msbuild instead of dotnet due to COMrefs in the project. | ||
|
||
Set-Location .\scaffolder\TcOpen.Scaffold\ | ||
./build.ps1 | ||
Set-Location $root | ||
$msbuild =([System.Environment]::GetEnvironmentVariable('TcoMsbuild')) | ||
cd cake | ||
dotnet restore Build.csproj | ||
|
||
& $msbuild Build.csproj /t:Rebuild /p:Configuration=Release /p:Platform=AnyCPU /p:TargetFramework=net5.0 /p:DefineConstants=Release $args | ||
.\bin\Release\net5.0\Build.exe $args | ||
cd .. | ||
exit $LASTEXITCODE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Cake.Frosting; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace Build | ||
{ | ||
[TaskName("Default")] | ||
[IsDependentOn(typeof(Scaffolder.LastTask))] | ||
public class DefaultTask : FrostingTask | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Cake.Common.Tools.MSBuild; | ||
using Cake.Core; | ||
using Cake.Core.IO; | ||
using Cake.Frosting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using Cake.Common.Tools.DotNet; | ||
|
||
|
||
namespace Build | ||
{ | ||
public static class Program | ||
{ | ||
public static int Main(string[] args) | ||
{ | ||
return new CakeHost() | ||
.UseContext<BuildContext>() | ||
.Run(args); | ||
|
||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
using Cake.Common.Tools.DotNet; | ||
using Cake.Core; | ||
using Cake.Frosting; | ||
using Octokit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Build.Scaffolder | ||
{ | ||
public class Const | ||
{ | ||
public const string BuildGroupName = " : Scaffolder"; | ||
} | ||
|
||
[TaskName("Startup" + Const.BuildGroupName)] | ||
[IsDependentOn(typeof(mts_s_template.LastTask))] | ||
public sealed class StartUpTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
|
||
} | ||
} | ||
|
||
[TaskName("Setup" + Const.BuildGroupName)] | ||
[IsDependentOn(typeof(StartUpTask))] | ||
public sealed class SetupTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
context.ProjectRootDirectory = Path.GetFullPath(Path.Combine(context.Environment.WorkingDirectory.FullPath, "..//scaffolder//TcOpen.Scaffold")); | ||
} | ||
} | ||
|
||
[TaskName("Clean" + Const.BuildGroupName)] | ||
[IsDependentOn(typeof(SetupTask))] | ||
public sealed class CleanTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
context.ProjectRootDirectory = Path.GetFullPath(Path.Combine(context.Environment.WorkingDirectory.FullPath, "..//scaffolder//TcOpen.Scaffold")); | ||
// delete artifacts folder | ||
var artifactsFolder = context.FileSystem.GetDirectory(context.ArtifactsFolder); | ||
if (artifactsFolder.Exists) | ||
{ | ||
artifactsFolder.Delete(true); | ||
} | ||
|
||
context.DotNetClean($"{context.ProjectRootDirectory}\\TcOpen.Scaffold.sln"); | ||
} | ||
} | ||
|
||
[TaskName("Build" + Const.BuildGroupName)] | ||
[IsDependentOn(typeof(CleanTask))] | ||
public sealed class BuildTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
context.DotNetBuild($"{context.ProjectRootDirectory}\\TcOpen.Scaffold.sln", new Cake.Common.Tools.DotNet.Build.DotNetBuildSettings() | ||
{ | ||
Configuration = "Release" | ||
}); | ||
} | ||
} | ||
|
||
[TaskName("Create artifacts" + Const.BuildGroupName)] | ||
[IsDependentOn(typeof(BuildTask))] | ||
public sealed class ArtifactTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
PublishArtifact(context, "net5.0-windows", "TcOpen.Scaffold.UI.zip", $"{context.ProjectRootDirectory}\\src\\TcOpen.Scaffold.UI\\TcOpen.Scaffold.UI.csproj", $"{context.ProjectRootDirectory}\\src\\TcOpen.Scaffold.UI\\Publish"); | ||
PublishArtifact(context, "net5.0", "TcOpen.Scaffold.Runner.zip", $"{context.ProjectRootDirectory}\\src\\TcOpen.Scaffold.Runner\\TcOpen.Scaffold.Runner.csproj", $"{context.ProjectRootDirectory}\\src\\TcOpen.Scaffold.Runner\\Publish"); | ||
} | ||
|
||
private static void PublishArtifact(BuildContext context, | ||
string framework, | ||
string name, | ||
string projectFile, | ||
string outputFolder) | ||
{ | ||
|
||
context.DotNetPublish(projectFile, | ||
new Cake.Common.Tools.DotNet.Publish.DotNetPublishSettings() | ||
{ | ||
Configuration = "Release", | ||
Framework = framework , | ||
PublishSingleFile = true, | ||
SelfContained = false, | ||
PublishReadyToRun = true, | ||
Runtime = "win10-x64", | ||
OutputDirectory = outputFolder | ||
}); | ||
|
||
context.ZipFolder(outputFolder, Path.GetFullPath(Path.Combine(context.ArtifactsFolder, name))); | ||
} | ||
} | ||
|
||
[TaskName("Publish release" + Const.BuildGroupName)] | ||
[IsDependentOn(typeof(ArtifactTask))] | ||
public sealed class PublishReleaseTask : FrostingTask<BuildContext> | ||
{ | ||
public override void Run(BuildContext context) | ||
{ | ||
//var githubActionsProvider = new Cake.Common.Build.GitHubActions.GitHubActionsProvider(context.Environment, context.FileSystem); | ||
|
||
//if (GitVersionInformation.BranchName == "dev") | ||
{ | ||
var githubToken = context.Environment.GetEnvironmentVariable("gh-public-repos"); | ||
var githubClient = new GitHubClient(new ProductHeaderValue("TcOpen.Scaffold.UI")); | ||
githubClient.Credentials = new Credentials(githubToken); | ||
|
||
var release = githubClient.Repository.Release.Create( | ||
"TcOpenGroup", | ||
"tcopen-app-templates", | ||
new NewRelease($"{GitVersionInformation.SemVer}") | ||
{ | ||
Name = $"{GitVersionInformation.SemVer}", | ||
TargetCommitish = GitVersionInformation.Sha, | ||
Body = $"Release v{GitVersionInformation.SemVer}", | ||
Draft = true, | ||
Prerelease = true | ||
} | ||
).Result; | ||
|
||
|
||
foreach (var artifact in Directory.EnumerateFiles(context.ArtifactsFolder, "*.zip").Select(p => new FileInfo(p))) | ||
{ | ||
var asset = new ReleaseAssetUpload(artifact.Name, "application/zip", new StreamReader(artifact.FullName).BaseStream, TimeSpan.FromSeconds(3600)); | ||
githubClient.Repository.Release.UploadAsset(release, asset).Wait(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
[TaskName("Default" + Const.BuildGroupName)] | ||
[IsDependentOn(typeof(PublishReleaseTask))] | ||
public class LastTask : FrostingTask | ||
{ | ||
} | ||
} |
Oops, something went wrong.