Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.4.0 #10

Merged
merged 33 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
name: "Bug report"
about: "Create a report to help us improve"
title: ""
labels: bug
assignees: LebJe

---

## Describe the bug

A clear and concise description of what the bug is.

## Version and Installation Info
* toml.lua version:
* Installation method: (Manual compilation or `luarocks install toml`)
* Compilation log, or Luarocks installation log:

- toml.lua version:
- Operating system:
- Installation method: (Manual compilation or `luarocks install toml`)
- Compilation log, or Luarocks installation log:

```shell
# For compilation logs, include the compilation command, and compiler version
# Paste installation or compilation log here
# For compilation logs, include the compilation command, and compiler version
```

## To Reproduce

Provide a **minimal** TOML file that demonstrates the issue:

```toml
Expand All @@ -33,7 +38,9 @@ local toml = require("toml")
```

## Expected behavior

A clear and concise description of what you expected to happen.

## Additional context

Add any other context about the problem here.
9 changes: 4 additions & 5 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
name: "Feature request"
about: "Suggest an idea for this project"
title: ""
labels: ""
assignees: LebJe

---

**Is your feature request related to a problem? Please describe.**
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildAndTest-Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
"liblua5.1-0-dev lua5.1",
]
steps:
- uses: "actions/checkout@v3"
- uses: "actions/checkout@v4"
- name: "Add Dependencies"
run: |
export COMPILER=${{ matrix.compiler }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildAndTest-MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
matrix:
lua: ["lua", "luajit"]
steps:
- uses: "actions/checkout@v3"
- uses: "actions/checkout@v4"
- name: "Install Dependencies"
run: |
brew install ${{ matrix.lua }} luarocks
Expand Down
35 changes: 25 additions & 10 deletions .github/workflows/buildAndTest-Windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
runs-on: "windows-latest"
strategy:
matrix:
compiler: ["LLVM", "MinGW"]
compiler: ["LLVM", "MinGW", "MSVC"]
steps:
- uses: "actions/checkout@v3"
- uses: "actions/checkout@v4"
- name: "Install Dependencies"
run: "choco install -y cmake ninja"
- name: "Build LuaJIT"
Expand All @@ -21,27 +21,39 @@ jobs:
uses: "egor-tensin/setup-clang@v1"
- name: "Set up MinGW"
if: "${{ matrix.compiler == 'MinGW' }}"
uses: "egor-tensin/setup-mingw@v2"
uses: "e-t-l/setup-mingw@patch-1"
with:
platform: "x64"
- name: "Set up MSVC"
if: "${{ matrix.compiler == 'MSVC' }}"
uses: "seanmiddleditch/gha-setup-vsdevenv@master"
- name: "Build Project"
uses: "compnerd/gha-setup-vsdevenv@main"
- name: "Configure Project"
run: |
New-Item -Path "LuaRocks\tree\luaRocksConfig.lua" -ItemType File

$env:LUAROCKS_TREE=$(Resolve-Path LuaRocks\tree)
$env:LUAROCKS_LUADIR=$(Resolve-Path LuaJIT\)
$env:LUAROCKS_CONFIG="$(Resolve-Path LuaRocks\tree\luaRocksConfig.lua)"

LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" config variables.LUA_LIBDIR "$(Resolve-Path LuaJIT\bin\)"

if (("${{ matrix.compiler }}" -eq "MinGW") -or ("${{ matrix.compiler }}" -eq "MSVC")) {
if (("${{ matrix.compiler }}" -eq "MinGW")) {
LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" config variables.LINK_FLAGS "$(Resolve-Path LuaJIT\bin\lua51.dll)"
}

LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" config cmake_generator "Ninja Multi-Config"
if (("${{ matrix.compiler }}" -eq "MSVC")) {
Copy-Item "$(Resolve-Path libs\lua51.lib)" -Destination "$(Resolve-Path LuaJIT\bin)"

LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" config "variables.LUA_LIBDIR" "$(Resolve-Path LuaJIT\bin\)"
LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" config cmake_generator "Visual Studio 17 2022"
} else {
LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" config "variables.LUA_LIBDIR" "$(Resolve-Path LuaJIT\bin)"
LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" config cmake_generator "Ninja Multi-Config"
}
- name: "Build Project"
run: |
$env:LUAROCKS_TREE=$(Resolve-Path LuaRocks\tree)
$env:LUAROCKS_LUADIR=$(Resolve-Path LuaJIT\)
$env:LUAROCKS_CONFIG="$(Resolve-Path LuaRocks\tree\luaRocksConfig.lua)"

LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" make
- name: "Run Tests"
run: |
Expand All @@ -51,6 +63,9 @@ jobs:
$env:LUAROCKS_CONFIG="$(Resolve-Path LuaRocks\tree\luaRocksConfig.lua)"
$env:LUA_CPATH="$(Resolve-Path LuaRocks\tree\lib\lua\5.1\)?.dll"
$env:LUA_PATH="$(Resolve-Path LuaRocks\tree\share\lua\5.1\)?.lua;$($pwd.Path)\?.lua"

LuaRocks\luarocks.exe --lua-dir "$($env:LUAROCKS_LUADIR)" --tree "$($env:LUAROCKS_TREE)" install luaunit

LuaJIT\bin\luajit.exe tests\tests.lua
if (("${{ matrix.compiler }}" -ne "MSVC")) {
LuaJIT\bin\luajit.exe tests\tests.lua
}
16 changes: 8 additions & 8 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: "Run pre-commit"
on: ["pull_request"]
name: "Run Pre-Commit"

on:
push:
branches:
- "main"

jobs:
PreCommit:
runs-on: "macos-latest"
steps:
- uses: "actions/checkout@v3"
- name: "Checkout PR"
run: "gh pr checkout ${{ github.event.pull_request.number }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: "actions/checkout@v4"
- name: "Install Dependencies"
run: "brew bundle --no-lock"
run: "brew bundle"
- uses: "LebJe/[email protected]"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ compile_commands.json
Brewfile.lock.json
.vscode/
.nova/
.vim/
.vim/

# Test files
test.lua
inspect.lua
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: "https://github.com/pre-commit/mirrors-prettier.git"
rev: "v2.4.1"
rev: "v4.0.0-alpha.8"
hooks:
- id: "prettier"
name: "Format YAML & Markdown"
Expand Down
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"singleQuote": false,
"useTabs": true
}
4 changes: 0 additions & 4 deletions .prettierrc.toml

This file was deleted.

30 changes: 28 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,33 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.0](https://github.com/LebJe/toml.lua/releases/tag/0.2.0) - 2023-02-19
## [0.4.0](https://github.com/LebJe/toml.lua/releases/tag/0.4.0) - 2024-01-02

### Added

- `toml.Int` for formatted integers.

```lua
local formattedIntegers = {
int1 = toml.Int.new(2582, toml.formatting.int.octal),
int2 = toml.Int.new(3483, toml.formatting.int.binary),
int3 = toml.Int.new(5791, toml.formatting.int.hexadecimal)
}

print(toml.encode(formattedIntegers))
--[[
int1 = 0o5026
int2 = 0b110110011011
int3 = 0x169F
--]]
```

- `formattedIntsAsUserdata` can be passed to the options table of `toml.decode` (see "Decoding Options" in the README).
- Updated to toml++ v3.4.0.
- Updated to MagicEnum v0.9.5.
- toml.lua compiles with MSVC.

## [0.3.0](https://github.com/LebJe/toml.lua/releases/tag/0.3.0) - 2023-02-19

### Added

Expand All @@ -14,7 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `toml.encodeToFile(data: table, fileOrOptions: string|table)`:
- Encodes `data` to the file specified in `fileOrOptions`. the file will be created if it doesn't exist.
- When `fileOrOptions` is a string, it simply is the file path.
- When `fileOrOptions` is a table, it should have`file`, and optionally, `overwrite` as keys. `file` is the file path, and `overwrite` should be `true` when `file` should be `overwritten` with `data`, and `false` when `data` should be appended to `file`.
- When `fileOrOptions` is a table, it should have`file`, and optionally, `overwrite` as keys. `file` is the file path, and `overwrite` should be `true` when `file` should be overwritten with `data`, and `false` when `data` should be appended to `file`.
- Added tests that cover:
- The property accessors of `toml.Date`, `toml.Time`, `toml.DateTime`, and `toml.TimeOffset`.
- `toml.toJSON` and `toml.toYAML`.
Expand Down
13 changes: 6 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(NOT TOML_LUA_VERSION)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --dirty
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE ret
OUTPUT_VARIABLE LUA_RAPIDJSON_VERSION
OUTPUT_VARIABLE TOML_LUA_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT ret EQUAL "0")
Expand Down Expand Up @@ -41,7 +41,7 @@ FetchContent_Declare(
GIT_REPOSITORY "https://github.com/marzer/tomlplusplus.git"
GIT_SHALLOW ON
GIT_SUBMODULES ""
GIT_TAG "v3.3.0"
GIT_TAG "v3.4.0"
)

