PR to check if FactorDocs.xml is up-to-date (#48)

* New YML build definition
* Updated documentation
This commit is contained in:
Sergey B. Berezin 2018-10-25 12:31:38 +03:00 коммит произвёл GitHub
Родитель bc2660941b
Коммит 0e1b204774
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 43 добавлений и 0 удалений

Просмотреть файл

@ -120,6 +120,9 @@ Please, refer to our [building guide](BUILDING.md).
We welcome contributions! Please review our [contribution guide](CONTRIBUTING.md).
When submitting pull request with changed or added factor, please make sure you updated factor documentation as described [here](docs/README.md#Documenting-Factors).
## License
Infer.NET is licensed under the [MIT license](LICENSE.txt).

24
build/pr-factordocs.yml Normal file
Просмотреть файл

@ -0,0 +1,24 @@
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
# Checks if factordocs.xml is up to date
resources:
- repo: self
clean: true
trigger: none # disable CI build
steps:
- task: DotNetCoreInstaller@0
inputs:
packageType: 'sdk'
version: '2.1.403'
- script: |
echo Checking $(Build.Repository.LocalPath)\src\Runtime\Factors\FactorDocs.xml...
dotnet build /p:DisableImplicitNuGetFallbackFolder=true --configuration ReleaseCore
dotnet run --configuration ReleaseCore -- "$(Build.Repository.LocalPath)\src\Runtime\Factors\FactorDocs.xml"
displayName: Verify if factordocs.xml is up to date
workingDirectory: src/Tools/BuildFactorDoc

Просмотреть файл

@ -15,3 +15,19 @@ The last version of the API documentation is in the `apiguide/` folder. If you w
* remove temporary folder `InferNet_Copy_Temp`,
* switch to gh-pages,
* commit and push the new changes.
## Documenting Factors
`Infer.NET` provides tool to automatically generate description text for factor classes, i.e. classes marked with `[FactorMethod]` attribute. Generated descriptions are written to `src/Runtime/Factors/FactorDocs.xml` file and referenced using `<include>` tags in source code triple comments.
It is important to have full and correct description of all factors, so when you change existing factor or add new one, please follow steps below.
1. Add triple comment
```/// <include file='FactorDocs.xml' path='factor_docs/message_op_class[@name="FactorClassName"]/doc/*'/>```
before newly created factor classes. Replace `FactorClassName` with actual class name without namespace.
2. Run `BuildFactorDoc` project from Microsoft Visual Studio or .NET Core CLI.
3. Commit updated `src/Runtime/Factors/FactorDocs.xml`.