Skip to content

Commit ec05c57

Browse files
authored
Merge pull request #402 from Shazwazza/website-updates-jan-2021
WIP Website updates jan 2021
2 parents 85b9321 + 214ecd4 commit ec05c57

4 files changed

Lines changed: 63 additions & 70 deletions

File tree

src/docs/convert.ps1

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# The ASF licenses this file to You under the Apache License, Version 2.0
77
# (the ""License""); you may not use this file except in compliance with
88
# the License. You may obtain a copy of the License at
9-
#
9+
#
1010
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
11+
#
1212
# Unless required by applicable law or agreed to in writing, software
1313
# distributed under the License is distributed on an ""AS IS"" BASIS,
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -51,41 +51,8 @@ if (-not (test-path $releaseLuceneFolder)) {
5151
Write-Error "Could not detect Java release files in folder $releaseLuceneFolder" -ErrorAction Stop
5252
}
5353

54-
# ensure we have NuGet
55-
New-Item "$ToolsFolder\nuget" -type directory -force
56-
$nuget = "$ToolsFolder\nuget\nuget.exe"
57-
if (-not (test-path $nuget)) {
58-
Write-Host "Download NuGet..."
59-
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile $nuget -TimeoutSec 60
60-
}
61-
62-
# ensure we have vswhere
63-
New-Item "$ToolsFolder\vswhere" -type directory -force
64-
$vswhere = "$ToolsFolder\vswhere\vswhere.exe"
65-
if (-not (test-path $vswhere)) {
66-
Write-Host "Download VsWhere..."
67-
$path = "$ToolsFolder\tmp"
68-
&$nuget install vswhere -OutputDirectory $path
69-
$dir = ls "$path\vswhere.*" | sort -property Name -descending | select -first 1
70-
$file = ls -path "$dir" -name vswhere.exe -recurse
71-
mv "$dir\$file" $vswhere
72-
}
73-
7454
Remove-Item -Recurse -Force "$ToolsFolder\tmp"
7555

76-
# Get MSBuild
77-
78-
$MSBuild = &$vswhere -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | select-object -first 1
79-
if (-not (test-path $MSBuild)) {
80-
throw "MSBuild not found!"
81-
}
82-
83-
# Build the solution
84-
$sln = (Join-Path -Path $PSScriptFilePath "DocumentationTools.sln")
85-
& $nuget restore $sln
86-
& $msbuild $sln
87-
88-
# Execute the program
89-
$exe = (Join-Path -Path $PSScriptFilePath "JavaDocToMarkdownConverter\bin\Debug\JavaDocToMarkdownConverter.exe")
90-
& $exe $releaseLuceneFolder $RepoRoot
91-
56+
# TODO: Execute the JavaDocToMarkdownConverter dotnet tool
57+
# TODO: Validate that this only executes within a git branch: `docs/markdown-converted/*`
58+
#

websites/site/contributing/community-links.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ A very detailed how-to guide for working with Lucene.Net.
1616

