close
The Wayback Machine - https://web.archive.org/web/20200910234322/https://github.com/microsoft/DirectXShaderCompiler/pull/2200
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

Generate new version for each DX Compiler build #2200

Merged
merged 10 commits into from Jun 28, 2019

Conversation

@hekota
Copy link
Member

hekota commented May 21, 2019

Added generating of new version for each DX Compiler build.

There are 3 kinds of version:

  1. Official build
    Built by using hctbuild -official. The version is based on the current DXIL version, latest official release and a number of commits since then. The format is dxil_major.dxil_minor.release_no.commit_count. For example a current official version would be something like 1.5.1905.42. The latest release information is read from utils\version\latest-release.json. The 1905 corresponds to dxil-2019-05-16 release branch and 42 is the number of commits since that release branch was created. For master branch the commit_count will be incremented by 10000 to distinguish it from stabilized official release branch builds. So the current official version of master would be someting like 1.5.1905.10042.

  2. Dev build
    Build by using hctbuild with no other version-related option. The format is dxil_major.dxil_minor.0.commit_count where commit_count is the number of total commits since the beginning of the project.

  3. Fixed version build
    Build by using hctbuild -fv. Enables overriding of the version information. The fixed version is read from utils\version\version.inc. Location of the version file can be overriden by -fvloc option on hctbuild.

In addition to the numbered version the product version string on the binaries will also include branch name and last commit sha - "1.5.1905.10042 (master, 47e31c8a)". This product version string is included in dxc -? output.

@hekota hekota requested review from MrTrillian and tex3d May 21, 2019
@AppVeyorBot
Copy link

AppVeyorBot commented May 22, 2019

@hekota hekota requested a review from jpporto May 23, 2019
@hekota hekota changed the title Generate new version for each DX Compiler build (do not merge) Generate new version for each DX Compiler build May 24, 2019
@hekota hekota force-pushed the hekota:autogen-version branch 3 times, most recently from 8c70330 to 3c992f8 May 24, 2019
@hekota hekota force-pushed the hekota:autogen-version branch from 3c992f8 to c55568a May 28, 2019
@MrTrillian
Copy link
Member

MrTrillian commented Jun 25, 2019

What happened for there to be so many other commits in here? Did something go wrong? I don't think you want to merge as is, and it's difficult to review your specific changes.

@hekota
Copy link
Member Author

hekota commented Jun 25, 2019

I need to rebase it.

hekota added 7 commits May 20, 2019
The version format is: 14.YYYY.1mmdd.1HHMM

"14" stands for DXIL 1.4.

Product version string includes name of a branch and last commit sha.

Enable use of fixed version (read from a file).
New -fvloc flag on hctbuild.cmd for specifying custom version file
Change version to dxil_major.dxil_minor.xxx.xxx, where xxx is currently derived from unix epoch time but that might change).
In "dxc.exe /?" detect old dev build version 3.7.0.0 and output the commit info and commit count
(in case dxc.exe works on top of older dxcompiler.dll)
Code review feedback
New -official flag on hctbuild will embed an official version to the dll.
This version will be based on the latest release number (read from latest-release.json)
and the number of commits since we branched for this release.

For master branch we'll add 10000 to the commit count.

Dev builds will have a version 1.5.0.commitcount (1.5. is a DXIL version and comes from
latest-release.json)
@hekota hekota force-pushed the hekota:autogen-version branch from 6f4c2bf to ab205b4 Jun 25, 2019
@hekota hekota changed the title (do not merge) Generate new version for each DX Compiler build Generate new version for each DX Compiler build Jun 25, 2019
@@ -0,0 +1,52 @@
#pragma once

This comment has been minimized.

@MrTrillian

MrTrillian Jun 27, 2019

Member

Should we be checking in this file? It will be generated by the build, won't it?

This comment has been minimized.

@hekota

hekota Jun 27, 2019

Author Member

There is a -fv option on hctbuild that enables overiding of the generated version and this is the default file it reads the version info from. The location can be overriden by the new -fvloc option but -fv needs to work on its own (I believe AppVeyor uses it and that's how we versioned the releases until now). It's a new file because the fixed version was previously specified as strings in AddLLVM.cmake. Now we don't need to touch cmake files to change the version.

This comment has been minimized.

@MrTrillian

MrTrillian Jun 27, 2019

Member

Ok! So the file generated by the build has the same format but will be somewhere else?

This comment has been minimized.

@hekota

hekota Jun 27, 2019

Author Member

Same format and same location (<build_dir>\utils\version), but it is either going to be generated or copied from here.

@@ -0,0 +1,107 @@
import argparse

This comment has been minimized.

@MrTrillian

MrTrillian Jun 27, 2019

Member

I'd like a header comment summarizing the version scheme implemented here. We have no documentation for it outside of the code itself, and while not too complex, it still needs reading through. This could be a place to write why we chose that scheme too, to leave a paper trail.

This comment has been minimized.

@hekota

hekota Jun 27, 2019

Author Member

Yes, I've just finished updating the PR description and I will copy that here.

This comment has been minimized.

@MrTrillian

MrTrillian Jun 27, 2019

Member

Perfect!

Copy link
Member

MrTrillian left a comment

Looking good! Can you just check the few comments I've left?

gen_version.py - Change git.exe to git for Linux runs
DWORD dwVerHnd = 0;
DWORD size = GetFileVersionInfoSize(dllPath, &dwVerHnd);
if (size == 0) return false;
std::unique_ptr<int[]> VfInfo(new int[size/sizeof(int)]);

This comment has been minimized.

@MrTrillian

MrTrillian Jun 27, 2019

Member

This fix is not correct as it will round down the number of bytes to the nearest multiple of four, but then you still pass "size" as the size. You can make this a char or BYTE, all of the functions you pass this as an argument to take a void* anyways so they don't care. What was the reason for making it an int?

This comment has been minimized.

@hekota

hekota Jun 27, 2019

Author Member

Right, sorry ;) There is no reason for this to be int. I have copied that from another place in this file. I'll fix both.

@hekota hekota merged commit 5edbabb into microsoft:master Jun 28, 2019
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla All CLA requirements met.
Details
@hekota hekota deleted the hekota:autogen-version branch Jul 12, 2019
@sunillnaik

This comment has been minimized.

Copy link

sunillnaik commented on cdab47b Jul 23, 2019

Since I dont have git setup, I only have source, how should I skip this gen_version.py execution in the build?

Building Custom Rule D:/MSDXCCompiler/dev/src/utils/version/CMakeLists.txt
 CMake does not need to re-run because D:/MSDXCCompiler/dev/build/win_x64/Release/utils/version/CMakeFiles/generate.stamp is up-to-date.
 "Generating version"
 fatal: not a git repository (or any of the parent directories): .git
 Traceback (most recent call last):
   File "D:/MSDXCCompiler/dev/src/utils/version/gen_version.py", line 132, in <module>
     main()

This comment has been minimized.

Copy link
Owner Author

hekota replied Jul 23, 2019

Ok, try building with the -fv flag:

hctbuild -fv

That will skip the version generating and use a fixed version file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.