Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroKaku committed May 24, 2022
2 parents 74e23d4 + 88a536f commit 2fe3e28
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 99 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# This is a basic workflow to help you get started with Actions

name: build & publish

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on: [push, pull_request]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: windows-2019

# Any commit that contains [build] will now trigger these jobs, everything else will be skipped.
# if: "contains(github.event.head_commit.message, '[build]')"

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: build nuspec
if: contains(github.ref, 'tags/')
working-directory: ${{github.workspace}}
shell: pwsh
run: |
if($env:GITHUB_REF.StartsWith("refs/tags/v", "CurrentCultureIgnoreCase"))
{
$BuildVersion = $env:GITHUB_REF.Remove(0, 11);
echo "BuildVersion=$BuildVersion" >> $env:GITHUB_ENV
# github的内置版本有Bug,此行必须添加,否则无法获得内容
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
$releaseNotes = & git tag -l --format='%(contents)' $env:GITHUB_REF.Remove(0, 10)
$content = [System.IO.File]::ReadAllText("nuget\ucxxrt.nuspec")
$releaseNotesToken = '$releaseNotes$'
$releaseNotesIndex = $content.IndexOf($releaseNotesToken)
if($releaseNotesIndex -ne -1)
{
echo $content.Substring(0, $releaseNotesIndex) | out-file "nuget\ucxxrt-new.nuspec" -NoNewline
echo $releaseNotes | out-file "nuget\ucxxrt-new.nuspec" -Append
echo $content.Remove(0, $releaseNotesIndex + $releaseNotesToken.Length) | out-file "nuget\ucxxrt-new.nuspec" -NoNewline -Append
}
}
- name: compile
working-directory: ${{github.workspace}}
shell: cmd
run: call .\.github\workflows\build.bat

- name: upload an artifact
uses: actions/upload-artifact@v3
with:
name: ucxxrt
path: ucxxrt\
if-no-files-found: error

- name: pack zip
if: contains(github.ref, 'tags/')
working-directory: ${{github.workspace}}
shell: cmd
run: 7z a -tzip ucxxrt.zip ucxxrt\

- name: pack nuget
if: contains(github.ref, 'tags/')
working-directory: ${{github.workspace}}
shell: cmd
run: |
if "${{env.BuildVersion}}" NEQ "" (
nuget pack nuget\ucxxrt-new.nuspec -Properties version=${{env.BuildVersion}};commit=%GITHUB_SHA%
)
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL%
- name: publish a version
if: contains(github.ref, 'tags/')
uses: "marvinpinto/action-automatic-releases@v1.2.1"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
ucxxrt.zip
*.nupkg
- name: publish nuget
if: contains(github.ref, 'tags/')
working-directory: ${{github.workspace}}
shell: cmd
run: |
nuget push ucxxrt.${{env.BuildVersion}}.nupkg -ApiKey ${{ secrets.NUGET_TOKEN }} -Source https://api.nuget.org/v3/index.json
if %ERRORLEVEL% NEQ 0 exit /B %ERRORLEVEL%
42 changes: 0 additions & 42 deletions .github/workflows/main.yaml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/release.yaml

This file was deleted.

25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,31 @@ void Test$HashMap()
}
```

## 2. Compile
## 2. How to use

IDE:Visual Studio 2019 or higher
**First, rename `DriverEntry` to `DriverMain`**

* `git clone https://github.com/MiroKaku/ucxxrt.git`
* Open `ucxxrt.sln` and compile
### 2.1 Option 1 (recommend)

Right click on the project and select "Manage NuGet Packages", then search for `ucxxrt` and choose the version that suits you, and finally click "Install".

## 3. How to use
![nuget](./readme/nuget.png)

1. Copy `ucxxrt/ucxxrt` forder to you project directory.
2. Add the property sheet `ucxxrt.props` to yor project.
### 2.2 Option 2

