Merging changes from Next. These do not affect the binary, so no version bump.

This commit is contained in:
Jim Derry 2021-07-16 19:42:23 -04:00
parent 228d8e90cd
commit 81b7fe3251
8 changed files with 510 additions and 49 deletions

95
.github/workflows/api_test.yml vendored Normal file
View file

@ -0,0 +1,95 @@
################################################################################
# Test LibTidy Public API (via Swift SwLibTidy).
#
# Because SwLibTidy wraps nearly 100% of LibTidy's API, it's a great candidate
# for testing LibTidy via a high-level, easy to write and understand tests.
#
# - This is a Public API test of LibTidy. It does not test the console
# application, is not a unit test, and is not an output regression test.
#
# - Build on multiple operating systems, once the runners are equipped with
# Swift.
#
################################################################################
name: API Test via SwLibTidy
on:
push:
paths:
- 'src/**'
- 'include/**'
- '.github/workflows/**'
pull_request:
paths:
- 'src/**'
- 'include/**'
- '.github/workflows/**'
jobs:
test_library_api:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
############################################################
# Ubuntu latest is a normal build with nothing special that
# really need be done.
# Note: currently disabled because some tests need to be
# refactored to avoid using macOS specific library calls.
############################################################
# - os: ubuntu-latest
# name: Ubuntu
############################################################
# On macOS, we'll build both architectures.
# Note: this is the currently only enabled runner, and I'm
# comfortable with it. This excercises nearly all of
# HTML Tidy's library API, which should be platform
# agnostic.
############################################################
- os: macOS-latest
name: macOS
############################################################
# The standard Windows build is perfectly vanilla, and as
# of now is using MSVC 19.
# Note: currently disabled because some tests need to be
# refactored to avoid using macOS specific library calls,
# but mostly because the Windows runners aren't set up
# yet for running Swift code.
############################################################
# - os: windows-latest
# name: MSVC
steps:
############################################################
# Checkout the Swift testing repository.
############################################################
- name: Checkout SwLibTidy
uses: actions/checkout@v2
with:
repository: htacg/SwLibTidy
############################################################
# Checkout the Tidy repository as Source/CLibTidy
############################################################
- name: Checkout this repository
uses: actions/checkout@v2
with:
path: ${{github.workspace}}/Sources/CLibTidy
############################################################
# Perform swift test
# Note: Github truncates the in-browser log. If you want
# to see everything, look for the Raw Logs button.
############################################################
- name: Swift Test
run: |
swift test

View file

@ -34,68 +34,145 @@ jobs:
matrix:
include:
############################################################
# Ubuntu latest is a normal build with nothing special that
# really need be done.
############################################################
- os: ubuntu-latest
flags:
name: Standard
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
build_command: "cmake --build . --config Release"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
############################################################
# On macOS, we'll build both architectures.
############################################################
- os: macOS-latest
flags: "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
name: X86_64 & Arm64
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
build_command: "cmake --build . --config Release"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
############################################################
# The standard Windows build is perfectly vanilla, and as
# of now is using MSVC 19.
############################################################
- os: windows-latest
flags:
name: MSVC
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
build_command: "cmake --build . --config Release"
vers_command: "./tidy.exe --version"
test_command: "ruby test.rb test"
############################################################
# We'll also build using MinGW on Windows, because it's
# always nice to support FOSS toolchains. While we could
# do this another way, we'll use the windows-2016 runner
# to distinguish it from the windows-latest runner.
############################################################
- os: windows-2016
flags: "-G 'MinGW Makefiles'"
name: MinGW
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release -G 'MinGW Makefiles'"
build_command: "cmake --build . --config Release"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
############################################################
# We'll also build using Cygwin on Windows, because even
# Windows people sometimes dislike Windows. While we could
# do this another way, we'll use the windows-2019 runner to
# distinguish it from the windows-latest runner.
# Note: only the `tidy` target will be built (without the
# man page) for this runner, because xltproc has issues
# loading files in the virtual environment. The man page
# is tested and builds perfectly fine on real installs.
############################################################
- os: windows-2019
name: Cygwin
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
build_command: "cmake --build . --target tidy --config Release"
vers_command: "./tidy --version"
test_command: "ruby test.rb test"
steps:
############################################################
# Checkput the repository.
############################################################
- uses: actions/checkout@v2
# We'll use the windows-2016 instance to perform a MinGW build.
# Of course, we only want to install if this is the correct target.
############################################################
# Install MinGW-w64 if needed for the current runner.
############################################################
- name: Install MinGW-w64
if: ${{matrix.os == 'windows-2016'}}
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
############################################################
# Install Cygwin if needed for the current runner.
############################################################
- name: Install Cygwin
if: ${{matrix.os == 'windows-2019'}}
uses: egor-tensin/setup-cygwin@v3
with:
platform: x64
packages: make gcc-core gcc-g++ cmake
############################################################
# Cmake and Make the project.
############################################################
- name: Build
working-directory: ${{github.workspace}}/build/cmake
run: cmake ../.. -DCMAKE_BUILD_TYPE=Release ${{matrix.flags}}
- name: Make
working-directory: ${{github.workspace}}/build/cmake
run: cmake --build . --config Release
# Windows MSVC is the only oddball here; why does it install the
# binary into a subfolder, unlike all of the other builds? Let's
# make everything else easier by relocating it to the same spot
# as all the other build locations.
- name: Move the exe to someplace sensible
run: |
${{matrix.cmake_command}}
${{matrix.build_command}}
############################################################
# Windows MSVC is the only oddball here; why does it
# install the binary into a subfolder, unlike all of the
# other builds? Let's make everything else easier by
# relocating it to the same spot as all the other build
# locations.
############################################################
- name: Move the MSVC exe to someplace sensible
if: ${{matrix.os == 'windows-latest'}}
run: move-item -path "${{github.workspace}}/build/cmake/Release/tidy.exe" -destination "${{github.workspace}}/build/cmake/"
run: |
move-item -path "${{github.workspace}}/build/cmake/Release/tidy.exe" -destination "${{github.workspace}}/build/cmake/"
############################################################
# Just so that a human can make a quick sanity check.
############################################################
- name: Show Version
working-directory: ${{github.workspace}}/build/cmake
run: ${{matrix.vers_command}}
run: |
${{matrix.vers_command}}
############################################################
# Install Ruby for running our regression tests. It's quite
# nice that this package is generic enough to work on all
# of the different runners.
############################################################
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
############################################################
# Ensure that dependencies are met.
############################################################
- name: Bundle Install
working-directory: ${{github.workspace}}/regression_testing
run: bundle install
run: |
bundle install
############################################################
# Finally, check for regressions.
############################################################
- name: Run Regression Test
working-directory: ${{github.workspace}}/regression_testing
run: ${{matrix.test_command}}
run: |
${{matrix.test_command}}

