Skip to content

Commit a7258cc

Browse files
committed
Initial import. Goal here is to have some implementations of extensions to forward various Java logging platforms to .NET platforms.
1 parent 8ef1573 commit a7258cc

14 files changed

+509
-0
lines changed

.gitattributes

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Custom for Visual Studio
5+
*.cs eol=crlf diff=csharp
6+
*.sln merge=union
7+
*.csproj merge=union
8+
*.vbproj merge=union
9+
*.fsproj merge=union
10+
*.dbproj merge=union
11+
12+
# Standard to msysgit
13+
*.doc diff=astextplain
14+
*.DOC diff=astextplain
15+
*.docx diff=astextplain
16+
*.DOCX diff=astextplain
17+
*.dot diff=astextplain
18+
*.DOT diff=astextplain
19+
*.pdf diff=astextplain
20+
*.PDF diff=astextplain
21+
*.rtf diff=astextplain
22+
*.RTF diff=astextplain
23+
24+
# Batch Files
25+
build eol=lf
26+
*.sh eol=lf
27+
*.bat eol=crlf
28+
*.cmd eol=crlf

.github/workflows/IKVM.Logging.yml

+235
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
name: IKVM.Logging
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: windows-2022
15+
steps:
16+
- name: Checkout Source
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
submodules: recursive
21+
- name: Setup .NET 3.1
22+
uses: actions/setup-dotnet@v3
23+
with:
24+
dotnet-version: 3.1.x
25+
- name: Setup .NET 6.0
26+
uses: actions/setup-dotnet@v3
27+
with:
28+
dotnet-version: 6.0.x
29+
- name: Setup .NET 7.0
30+
uses: actions/setup-dotnet@v3
31+
with:
32+
dotnet-version: 7.0.x
33+
- name: Install GitVersion
34+
uses: gittools/actions/gitversion/[email protected]
35+
with:
36+
versionSpec: 5.x
37+
- name: Execute GitVersion
38+
uses: gittools/actions/gitversion/[email protected]
39+
with:
40+
useConfigFile: true
41+
- name: Move NuGet Directory
42+
shell: pwsh
43+
run: Add-Content $env:GITHUB_ENV "`nNUGET_PACKAGES=${{ runner.temp }}\nuget\packages"
44+
- name: Add NuGet Source (GitHub)
45+
shell: pwsh
46+
run: dotnet nuget add source --username USERNAME --password $env:GITHUB_TOKEN --store-password-in-clear-text --name ikvm $env:GITHUB_REPOS
47+
env:
48+
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
- name: Cache NuGet
51+
uses: actions/cache@v3
52+
with:
53+
path: ${{ runner.temp }}\nuget\packages
54+
key: ${{ runner.os }}-nuget-${{ hashFiles('**\*.csproj', '**\*.msbuildproj') }}-1
55+
restore-keys: ${{ runner.os }}-nuget-
56+
- name: NuGet Restore
57+
run: dotnet restore IKVM.Logging.sln
58+
- name: Build
59+
run: |
60+
dotnet msbuild /m /bl `
61+
/p:Configuration="Release" `
62+
/p:Platform="Any CPU" `
63+
/p:Version=${env:GitVersion_FullSemVer} `
64+
/p:AssemblyVersion=${env:GitVersion_AssemblySemVer} `
65+
/p:InformationalVersion=${env:GitVersion_InformationalVersion} `
66+
/p:FileVersion=${env:GitVersion_AssemblySemFileVer} `
67+
/p:PackageVersion=${env:GitVersion_NuGetVersionV2} `
68+
/p:RepositoryUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}.git" `
69+
/p:PackageProjectUrl="${env:GITHUB_SERVER_URL}/${env:GITHUB_REPOSITORY}" `
70+
/p:BuildInParallel=true `
71+
/p:CreateHardLinksForAdditionalFilesIfPossible=true `
72+
/p:CreateHardLinksForCopyAdditionalFilesIfPossible=true `
73+
/p:CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true `
74+
/p:CreateHardLinksForCopyLocalIfPossible=true `
75+
/p:CreateHardLinksForPublishFilesIfPossible=true `
76+
/p:ContinuousIntegrationBuild=true `
77+
IKVM.Logging.dist.msbuildproj
78+
- name: Upload MSBuild Log
79+
if: ${{ always() }}
80+
uses: actions/upload-artifact@v3
81+
with:
82+
name: msbuild.binlog
83+
path: msbuild.binlog
84+
- name: Upload NuGet Packages
85+
uses: actions/upload-artifact@v3
86+
with:
87+
name: nuget
88+
path: dist/nuget
89+
- name: Package Tests
90+
run: tar czvf tests.tar.gz tests
91+
working-directory: dist
92+
- name: Upload Tests
93+
uses: actions/upload-artifact@v3
94+
with:
95+
name: tests
96+
path: dist/tests.tar.gz
97+
test:
98+
strategy:
99+
matrix:
100+
sys:
101+
- windows
102+
- linux
103+
- macos
104+
tfm:
105+
- net461
106+
- netcoreapp3.1
107+
- net6.0
108+
- net7.0
109+
exclude:
110+
- tfm: net461
111+
sys: linux
112+
- tfm: net461
113+
sys: macos
114+
- tfm: netcoreapp3.1
115+
sys: macos
116+
name: Test (${{ matrix.sys }}:${{ matrix.tfm }})
117+
needs:
118+
- build
119+
runs-on: ${{ fromJSON('{"windows":["windows-2022"],"linux":["ubuntu-22.04"],"macos":["macos-latest"]}')[matrix.sys] }}
120+
steps:
121+
- name: Setup .NET 3.1
122+
uses: actions/setup-dotnet@v3
123+
with:
124+
dotnet-version: 3.1.x
125+
- name: Setup .NET 6.0
126+
uses: actions/setup-dotnet@v3
127+
with:
128+
dotnet-version: 6.0.x
129+
- name: Setup .NET 7.0
130+
uses: actions/setup-dotnet@v3
131+
with:
132+
dotnet-version: 7.0.x
133+
- name: Add NuGet Source (GitHub)
134+
shell: pwsh
135+
run: dotnet nuget add source --username USERNAME --password $env:GITHUB_TOKEN --store-password-in-clear-text --name ikvm $env:GITHUB_REPOS
136+
env:
137+
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
138+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
- name: Download Tests
140+
uses: actions/download-artifact@v3
141+
with:
142+
name: tests
143+
- name: Restore Tests
144+
run: tar xzvf tests.tar.gz
145+
- name: Execute Tests
146+
timeout-minutes: 480
147+
shell: pwsh
148+
run: |
149+
# assign powershell variables
150+
$run = "${{ matrix.run }}"
151+
$tfm = "${{ matrix.tfm }}"
152+
$sys = "${{ matrix.sys }}"
153+
154+
# suite name can contain filter expression after ?
155+
$split = $run.IndexOf("?")
156+
if ($split -gt -1) {
157+
$tst = $run.Substring(0, $split)
158+
$qry = $run.Substring($split + 1)
159+
} else {
160+
$tst = $run
161+
}
162+
163+
# scan for test assemblies
164+
$tests = $(gci .\tests\$tst\$tfm -Recurse -Filter '*.Tests.dll')
165+
166+
# if a query was specified, add to test command
167+
if ($tests) {
168+
if ($qry -ne "" -and $qry -ne $null) {
169+
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst-$qry--$tfm--$sys"
170+
dotnet test -f $tfm --blame -v 2 --results-directory "TestResults" --logger:"console;verbosity=detailed" --logger:trx --collect "Code Coverage" --filter "$qry" $tests
171+
} else {
172+
Add-Content $env:GITHUB_ENV "`nRET=TestResults--$tst--$tfm--$sys"
173+
dotnet test -f $tfm --blame -v 2 --results-directory "TestResults" --logger:"console;verbosity=detailed" --logger:trx --collect "Code Coverage" $tests
174+
}
175+
}
176+
- name: Archive Test Results
177+
if: always() && startsWith(env.RET, 'TestResults--')
178+
run: tar czvf TestResults.tar.gz TestResults
179+
working-directory: ${{ env.IKVMPATH }}
180+
- name: Upload Test Results
181+
if: always() && startsWith(env.RET, 'TestResults--')
182+
uses: actions/upload-artifact@v3
183+
with:
184+
name: ${{ env.RET }}
185+
path: TestResults.tar.gz
186+
release:
187+
name: Release
188+
needs:
189+
- test
190+
runs-on: ubuntu-latest
191+
steps:
192+
- name: Checkout Source
193+
uses: actions/checkout@v3
194+
with:
195+
fetch-depth: 0
196+
- name: Setup .NET 7.0
197+
uses: actions/setup-dotnet@v3
198+
with:
199+
dotnet-version: 7.0.x
200+
- name: Install GitVersion
201+
uses: gittools/actions/gitversion/[email protected]
202+
with:
203+
versionSpec: 5.x
204+
- name: Execute GitVersion
205+
id: GitVersion
206+
uses: gittools/actions/gitversion/[email protected]
207+
with:
208+
useConfigFile: true
209+
- name: Download NuGet Packages
210+
uses: actions/download-artifact@v3
211+
with:
212+
name: nuget
213+
path: dist
214+
- name: Create Release
215+
if: github.ref_type == 'tag'
216+
uses: ncipollo/release-action@v1
217+
with:
218+
tag: ${{ github.ref_name }}
219+
allowUpdates: true
220+
artifacts: dist/nuget/*.nupkg,dist/nuget/*.snupkg
221+
draft: false
222+
token: ${{ secrets.GITHUB_TOKEN }}
223+
- name: Push NuGet (GitHub)
224+
shell: pwsh
225+
run: dotnet nuget push dist/nuget/*.nupkg --source $env:GITHUB_REPOS --api-key $env:GITHUB_TOKEN --skip-duplicate --no-symbols
226+
env:
227+
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
228+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
229+
- name: Push NuGet
230+
if: github.ref_type == 'tag'
231+
shell: pwsh
232+
run: dotnet nuget push dist/nuget/*.nupkg --source $env:NUGET_REPOS --api-key $env:NUGET_TOKEN --skip-duplicate
233+
env:
234+
NUGET_REPOS: https://api.nuget.org/v3/index.json
235+
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}

Directory.Build.props

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<Project>
2+
<PropertyGroup>
3+
<LangVersion Condition=" '$(LangVersion)' == '' ">10.0</LangVersion>
4+
</PropertyGroup>
5+
6+
<ItemGroup>
7+
<Authors Include="Jerome Haltom" />
8+
</ItemGroup>
9+
10+
<PropertyGroup Label="Copyright Info">
11+
<ProductName>IKVM.Logging</ProductName>
12+
<Authors>@(Authors, ',')</Authors>
13+
<CurrentYear Condition=" '$(CurrentYear)' == '' ">$([System.DateTime]::UtcNow.Year.ToString())</CurrentYear>
14+
<Copyright>Copyright © $(CurrentYear) @(Authors, ', ')</Copyright>
15+
</PropertyGroup>
16+
17+
<PropertyGroup Label="Version Info">
18+
<DefaultMajorVersion>1</DefaultMajorVersion>
19+
<Version Condition=" '$(Version)' == '' ">$(DefaultMajorVersion).0.0-dev</Version>
20+
<AssemblyVersion Condition=" '$(AssemblyVersion)' == '' ">$(DefaultMajorVersion).0.0.0</AssemblyVersion>
21+
<FileVersion Condition=" '$(FileVersion)' == '' ">$(DefaultMajorVersion).0.0.0</FileVersion>
22+
<InformationalVersion Condition=" '$(InformationalVersion)' == '' ">$(DefaultMajorVersion).0.0.0</InformationalVersion>
23+
</PropertyGroup>
24+
25+
<PropertyGroup Label="Package Info">
26+
<RepositoryUrl Condition=" '$(RepositoryUrl)' == '' ">https://github.com/ikvmnet/ikvm-logging.git</RepositoryUrl>
27+
<RepositoryType Condition=" '$(RepositoryType)' == '' ">git</RepositoryType>
28+
<PackageProjectUrl Condition=" '$(PackageProjectUrl)' == '' ">https://github.com/ikvmnet/ikvm-logging</PackageProjectUrl>
29+
<PackageVersion Condition=" '$(PackageVersion)' == '' ">$(Version)</PackageVersion>
30+
</PropertyGroup>
31+
32+
<ItemGroup>
33+
<PackageReference Include="IKVM.Core.MSBuild" Version="0.1.28">
34+
<PrivateAssets>all</PrivateAssets>
35+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
36+
</PackageReference>
37+
</ItemGroup>
38+
39+
</Project>

Directory.Build.targets

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project>
2+
3+
4+
5+
</Project>

GitVersion.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
major-version-bump-message: '\+semver:\s?(major)'
2+
minor-version-bump-message: '\+semver:\s?(minor)'
3+
patch-version-bump-message: '\+semver:\s?(patch)'
4+
mode: Mainline

IKVM.Logging.dist.msbuildproj

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Project DefaultTargets="Publish">
2+
<PropertyGroup>
3+
<DistDir Condition="'$(DistDir)' == ''">$(DISTDIR)</DistDir>
4+
<DistDir Condition="'$(DistDir)' == ''">$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', 'dist'))</DistDir>
5+
<DistDir>$([System.IO.Path]::GetFullPath('$(DistDir)'))</DistDir>
6+
<SolutionFile>$([System.IO.Path]::Combine('$(MSBuildThisFileDirectory)', 'IKVM.Logging.sln'))</SolutionFile>
7+
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
8+
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<TargetsForPublish Include="$(SolutionFile)">
13+
<Targets>dist%5Cdist-nuget:Publish</Targets>
14+
<Properties>PublishDir=$(DistDir)\nuget</Properties>
15+
</TargetsForPublish>
16+
<TargetsForPublish Include="$(SolutionFile)">
17+
<Targets>dist%5Cdist-tests:Publish</Targets>
18+
<Properties>PublishDir=$(DistDir)\tests</Properties>
19+
</TargetsForPublish>
20+
</ItemGroup>
21+
22+
<Target Name="Publish">
23+
<ItemGroup>
24+
<_TargetsForPublish Include="@(TargetsForPublish)">
25+
<Properties>%(TargetsForPublish.Properties)</Properties>
26+
</_TargetsForPublish>
27+
</ItemGroup>
28+
29+
<MSBuild BuildInParallel="$(BuildInParallel)" ContinueOnError="false" Projects="@(_TargetsForPublish)" Targets="%(_TargetsForPublish.Targets)" />
30+
</Target>
31+
32+
</Project>

0 commit comments

Comments
 (0)