diff --git a/.github/workflows/codeql-csharp-analysis.yml b/.github/workflows/codeql-csharp-analysis.yml
index 48af1be55c1..f18428ce200 100644
--- a/.github/workflows/codeql-csharp-analysis.yml
+++ b/.github/workflows/codeql-csharp-analysis.yml
@@ -67,6 +67,7 @@ jobs:
3.1.x
5.0.x
6.0.x
+ 7.0.x
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
diff --git a/.github/workflows/maven4.yml b/.github/workflows/maven4.yml
new file mode 100644
index 00000000000..5e29e019639
--- /dev/null
+++ b/.github/workflows/maven4.yml
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: 'Maven 4'
+on:
+ workflow_dispatch:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+ paths:
+ - .github/workflows/maven4.yml
+ - lang/java/**
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ maven4:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Cache Local Maven Repository
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+
+ - name: Cache Maven 4 Build Cache
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2/build-cache
+ key: ${{ runner.os }}-maven-build-cache-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-build-cache
+
+ - name: Setup Java
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'adopt'
+ java-version: '11'
+
+ - name: Setup Maven 4
+ uses: stCarolas/setup-maven@v4.5
+ with:
+ maven-version: 4.0.0-alpha-3
+
+ - name: Test
+ run: mvn clean package
diff --git a/.github/workflows/test-lang-csharp.yml b/.github/workflows/test-lang-csharp.yml
index b436f270c88..1b1d5af9527 100644
--- a/.github/workflows/test-lang-csharp.yml
+++ b/.github/workflows/test-lang-csharp.yml
@@ -36,21 +36,22 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Add libzstd
shell: bash
run: sudo apt-get install -y libzstd-dev
- name: Install .NET SDKs
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
+ 7.0.x
- - uses: actions/cache@v2
+ - uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -63,38 +64,26 @@ jobs:
- name: Test
run: ./build.sh test
- # Build and test against .NET 7
- # .NET 7 is not released yet, however this is a good way to test if the project is ready for the release
- # Once .NET 7 is officially released, this can be removed and 7.0.x can be used instead above
- - name: Install .NET SDK 7.0 (pre-release)
- uses: actions/setup-dotnet@v1
- with:
- include-prerelease: true
- dotnet-version: |
- 7.0.x
-
- - name: Test .NET 7.0 (pre-release)
- run: ./build.sh test
-
interop:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Add libzstd
shell: bash
run: sudo apt-get install -y libzstd-dev
- name: Install .NET SDKs
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
+ 7.0.x
- name: Cache Local Maven Repository
- uses: actions/cache@v2
+ uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
diff --git a/.github/workflows/test-lang-java.yml b/.github/workflows/test-lang-java.yml
index c7049437a32..3f1917283a3 100644
--- a/.github/workflows/test-lang-java.yml
+++ b/.github/workflows/test-lang-java.yml
@@ -125,6 +125,7 @@ jobs:
3.1.x
5.0.x
6.0.x
+ 7.0.x
- name: Install Java Avro for Interop Test
working-directory: .
diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
new file mode 100644
index 00000000000..c6000969d38
--- /dev/null
+++ b/.mvn/extensions.xml
@@ -0,0 +1,25 @@
+
+
+
+
+ org.apache.maven.extensions
+ maven-build-cache-extension
+ 1.0.0
+
+
diff --git a/build.sh b/build.sh
index 52ee9cd30c3..0bd1e1880c4 100755
--- a/build.sh
+++ b/build.sh
@@ -56,6 +56,9 @@ DOCKER_BUILD_XTRA_ARGS=${DOCKER_BUILD_XTRA_ARGS-}
# Override the docker image name used.
DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME-}
+# When building a docker container, these are the files that will sent and available.
+DOCKER_EXTRA_CONTEXT="lang/ruby/Gemfile lang/ruby/avro.gemspec lang/ruby/Manifest share/VERSION.txt"
+
usage() {
echo "Usage: $0 {lint|test|dist|sign|clean|veryclean|docker [--args \"docker-args\"]|rat|githooks|docker-test}"
exit 1
@@ -300,8 +303,9 @@ do
echo "RUN getent group $GROUP_ID || groupadd -g $GROUP_ID $USER_NAME"
echo "RUN getent passwd $USER_ID || useradd -g $GROUP_ID -u $USER_ID -k /root -m $USER_NAME"
} > Dockerfile
+ # Include the ruby gemspec for preinstallation.
# shellcheck disable=SC2086
- tar -cf- lang/ruby/Gemfile Dockerfile | docker build $DOCKER_BUILD_XTRA_ARGS -t "$DOCKER_IMAGE_NAME" -
+ tar -cf- Dockerfile $DOCKER_EXTRA_CONTEXT | docker build $DOCKER_BUILD_XTRA_ARGS -t "$DOCKER_IMAGE_NAME" -
rm Dockerfile
# By mapping the .m2 directory you can do an mvn install from
# within the container and use the result on your normal
@@ -336,7 +340,7 @@ do
;;
docker-test)
- tar -cf- share/docker/Dockerfile lang/ruby/Gemfile |
+ tar -cf- share/docker/Dockerfile $DOCKER_EXTRA_CONTEXT |
docker build -t avro-test -f share/docker/Dockerfile -
docker run --rm -v "${PWD}:/avro${DOCKER_MOUNT_FLAG}" --env "JAVA=${JAVA:-8}" avro-test /avro/share/docker/run-tests.sh
;;
diff --git a/lang/c++/api/Reader.hh b/lang/c++/api/Reader.hh
index ca6a719e31c..588a912648a 100644
--- a/lang/c++/api/Reader.hh
+++ b/lang/c++/api/Reader.hh
@@ -84,7 +84,7 @@ public:
union {
double d;
uint64_t i;
- } v;
+ } v = { 0 };
reader_.read(v.i);
val = v.d;
}
diff --git a/lang/c++/api/buffer/Buffer.hh b/lang/c++/api/buffer/Buffer.hh
index bc3baf12330..45c439d6d43 100644
--- a/lang/c++/api/buffer/Buffer.hh
+++ b/lang/c++/api/buffer/Buffer.hh
@@ -145,7 +145,7 @@ public:
**/
size_type wroteTo(size_type size) {
- int wrote = 0;
+ size_type wrote = 0;
if (size) {
if (size > freeSpace()) {
throw std::length_error("Impossible to write more data than free space");
diff --git a/lang/c/tests/test_avro_commons_schema.c b/lang/c/tests/test_avro_commons_schema.c
index c4679d89df9..e3751e9836a 100644
--- a/lang/c/tests/test_avro_commons_schema.c
+++ b/lang/c/tests/test_avro_commons_schema.c
@@ -104,6 +104,8 @@ static void read_data(const char *dirpath, avro_schema_t schema) {
fprintf(stdout, "\nExit run test OK => %d records", records_read);
remove("./copy.avro");
fflush(stdout);
+ avro_file_reader_close(reader);
+ avro_file_writer_close(writer);
}
static void run_tests(const char *dirpath)
@@ -111,6 +113,7 @@ static void run_tests(const char *dirpath)
fprintf(stdout, "\nRun test for path '%s'", dirpath);
avro_schema_t schema = read_common_schema_test(dirpath);
read_data(dirpath, schema);
+ avro_schema_decref(schema);
}
diff --git a/lang/csharp/README.md b/lang/csharp/README.md
index 70fc90e86da..6f923fe0273 100644
--- a/lang/csharp/README.md
+++ b/lang/csharp/README.md
@@ -17,20 +17,20 @@ Install-Package Apache.Avro
## Project Target Frameworks
-| Project | Published to nuget.org | Type | .NET Standard 2.0 | .NET Standard 2.1 | .NET Core 3.1 | .NET 5.0 | .NET 6.0 |
-|:-------------------:|:--------------------------:|:----------:|:------------------:|:-----------------:|:-------------:|:---------:|:---------:|
-| Avro.main | Apache.Avro | Library | ✔️ | ✔️ | | | |
-| Avro.File.Snappy | Apache.Avro.File.Snappy | Library | ✔️ | ✔️ | | | |
-| Avro.File.BZip2 | Apache.Avro.File.BZip2 | Library | ✔️ | ✔️ | | | |
-| Avro.File.XZ | Apache.Avro.File.XZ | Library | ✔️ | ✔️ | | | |
-| Avro.File.Zstandard | Apache.Avro.File.Zstandard | Library | ✔️ | ✔️ | | | |
-| Avro.codegen | Apache.Avro.Tools | Exe | | | ✔️ |✔️ |✔️ |
-| Avro.ipc | | Library | ✔️ | ✔️ | | | |
-| Avro.ipc.test | | Unit Tests | | | ✔️ |✔️ |✔️ |
-| Avro.msbuild | | Library | ✔️ | ✔️ | | | |
-| Avro.perf | | Exe | | | ✔️ |✔️ |✔️ |
-| Avro.test | | Unit Tests | | | ✔️ |✔️ |✔️ |
-| Avro.benchmark | | Exe | | | ✔️ |✔️ |✔️ |
+| Project | Published to nuget.org | Type | .NET Standard 2.0 | .NET Standard 2.1 | .NET Core 3.1 | .NET 5.0 | .NET 6.0 | .NET 7.0 |
+|:-------------------:|:--------------------------:|:----------:|:------------------:|:-----------------:|:-------------:|:---------:|:---------:|:---------:|
+| Avro.main | Apache.Avro | Library | ✔️ | ✔️ | | | | |
+| Avro.File.Snappy | Apache.Avro.File.Snappy | Library | ✔️ | ✔️ | | | | |
+| Avro.File.BZip2 | Apache.Avro.File.BZip2 | Library | ✔️ | ✔️ | | | | |
+| Avro.File.XZ | Apache.Avro.File.XZ | Library | ✔️ | ✔️ | | | | |
+| Avro.File.Zstandard | Apache.Avro.File.Zstandard | Library | ✔️ | ✔️ | | | | |
+| Avro.codegen | Apache.Avro.Tools | Exe | | | ✔️ |✔️ |✔️ |✔️ |
+| Avro.ipc | | Library | ✔️ | ✔️ | | | | |
+| Avro.ipc.test | | Unit Tests | | | ✔️ |✔️ |✔️ |✔️ |
+| Avro.msbuild | | Library | ✔️ | ✔️ | | | | |
+| Avro.perf | | Exe | | | ✔️ |✔️ |✔️ |✔️ |
+| Avro.test | | Unit Tests | | | ✔️ |✔️ |✔️ |✔️ |
+| Avro.benchmark | | Exe | | | ✔️ |✔️ |✔️ |✔️ |
## Dependency package version strategy
diff --git a/lang/csharp/build.sh b/lang/csharp/build.sh
index c65e08d5df1..623ef03a353 100755
--- a/lang/csharp/build.sh
+++ b/lang/csharp/build.sh
@@ -42,7 +42,7 @@ do
perf)
pushd ./src/apache/perf/
- dotnet run --configuration Release --framework net6.0
+ dotnet run --configuration Release --framework net7.0
;;
dist)
@@ -77,7 +77,7 @@ do
;;
interop-data-generate)
- dotnet run --project src/apache/test/Avro.test.csproj --framework net6.0 ../../share/test/schemas/interop.avsc ../../build/interop/data
+ dotnet run --project src/apache/test/Avro.test.csproj --framework net7.0 ../../share/test/schemas/interop.avsc ../../build/interop/data
;;
interop-data-test)
diff --git a/lang/csharp/common.props b/lang/csharp/common.props
index 72a79fda086..f7d03625598 100644
--- a/lang/csharp/common.props
+++ b/lang/csharp/common.props
@@ -37,9 +37,7 @@
-
- netcoreapp3.1;net5.0;net6.0
- net7.0
+ netcoreapp3.1;net5.0;net6.0;net7.0
netstandard2.0;netstandard2.1
@@ -61,6 +59,12 @@
+
+
+ false
+ true
+
+
false
true
diff --git a/lang/csharp/src/apache/benchmark/Avro.benchmark.csproj b/lang/csharp/src/apache/benchmark/Avro.benchmark.csproj
index 5b38895a18c..b944de3c2d4 100644
--- a/lang/csharp/src/apache/benchmark/Avro.benchmark.csproj
+++ b/lang/csharp/src/apache/benchmark/Avro.benchmark.csproj
@@ -31,6 +31,12 @@
false
+
+
+
+ $(NoWarn);CS8981
+
+
diff --git a/lang/csharp/src/apache/benchmark/Program.cs b/lang/csharp/src/apache/benchmark/Program.cs
index 4381897e24e..5b63517623c 100644
--- a/lang/csharp/src/apache/benchmark/Program.cs
+++ b/lang/csharp/src/apache/benchmark/Program.cs
@@ -21,8 +21,8 @@ namespace Avro.Benchmark
{
public class Program
{
- // dotnet run -c Release -f net6.0
- // dotnet run -c Release -f net6.0 --runtimes netcoreapp3.1 net5.0 net6.0
+ // dotnet run -c Release -f net7.0
+ // dotnet run -c Release -f net7.0 --runtimes netcoreapp3.1 net5.0 net6.0 net7.0
public static void Main(string[] args)
{
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
diff --git a/lang/csharp/src/apache/main/IO/Encoder.cs b/lang/csharp/src/apache/main/IO/Encoder.cs
index 84a2099a195..0c1712af430 100644
--- a/lang/csharp/src/apache/main/IO/Encoder.cs
+++ b/lang/csharp/src/apache/main/IO/Encoder.cs
@@ -187,5 +187,10 @@ public interface Encoder
/// Position within data where the contents start.
/// Number of bytes to write.
void WriteFixed(byte[] data, int start, int len);
+
+ ///
+ /// Flushes the encoder.
+ ///
+ void Flush();
}
}
diff --git a/lang/csharp/src/apache/main/IO/JsonEncoder.cs b/lang/csharp/src/apache/main/IO/JsonEncoder.cs
index 48415d7cddd..c159a013e8c 100644
--- a/lang/csharp/src/apache/main/IO/JsonEncoder.cs
+++ b/lang/csharp/src/apache/main/IO/JsonEncoder.cs
@@ -28,7 +28,7 @@ namespace Avro.IO
/// An for Avro's JSON data encoding.
///
/// JsonEncoder buffers output, and data may not appear on the output until
- /// is called.
+ /// is called.
///
/// JsonEncoder is not thread-safe.
///
diff --git a/lang/csharp/src/apache/test/IO/JsonCodecTests.cs b/lang/csharp/src/apache/test/IO/JsonCodecTests.cs
index 145b8df7294..28aab10e70c 100644
--- a/lang/csharp/src/apache/test/IO/JsonCodecTests.cs
+++ b/lang/csharp/src/apache/test/IO/JsonCodecTests.cs
@@ -316,8 +316,8 @@ private byte[] fromJsonToAvro(string json, Schema schema)
GenericDatumWriter