191
.github/workflows/publish_binaries.yml vendored Normal file
View file

@ -0,0 +1,191 @@
################################################################################
# Build Release Packages for Major Platforms
#
# - Builds release packages on multiple operating systems.
#
# - Some packages may have to be supplmented with manually-built releases
# to account for code-signing and/or notorization requirements.
#
################################################################################
name: Build and Publish Packages
on:
release:
types: [published]
jobs:
build_packages:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
############################################################
# Ubuntu latest is a normal build.
# Package building requires rpm in order to generate
# .rpm packages. The runner already includes this by
# default.
############################################################
- os: ubuntu-latest
name: Standard
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
build_command: "cmake --build . --config Release --target package"
sha_command: "sha256sum"
stat_command: "stat"
artifacts: "tidy-%s-Linux-64bit.deb tidy-%s-Linux-64bit.rpm"
############################################################
# On macOS, we'll build both architectures.
# Package building has all prerequisites install already.
############################################################
- os: macOS-latest
name: X86_64 & Arm64
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'"
build_command: "cmake --build . --config Release --target package"
sha_command: "shasum -a 256"
stat_command: "gstat"
artifacts: "tidy-%s-macOS-x86_64+arm64.pkg"
############################################################
# The standard Windows build is using MSVC 19 as of now.
# Package building requires nsis and wixtoolset, both of
# which can be installed via choco, which is already
# installed. Note: looks like xictoolset is already
# installed.
############################################################
- os: windows-latest
name: MSVC
cmake_command: "cmake ../.. -DCMAKE_BUILD_TYPE=Release"
build_command: "cmake --build . --config Release --target package"
sha_command: "sha256sum"
stat_command: "stat"
artifacts: "tidy-%s-win64.exe tidy-%s-win64.msi tidy-%s-win64.zip"
steps:
############################################################
# Install Windows Pre-Requisites
############################################################
- name: Install Windows Requirements
if: ${{matrix.os == 'windows-latest'}}
run: |
choco install nsis -y
############################################################
# Install macOS Pre-Requisites
############################################################
- name: Install macOS Requirements
if: ${{matrix.os == 'macOS-latest'}}
run: |
brew install coreutils
############################################################
# Checkput the repository.
############################################################
- name: Checkout Self
uses: actions/checkout@v2
############################################################
# Get the version number. The output isn't available until
# we exit this step.
############################################################
- name: Get Tidy Version
id: getversion
working-directory: ${{github.workspace}}
shell: bash
run: |
echo "::set-output name=version::$(head -1 version.txt)"
############################################################
# Print the version number, which is now available from
# the previous step.
############################################################
- name: Print Tidy Version
shell: bash
run: |
echo "Tidy version is ${{ steps.getversion.outputs.version }}."
############################################################
# Configure and Build
############################################################
- name: Configure and Build
working-directory: ${{github.workspace}}/build/cmake
shell: bash
run: |
${{matrix.cmake_command}}
${{matrix.build_command}}
############################################################
# Move Files and Make Checksums
############################################################
- name: Move Files and Make Checksums
working-directory: ${{github.workspace}}/build/cmake
shell: bash
run: |
ls -al
mkdir artifacts
array="${{matrix.artifacts}}"
for i in ${array[@]}; do
filename=$(printf "$i\n" ${{ steps.getversion.outputs.version }})
${{matrix.sha_command}} "$filename" > "artifacts/${filename}.sha256"
mv "$filename" "artifacts/"
done
############################################################
# Build Manifest Partials for binaries.html-tidy.org
############################################################
- name: Build Manifest Partials
working-directory: ${{github.workspace}}/build/cmake/artifacts
shell: bash
run: |
ls -al
manifest="../binaries-partial.yml"
touch "${manifest}"
for filename in *.*[^sha256]; do
filesize=$(numfmt --to=si --suffix=B $(wc -c < ${filename}))
modified=$(${{matrix.stat_command}} -c %y "${filename}" | cut -d'.' -f1)
sha256=$(${{matrix.sha_command}} "${filename}" | awk '{print $1}')
echo " - filename: ${filename}" >> "${manifest}"
echo " filesize: ${filesize}" >> "${manifest}"
echo " modified: ${modified}" >> "${manifest}"
echo " describe: ''" >> "${manifest}"
echo " sha256: ${sha256}" >> "${manifest}"
echo "" >> "${manifest}"
done;
cat "${manifest}"
############################################################
# Release the artifacts.
############################################################
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
#name: "New Draft Release"
#tag_name: "v1.2.7"
#draft: true
#prerelease: true
files: "${{github.workspace}}/build/cmake/artifacts/*"
############################################################
# Post the manifest to the run results.
############################################################
- name: Post the Manifest
uses: actions/upload-artifact@v2
with:
name: "partials_for_website-${{matrix.os}}.yml"
path: ${{github.workspace}}/build/cmake/binaries-partial.yml

