mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-08-01 19:06:38 +08:00
Compare commits
6 Commits
068cf29e67
...
7ef651f7e9
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7ef651f7e9 | ||
![]() |
ee80e956dd | ||
![]() |
aa6d1df1dd | ||
![]() |
cabb7cad91 | ||
![]() |
a0d59acf62 | ||
![]() |
30304f1668 |
@ -1,25 +1,24 @@
|
|||||||
# Copyright 2025 Arthur Sonzogni. All rights reserved.
|
# Copyright 2025 Arthur Sonzogni. All rights reserved.
|
||||||
# Use of this source code is governed by the MIT license that can be found in
|
# Use of this source code is governed by the MIT license that can be found in
|
||||||
# the LICENSE file.
|
# the LICENSE file.
|
||||||
bcr_test_module:
|
matrix:
|
||||||
module_path: "."
|
platform:
|
||||||
matrix:
|
- centos7
|
||||||
platform: [
|
- debian10
|
||||||
"debian11",
|
- ubuntu2004
|
||||||
"macos",
|
- macos
|
||||||
"macos-arm64",
|
- windows
|
||||||
"ubuntu2204",
|
bazel: [6.x, 7.x, 8.x]
|
||||||
"windows",
|
tasks:
|
||||||
]
|
verify_targets:
|
||||||
bazel: [
|
name: Build and test.
|
||||||
6.x,
|
platform: ${{ platform }}
|
||||||
7.x,
|
bazel: ${{ bazel }}
|
||||||
8.x,
|
build_targets:
|
||||||
]
|
- '@ftxui//:ftxui'
|
||||||
tasks:
|
- '@ftxui//:screen'
|
||||||
run_tests:
|
- '@ftxui//:dom'
|
||||||
name: "Run test module"
|
- '@ftxui//:component'
|
||||||
platform: ${{ platform }}
|
test_targets:
|
||||||
bazel: ${{ bazel }}
|
- '@ftxui//:tests'
|
||||||
test_targets:
|
|
||||||
- "//..."
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"integrity": "",
|
"integrity": "",
|
||||||
"strip_prefix": "{REPO}-{VERSION}",
|
"strip_prefix": "",
|
||||||
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz"
|
"url": "https://github.com/ArthurSonzogni/FTXUI/releases/download/{TAG}/source.tar.gz"
|
||||||
}
|
}
|
||||||
|
29
.github/workflows/build.yaml
vendored
29
.github/workflows/build.yaml
vendored
@ -12,7 +12,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
test_bazel:
|
test_bazel:
|
||||||
name: "Test Bazel"
|
name: "Bazel, ${{ matrix.compiler }}, ${{ matrix.os }}"
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -44,7 +44,7 @@ jobs:
|
|||||||
run: bazel run tests
|
run: bazel run tests
|
||||||
|
|
||||||
test_cmake:
|
test_cmake:
|
||||||
name: "Tests CMake"
|
name: "CMake, ${{ matrix.compiler }}, ${{ matrix.os }}"
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -173,7 +173,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Build artifact for the release
|
# Build artifact for the release
|
||||||
package:
|
package_compiled:
|
||||||
name: "Build packages"
|
name: "Build packages"
|
||||||
needs: release
|
needs: release
|
||||||
strategy:
|
strategy:
|
||||||
@ -217,6 +217,29 @@ jobs:
|
|||||||
upload_url: ${{ needs.release.outputs.upload_url }}
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
||||||
asset_path: ${{ matrix.asset_path }}
|
asset_path: ${{ matrix.asset_path }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
|
|
||||||
|
# Build "source" artifact for the release. This is the same as the github
|
||||||
|
# "source" archive, but with a stable URL. This is useful for the Bazel
|
||||||
|
# Central Repository.
|
||||||
|
package_source:
|
||||||
|
name: "Build source package"
|
||||||
|
needs: release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Checkout repository"
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: "Create source package"
|
||||||
|
run: >
|
||||||
|
git archive --format=tar.gz --prefix=ftxui/ -o source.tar.gz HEAD
|
||||||
|
|
||||||
|
- name: "Upload source package"
|
||||||
|
uses: shogo82148/actions-upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ needs.release.outputs.upload_url }}
|
||||||
|
asset_path: source.tar.gz
|
||||||
|
overwrite: true
|
||||||
|
|
||||||
|
|
||||||
documentation:
|
documentation:
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
on:
|
on:
|
||||||
# Run the publish workflow after a successful release.
|
# On new releases:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
tag_name:
|
tag_name:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
# Allow manual triggering of the workflow.
|
# On manual trigger:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag_name:
|
tag_name:
|
||||||
@ -15,10 +15,9 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@[version]
|
uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.0.4
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ inputs.tag_name }}
|
tag_name: ${{ inputs.tag_name }}
|
||||||
# GitHub repository which is a fork of the upstream where the Pull Request will be opened.
|
|
||||||
registry_fork: ArthurSonzogni/bazel-central-registry
|
registry_fork: ArthurSonzogni/bazel-central-registry
|
||||||
permissions:
|
permissions:
|
||||||
attestations: write
|
attestations: write
|
14
BUILD.bazel
14
BUILD.bazel
@ -3,13 +3,9 @@
|
|||||||
# the LICENSE file.
|
# the LICENSE file.
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# - Windows/MSVC support.
|
# - Build benchmark.
|
||||||
# - Pass /utf-8 to MSVC users depending on FTXUI.
|
# - Build fuzzers.
|
||||||
# - Pass "FTXUI_MICROSOFT_TERMINAL_FALLBACK" to windows users.
|
# - Build documentation.
|
||||||
# - Support building benchmark.
|
|
||||||
# - Support building examples.
|
|
||||||
# - Support building fuzzer.
|
|
||||||
# - Support building documentation.
|
|
||||||
# - Enable the two tests timing out.
|
# - Enable the two tests timing out.
|
||||||
# - Support WebAssembly
|
# - Support WebAssembly
|
||||||
|
|
||||||
@ -17,7 +13,7 @@ load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
|||||||
load(":bazel/ftxui.bzl", "ftxui_cc_library")
|
load(":bazel/ftxui.bzl", "ftxui_cc_library")
|
||||||
load(":bazel/ftxui.bzl", "generate_examples")
|
load(":bazel/ftxui.bzl", "generate_examples")
|
||||||
load(":bazel/ftxui.bzl", "cpp20")
|
load(":bazel/ftxui.bzl", "cpp20")
|
||||||
load(":bazel/ftxui.bzl", "msvc_copts")
|
load(":bazel/ftxui.bzl", "windows_copts")
|
||||||
load(":bazel/ftxui.bzl", "pthread_linkopts")
|
load(":bazel/ftxui.bzl", "pthread_linkopts")
|
||||||
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
@ -245,7 +241,7 @@ cc_test(
|
|||||||
"include",
|
"include",
|
||||||
"src",
|
"src",
|
||||||
],
|
],
|
||||||
copts = cpp20() + msvc_copts(),
|
copts = cpp20() + windows_copts(),
|
||||||
deps = [
|
deps = [
|
||||||
"//:ftxui",
|
"//:ftxui",
|
||||||
"@googletest//:gtest_main",
|
"@googletest//:gtest_main",
|
||||||
|
@ -20,23 +20,42 @@ def cpp20():
|
|||||||
"//conditions:default": ["-std=c++20"],
|
"//conditions:default": ["-std=c++20"],
|
||||||
})
|
})
|
||||||
|
|
||||||
def msvc_copts():
|
# Microsoft terminal is a bit buggy ¯\_(ツ)_/¯ and MSVC uses bad defaults.
|
||||||
|
def windows_copts():
|
||||||
MSVC_COPTS = [
|
MSVC_COPTS = [
|
||||||
# Force Microsoft Visual Studio to decode sources files in UTF-8.
|
# Microsoft Visual Studio must decode sources files as UTF-8.
|
||||||
"/utf-8",
|
"/utf-8",
|
||||||
|
|
||||||
# Force Microsoft Visual Studio to interpret the source files as
|
# Microsoft Visual Studio must interpret the codepoint using unicode.
|
||||||
# Unicode.
|
|
||||||
"/DUNICODE",
|
"/DUNICODE",
|
||||||
"/D_UNICODE",
|
"/D_UNICODE",
|
||||||
|
|
||||||
# Fallback for Microsoft Terminal.
|
# Fallback for Microsoft Terminal.
|
||||||
|
# This
|
||||||
|
# - Replace missing font symbols by others.
|
||||||
|
# - Reduce screen position pooling frequency to deals against a Microsoft
|
||||||
|
# race condition. This was fixed in 2020, but clients never not updated.
|
||||||
|
# - https://github.com/microsoft/terminal/pull/7583
|
||||||
|
# - https://github.com/ArthurSonzogni/FTXUI/issues/136
|
||||||
"/DFTXUI_MICROSOFT_TERMINAL_FALLBACK",
|
"/DFTXUI_MICROSOFT_TERMINAL_FALLBACK",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
WINDOWS_COPTS = [
|
||||||
|
# Fallback for Microsoft Terminal.
|
||||||
|
# This
|
||||||
|
# - Replace missing font symbols by others.
|
||||||
|
# - Reduce screen position pooling frequency to deals against a Microsoft
|
||||||
|
# race condition. This was fixed in 2020, but clients never not updated.
|
||||||
|
# - https://github.com/microsoft/terminal/pull/7583
|
||||||
|
# - https://github.com/ArthurSonzogni/FTXUI/issues/136
|
||||||
|
"-DFTXUI_MICROSOFT_TERMINAL_FALLBACK",
|
||||||
|
];
|
||||||
|
|
||||||
return select({
|
return select({
|
||||||
|
# MSVC:
|
||||||
"@rules_cc//cc/compiler:msvc-cl": MSVC_COPTS,
|
"@rules_cc//cc/compiler:msvc-cl": MSVC_COPTS,
|
||||||
"@rules_cc//cc/compiler:clang-cl": MSVC_COPTS,
|
"@rules_cc//cc/compiler:clang-cl": MSVC_COPTS,
|
||||||
|
"@platforms//os:windows": WINDOWS_COPTS,
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -69,10 +88,12 @@ def ftxui_cc_library(
|
|||||||
"include",
|
"include",
|
||||||
"src",
|
"src",
|
||||||
],
|
],
|
||||||
copts = cpp17() + msvc_copts(),
|
copts = cpp17() + windows_copts(),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Compile all the examples in the examples/ directory.
|
||||||
|
# This is useful to check the Bazel is synchronized with CMake definitions.
|
||||||
def generate_examples():
|
def generate_examples():
|
||||||
cpp_files = native.glob(["examples/**/*.cpp"])
|
cpp_files = native.glob(["examples/**/*.cpp"])
|
||||||
|
|
||||||
@ -90,5 +111,5 @@ def generate_examples():
|
|||||||
name = name,
|
name = name,
|
||||||
srcs = [src],
|
srcs = [src],
|
||||||
deps = ["//:component"],
|
deps = ["//:component"],
|
||||||
copts = cpp20() + msvc_copts(),
|
copts = cpp20() + windows_copts(),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user