1717
> "This is one of the best posts I have ever seen about Lucene.NET"
1818
19+
### Great intro posts about Lucene:
20+
21+
* [Analysis of Lucene - Basic Concepts](https://www.alibabacloud.com/blog/analysis-of-lucene---basic-concepts_594672)
22+
* [Apache Lucene: free search for your website](https://www.ionos.com/digitalguide/server/configuration/apache-lucene/)
23+
1924
### Introductory Lucene.Net Series
2025

2126
An excellent introductory series from [Simone Chiaretta](http://codeclimber.net.nz/)

websites/site/contributing/documentation.md

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ The file/folder structure is within `/websites/site`:
5454

5555
### Deploy the website
5656

57-
- The website is deployed via git
58-
- Checkout the Git repo that hosts the documentation: https://github.com/apache/lucenenet-site/tree/asf-site _(ensure you have `asf-site` branch checked out, not `master`)_
59-
- Copy the build output of the website to the root. The build output will be all of the files in the `/websites/site/_site` in your main Lucene.NET checked out Git repository.
60-
- Commit and push these changes
61-
- The new version of the website will be live. If the amount of new files committed is large, the new files may take some time to become live.
57+
- The website is deployed via GitHub and is hosted by static files here: https://github.com/apache/lucenenet-site/tree/asf-site _(ensure you have `asf-site` branch checked out, not `master`)_
58+
- Any file changes made in the `master` branch of the Lucene.Net repository under the path `/websites/site/*` will trigger a GitHub action to build the site and publish a Pull Request to the https://github.com/apache/lucenenet-site repository where it can be accepted
59+
- Review and merge the Pull Request. The new version of the website will be live. If the amount of new files committed is large, the new files may take some time to become live.
6260

6361
## API Docs
6462

@@ -95,39 +93,62 @@ The script parameters are:
9593

9694
The file/folder structure is within `/websites/apidocs`:
9795

98-
- `docs.ps1` - the build script
99-
- `docfx.json` - the DocFx configuration file _(see docfx manual for further info)_
100-
- `lucenetemplate/*` - the custom template files to style the website
101-
- `*.md` - the root site content such as the index and download pages
102-
- `toc.yml` - these files determine the menu structures _(see docfx manual for further info)_
103-
- `tools/*` - during the build process some tools will be downloaded which are stored here
104-
- `_site` - this is the exported static site that is generated
105-
106-
> [!NOTE]
107-
> The project is going through a trial run of using mini-sites instead of a single API docs site. Currently, the active DocFx configuration files are the `docfx.<project>.json` files, however both the mini-site and `docfx.json` configuration files need to be updated, since there is a chance we will need to switch back.
96+
- `docs.ps1` - The build script
97+
- `docfx.*.json` - The DocFx configuration files _(see docfx manual for further info)_
98+
- `docfx.{library}.json` - Where {library} is an individual Lucene.NET project (i.e. `codecs`). Each library is built as it's own individual DocFx site and it's xref maps are exported to file to be shared between DocFx builds.
99+
- `docfx.global.json` - Each library DocFx json references this file for global metadata. This is where all global metadata such as Title, Logo, Footer, etc... are declared.
100+
- `docfx.global.subsite.json` - Each library DocFx json references this file for global metadata which denotes the [`_rel`](https://dotnet.github.io/docfx/tutorial/intro_template.html#system-generated-properties) (The relative path of the root output folder from current output file. i.e. the base URL). For example: `https://lucenenet.apache.org/docs/4.8.0-beta00009/`.
101+
- `docfx.site.json` - Once each library is built and it's xref maps are exported, the main documentation site container is built with this definition.
102+
- `lucenetemplate/*` - The custom template files to style the website
103+
- `*.md` - The root site content such as the index and download pages
104+
- `toc.yml` - These files determine the menu structures _(see docfx manual for further info)_
105+
- `tools/*` - During the build process some tools will be downloaded which are stored here
106+
- `_site` - This is the exported static site that is generated
108107

109-
### Process overview
108+
### Java to Markdown converter
110109

111110
The documentation generation is a complex process because it needs to convert the Java Lucene project's documentation into a usable format to produce the output Lucene.NET's documentation.
112111

113-
The process overview is:
112+
The `JavaDocToMarkdownConverter` dotnet tool to is used to convert the Java Lucene project's docs into a useable format for DocFx. This tool uses a release tag output of the Java Lucene project as it's source to convert against the Lucene.NET's source. This tool must **only** be executed against the current documentation branch, for example in 4.8.0 it is: `docs/markdown-converted/4.8.1`. This conversion process does not need to be executed everytime the docs are built, it is executed rarely when:
113+
- A new major or minor version of Lucene.Net is created and the conversion needs to be re-executed again the Java Lucene source. In this case a new documentation branch should be created from the previous documentation branch.
114+
- Updates to the `JavaDocToMarkdownConverter` are made and the conversion needs to be re-executed.
115+
116+
#### Manual execution
117+
118+
To use the dotnet tool you must download the current tag of the Java Lucene project, for example: ["4.8.1"](https://github.com/apache/lucene-solr/releases/tag/releases%2Flucene-solr%2F4.8.1)
119+
120+
Then install the tool:
121+
122+
```
123+
dotnet tool install javadoc2markdown --add-source https://pkgs.dev.azure.com/lucene-net/_packaging/lucene-net-tools/nuget/v3/index.json --tool-path ./
124+
```
125+
126+
Then run the command:
127+
```
128+
javadoc2markdown <LUCENE DIRECTORY> <LUCENENET DIRECTORY>
129+
```
130+
131+
Where `<LUCENE DIRECTORY>` is the `lucene` sub folder location of the Java Lucene tag downloaded above. The `<LUCENENET DIRECTORY>` is the folder of your locally checked out Lucene.Net git repository of the documentation tag (i.e. `docs/markdown-converted/4.8.1`).
132+
133+
#### Automated execution
134+
135+
A powershell script has been created to automate the above. Execute the `./src/docs/convert.ps1` script and enter the current Lucene version to convert from. For example, for Lucene.Net 4.8.0 we are converting from the Java Lucene build release of ["4.8.1"](https://github.com/apache/lucene-solr/releases/tag/releases%2Flucene-solr%2F4.8.1) so in this case enter: 4.8.1 at the prompt or call the whole script like `./src/docs/convert.ps1 -JavaLuceneVersion 4.8.1`
136+
137+
#### Review, commit and merge
138+
139+
Once the conversion is done, review, commit and push those changes. Many times there will just be whitespace changes in the files especially if this process has been executed before for the same source/destination version. If this is a new source/destination version there will be a **lot** of file changes, at least one file per folder. If there are formatting issues or irregularities in the converted output then these will need to be addressed by making changes to the conversion tool itself (generally only needed for new major version releases).
140+
141+
Once pushed, you can merge those changes to the `master` branch. Doing this may trigger merge conflicts because the documentation files may have been manually edited. In these cases you will need to manually review and fix the merge conflicts with your favorite merge tool ensuring that the most recent manual changes done are kept.
114142

115-
- Use the `JavaDocToMarkdownConverter` project within the `DocumentationTools.sln` solution to run the conversion of the Java Lucene projects docs into a useable format for DocFx. This tool takes uses a release tag output of the Java Lucene project as it's source to convert against the Lucene.NET's source.
116-
- Run the documentation build script to produce the documentation site
117-
- Publish the output to the [`lucenenet-site`](https://github.com/apache/lucenenet-site) repository into a corresponding named version directory
143+
#### Tool info
118144

119-
We don't want to manually change the converted resulting markdown files (`.md`) because they would get overwritten again when the conversion process is re-executed. Therefore to fix any formatting issues or customized output of the project docs, these customizations/fixes/tweaks are built directly into the conversion process itself in the `JavaDocToMarkdownConverter.csproj` project.
145+
- [Source code is here](https://github.com/NightOwl888/lucenenet-javadoc2markdown)
146+
- Tool name: `javadoc2markdown`
147+
- [NuGet feed here](https://dev.azure.com/lucene-net/Lucene.NET/_packaging?_a=feed&feed=lucene-net-tools)
120148

121149
### Building the docs
122150

123151
- Checkout the Lucene.Net release tag to build the docs against
124-
- Execute the `./src/docs/convert.ps1` script and enter the current Lucene version to convert from.
125-
- For example, for Lucene.Net 4.8.0 we are converting from the Java Lucene build release of ["4.8.1"](https://github.com/apache/lucene-solr/releases/tag/releases%2Flucene-solr%2F4.8.1) so in this case enter: 4.8.1 at the prompt or call the whole script like `./src/docs/convert.ps1 -JavaLuceneVersion 4.8.1`
126-
- This script will download and extract the Java Lucene release files, build the `DocumentationTools.sln` solution and execute the `JavaDocToMarkdownConverter.exe`
127-
- Review and commit the files changed
128-
- Many times there will just be whitespace changes in the files especially if this process has been executed before for the same source/destination version.
129-
- If this is a new source/destination version there will be a **lot** of file changes, at least one file per folder.
130-
- If there are formatting issues or irregularities in the converted output then these will need to be addressed by making changes to the conversion tool itself `JavaDocToMarkdownConverter.csproj` (generally only needed for new major version releases)
131152
- Execute the `./websites/apidocs/docs.ps1` script to build and serve the api docs website locally for testing.
132153
- Example: `./websites/apidocs/docs.ps1 -LuceneNetVersion 4.8.0-beta00008`
133154
- will serve a website on [http://localhost:8080](http://localhost:8080)

websites/site/site.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $ToolsFolder = Join-Path -Path $SiteFolder -ChildPath "tools";
3838
#ensure the /build/tools folder
3939
New-Item $ToolsFolder -type directory -force
4040

41-
if ($Clean -eq 1) {
41+
if ($Clean) {
4242
Write-Host "Cleaning tools..."
4343
Remove-Item (Join-Path -Path $ToolsFolder "\*") -recurse -force -ErrorAction SilentlyContinue
4444
}
@@ -52,15 +52,15 @@ if (-not (test-path $DocFxExe))
5252
{
5353
Write-Host "Retrieving docfx..."
5454
$DocFxZip = "$ToolsFolder\tmp\docfx.zip"
55-
Invoke-WebRequest "https://github.com/dotnet/docfx/releases/download/v2.50/docfx.zip" -OutFile $DocFxZip -TimeoutSec 60
55+
Invoke-WebRequest "https://github.com/dotnet/docfx/releases/download/v2.56.6/docfx.zip" -OutFile $DocFxZip -TimeoutSec 60
5656
#unzip
5757
Expand-Archive $DocFxZip -DestinationPath (Join-Path -Path $ToolsFolder -ChildPath "docfx")
5858
}
5959

6060
Remove-Item -Recurse -Force "$ToolsFolder\tmp"
6161

6262
# delete anything that already exists
63-
if ($Clean -eq 1) {
63+
if ($Clean) {
6464
Write-Host "Cleaning..."
6565
Remove-Item (Join-Path -Path $SiteFolder "_site\*") -recurse -force -ErrorAction SilentlyContinue
6666
Remove-Item (Join-Path -Path $SiteFolder "_site") -force -ErrorAction SilentlyContinue
@@ -72,7 +72,7 @@ $DocFxJson = Join-Path -Path $SiteFolder "docfx.json"
7272
$DocFxLog = Join-Path -Path $SiteFolder "obj\docfx.log"
7373

7474
if($?) {
75-
if ($ServeDocs -eq 0){
75+
if ($ServeDocs -eq $false) {
7676
# build the output
7777
Write-Host "Building docs..."
7878
& $DocFxExe build $DocFxJson -l "$DocFxLog" --loglevel $LogLevel

0 commit comments

Comments
 (0)