Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/g/gtl/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ package("gtl")
set_description("Greg's Template Library of useful classes.")
set_license("Apache-2.0")

add_urls("https://github.com/greg7mdp/gtl/archive/refs/tags/v$(version).tar.gz",
"https://github.com/greg7mdp/gtl.git")
add_urls("https://github.com/greg7mdp/gtl/archive/refs/tags/v$(version).tar.gz")
add_urls("https://github.com/greg7mdp/gtl.git", {alias = "git"})

add_versions("git:1.2.0", "v1.2.0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This correctly maps version 1.2.0 to the v1.2.0 tag for the git source. However, this should be done for all versions, as they all use a v prefix for their git tags. To make installation from git source reliable for all versions and to keep the package definition concise, consider using a loop to define all git-specific versions.

    for _, v in ipairs({"1.2.0", "1.1.8", "1.1.6", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0"}) do
        add_versions("git:" .. v, "v" .. v)
    end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with gemini this time, we should add them all. see: https://github.com/greg7mdp/gtl/tags

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I'll add it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use?

local versions = {
    ["1.2.0"] = "1547ab78f62725c380f50972f7a49ffd3671ded17a3cb34305da5c953c6ba8e7"
}

for v, hash in pairs(versions) do
    add_versions(v, hash)
    add_versions("git:" .. v, "v" .. v)
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elegant! nice and simple does the trick!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I think writing it like this is sufficient — most packages that use tags starting with 'v' do the same, which allows seamless compatibility with both urls.

    add_urls("https://github.com/greg7mdp/gtl/archive/refs/tags/$(version).tar.gz",
             "https://github.com/greg7mdp/gtl.git")

    add_versions("v1.2.0", "1547ab78f62725c380f50972f7a49ffd3671ded17a3cb34305da5c953c6ba8e7")


add_versions("1.2.0", "1547ab78f62725c380f50972f7a49ffd3671ded17a3cb34305da5c953c6ba8e7")
add_versions("1.1.8", "6bda4c07bd966a88740ee07e3df23863a93d7b5365e0eea7f13cde9eda961b86")
Expand Down
Loading