Commit Graph

868 Commits

Author SHA1 Message Date
JP Simard 1f5cc7ac33
Remove Foundation dependency 2022-12-10 14:39:52 -05:00
JP Simard 740d49c99b
Basic CLI 2022-12-09 10:45:15 -05:00
JP Simard 39698493e0
[CI] Update tool versions (#355)
To test with Xcode 13.4 and Swift 5.6
2022-06-06 12:30:51 -04:00
JP Simard 1f3c1c665c
Add DocC plugin and integrate with Swift Package Index (#354)
Following the instructions here:
https://blog.swiftpackageindex.com/posts/auto-generating-auto-hosting-and-auto-updating-docc-documentation

Only install Swift DocC plugin on Swift 5.6.x on macOS.
2022-06-05 13:28:58 -04:00
JP Simard 325d86409d
Add empty changelog section 2022-04-28 13:54:35 -04:00
JP Simard 01835dc202
Release 5.0.1 2022-04-28 13:50:41 -04:00
Yuta Saito cd43968868
Build CYaml as PIC explicitly to link it agaist libYams.so (#353)
CYaml has been a private dependency of libYams.so and linked statically
against it since 2a93d740ef.
Therefore, CYaml should be built as PIC, but it wasn't.

Since gas 2.31 (Ubuntu 20.04), which includes implicit promotion of
non-PIC reloc (R_X86_64_PC32) to PIC reloc (R_X86_64_PLT32)[^1], this
issue is not revealed. However gas older than 2.31 (Ubuntu 18.04), this
PIC-ness mismatch causes linking failure with the following output:

```
/usr/bin/ld.gold: error: lib/libCYaml.a(api.c.o): requires dynamic R_X86_64_PC32 reloc against 'yaml_realloc' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: lib/libCYaml.a(scanner.c.o): requires dynamic R_X86_64_PC32 reloc against 'yaml_parser_fetch_more_tokens' which may overflow at runtime; recompile with -fPIC
```

This patch fixes the PIC-ness mismatch by enabling
`POSITION_INDEPENDENT_CODE` explicitly, and adds CI job to check cmake
build system works on Ubuntu 18.04.

[^1]: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a
2022-04-28 13:38:03 -04:00
dependabot[bot] a8af4984b1
Bump cocoapods-downloader from 1.5.1 to 1.6.3 (#350)
Bumps [cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader) from 1.5.1 to 1.6.3.
- [Release notes](https://github.com/CocoaPods/cocoapods-downloader/releases)
- [Changelog](https://github.com/CocoaPods/cocoapods-downloader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/CocoaPods/cocoapods-downloader/compare/1.5.1...1.6.3)

---
updated-dependencies:
- dependency-name: cocoapods-downloader
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-05 20:40:31 -04:00
JP Simard 074fd3c61d
[CI] Add macOS 12 / Xcode 13.3 / Swift 5.6 jobs (#349)
* [CI] Add macOS 12 / Xcode 13.3 / Swift 5.6 jobs
* Fix Apple TV on Xcode 13.3
* Update jazzy to 0.14.2
* set sdk
* Revert Analyze CI job to Xcode 13.2.1
2022-03-22 16:17:22 -04:00
JP Simard fcb0a9eb33
Add empty changelog section 2022-02-16 15:57:13 -05:00
JP Simard 00c403debc
Release 5.0.0 2022-02-16 15:38:35 -05:00
JP Simard ce133e5b34
Bump swift-tools-version to 5.4 (#348)
To match the minimum required Swift version.
2022-02-16 12:30:29 -08:00
Saleem Abdulrasool 2a93d740ef
Yams: make `CYaml` private to Yams (#343)
This changes how `CYaml` is built and used within Yams.  As there are no
interfaces from `CYaml` being directly exposed, we can statically link
the library.  However, this still would cause a problem as the `CYaml`
import would be serialized into the module requiring that the module is
available when building anything which consumes `Yams`.  To avoid that,
change the `import CYaml` instances to `@_implementationOnly`.  This
allows for `CYaml` to not be required at the consumer site.

While in the area of the CMake build system, clean up some of the build
system to use language specific options.  This is required to avoid the
de-duplication of the options across languages and enables linking
`CYaml` statically into the library.  Note that on Windows static
linking of *Swift* libraries is not yet properly supported and this does
not enable that nor use that - it is statically linking *C* content.

This now allows building Yams dynamically as a single library target.
On Windows, this is a negligible space savings of ~16KiB.
2022-02-15 17:10:37 -08:00
JP Simard b951102b1f
Require Swift 5.4 (#347)
* Update jazzy job to use newest versions of jazzy & Swift
* Bump rules_apple from 0.30.0 to 0.33.0
2022-02-15 11:41:03 -08:00
JP Simard 6ac70dd4ea
Add 13.2.1 CI jobs (#342) 2022-01-24 12:05:08 -08:00
Terence J. Grant e01df7ded9
Add `sequenceStyle` and `mappingStyle` to `Emitter.Options` (#340)
## Summary:

This adds `sequenceStyle` and `mappingStyle` options to `Emitter.Options`, which allows those using `YAMLEncoder` to specify whether "sequences" and "mappings" use `block` style (the default style) or `flow` style.

Also, CHANGELOG.md was updated and Podspec version was bumped to 4.0.7.

No unit test coverage was added, as there isn't direct unit test coverage for `Emitter.Options`, however there are already tests around mapping and sequence styles in the `EmitterTests` class, so this should be sufficient.

_**Note:** "sequences" are arrays / lists, "mappings" are dictionaries_

## Strategy:

`sequenceStyle` and `mappingStyle` were added to `Emitter.Options`, and changes were cascaded down into `Emitter`, `Encoder`, and `Node` where necessary. The existing field `sortKeys` in `Emitter.Options` was used as a guide to see where both `sequenceStyle` and `mappingStyle` should be added in other places in the code. Otherwise, minimal code changes were made to gain the desired feature.

## Examples:

Given an example YAML file here:

```
structure:
  edges:
    e1:
    - n1
    - n2
    e2:
    - n1
    - n3
    e3:
    - n2
    - n3
  nodes:
  - n1
  - n2
  - n3
```

### `sequenceStyle`

Setting `sequenceStyle` to `.flow` now generates:

```
structure:
  edges:
    e1: [n1, n2]
    e2: [n1, n3]
    e3: [n2, n3]
  nodes: [n1, n2, n3]
```

Which can be more visually pleasing, readable, and compact in certain scenarios such as this one.

### `mappingStyle`

Setting `mappingStyle` to `.flow` now generates:

```
{structure: {edges: {e1: [n1, n2], e2: [n1, n3], e3: [n2, n3]}, nodes: [n1, n2, n3]}}
```

Which may not be as visually pleasing with larger YAML files, but still could be useful in certain scenarios, and having the option to configure `mappingStyle` does "match parity" with being able to configure `sequenceStyle`.

Also you might notice, setting `mappingStyle` to `.flow` also forces `sequenceStyle` to be `.flow`, but this is not an error as for "flow" style to be used correctly with mappings at the top level, it must be enforced recursively through each child. (Implying, child mappings and child sequences must also be "flow" style.)
2022-01-07 14:59:12 -05:00
Saleem Abdulrasool 231963ff24
Tests: enable the full test suite on Windows with newer Swift (#336)
The underlying compiler issue that was prenventing the test suite from complete
execution on Windows has been resolved.  Restrict the full test suite to newer
versions of Swift.  While technically the 11/10 snapshot should contain the fix,
another issue prevents its usage.  The 11/20 snapshot and newer should support
the full test suite on windows as well.

The Windows support should now be at complete parity with the other platforms.
2021-12-14 10:01:23 -08:00
Saleem Abdulrasool 7ff7e67c7b
CI: enable multi-version builds on Windows (#335)
With the use of compnerd/gha-setup-swift, it is relatively easy to enable a
matrix build on Windows, enabling building and testing against different Swift
verisons.  Use this to enable builds for 5.5 and 5.6-dev.
2021-11-21 22:01:55 -05:00
JP Simard a207bf7af2
Update CI (#333)
Run on Swift 5.5 / Xcode 13+
2021-11-15 09:19:55 -08:00
Saleem Abdulrasool bdcb0404b3
CI: Update and simplify Windows setup (#332)
Update the Windows CI to use 5.4.3 instead of 5.4.0.  This update enables switching to gha-setup-swift which simplifies the CI setup for Windows.
2021-11-14 08:29:24 -05:00
Maxwell Elliott b783fdae5b
WORKSPACE typo (#329)
Yams must be capitalized here
2021-11-03 07:26:42 -07:00
Mattt 64f37c1adc
Fix typos in documentation comments (#326)
* Fix typo: intendation -> indentation

* Fix typo: emmitter -> emitter
2021-06-22 09:00:39 -04:00
JP Simard 6ba7f1c6e6
[CI] Run on Xcode 13 beta (#324) 2021-06-09 06:35:13 -07:00
JP Simard 90866c3aac
Run CI jobs with Xcode 12.5 & Swift 5.4 (#323) 2021-06-03 14:55:38 -04:00
JP Simard 9541400b82
Run Linux CI jobs with Swift 5.4 (#322)
Update CI to run with Swift 5.4 on Linux. Swift 5.4 ships with Xcode 12.5, which requires macOS 11, which GitHub Actions don't support yet.

Also add Swift 5.4 to the podspec's swift versions.
2021-06-02 08:00:29 -07:00
Eugene Gubin 4c5473ece8
Use Swift 5.4 release toolchain on Windows (#319) 2021-05-13 13:35:44 -04:00
JP Simard 9ff1cc9327
Release 4.0.6 2021-04-07 17:26:38 -04:00
JP Simard 22740fe250
Fix CocoaPods (#314) 2021-04-07 09:01:05 -07:00
Keith Smiley 67a1b1a4f5
Simplify bazel CI configuration (#313)
This reduces the need to pass through some custom environment, and makes
it work locally on Linux without copying this command
2021-03-25 07:57:48 -04:00
Keith Smiley 2ceeb28a28
Update BUILD configuration (#312)
This has 2 important fixes from Lyft's internal config:

1. The `cc_library` is now tagged with `swift_module` which is a special
   tag that tells rules_swift to generate a module map for the library.
   This is likely why sandboxing had to be disabled.
2. This adds `-fPIC` to the `cc_library` compilation. This is required
   for C libraries that Swift depends on, but there's an outstanding bug
   in bazel where this isn't handled correctly when you use the target
   through the host transition.

This also formats this file using buildifier
2021-03-23 21:17:34 -04:00
Maxwell Elliott 3ed41e1acf
Move Yams Bazel targets to the top level (#310)
Currently developers cannot access these nested targets, moving to the
top level will allow them to consume them in their bazel projects
2021-03-23 14:58:54 -07:00
JP Simard 86b81ab854
Add empty changelog section 2021-03-22 21:22:55 -04:00
JP Simard 4ec0a3c5d6
Release 4.0.5 2021-03-22 21:17:47 -04:00
JP Simard cd589369c4
Use latest stable Xcode version where possible (#309) 2021-03-22 14:04:31 -07:00
JP Simard b26d15bede
Fix codecov.io integration (#308)
Move code coverage generation from the xcodebuild workflow to the
SwiftPM one instead.
2021-03-22 13:23:51 -07:00
JP Simard 409e565756
Update libyaml (#307)
Changes: 53f5b86...acd6f6f
2021-03-22 11:59:22 -07:00
Maxwell Elliott 6780f317eb
Add bazel support to Yams (#302)
Also add a GitHub action to ensure builds are working.

Validated on all Apple platforms and Linux.
2021-03-22 10:27:51 -07:00
JP Simard 938a037ba3
[CI] Re-enable Windows CI job (#306)
Fixed in https://github.com/jpsim/Yams/pull/305

Also take this opportunity to update the Swift snapshot to a more recent
version.
2021-03-22 16:46:38 +00:00
Saleem Abdulrasool 780e2ada77
build: build libyaml as a shared module on Windows (#305)
The libyaml setup is currently configured improperly, not selecting
either shared nor static builds, resulting in libyaml being built
assuming that it is a user of libyaml, which is incorrect.  Adjust the
build to build libyaml as a shared library.

This change is not exactly precise, over generalizing the application of
the `YAML_DECLARE_EXPORT` to avoid bumping the minimum version of SPM to
5.4, which is the first version to include support for
`.platform(.windows)`.  This should not impact the other targets, as the
macro is not consulted for other targets.

This should allow us to enable testing on Windows again which was
disabled with #304.
2021-03-22 08:51:34 -07:00
JP Simard 9bb84f0566
Disable Windows CI job
Until we can fix it. See https://github.com/jpsim/Yams/pull/304 for
details and attempts to fix.
2021-03-22 10:42:16 -04:00
JP Simard 9a84fc3e44
Fix SwiftLint analyze CI job
Seems like some macOS GitHub Actions agents already have SwiftLint
installed.
2021-03-15 10:57:25 -04:00
Saleem Abdulrasool 3a1b1f8c23
CYaml: correct platform check (#303)
The target macro for Windows `_WIN32`.  We would fail to build with CMake on Windows when building with shared libraries.
2021-03-15 07:55:21 -07:00
JP Simard adeee7ef61
Add empty changelog section 2021-01-19 15:32:09 -05:00
JP Simard 9003d51672
Release 4.0.4 2021-01-19 15:25:58 -05:00
JP Simard bf7793c6f5
Simplification 2021-01-19 15:25:05 -05:00
Brentley Jones 8695c0bd11
Expose the underlying Node's Mark on Decoder (#296)
This allows accessing source location during decoding.
2021-01-11 13:58:33 -06:00
dependabot[bot] b1610298b4
Bump redcarpet from 3.5.0 to 3.5.1 (#298)
Bumps [redcarpet](https://github.com/vmg/redcarpet) from 3.5.0 to 3.5.1.
- [Release notes](https://github.com/vmg/redcarpet/releases)
- [Changelog](https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vmg/redcarpet/compare/v3.5.0...v3.5.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-11 11:41:24 -08:00
Brentley Jones 11ab354492
Fix mark for sequences and mappings (#297)
Instead of the start mark for the sequence or map we were capturing the start mark of the _next_ element.
2021-01-11 12:33:06 -06:00
Koen Punt 091bdbe1a5
update "Customize Parsing" examples (#294)
The examples didn't work with the latest version of the package.
2020-12-31 12:12:58 -08:00
JP Simard 13f942e95c
Rename master branch to main 2020-12-11 14:21:03 -05:00