Skip to content

Commit

Permalink
include files
Browse files Browse the repository at this point in the history
  • Loading branch information
huoshan12345 committed Oct 2, 2024
1 parent ede6478 commit 159c6aa
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ public class ObjectHelper
---
## Options
Options that can be configured through some MSBuild properties to set in consuming projects.
- `MixedILExcludeIgnoresAccessChecksToAttribute`: Exclude **IgnoresAccessChecksToAttribute** from source files to comiple.
#### NOTE:
- **IgnoresAccessChecksToAttribute** is used to access non-public types and members across assemblies through IL code. It is helpful when you are using `MixedIL` or `System.Reflection.Emit`.
---
## Examples
- [An example project](https://github.com/huoshan12345/MixedIL.Fody/tree/master/src/MixedIL.Example)
Expand Down
24 changes: 16 additions & 8 deletions build/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ $ver_path = Join-Path $root "pkg.version"
$ver = Get-Content -Path $ver_path
$key = $Env:NUGET_APIKEY
$nuget = "https://api.nuget.org/v3/index.json"
$isGithubAction = [string]::IsNullOrEmpty($Env:GITHUB_ACTION) -eq $false

if ([string]::IsNullOrEmpty($key)) {
throw "the api key is empty"
Expand All @@ -30,13 +31,20 @@ Write-Output "Packing finished."

$files = Get-ChildItem $pkgPath

Write-Output "Uploading..."
foreach ($file in $files) {
Write-Output "Uploading $($file.Basename)"
& dotnet nuget push $file -k $key --source $nuget -t 50 --skip-duplicate
if ($Lastexitcode -ne 0) {
throw "failed with exit code $LastExitCode"
if ($isGithubAction) {
Write-Output "Uploading..."
foreach ($file in $files) {
Write-Output "Uploading $($file.Basename)"
& dotnet nuget push $file -k $key --source $nuget -t 50 --skip-duplicate
if ($Lastexitcode -ne 0) {
throw "failed with exit code $LastExitCode"
}
}
}

Write-Output "Uploading finished."
Write-Output "Uploading finished."
}
else {
$packageName = Split-Path $path -Leaf
$packageLocalDir = [io.path]::combine( $env:USERPROFILE, ".nuget", "packages", $packageName.ToLower(), $ver);
Remove-Item $packageLocalDir -Recurse -Force -ErrorAction SilentlyContinue
}
2 changes: 1 addition & 1 deletion build/pkg.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.7
0.1.8
2 changes: 2 additions & 0 deletions src/MixedIL/MixedIL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
</ItemGroup>

<ItemGroup Label="FilesToCopy">
<Content Include="System\Runtime\CompilerServices\IgnoresAccessChecksToAttribute.fs" Pack="true" BuildAction="None" PackagePath="content\" />
<Content Include="System\Runtime\CompilerServices\IgnoresAccessChecksToAttribute.cs" Pack="true" BuildAction="None" PackagePath="content\" />
<Content Include="MixedIL.targets" Pack="true" BuildAction="None" PackagePath="build\MixedIL.Fody.targets" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/MixedIL/MixedIL.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ItemGroup>
<WeaverFiles Include="$(MsBuildThisFileDirectory)..\weaver\$(MSBuildThisFileName).dll" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition="'$(MixedILExcludeIgnoresAccessChecksToAttribute)' != 'true'">
<Compile Condition="'$(ProjectExt)' == '.csproj'"
Include="$(MSBuildThisFileDirectory)..\content\IgnoresAccessChecksToAttribute.cs"/>
<Compile Condition="'$(ProjectExt)' == '.fsproj'"
Expand Down

0 comments on commit 159c6aa

Please sign in to comment.