Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Release 5.0.0-beta3 Cleanup #2323

Merged
Merged
Changes from all commits
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: 3 additions & 3 deletions src/host/premake.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* \file premake.h
* \brief Program-wide constants and definitions.
* \author Copyright (c) 2002-2021 Jess Perkins and the Premake project
* \author Copyright (c) 2002-2024 Jess Perkins and the Premake project
*/

#define lua_c
Expand All @@ -12,8 +12,8 @@
#include <stdint.h>
#include <stdlib.h>

#define PREMAKE_VERSION "5.0.0-beta3"
#define PREMAKE_COPYRIGHT "Copyright (C) 2002-2021 Jess Perkins and the Premake Project"
#define PREMAKE_VERSION "5.0.0-dev"
Copy link
Contributor

Choose a reason for hiding this comment

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

How about having version.h.in using git describe?

Something like:

local function template(file_in, dict, file_out)
	local content = io.readfile(file_in)
	for k,v in pairs(dict) do
		content = content:gsub(k, v)
	end
	os.mkdir(path.getdirectory(file_out))
	local f, err = os.writefile_ifnotequal(content, file_out)

	if (f == 0) then
		-- file not modified
	elseif (f < 0) then
		error(err, 0)
		return false
	elseif (f > 0) then
		print("Generated " .. file_out)
	end
	return true
end

local function autoversion_h()
	local git_tag, errorCode = os.outputof("git describe --tag --always")
	if errorCode ~= 0 then
        error("`git describe --tag` failed with error code", errorCode, git_tag)
    end
    print("git description: ", git_tag)
	return template(
		"src/autoversion.h.in",
		{["@GIT_DESC@"] = git_tag},
		path.join("solution", _ACTION, "autoversion.h")
end

gitintegration "Always" -- to add git hook

if _ACTION ~= nil then -- Do nothing for premake --version :-)
    autoversion_h()
end

So no longer need to modify the code, it just use git tag.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's table this for a follow up, just so we can complete the current release cycle under the existing release guide. Then we can discuss updating this for the future in maybe a GH discussion?

Copy link
Contributor

Choose a reason for hiding this comment

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

No pb to postpone the discussion (I approved BTW).

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, you're not a reviewer with write access so I have to wait for another review :(

#define PREMAKE_COPYRIGHT "Copyright (C) 2002-2024 Jess Perkins and the Premake Project"
#define PREMAKE_PROJECT_URL "https://github.com/premake/premake-core/wiki"

#if defined(__linux__)
Expand Down