Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/bump-dependencymodel #53

Merged
merged 9 commits into from
Aug 28, 2024
Merged
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
5 changes: 4 additions & 1 deletion .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: .NET Build

env:
DOTNET_VERSION: "8.0.x"

on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -34,7 +37,7 @@ jobs:
- name: Setup .Net
uses: actions/setup-dotnet@v4
with:
dotnet-version: "6.0.400"
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Build & run tests for root
run: dotnet test --configuration Release
7 changes: 5 additions & 2 deletions .github/workflows/javascript-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: JavaScript Build

env:
NODE_VERSION: "22.x"

on:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -31,10 +34,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup node v20
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"

- uses: actions/cache@v3
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Publish

env:
NUGET_OUTPUT: ./Artifacts/NuGet
DOTNET_VERSION: "6.0.400"
NUGET_OUTPUT: ./Artifacts/NuGet
DOTNET_VERSION: "8.0.x"
NODE_VERSION: "22.x"

on:
workflow_dispatch:
Expand Down Expand Up @@ -86,13 +87,13 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup node v20
- name: Setup node
uses: actions/setup-node@v4
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
node-version: 20.x
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"

- uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="8.0.0" />
<PackageVersion Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
<PackageVersion Include="Humanizer" Version="2.14.1" />
Expand Down
7 changes: 7 additions & 0 deletions Samples/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<Import Project="../Directory.Build.props" />

<PropertyGroup>
<NoWarn>$(NoWarn);SA0001</NoWarn>
</PropertyGroup>
</Project>
4 changes: 1 addition & 3 deletions Samples/TypeDiscovery/FirstImplementation.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
namespace TypeDiscovery;

public class FirstImplementation : ISomeInterface
{
}
public class FirstImplementation : ISomeInterface;
4 changes: 1 addition & 3 deletions Samples/TypeDiscovery/ISomeInterface.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
namespace TypeDiscovery;

public interface ISomeInterface
{
}
public interface ISomeInterface;
4 changes: 3 additions & 1 deletion Samples/TypeDiscovery/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Cratis.Types;
using Cratis.Collections;
using Cratis.Types;

namespace TypeDiscovery;

Expand All @@ -8,5 +9,6 @@ public static void Main()
{
var types = new Types();
var typesFound = types.FindMultiple<ISomeInterface>();
typesFound.ForEach(type => Console.WriteLine(type.FullName));
}
}
4 changes: 1 addition & 3 deletions Samples/TypeDiscovery/SecondImplementation.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
namespace TypeDiscovery;

public class SecondImplementation : ISomeInterface
{
}
public class SecondImplementation : ISomeInterface;
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public void Initialize()
}

var entryAssembly = Assembly.GetEntryAssembly();
if (entryAssembly is null) return;

var dependencyModel = DependencyContext.Load(entryAssembly);
if (dependencyModel is null) return;

var assemblies = dependencyModel.RuntimeLibraries
.Where(_ => !_.Type.Equals("project") &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public void Initialize()

var entryAssembly = Assembly.GetEntryAssembly()!;
var dependencyModel = DependencyContext.Load(entryAssembly);
if (dependencyModel is null) return;

var projectReferencedAssemblies = dependencyModel.RuntimeLibraries
.Where(_ => _.Type.Equals("project"))
.Select(_ => AssemblyHelpers.Resolve(_.Name)!)
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.0",
"version": "8.0.401",
"rollForward": "latestFeature"
}
}
21 changes: 11 additions & 10 deletions mocha-setup.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Copyright (c) Cratis. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

require('reflect-metadata');

const chai = require('chai');
global.expect = chai.expect;
const should = chai.should();
global.sinon = require('sinon');
const sinonChai = require('sinon-chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(sinonChai);
chai.use(chaiAsPromised);
(async () => {
await import('reflect-metadata');
const chai = await import('chai');
global.expect = chai.expect;
const should = chai.should();
global.sinon = await import('sinon');
const sinonChai = await import('sinon-chai');
const chaiAsPromised = await import('chai-as-promised');
chai.use(sinonChai.default);
chai.use(chaiAsPromised.default);
})();
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"noFallthroughCasesInSwitch": true,
"stripInternal": true,
"allowSyntheticDefaultImports": true,
"watch": true,
"forceConsistentCasingInFileNames": true,
"assumeChangesOnlyAffectDirectDependencies": true,
"alwaysStrict": true,
Expand Down
Loading