Skip to content

Commit a07b405

Browse files
committed
Include all license files in MSI
1 parent 0ebc6c7 commit a07b405

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

BranchSDK/Windows/BranchInstaller/Components.wxs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@
3838
<Directory Id="X86RELEASELIBFOLDER" Name="Release"/>
3939
</Directory>
4040
</Directory>
41+
<Directory Id="LICENSEFOLDER" Name="licenses"/>
4142
</Directory>
4243
</Directory>
4344
</Directory>
4445
</Fragment>
4546
<Fragment>
4647
<ComponentGroup Id="BranchHeaders">
48+
<Component Directory="LICENSEFOLDER" Guid="c476d3e5-66fa-4689-9a03-1fee2b8403d7" Id="BranchLicense">
49+
<File Id="BranchLicense" Name="LICENSE.txt" Source="$(var.ProjectDir)\..\..\..\LICENSE"/>
50+
</Component>
4751
<Component Directory="Releasex64.stage.include.BranchIO" Guid="e4c5d9ed-da88-450d-9142-42c8306246fb" Id="Releasex64.stage.include.BranchIO">
4852
<File Id="Releasex64.stage.include.BranchIO.AdvertiserInfo.h" Source="$(var.ProjectDir)\..\..\..\build\Releasex64\stage\include\BranchIO\AdvertiserInfo.h"/>
4953
<File Id="Releasex64.stage.include.BranchIO.AppInfo.h" Source="$(var.ProjectDir)\..\..\..\build\Releasex64\stage\include\BranchIO\AppInfo.h"/>
@@ -920,6 +924,11 @@
920924
<File Id="Releasex64.stage.include.zconf.h" Source="$(var.ProjectDir)\..\..\..\build\Releasex64\stage\include\zconf.h"/>
921925
<File Id="Releasex64.stage.include.zlib.h" Source="$(var.ProjectDir)\..\..\..\build\Releasex64\stage\include\zlib.h"/>
922926
</Component>
927+
<Component Directory="LICENSEFOLDER" Guid="37a92faa-7f32-4483-8a05-0ef404be8e5d" Id="ThirdPartyLicenses">
928+
<File Id="PocoLicense" Source="C:\Users\jgvd3\github\BranchMetrics\cpp-branch-deep-linking-attribution\build\Releasex64\stage\licenses\LICENSE-Poco.txt"/>
929+
<File Id="OpenSSLLicense" Source="C:\Users\jgvd3\github\BranchMetrics\cpp-branch-deep-linking-attribution\build\Releasex64\stage\licenses\LICENSE-OpenSSL.txt"/>
930+
<File Id="ZlibLicense" Source="C:\Users\jgvd3\github\BranchMetrics\cpp-branch-deep-linking-attribution\build\Releasex64\stage\licenses\LICENSE-zlib.txt"/>
931+
</Component>
923932
</ComponentGroup>
924933
<ComponentGroup Id="BranchLibrariesX64">
925934
<Component Directory="X64DEBUGLIBFOLDER" Guid="6b538925-ded6-4bbf-8b59-64495e0e3b9c" Id="BranchLibrariesDebugX64">

BranchSDK/tools/build_wix.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def wix_component(elem, path, identifier=None):
162162
if os.path.isdir(fullpath):
163163
continue
164164
source = fullpath.replace(repo_root, "$(var.ProjectDir)\\..\\..\\..")
165-
file_elem = make_file_elem(component, file_identifier(fullpath), source)
165+
make_file_elem(component, file_identifier(fullpath), source)
166166

