Skip to content

Commit 7064a5d

Browse files
dschojamill
authored andcommitted
buildsystems(Vcproj): auto-generate GUIDs
We ran out GUIDs. Again. But there is no need to: we can generate them semi-randomly from the target file name of the project. Note: the Vcproj generator is probably only interesting for historical reasons; nevertheless, the Vcxproj generator in the Git for Windows project is based on the Vcproj generator and it is better to backport the fix than to let Vcproj have the hard-coded list of GUIDs. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent ef99f2f commit 7064a5d

File tree

1 file changed

+9
-63
lines changed

1 file changed

+9
-63
lines changed

contrib/buildsystems/Generators/Vcproj.pm

Lines changed: 9 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ require Exporter;
33

44
use strict;
55
use vars qw($VERSION);
6+
use Digest::SHA qw(sha256_hex);
67

78
our $VERSION = '1.00';
89
our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);
@@ -12,65 +13,12 @@ BEGIN {
1213
push @EXPORT_OK, qw(generate);
1314
}
1415

15-
my $guid_index = 0;
16-
my @GUIDS = (
17-
"{E07B9989-2BF7-4F21-8918-BE22BA467AC3}",
18-
"{278FFB51-0296-4A44-A81A-22B87B7C3592}",
19-
"{7346A2C4-F0FD-444F-9EBE-1AF23B2B5650}",
20-
"{67F421AC-EB34-4D49-820B-3196807B423F}",
21-
"{385DCFE1-CC8C-4211-A451-80FCFC31CA51}",
22-
"{97CC46C5-D2CC-4D26-B634-E75792B79916}",
23-
"{C7CE21FE-6EF8-4012-A5C7-A22BCEDFBA11}",
24-
"{51575134-3FDF-42D1-BABD-3FB12669C6C9}",
25-
"{0AE195E4-9823-4B87-8E6F-20C5614AF2FF}",
26-
"{4B918255-67CA-43BB-A46C-26704B666E6B}",
27-
"{18CCFEEF-C8EE-4CC1-A265-26F95C9F4649}",
28-
"{5D5D90FA-01B7-4973-AFE5-CA88C53AC197}",
29-
"{1F054320-036D-49E1-B384-FB5DF0BC8AC0}",
30-
"{7CED65EE-F2D9-4171-825B-C7D561FE5786}",
31-
"{8D341679-0F07-4664-9A56-3BA0DE88B9BC}",
32-
"{C189FEDC-2957-4BD7-9FA4-7622241EA145}",
33-
"{66844203-1B9F-4C53-9274-164FFF95B847}",
34-
"{E4FEA145-DECC-440D-AEEA-598CF381FD43}",
35-
"{73300A8E-C8AC-41B0-B555-4F596B681BA7}",
36-
"{873FDEB1-D01D-40BF-A1BF-8BBC58EC0F51}",
37-
"{7922C8BE-76C5-4AC6-8BF7-885C0F93B782}",
38-
"{E245D370-308B-4A49-BFC1-1E527827975F}",
39-
"{F6FA957B-66FC-4ED7-B260-E59BBE4FE813}",
40-
"{E6055070-0198-431A-BC49-8DB6CEE770AE}",
41-
"{54159234-C3EB-43DA-906B-CE5DA5C74654}",
42-
"{594CFC35-0B60-46F6-B8EF-9983ACC1187D}",
43-
"{D93FCAB7-1F01-48D2-B832-F761B83231A5}",
44-
"{DBA5E6AC-E7BE-42D3-8703-4E787141526E}",
45-
"{6171953F-DD26-44C7-A3BE-CC45F86FC11F}",
46-
"{9E19DDBE-F5E4-4A26-A2FE-0616E04879B8}",
47-
"{AE81A615-99E3-4885-9CE0-D9CAA193E867}",
48-
"{FBF4067E-1855-4F6C-8BCD-4D62E801A04D}",
49-
"{17007948-6593-4AEB-8106-F7884B4F2C19}",
50-
"{199D4C8D-8639-4DA6-82EF-08668C35DEE0}",
51-
"{E085E50E-C140-4CF3-BE4B-094B14F0DDD6}",
52-
"{00785268-A9CC-4E40-AC29-BAC0019159CE}",
53-
"{4C06F56A-DCDB-46A6-B67C-02339935CF12}",
54-
"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}",
55-
"{9392EB58-D7BA-410B-B1F0-B2FAA6BC89A7}",
56-
"{2ACAB2D5-E0CE-4027-BCA0-D78B2D7A6C66}",
57-
"{86E216C3-43CE-481A-BCB2-BE5E62850635}",
58-
"{FB631291-7923-4B91-9A57-7B18FDBB7A42}",
59-
"{0A176EC9-E934-45B8-B87F-16C7F4C80039}",
60-
"{DF55CA80-46E8-4C53-B65B-4990A23DD444}",
61-
"{3A0F9895-55D2-4710-BE5E-AD7498B5BF44}",
62-
"{294BDC5A-F448-48B6-8110-DD0A81820F8C}",
63-
"{4B9F66E9-FAC9-47AB-B1EF-C16756FBFD06}",
64-
"{72EA49C6-2806-48BD-B81B-D4905102E19C}",
65-
"{5728EB7E-8929-486C-8CD5-3238D060E768}",
66-
"{A3E300FC-5630-4850-A470-E9F2C2EFA7E7}",
67-
"{CEA071D4-D9F3-4250-98F7-44AFDC8ACAA1}",
68-
"{3FD87BB4-2236-4A1B-ADD2-46211A302442}",
69-
"{49B03F41-5157-4079-95A7-64D728BCF74F}",
70-
"{95D5A28B-80E2-40A9-BEA3-C52B9CA488E3}",
71-
"{B85E6545-D523-4323-9F29-45389D090343}",
72-
"{06840CEF-746C-4B71-9442-C395DD6590A5}"
73-
);
16+
sub generate_guid ($) {
17+
my $hex = sha256_hex($_[0]);
18+
$hex =~ s/^(.{8})(.{4})(.{4})(.{4})(.{12}).*/{$1-$2-$3-$4-$5}/;
19+
$hex =~ tr/a-z/A-Z/;
20+
return $hex;
21+
}
7422

7523
sub generate {
7624
my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;
@@ -98,9 +46,8 @@ sub createLibProject {
9846
$target =~ s/\//_/g;
9947
$target =~ s/\.a//;
10048

101-
my $uuid = $GUIDS[$guid_index];
49+
my $uuid = generate_guid($libname);
10250
$$build_structure{"LIBS_${target}_GUID"} = $uuid;
103-
$guid_index += 1;
10451

10552
my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"LIBS_${libname}_SOURCES"}}));
10653
my @sources;
@@ -315,9 +262,8 @@ sub createAppProject {
315262
$target =~ s/\//_/g;
316263
$target =~ s/\.exe//;
317264

318-
my $uuid = $GUIDS[$guid_index];
265+
my $uuid = generate_guid($appname);
319266
$$build_structure{"APPS_${target}_GUID"} = $uuid;
320-
$guid_index += 1;
321267

322268
my @srcs = sort(map("$rel_dir\\$_", @{$$build_structure{"APPS_${appname}_SOURCES"}}));
323269
my @sources;

0 commit comments

Comments
 (0)