# frozen_string_literal: true

require File.expand_path('../config.rb', __FILE__)

def platform_centos7?
  return false unless File.exist?("/etc/os-release")
  os_info = File.read("/etc/os-release")
  os_info.include?("CentOS Linux 7")
end

source "https://rubygems.org"

# core gems

no_fat_gem = [:ruby]
gem "rake"
gem "bundler", BUNDLER_VERSION
gem "cool.io", "1.9.4",  platforms: no_fat_gem
gem "sigdump", "0.2.5"
gem "http_parser.rb", "0.8.1"
gem "yajl-ruby", "1.4.3"
gem "serverengine", "2.4.0"
gem "msgpack", "1.8.0"
gem "oj", "3.16.11"
gem "tzinfo", "2.0.6"
gem "tzinfo-data", "1.2026.1"

# Fluentd v1.19.0 requires io-event 1.10.x or before.
# The dependency condition cannot be met with async >= 2.25
gem "async", "2.24.0"
gem "async-http", "0.89.0"
gem "webrick", "1.9.2"

if ENV["INSTALL_GEM_FROM_LOCAL_REPO"]
  # During build process, pre-built fluentd gem will be installed
  # from this local repository, this way is used to avoid embedding full-path
  # into managed Gemfile.lock
  source FLUENTD_LOCAL_GEM_REPO do
    gem "fluentd"
    # Bundle forked version of win32-service until
    # https://github.com/chef/win32-service/pull/85 is merged.
    # This workaround should be applied to fluent-package not to block starting
    # fluentdwinsvc service on Windows. See
    # https://github.com/fluent/fluent-package-builder/issues/618
    # NOTE: platforms: does not work in source ... do block
    gem "win32-service" if RUBY_PLATFORM =~ /mswin|mingw/
  end
else
  # Lock to specific revision
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
  gem "fluentd", github: "fluent/fluentd", ref: FLUENTD_REVISION
  gem "win32-service", github: "fluent-plugins-nursery/win32-service", branch: "fluent-package", platforms: [:mingw, :x64_mingw]
end

# plugin gems

gem "elasticsearch", "8.19.2"
gem "fluent-plugin-elasticsearch", "6.0.0"
gem "ruby-kafka", "1.5.0"
gem "digest-murmurhash", "1.1.1"
gem "fluent-plugin-kafka", "0.19.6"
gem "prometheus-client", "4.2.5"
gem "fluent-plugin-prometheus", "2.2.1"
gem "fluent-plugin-prometheus_pushgateway", "0.2.1"
gem "jmespath", "1.6.2"
gem "aws-partitions", "1.1150.0"
gem "aws-sdk-core", "3.234.0"
gem "aws-sdk-kms", "1.110.0"
gem "aws-sdk-sqs", "1.101.0"
gem "aws-sigv4", "1.12.1"
gem "aws-sdk-s3", "1.208.0"
gem "fluent-plugin-s3", "1.8.4"
gem "httpclient", "2.9.0"
gem "fluent-diagtool", "1.0.5"
gem "td", "0.19.1"
gem "td-client", "3.0.0"
gem "fluent-plugin-td", "1.2.0"
gem "webhdfs", "0.11.0"
gem "fluent-plugin-webhdfs", "1.6.0"
gem "fluent-plugin-record-modifier", "2.2.1"
gem "fluent-plugin-rewrite-tag-filter", "2.4.0"
gem "fluent-plugin-sd-dns", "0.1.0"
gem "fluent-plugin-flowcounter-simple", "0.1.0"
gem "mini_portile2", "2.8.9"
gem "cmetrics", "0.3.3"
gem "fluent-plugin-metrics-cmetrics", "0.1.2"
gem "opensearch-ruby", "3.4.0"
gem "fluent-plugin-opensearch", "1.1.5"
gem "fluent-plugin-fluent-package-update-notifier", "0.2.3"
gem "fluent-plugin-obsolete-plugins", "0.2.2"
gem "fluent-plugin-opentelemetry", "0.5.2"

# fix CVE-2026-25765 for elasticseach and opensearch
gem "faraday", "2.14.1"

windows_platforms = [:mingw, :x64_mingw] # :mswin
# ffi-win32-extensions doesn't support ffi 1.17.1 or later
gem "ffi", "1.17.0", platforms: windows_platforms
gem "ffi-win32-extensions", "1.1.0", platforms: windows_platforms
# fiddle gem that isn't default gems as of Ruby 3.5
gem "fiddle", "1.1.8", platforms: windows_platforms
gem "nokogiri", "1.19.2", platforms: windows_platforms
gem "win32-event", "0.6.3", platforms: windows_platforms
gem "win32-ipc", "0.7.0", platforms: windows_platforms
# Use officially released version when PR was merged and released.
#gem "win32-service", "2.3.2", platforms: windows_platforms
gem "winevt_c", "0.11.2", platforms: windows_platforms
gem "win32-eventlog", "0.6.7", platforms: windows_platforms
gem "fluent-plugin-parser-winevt_xml", "0.2.8", platforms: windows_platforms
gem "fluent-plugin-windows-eventlog", "0.9.2", platforms: windows_platforms
gem "fluent-plugin-windows-exporter", "1.0.0", platforms: windows_platforms

not_windows_platforms = [:ruby]
gem "capng_c", "0.2.4", platforms: not_windows_platforms
# Use newer bundled rdkafka with librdkafka 2.8.0 to support AlmaLinux 10
# (librdkafka 2.8.0 supports "OpenSSL without the ENGINE component")
# librdkafka 2.8.0 can't be built on CentOS 7.
unless platform_centos7?
  gem "rdkafka", "0.21.0", platforms: not_windows_platforms
end
gem "fluent-plugin-systemd", "1.1.1", platforms: not_windows_platforms
gem "fluent-plugin-utmpx", "0.5.0", platforms: not_windows_platforms