167167
"""
168168
Recursively generates a flat, unnested list of Component elements
@@ -196,6 +196,7 @@ def wix_components(elem, paths, include_subdirs=True):
196196
stage_root = os.path.join(build_root, "Releasex64", "stage")
197197
include_root = os.path.join(stage_root, "include")
198198
lib_root = os.path.join(stage_root, "lib")
199+
license_root = os.path.join(stage_root, "licenses")
199200

200201
# -----
201202
# ----- Directory tree Fragment.
@@ -214,6 +215,7 @@ def wix_components(elem, paths, include_subdirs=True):
214215
wix_directory(branch_sdk_install_folder, include_root)
215216

216217
lib_folder = make_directory_elem(branch_sdk_install_folder, "LIBFOLDER", "lib")
218+
license_folder = make_directory_elem(branch_sdk_install_folder, "LICENSEFOLDER", "licenses")
217219
x64_lib_folder = make_directory_elem(lib_folder, "X64LIBFOLDER", "x64")
218220
x86_lib_folder = make_directory_elem(lib_folder, "X86LIBFOLDER", "x86")
219221
make_directory_elem(x64_lib_folder, "X64DEBUGLIBFOLDER", "Debug")
@@ -228,6 +230,9 @@ def wix_components(elem, paths, include_subdirs=True):
228230

229231
cg_fragment = SubElement(root, "Fragment")
230232
branch_headers = SubElement(cg_fragment, "ComponentGroup", {"Id": "BranchHeaders"})
233+
branch_license = make_component_elem(branch_headers, "BranchLicense", "LICENSEFOLDER")
234+
make_file_elem(branch_license, "BranchLicense", "$(var.ProjectDir)\\..\\..\\..\\LICENSE", "LICENSE.txt")
235+
231236
third_party_headers = SubElement(cg_fragment, "ComponentGroup", {"Id": "ThirdPartyHeaders"})
232237
branch_libraries_x64 = SubElement(cg_fragment, "ComponentGroup", {"Id": "BranchLibrariesX64"})
233238
third_party_libraries_x64 = SubElement(cg_fragment, "ComponentGroup", {"Id": "ThirdPartyLibrariesX64"})
@@ -240,6 +245,10 @@ def wix_components(elem, paths, include_subdirs=True):
240245
wix_components(third_party_headers, [os.path.join(include_root, p) for p in ["Poco", "openssl"]])
241246
# zlib headers are directly in the include_root. Don't include subdirs.
242247
wix_components(third_party_headers, include_root, False)
248+
third_party_licenses = make_component_elem(third_party_headers, "ThirdPartyLicenses", "LICENSEFOLDER")
249+
make_file_elem(third_party_licenses, "PocoLicense", os.path.join(license_root, "LICENSE-Poco.txt"))
250+
make_file_elem(third_party_licenses, "OpenSSLLicense", os.path.join(license_root, "LICENSE-OpenSSL.txt"))
251+
make_file_elem(third_party_licenses, "ZlibLicense", os.path.join(license_root, "LICENSE-zlib.txt"))
243252

244253
# The BranchIO.lib sits in the same lib folder with the third-party libs. This
245254
# is as it should be, to avoid making devs pass multiple library paths at

BranchSDK/tools/component-ids.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"Releasex64.stage.include.BranchIO": "e4c5d9ed-da88-450d-9142-42c8306246fb", "Releasex64.stage.include.BranchIO.Event": "7d04d0a2-a632-4c4f-b4c9-1863a10ca9eb", "Releasex64.stage.include.BranchIO.Util": "4741ca5d-d4f2-4009-8f2d-bb663b72e06a", "Releasex64.stage.include.Poco": "6787e14a-2ad3-4462-be59-640f621748ff", "Releasex64.stage.include.Poco.Crypto": "d5f84981-e34d-41bd-8eba-83564fbb6e32", "Releasex64.stage.include.Poco.Data": "efa47c70-0d89-48b3-b7e7-ab9aa990b27e", "Releasex64.stage.include.Poco.DOM": "b1e33b2f-3c57-4fdd-bd70-71b8857c5b08", "Releasex64.stage.include.Poco.Dynamic": "97c640b2-5a2b-4294-bb68-58b477760db2", "Releasex64.stage.include.Poco.JSON": "29e19a51-1d32-42fd-928b-1755d6c6919a", "Releasex64.stage.include.Poco.Net": "e8193dd6-42c5-4bbb-b82c-aca3f8446eea", "Releasex64.stage.include.Poco.Redis": "757f9443-d1ea-4ab7-8bc6-ffb8dc651df0", "Releasex64.stage.include.Poco.SAX": "f7b5c348-7fcc-4ded-8423-0c97d7664cae", "Releasex64.stage.include.Poco.Util": "f8422974-80d9-4007-9105-03246f2a46e0", "Releasex64.stage.include.Poco.XML": "969ac18a-7fe0-4a8d-8232-594c5fdefe7e", "Releasex64.stage.include.Poco.Zip": "c8ff9dbd-697e-4290-b14e-fe5d328a08ad", "Releasex64.stage.include.Poco.Data.MySQL": "800ed270-f1db-435d-9f37-ae56357fdd73", "Releasex64.stage.include.Poco.Data.ODBC": "c539e814-8be7-4d64-9b7a-072edb2e0818", "Releasex64.stage.include.openssl": "1b72cb36-73d9-4ccd-9a65-6f6939a40b8c", "Releasex64.stage.include": "ac1a8143-7c11-4dec-bf84-111b8b2b0093", "BranchLibrariesDebugX64": "6b538925-ded6-4bbf-8b59-64495e0e3b9c", "BranchLibrariesReleaseX64": "14030dd2-fad4-4d5a-baf2-20abdda3be0c", "BranchLibrariesDebugX86": "054b215a-7743-4fe3-b212-a4798cfc305d", "BranchLibrariesReleaseX86": "c8b9e075-e963-4283-993d-b1ed2e853ea7", "X64DEBUGLIBFOLDER": "5a94d40d-f719-40f4-86a1-8b897cfc4b70", "X64RELEASELIBFOLDER": "c9f2a7b9-560d-4ff7-bd7b-5535a60b1123", "X86DEBUGLIBFOLDER": "0db87ca1-c644-47df-a72e-85913578c98a", "X86RELEASELIBFOLDER": "db6ede4d-cc8f-4c26-918a-01de8c5ea904"}
1+
{"Releasex64.stage.include.BranchIO": "e4c5d9ed-da88-450d-9142-42c8306246fb", "Releasex64.stage.include.BranchIO.Event": "7d04d0a2-a632-4c4f-b4c9-1863a10ca9eb", "Releasex64.stage.include.BranchIO.Util": "4741ca5d-d4f2-4009-8f2d-bb663b72e06a", "Releasex64.stage.include.Poco": "6787e14a-2ad3-4462-be59-640f621748ff", "Releasex64.stage.include.Poco.Crypto": "d5f84981-e34d-41bd-8eba-83564fbb6e32", "Releasex64.stage.include.Poco.Data": "efa47c70-0d89-48b3-b7e7-ab9aa990b27e", "Releasex64.stage.include.Poco.DOM": "b1e33b2f-3c57-4fdd-bd70-71b8857c5b08", "Releasex64.stage.include.Poco.Dynamic": "97c640b2-5a2b-4294-bb68-58b477760db2", "Releasex64.stage.include.Poco.JSON": "29e19a51-1d32-42fd-928b-1755d6c6919a", "Releasex64.stage.include.Poco.Net": "e8193dd6-42c5-4bbb-b82c-aca3f8446eea", "Releasex64.stage.include.Poco.Redis": "757f9443-d1ea-4ab7-8bc6-ffb8dc651df0", "Releasex64.stage.include.Poco.SAX": "f7b5c348-7fcc-4ded-8423-0c97d7664cae", "Releasex64.stage.include.Poco.Util": "f8422974-80d9-4007-9105-03246f2a46e0", "Releasex64.stage.include.Poco.XML": "969ac18a-7fe0-4a8d-8232-594c5fdefe7e", "Releasex64.stage.include.Poco.Zip": "c8ff9dbd-697e-4290-b14e-fe5d328a08ad", "Releasex64.stage.include.Poco.Data.MySQL": "800ed270-f1db-435d-9f37-ae56357fdd73", "Releasex64.stage.include.Poco.Data.ODBC": "c539e814-8be7-4d64-9b7a-072edb2e0818", "Releasex64.stage.include.openssl": "1b72cb36-73d9-4ccd-9a65-6f6939a40b8c", "Releasex64.stage.include": "ac1a8143-7c11-4dec-bf84-111b8b2b0093", "BranchLibrariesDebugX64": "6b538925-ded6-4bbf-8b59-64495e0e3b9c", "BranchLibrariesReleaseX64": "14030dd2-fad4-4d5a-baf2-20abdda3be0c", "BranchLibrariesDebugX86": "054b215a-7743-4fe3-b212-a4798cfc305d", "BranchLibrariesReleaseX86": "c8b9e075-e963-4283-993d-b1ed2e853ea7", "X64DEBUGLIBFOLDER": "5a94d40d-f719-40f4-86a1-8b897cfc4b70", "X64RELEASELIBFOLDER": "c9f2a7b9-560d-4ff7-bd7b-5535a60b1123", "X86DEBUGLIBFOLDER": "0db87ca1-c644-47df-a72e-85913578c98a", "X86RELEASELIBFOLDER": "db6ede4d-cc8f-4c26-918a-01de8c5ea904", "Releasex64.stage.licenses.LICENSE.txt": "ee137023-e23a-4290-b0a1-4b9effcc8a6b", "Releasex64.stage.licenses.LICENSE-Poco.txt": "1e2bbcce-7e37-4416-848d-704dbeb7c54b", "ThirdPartyLicenses": "37a92faa-7f32-4483-8a05-0ef404be8e5d", "BranchLicense": "c476d3e5-66fa-4689-9a03-1fee2b8403d7"}

BranchSDK/tools/stage.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ def copy_pdbs(src, dst):
4242
path = os.path.join(src, d)
4343
copy_pdbs(path, dst)
4444

45+
# TODO: Collapse this and the above and/or rethink this whole idea, remove conan
46+
# from build process. Makes a copy of all LICENSE files from the conan source cache.
47+
def copy_licenses(src, dst):
48+
if not os.path.exists(src):
49+
return
50+
all_files = os.listdir(src)
51+
52+
# TODO: Use a re with os.path.splitext or something
53+
for f in [f for f in all_files if f == "LICENSE"]:
54+
path = os.path.join(src, f)
55+
shutil.copy(path, dst)
56+
# Expect one LICENSE per package
57+
return
58+
59+
for d in [f for f in all_files if os.path.isdir(os.path.join(src, f))]:
60+
path = os.path.join(src, d)
61+
copy_licenses(path, dst)
62+
4563
# Generated by conan create
4664
f = open("conan-install.json", "r")
4765
install_data = json.loads(f.read())
@@ -54,6 +72,7 @@ def copy_pdbs(src, dst):
5472
shutil.rmtree("stage", ignore_errors=True)
5573
makedirs("stage/include")
5674
makedirs("stage/lib")
75+
makedirs("stage/licenses")
5776

5877
# Skip Poco's MongoDB and SQLiteData modules, which we don't require.
5978
# Also CppUnit, which one of our deps uses.
@@ -75,6 +94,8 @@ def copy_pdbs(src, dst):
7594
copyall(rootpath + "/include", "stage/include", excludes=excludes)
7695
copyall(rootpath + "/lib", "stage/lib", excludes=excludes)
7796

97+
copy_licenses(rootpath, "stage/licenses/LICENSE-" + package_name + ".txt")
98+
7899
# pdbs are under build_path
79100
build_path = os.path.join((os.path.dirname(os.path.dirname(rootpath))), "build", build_id)
80101
copy_pdbs(build_path, "stage/lib")

0 commit comments

Comments
 (0)