View file

@ -593,6 +593,8 @@ endif ()
# Windows
# MSI - this needs WiX Tooset installed and a path to candle.exe
# EXE - this needs NSIS tools to be in path
# Everything Else
# RPM required to build RPM's, and might not be installed by default.
#------------------------------------------------------------------------
if (WIN32)
set(CPACK_GENERATOR "NSIS;WIX;ZIP")
@ -621,10 +623,23 @@ set(CPACK_PACKAGE_VERSION_MINOR "${TIDY_MINOR_VERSION}")
set(CPACK_PACKAGE_VERSION_PATCH "${TIDY_POINT_VERSION}")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
# use one compatible license file for all
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
#------------------------------------------------------------------------
# Windows: it looks like only the LICENSE.txt file is used by Windows,
# for either package type (.exe and .msi).
# Linux: none of the files are shown publicly by default when installing
# from a .deb or .rpm.
# Mac: cannot show HTML; need RTF. CPACK_RESOURCE_FILE_WELCOME isn't
# needed.
#------------------------------------------------------------------------
if (APPLE)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/build/macos/Installer-License.rtf")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/build/macos/Installer-Introduction.rtf")
else ()
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/README/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html")
endif ()
#------------------------------------------------------------------------
@ -632,26 +647,45 @@ set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_CURRENT_SOURCE_DIR}/README/README.html"
#------------------------------------------------------------------------
set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${LIBTIDY_URL})
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc")
set(CPACK_DEBIAN_PACKAGE_SECTION "Libraries")
set(CPACK_SOURCE_IGNORE_FILES
"${PROJECT_SOURCE_DIR}/build"
)
set(CPACK_SOURCE_IGNORE_FILES "${PROJECT_SOURCE_DIR}/build" )
#------------------------------------------------------------------------
# RPM config
#------------------------------------------------------------------------
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/man" "/usr/share/man/man1")
set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/test/;${CMAKE_CURRENT_SOURCE_DIR}/build/;${CMAKE_CURRENT_SOURCE_DIR}/.git/")
if (NOT WIN32 AND NOT APPLE)
set( CPACK_PACKAGE_FILE_NAME "${LIB_NAME}-${CPACK_PACKAGE_VERSION}-${BITNESS}bit" )
#------------------------------------------------------------------------
# Package name configuration
# The default is LIB_NAME-CPACK_PACKAGE_VERSION-CMAKE_SYSTEM_NAME,
# but we want to include system name for Unixes, and correct the
# system name on Apple targets.
#------------------------------------------------------------------------
if (UNIX AND NOT APPLE)
set(CPACK_PACKAGE_FILE_NAME "${LIB_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${BITNESS}bit")
endif ()
if (APPLE AND NOT IOS)
if (CMAKE_OSX_ARCHITECTURES)
set(CPACK_PACKAGE_FILE_NAME "${LIB_NAME}-${CPACK_PACKAGE_VERSION}-macOS-${CMAKE_OSX_ARCHITECTURES}")
string(REPLACE ";" "+" CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}")
else ()
set(CPACK_PACKAGE_FILE_NAME "${LIB_NAME}-${CPACK_PACKAGE_VERSION}-macOS-${BITNESS}bit")
endif ()
endif ()
if (IOS)
set(CPACK_PACKAGE_FILE_NAME "${LIB_NAME}-${CPACK_PACKAGE_VERSION}-iOS-${BITNESS}bit")
endif ()
#------------------------------------------------------------------------
# Build the Package
#------------------------------------------------------------------------
include(CPack)
#------------------------------------------------------------------------
# pkg-config
#------------------------------------------------------------------------

