Skip to content

Commit

Permalink
Package libdatadog-0.7.0-rc.1 for rubygems.org release as libdatadog-…
Browse files Browse the repository at this point in the history
…0.7.0.1.0.rc1
  • Loading branch information
ivoanjo committed Jun 1, 2022
1 parent 6997bc0 commit 5cc6379
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
64 changes: 33 additions & 31 deletions ruby/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,34 @@ require "rubygems/package"

RSpec::Core::RakeTask.new(:spec)

LIB_GITHUB_RELEASES = {
# This should match the version in the version.rb file
"0.6.0" => [
{
file: "libddprof-aarch64-alpine-linux-musl.tar.gz",
sha256: "7501d26ed9b2607c2bca79b3fd39971efa4dbb6949226d7d123f095e47ca541c",
ruby_platform: "aarch64-linux-musl"
},
{
file: "libddprof-aarch64-unknown-linux-gnu.tar.gz",
sha256: "c18351882fdb4b64df76f4cd49dbf567d8871349fa444144aa9a8ddf0532bad2",
ruby_platform: "aarch64-linux"
},
{
file: "libddprof-x86_64-alpine-linux-musl.tar.gz",
sha256: "ca5e49636465ee977943d64815442d4bff2de2b74678b1376e6368280534f909",
ruby_platform: "x86_64-linux-musl"
},
{
file: "libddprof-x86_64-unknown-linux-gnu.tar.gz",
sha256: "8eaec92d14bcfa8839843ba2ddfeae254804e087a4984985132a508d6f841645",
ruby_platform: "x86_64-linux"
}
]
}
LIB_VERSION_TO_PACKAGE = "0.7.0-rc.1"
unless LIB_VERSION_TO_PACKAGE.start_with?(Libdatadog::LIB_VERSION)
raise "`LIB_VERSION_TO_PACKAGE` setting in <Rakefile> (#{LIB_VERSION_TO_PACKAGE}) does not match " \
"`LIB_VERSION` setting in <lib/libdatadog/version.rb> (#{Libdatadog::LIB_VERSION})"
end

LIB_GITHUB_RELEASES = [
{
file: "libdatadog-aarch64-alpine-linux-musl.tar.gz",
sha256: "d3a6d71f45ce0f95978dcb31525389ee3ea02ea0170f00be466ff6ce1a1f6047",
ruby_platform: "aarch64-linux-musl"
},
{
file: "libdatadog-aarch64-unknown-linux-gnu.tar.gz",
sha256: "e792c923d5cdc6d581da87d12ab789ae578fa588fb2a220f72660f8d25df6de8",
ruby_platform: "aarch64-linux"
},
{
file: "libdatadog-x86_64-alpine-linux-musl.tar.gz",
sha256: "402a1f40b55e1bad022d1391793a4ed79c8b41bfd9265cad721960be77c12f1e",
ruby_platform: "x86_64-linux-musl"
},
{
file: "libdatadog-x86_64-unknown-linux-gnu.tar.gz",
sha256: "9b43711b23e42e76684eeced9e8d25183d350060d087d755622fa6748fa79aa5",
ruby_platform: "x86_64-linux"
}
]

task default: [
:spec,
Expand All @@ -45,7 +48,7 @@ task default: [
desc "Download lib release from github"
task :fetch do
Helpers.each_github_release_variant do |file:, sha256:, target_directory:, target_file:, **_|
target_url = "https://github.com/datadog/libdatadog/releases/download/v#{Libdatadog::LIB_VERSION}/#{file}"
target_url = "https://github.com/datadog/libdatadog/releases/download/v#{LIB_VERSION_TO_PACKAGE}/#{file}"

if File.exist?(target_file)
target_file_hash = Digest::SHA256.hexdigest(File.read(target_file))
Expand Down Expand Up @@ -125,14 +128,14 @@ task push_to_rubygems: [
end

module Helpers
def self.each_github_release_variant(version: Libdatadog::LIB_VERSION)
LIB_GITHUB_RELEASES.fetch(version).each do |variant|
def self.each_github_release_variant
LIB_GITHUB_RELEASES.each do |variant|
file = variant.fetch(:file)
sha256 = variant.fetch(:sha256)
ruby_platform = variant.fetch(:ruby_platform)

# These two are so common that we just centralize them here
target_directory = "vendor/libdatadog-#{version}/#{ruby_platform}"
target_directory = "vendor/libdatadog-#{Libdatadog::LIB_VERSION}/#{ruby_platform}"
target_file = "#{target_directory}/#{file}"

FileUtils.mkdir_p(target_directory)
Expand All @@ -156,7 +159,6 @@ module Helpers

def self.files_for(
*included_platforms,
version: Libdatadog::LIB_VERSION,
excluded_files: [
"ddprof_ffi.pc", # we use the ddprof_ffi_with_rpath.pc variant
"libddprof_ffi.a", "ddprof_ffi-static.pc", # We don't use the static library
Expand All @@ -166,7 +168,7 @@ module Helpers
)
files = []

each_github_release_variant(version: version) do |ruby_platform:, target_directory:, target_file:, **_|
each_github_release_variant do |ruby_platform:, target_directory:, target_file:, **_|
next unless included_platforms.include?(ruby_platform)

downloaded_release_tarball = target_file
Expand Down
4 changes: 2 additions & 2 deletions ruby/lib/libdatadog/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

module Libdatadog
# Current libdatadog version
LIB_VERSION = "0.6.0"
LIB_VERSION = "0.7.0"

GEM_MAJOR_VERSION = "1"
GEM_MINOR_VERSION = "0"
GEM_PRERELEASE_VERSION = "" # remember to include dot prefix, if needed!
GEM_PRERELEASE_VERSION = ".rc1" # remember to include dot prefix, if needed!
private_constant :GEM_MAJOR_VERSION, :GEM_MINOR_VERSION, :GEM_PRERELEASE_VERSION

# The gem version scheme is lib_version.gem_major.gem_minor[.prerelease].
Expand Down

0 comments on commit 5cc6379

Please sign in to comment.