Skip to content

Commit

Permalink
fix: A number of fixes related to build / launch.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexyakunin committed Jun 25, 2020
1 parent 976b0a9 commit c768188
Show file tree
Hide file tree
Showing 21 changed files with 58 additions and 384 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -58,7 +58,7 @@ dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggesti
dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion
dotnet_style_prefer_conditional_expression_over_return = false:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_prefer_braces = true:silent
csharp_prefer_braces = false:suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = true:none
Expand Down
18 changes: 3 additions & 15 deletions .gitignore
@@ -1,9 +1,3 @@
*.cmd
artifacts/
*.binlog
**/Properties/launchSettings.json


# IDE folders & files
.vs/
.vscode/
Expand All @@ -17,6 +11,7 @@ _ReSharper*/
*.userosscache
*.sln.docstates
*.userprefs
**/Properties/launchSettings.json

# Build artifacts
[Aa]rtifacts/
Expand All @@ -28,25 +23,18 @@ StyleCopReport.xml
*.dotCover
*.coverage
*.coveragexml
*.DotSettings


# Package folders
[Pp]ackages/
node_modules/

# Log files & folders
.log
*.log
*.binlog

# Visual Studio Profiler & Trace files
*.psess
*.vsp
*.vspx
*.sap
*.e2e

# Terraform files
.terraform/
*.tfstate*
terraform.tfstate
terraform.tfvars
3 changes: 2 additions & 1 deletion docker/Dockerfile → Dockerfile
Expand Up @@ -7,12 +7,13 @@ COPY ["samples/", "samples/"]
COPY ["tests/", "tests/"]
COPY ["docs/", "docs/"]
COPY ["build/", "build/"]
COPY ["scripts/", "scripts/"]

COPY Stl.sln .
COPY Directory.Build.props .
COPY Directory.Build.targets .
COPY Packages.props .
COPY NuGet.Config .
COPY version.json .

# Collect application artifacts
FROM base as build
Expand Down
15 changes: 0 additions & 15 deletions Stl.sln
Expand Up @@ -39,8 +39,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stl.Plugins.Extensions", "s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stl.Hosting", "src\Stl.Hosting\Stl.Hosting.csproj", "{A346AAA9-DC3F-43AA-854B-B63A1B68B677}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stl.ImmutableModel", "src\Stl.ImmutableModel\Stl.ImmutableModel.csproj", "{B4D50716-B550-4E07-849B-408E5C6DCA5F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stl.CommandLine", "src\Stl.CommandLine\Stl.CommandLine.csproj", "{34B065C1-B704-4E5D-B376-6178A5672998}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stl.Fusion", "src\Stl.Fusion\Stl.Fusion.csproj", "{E8373553-8367-4C29-B9AE-0C334FF87791}"
Expand Down Expand Up @@ -134,18 +132,6 @@ Global
{A346AAA9-DC3F-43AA-854B-B63A1B68B677}.Release|x64.Build.0 = Release|Any CPU
{A346AAA9-DC3F-43AA-854B-B63A1B68B677}.Release|x86.ActiveCfg = Release|Any CPU
{A346AAA9-DC3F-43AA-854B-B63A1B68B677}.Release|x86.Build.0 = Release|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Debug|x64.ActiveCfg = Debug|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Debug|x64.Build.0 = Debug|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Debug|x86.ActiveCfg = Debug|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Debug|x86.Build.0 = Debug|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Release|Any CPU.Build.0 = Release|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Release|x64.ActiveCfg = Release|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Release|x64.Build.0 = Release|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Release|x86.ActiveCfg = Release|Any CPU
{B4D50716-B550-4E07-849B-408E5C6DCA5F}.Release|x86.Build.0 = Release|Any CPU
{34B065C1-B704-4E5D-B376-6178A5672998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34B065C1-B704-4E5D-B376-6178A5672998}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34B065C1-B704-4E5D-B376-6178A5672998}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -262,7 +248,6 @@ Global
{E84DBDB6-4E0D-4736-AF7C-B6C3BA20C2E7} = {A50B98CF-9AA1-4622-B2AD-5E17610115A7}
{A6C8E7D0-1659-4694-9B0E-505180C27476} = {A50B98CF-9AA1-4622-B2AD-5E17610115A7}
{A346AAA9-DC3F-43AA-854B-B63A1B68B677} = {A50B98CF-9AA1-4622-B2AD-5E17610115A7}
{B4D50716-B550-4E07-849B-408E5C6DCA5F} = {A50B98CF-9AA1-4622-B2AD-5E17610115A7}
{34B065C1-B704-4E5D-B376-6178A5672998} = {A50B98CF-9AA1-4622-B2AD-5E17610115A7}
{E8373553-8367-4C29-B9AE-0C334FF87791} = {A50B98CF-9AA1-4622-B2AD-5E17610115A7}
{A09C997F-3762-4ED1-8A66-B837DA773086} = {A50B98CF-9AA1-4622-B2AD-5E17610115A7}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion samples/Stl.Samples.Blazor.Client/Program.cs
Expand Up @@ -19,7 +19,7 @@ public class Program
{
public static Task Main(string[] args)
{
if (OSInfo.Kind != OSKind.Wasm)
if (OSInfo.Kind != OSKind.WebAssembly)
throw new ApplicationException("This app runs only in browser.");

var builder = WebAssemblyHostBuilder.CreateDefault(args);
Expand Down
@@ -0,0 +1,13 @@
{
"profiles": {
"Stl.Samples.Blazor.Server": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
}
}
}
5 changes: 5 additions & 0 deletions scripts/Build.cmd
@@ -0,0 +1,5 @@
@echo off

pushd ..
dotnet build %*
popd
9 changes: 9 additions & 0 deletions scripts/Docker-Run-Samples.cmd
@@ -0,0 +1,9 @@
@echo off

pushd ..
docker-compose build
start "Stl.Samples.Blazor.Server" docker-compose up
timeout 2
popd

call Start-Chrome-Debug.cmd
9 changes: 9 additions & 0 deletions scripts/Run-Samples.cmd
@@ -0,0 +1,9 @@
@echo off

pushd ..
dotnet build
set ASPNETCORE_ENVIRONMENT=Development
start "Stl.Samples.Blazor.Server" /D artifacts\samples\Stl.Samples.Blazor.Server Stl.Samples.Blazor.Server.exe
popd

call Start-Chrome-Debug.cmd
1 change: 1 addition & 0 deletions scripts/Start-Chrome-Debug.cmd
@@ -0,0 +1 @@
@start "Chrome" chrome.exe --remote-debugging-port=9222 --user-data-dir="%TEMP%\blazor-chrome-debug" http://localhost:5000/
2 changes: 0 additions & 2 deletions src/Stl.CommandLine/Stl.CommandLine.csproj.DotSettings

This file was deleted.

2 changes: 1 addition & 1 deletion src/Stl/OS/DisplayInfo.cs
Expand Up @@ -35,7 +35,7 @@ static DisplayInfo()
break;
case OSKind.Unix:
case OSKind.MacOS:
case OSKind.Wasm:
case OSKind.WebAssembly:
break;
}
}
Expand Down
15 changes: 10 additions & 5 deletions src/Stl/OS/HardwareInfo.cs
@@ -1,11 +1,12 @@
using System;
using System.Threading;
using Stl.Mathematics;