View file

@ -0,0 +1,37 @@
{\rtf1\ansi\ansicpg1252\cocoartf2580
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fswiss\fcharset0 Helvetica-Oblique;
\f3\fmodern\fcharset0 Courier;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww25720\viewh15920\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc\partightenfactor0
\f0\b\fs36 \cf0 HTACG HTML Tidy for macOS
\fs24 \
\
\fs28 http://www.html-tidy.org
\f1\b0\fs24 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\cf0 \
Installer will install
\f2\i HTML Tidy
\f1\i0 for macOS.\
\
This version is much newer than the version supplied by Apple, which is only recent as of October 2006. This version of
\f2\i HTML Tidy
\f1\i0 supports HTML5, which is probably the most important thing. Additionally it supports a lot of extended attributes and other things that have made their way into HTML since 2006.\
\
It will not replace the built in version of
\f2\i HTML Tidy
\f1\i0 included in macOS, but it will act as a replacement by default.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\f0\b \cf0 Important note
\f1\b0 \
\
This installer places files into
\f3 /usr/local/
\f1 which is the correct location for Unix files such as this. Normally macOS allows the installer to access this directory, but early upgrade-installed versions of macOS 10.11 El Capitan prevented this. If the installer fails and you are still running El Capitan, please ensure that you are using the latest point release of that operating system.\
}

View file

@ -0,0 +1,34 @@
{\rtf1\ansi\ansicpg1252\cocoartf2580
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Bold;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww11740\viewh11980\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
\f0\fs24 \cf0 Copyright \'a9 1998-2008 World Wide Web Consortium (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved.\
\
Contributing Author(s):\
Dave Raggett <dsr@w3.org>\
\
The contributing author(s) would like to thank all those who helped with testing, bug fixes and suggestions for improvements. This wouldn't have been possible without your help.\
\
\f1\b COPYRIGHT NOTICE:
\f0\b0 \
\
This software and documentation is provided "as is," and the copyright holders and contributing author(s) make no representations or warranties, express or implied, including but not limited to, warranties of merchantability or fitness for any particular purpose or that the use of the software or documentation will not infringe any third party patents, copyrights, trademarks or other rights. \
\
The copyright holders and contributing author(s) will not be held liable for any direct, indirect, special or consequential damages arising out of any use of the software or documentation, even if advised of the possibility of such damage.\
\
Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, documentation and executables, for any purpose, without fee, subject to the following restrictions:\
\
1. The origin of this source code must not be misrepresented.\
2. Altered versions must be plainly marked as such and must not be misrepresented as being the original source.\
3. This Copyright notice may not be removed or altered from any source or altered source distribution.\
\
The copyright holders and contributing author(s) specifically permit, without fee, and encourage the use of this source code as a component for supporting the Hypertext Markup Language in commercial products. If you use this source code in a product, acknowledgment is not required but would be appreciated.\
\
Created 2001-05-20 by Charles Reitzel\
Updated 2002-07-01 by Charles Reitzel - 1st Implementation\
Updated 2021-04-28 by others subjected to this same license.\
}

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>org.htacg.html-tidy.tidy5</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>5.6.0</string>
<key>CFBundleVersion</key>
<string>5.6.0</string>
</dict>
</plist>

7
include/module.modulemap Normal file
View file

@ -0,0 +1,7 @@
module CLibTidy {
header "tidy.h"
header "tidybuffio.h"
header "tidyenum.h"
header "tidyplatform.h"
export *
}