FetchContent_Declare(
Expand All @@ -57,13 +57,13 @@ FetchContent_Declare(
GIT_REPOSITORY "https://github.com/Neargye/magic_enum.git"
GIT_SHALLOW ON
GIT_SUBMODULES ""
GIT_TAG "v0.8.2"
GIT_TAG "v0.9.5"
)

FetchContent_GetProperties(${TOML++})
if(NOT ${TOML++}_POPULATED)
message(STATUS "Cloning ${TOML++}")
FetchContent_Populate(${TOML++})
#FetchContent_Populate(${TOML++})
FetchContent_MakeAvailable(${TOML++})
endif()

Expand Down Expand Up @@ -107,7 +107,6 @@ else(UNIX)
endif(WIN32)
endif(UNIX)


if(NOT LUA_INCLUDE_DIR OR (WIN32 AND NOT LUA_LIBRARIES))
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
find_package(Lua)
Expand All @@ -127,10 +126,10 @@ set(SOURCES
add_library(toml.lua MODULE ${SOURCES})
source_group(src FILES ${SOURCES})

if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR MSVC)
target_link_options(toml.lua PUBLIC ${PROJECT_SOURCE_DIR}\\libs\\lua51.lib)
else()
target_link_libraries(toml.lua ${LUA_LIBRARIES})
target_link_libraries(toml.lua ${LUA_LIBRARIES} tomlplusplus::tomlplusplus)
endif()

if (LINK_FLAGS)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Jeff Lebrun
Copyright (c) 2024 Jeff Lebrun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading