From 1129c9c02691cdfe422ecdcc82ad61a99de1fd1d Mon Sep 17 00:00:00 2001 From: Jamieson Pryor Date: Thu, 2 Jan 2025 11:14:06 -0800 Subject: [PATCH] Add Github action workflows for new C++20 targets: Part 1. Unfortunately for presubmit to pass these have to already be submitted, so first I will add the new targets and then I will remove the legacy targets This enables testing for gcc. PiperOrigin-RevId: 711474571 --- .github/workflows/ci.yml | 39 ++++++++++++++++++ implementation/BUILD | 8 +--- implementation/array_ref.h | 13 +++--- implementation/array_view.h | 32 ++++++++------- implementation/jvm_test.cc | 11 ++++-- implementation/selector_static_info.h | 32 +++++++-------- javatests/com/jnibind/test/modulo.h | 2 +- metaprogramming/BUILD | 1 + metaprogramming/cartesian_product.h | 46 ++++++++++----------- metaprogramming/even_odd.h | 56 +++++++++++--------------- metaprogramming/lambda_string.h | 2 + metaprogramming/n_bit_sequence.h | 57 ++++++++++++++------------- metaprogramming/passthrough_test.cc | 10 +++-- metaprogramming/string_concatenate.h | 3 ++ 14 files changed, 178 insertions(+), 134 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1664dff..abb213ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ permissions: contents: read jobs: + # These jobs are legacy but needed for CopyBara to pass tests. ubuntu-latest-cpp17: runs-on: ubuntu-latest steps: @@ -37,3 +38,41 @@ jobs: - uses: actions/checkout@v4 - name: test run: bazel test --cxxopt='-Werror' --cxxopt='-std=c++20' --repo_env=CC=clang --test_output=errors ... + + # These are the new jobs that will be migrated to. + ubuntu-latest-cpp17-clang: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: test + run: bazel test --cxxopt='-Werror' --cxxopt='-std=c++17' --repo_env=CC=clang --test_output=errors //implementation/legacy/... + + ubuntu-latest-cpp20-clang: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: test + run: bazel test --cxxopt='-Werror' --cxxopt='-std=c++20' --repo_env=CC=clang --test_output=errors ... + + # Commented out because for some reason Github's action runner seems to be + # forcing C++14 which I can't reproduce locally. + # ubuntu-latest-cpp20-gcc: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - name: test + # run: bazel test --cxxopt='-Werror' --cxxopt='-std=c++20' --repo_env=CC=gcc --test_output=errors ... -- -//implementation/legacy/... + + macos-latest-cpp17-clang: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: test + run: bazel test --cxxopt='-Werror' --cxxopt='-std=c++17' --repo_env=CC=clang --test_output=errors //implementation/legacy/... + + macos-latest-cpp20-clang: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - name: test + run: bazel test --cxxopt='-Werror' --cxxopt='-std=c++20' --repo_env=CC=clang --test_output=errors ... diff --git a/implementation/BUILD b/implementation/BUILD index 079548f3..096ae00a 100644 --- a/implementation/BUILD +++ b/implementation/BUILD @@ -41,21 +41,15 @@ cc_library( name = "array_ref", hdrs = ["array_ref.h"], deps = [ - ":array", ":array_view", - ":class", ":class_ref", - ":default_class_loader", ":forward_declarations", - ":jni_type", ":local_object", - ":object_ref", + ":no_idx", ":promotion_mechanics_tags", - ":ref_base", "//:jni_dep", "//implementation/jni_helper:jni_array_helper", "//implementation/jni_helper:lifecycle", - "//implementation/jni_helper:lifecycle_object", ], ) diff --git a/implementation/array_ref.h b/implementation/array_ref.h index 168b6a26..17563e43 100644 --- a/implementation/array_ref.h +++ b/implementation/array_ref.h @@ -19,7 +19,9 @@ // IWYU pragma: private, include "third_party/jni_wrapper/jni_bind.h" +#include #include +#include #include "implementation/array_view.h" #include "implementation/class_ref.h" @@ -27,6 +29,7 @@ #include "implementation/jni_helper/jni_array_helper.h" #include "implementation/jni_helper/lifecycle.h" #include "implementation/local_object.h" +#include "implementation/no_idx.h" #include "implementation/promotion_mechanics_tags.h" #include "jni_dep.h" @@ -50,10 +53,6 @@ class ArrayRef : public ScopedArrayImpl { : Base(AdoptLocal{}, JniArrayHelper::NewArray(size)) {} - template - ArrayRef(const ArrayViewHelper& array_view_helper) - : Base(AdoptLocal{}, array_view_helper.val) {} - explicit ArrayRef(int size) : ArrayRef(static_cast(size)) {} ArrayView Pin(bool copy_on_completion = true) { @@ -133,9 +132,9 @@ class ArrayRef< // e.g. // LocalArray arr { 5, LocalObject {args...} }; // LocalArray arr { 5, GlobalObject {args...} }; - template