namespace Stl.OS
{
public class HardwareInfo
{
private const int RefreshIntervalTicks = 30000; // Tick = millisecond
private const int RefreshIntervalTicks = 30_000; // Tick = millisecond
private static volatile int _lastRefreshTicks;
private static volatile int _processorCount;
private static volatile int _processorCountPo2;
Expand All @@ -27,11 +28,15 @@ public class HardwareInfo
private static void MaybeRefresh()
{
var now = Environment.TickCount;
if (_lastRefreshTicks != 0 && now - _lastRefreshTicks < RefreshIntervalTicks)
var lastRefreshTicks = _lastRefreshTicks;
if (lastRefreshTicks != 0 && now - lastRefreshTicks < RefreshIntervalTicks)
// No need to refresh
return;
_lastRefreshTicks = now;
_processorCount = Environment.ProcessorCount;
_processorCountPo2 = (int) Bits.GreaterOrEqualPowerOf2((uint) _processorCount);
if (lastRefreshTicks != Interlocked.CompareExchange(ref _lastRefreshTicks, now, lastRefreshTicks))
// Some other thread is already updating these values
return;
_processorCount = Math.Max(1, Environment.ProcessorCount);
_processorCountPo2 = Math.Max(1, (int) Bits.GreaterOrEqualPowerOf2((uint) _processorCount));
}
}
}
7 changes: 3 additions & 4 deletions src/Stl/OS/OSInfo.cs
@@ -1,5 +1,4 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace Stl.OS
Expand All @@ -9,7 +8,7 @@ public enum OSKind
Unix = 0,
Windows = 1,
MacOS = 2,
Wasm = 3,
WebAssembly = 3,
}

public static class OSInfo
Expand All @@ -19,9 +18,9 @@ public static class OSInfo

static OSInfo()
{
// WASM
// WebAssembly
if (RuntimeInformation.OSDescription == "web" && RuntimeInformation.FrameworkDescription.StartsWith("Mono")) {
Kind = OSKind.Wasm;
Kind = OSKind.WebAssembly;
UserHomePath = "";
return;
}
Expand Down
159 changes: 0 additions & 159 deletions tests/Stl.Tests/ImmutableModel/Indexing/IndexTest.cs

This file was deleted.

0 comments on commit c768188

Please sign in to comment.