mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 14:02:19 +00:00
Added templates for dotnet new.
This commit is contained in:
parent
274fa3e9a5
commit
fb2251df65
13 changed files with 198 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
<Import Project="StrongName.targets" />
|
<Import Project="StrongName.targets" />
|
||||||
|
|
||||||
|
<Import Project="Templates.targets" Condition="'$(IsTemplatesProject)' == 'True'" />
|
||||||
<Import Project="Tests.targets" Condition="'$(IsTestProject)' == 'True'" />
|
<Import Project="Tests.targets" Condition="'$(IsTestProject)' == 'True'" />
|
||||||
<Import Project="VSIX.targets" Condition="'$(IsVsixProject)' == 'True'" />
|
<Import Project="VSIX.targets" Condition="'$(IsVsixProject)' == 'True'" />
|
||||||
|
|
||||||
|
|
|
||||||
42
Build/Targets/Templates.targets
Normal file
42
Build/Targets/Templates.targets
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
<Project>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard1.0</TargetFramework>
|
||||||
|
<PackageOutputPath>$(ArtifactsDir)packages\</PackageOutputPath>
|
||||||
|
<NoBuild>True</NoBuild>
|
||||||
|
<IncludeBuildOutput>False</IncludeBuildOutput>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<PackageInstallationDir>$(UserProfile)\.cosmos\packages\</PackageInstallationDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="content\**" Pack="True" PackagePath="content\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="InstallTemplates" DependsOnTargets="Pack">
|
||||||
|
|
||||||
|
<MakeDir Directories="$(PackageInstallationDir)" />
|
||||||
|
|
||||||
|
<MSBuild Projects="$(MSBuildProjectFullPath)"
|
||||||
|
Targets="_GetOutputItemsFromPack">
|
||||||
|
<Output TaskParameter="TargetOutputs" ItemName="PackageFile" />
|
||||||
|
</MSBuild>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageFile Remove="@(PackageFile)" Condition="'%(Extension)' != '.nupkg'" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TemplatePackagePath>@(PackageFile)</TemplatePackagePath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Copy SourceFiles="@(TemplatePackagePath)"
|
||||||
|
DestinationFolder="$(PackageInstallationDir)" />
|
||||||
|
|
||||||
|
<Exec Command="dotnet new -i $(PackageInstallationDir)$([System.IO.Path]::GetFilename('$(TemplatePackagePath)'))" />
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<IsTemplatesProject>True</IsTemplatesProject>
|
||||||
|
<PackageDescription>Cosmos kernel templates for C#, Visual Basic and F#.
|
||||||
|
$(CosmosDescription)</PackageDescription>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/template",
|
||||||
|
"author": "Cosmos",
|
||||||
|
"classifications": [ "Kernel", "Cosmos" ],
|
||||||
|
"groupIdentity": "Cosmos.Templates.Kernel",
|
||||||
|
"identity": "Cosmos.Templates.Kernel.CSharp",
|
||||||
|
"name": "Cosmos Kernel",
|
||||||
|
"shortName": "cosmoskernel",
|
||||||
|
"tags":{
|
||||||
|
"language": "C#",
|
||||||
|
"type": "project"
|
||||||
|
},
|
||||||
|
"sourceName": "CosmosKernel"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Cosmos.Build" Version="*" NoWarn="NU1604" />
|
||||||
|
<PackageReference Include="Cosmos.Debug.Kernel" Version="*" NoWarn="NU1604" />
|
||||||
|
<PackageReference Include="Cosmos.System2" Version="*" NoWarn="NU1604" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Sys = Cosmos.System;
|
||||||
|
|
||||||
|
namespace CosmosKernel
|
||||||
|
{
|
||||||
|
public class Kernel: Sys.Kernel
|
||||||
|
{
|
||||||
|
protected override void BeforeRun()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Run()
|
||||||
|
{
|
||||||
|
Console.Write("Input: ");
|
||||||
|
var input = Console.ReadLine();
|
||||||
|
Console.Write("Text typed: ");
|
||||||
|
Console.WriteLine(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/template",
|
||||||
|
"author": "Cosmos",
|
||||||
|
"classifications": [ "Kernel", "Cosmos" ],
|
||||||
|
"groupIdentity": "Cosmos.Templates.Kernel",
|
||||||
|
"identity": "Cosmos.Templates.Kernel.FSharp",
|
||||||
|
"name": "Cosmos Kernel",
|
||||||
|
"shortName": "cosmoskernel",
|
||||||
|
"tags":{
|
||||||
|
"language": "F#",
|
||||||
|
"type": "project"
|
||||||
|
},
|
||||||
|
"sourceName": "CosmosKernel"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Kernel.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Cosmos.Build" Version="*" NoWarn="NU1604" />
|
||||||
|
<PackageReference Include="Cosmos.Debug.Kernel" Version="*" NoWarn="NU1604" />
|
||||||
|
<PackageReference Include="Cosmos.System2" Version="*" NoWarn="NU1604" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
namespace CosmosKernel
|
||||||
|
|
||||||
|
open System
|
||||||
|
|
||||||
|
type Kernel() =
|
||||||
|
inherit Cosmos.System.Kernel()
|
||||||
|
override u.BeforeRun() = (Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.");)
|
||||||
|
override u.Run() =
|
||||||
|
Console.Write("Input: ");
|
||||||
|
let input = Console.ReadLine();
|
||||||
|
Console.Write("Text typed: ");
|
||||||
|
Console.WriteLine(input);
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/template",
|
||||||
|
"author": "Cosmos",
|
||||||
|
"classifications": [ "Kernel", "Cosmos" ],
|
||||||
|
"groupIdentity": "Cosmos.Templates.Kernel",
|
||||||
|
"identity": "Cosmos.Templates.Kernel.VisualBasic",
|
||||||
|
"name": "Cosmos Kernel",
|
||||||
|
"shortName": "cosmoskernel",
|
||||||
|
"tags":{
|
||||||
|
"language": "VB",
|
||||||
|
"type": "project"
|
||||||
|
},
|
||||||
|
"sourceName": "CosmosKernel"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Cosmos.Build" Version="*" NoWarn="NU1604" />
|
||||||
|
<PackageReference Include="Cosmos.Debug.Kernel" Version="*" NoWarn="NU1604" />
|
||||||
|
<PackageReference Include="Cosmos.System2" Version="*" NoWarn="NU1604" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
Imports System
|
||||||
|
Imports System.Collections.Generic
|
||||||
|
Imports System.Text
|
||||||
|
|
||||||
|
Namespace CosmosKernel
|
||||||
|
|
||||||
|
Public Class Kernel
|
||||||
|
Inherits Cosmos.System.Kernel
|
||||||
|
|
||||||
|
Protected Overrides Sub BeforeRun()
|
||||||
|
Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.")
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Protected Overrides Sub Run()
|
||||||
|
Console.Write("Input: ")
|
||||||
|
Dim input = Console.ReadLine()
|
||||||
|
Console.Write("Text typed: ")
|
||||||
|
Console.WriteLine(input)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
End Class
|
||||||
|
|
||||||
|
End Namespace
|
||||||
3
source/Templates/install-dotnet-templates.bat
Normal file
3
source/Templates/install-dotnet-templates.bat
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
dotnet msbuild Cosmos.Templates.Kernel\Cosmos.Templates.Kernel.csproj /t:InstallTemplates
|
||||||
Loading…
Reference in a new issue