> !! note:Rename `DriverEntry` to `DriverMain`
1. Download the latest package from [release](https://github.com/MiroKaku/ucxxrt/releases) and unzip it.

2. Add the property sheet `ucxxrt.props` to yor project.

![usage](./readme/use.gif)

## 3. How to compile

IDE:Visual Studio 2019 or higher

* `git clone https://github.com/MiroKaku/ucxxrt.git`
* Open `ucxxrt.sln` and compile.

## 4. Reference and Acknowledgement

* [Microsoft's C++ Standard Library](https://github.com/microsoft/stl)
Expand Down
24 changes: 16 additions & 8 deletions ReadMe.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,30 @@ void Test$HashMap()
}
```

## 2. 编译
## 2. 怎样使用

IDE:Visual Studio 2019 或更高版本
**首先 `DriverEntry` 需要改为 `DriverMain`**

* `git clone https://github.com/MiroKaku/ucxxrt.git`
* 打开 `ucxxrt.sln` 进行编译
### 2.1 方法一(推荐)

## 3. 怎样使用
右键单击该项目并选择“管理 NuGet 包”,然后搜索`ucxxrt`并选择适合你的版本,最后单击“安装”。

1. 将编译生成的 `unittest` 文件夹复制到自己项目中
2. 在 Visual Studio 中,你可以打开属性管理器(视图 - 属性管理器),然后右键添加现有属性表,然后选择 `ucxxrt.props` 即可。
![nuget](./readme/nuget.png)

> !! 注意:`DriverEntry` 需要改为 `DriverMain`
### 2.2 方法二

1.[release](https://github.com/MiroKaku/ucxxrt/releases) 下载最新包并解压。
2. 在 Visual Studio 中,你可以打开属性管理器(视图 - 属性管理器),然后右键添加现有属性表,然后选择 `ucxxrt.props` 即可。

![使用方法](./readme/use.zh-cn.gif)

## 3. 怎样编译

IDE:Visual Studio 2019 或更高版本

* `git clone https://github.com/MiroKaku/ucxxrt.git`
* 打开 `ucxxrt.sln` 进行编译。

## 4. 引用参考和感谢

* [Microsoft's C++ Standard Library](https://github.com/microsoft/stl)
Expand Down
28 changes: 28 additions & 0 deletions nuget/ucxxrt.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
<metadata minClientVersion="2.5">
<id>ucxxrt</id>
<version>$version$</version>
<title>Universal C++ RunTime (UCXXRT)</title>
<authors>MiroKaku (MeeSong)</authors>
<owners>MiroKaku (MeeSong)</owners>
<developmentDependency>true</developmentDependency>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<license type="file">lib\native\LICENSE</license>
<readme>lib\native\README.md</readme>
<projectUrl>https://github.com/MiroKaku/ucxxrt</projectUrl>
<description>The Universal C++ RunTime library, supporting kernel-mode C++ exception-handler and STL.</description>
<releaseNotes>$releaseNotes$</releaseNotes>
<copyright>Copyright© MiroKaku</copyright>
<language>en-US</language>
<tags>ucxxrt wdk driver kernel</tags>
<repository type="git" url="https://github.com/MiroKaku/ucxxrt.git" branch="master" commit="$commit$" />
<dependencies>
<dependency id="YY.NuGet.Import.Helper" version="1.0.0.4" />
</dependencies>
</metadata>
<files>
<file src="ucxxrt.props" target="build\ucxxrt.props" />
<file src="..\ucxxrt\**" target="lib\native" exclude="**\*.lastcodeanalysissucceeded;"/>
</files>
</package>
6 changes: 6 additions & 0 deletions nuget/ucxxrt.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NuGetImportAfterCppProps Condition="Exists('$(MSBuildThisFileDirectory)..\lib\native\ucxxrt.props')">$(NuGetImportAfterCppProps);$(MSBuildThisFileDirectory)..\lib\native\ucxxrt.props</NuGetImportAfterCppProps>
</PropertyGroup>
</Project>
Binary file added readme/nuget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2fe3e28

Please sign in to comment.