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

[AD-759] FIX windows installer #101

Merged
merged 10 commits into from
Jul 8, 2022
29 changes: 16 additions & 13 deletions scripts/build_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,16 @@ $BUILD_DIR = "${WORKING_DIR}\build"
# $BUILD_DIR = "${WORKING_DIR}\build\${CONFIGURATION}${BITNESS}"
New-Item -Path $BUILD_DIR -ItemType Directory -Force | Out-Null

# Build driver

$DRIVER_SOURCE_DIR = "${WORKING_DIR}\src"
$DRIVER_BUILD_DIR = "${BUILD_DIR}\odbc\cmake"

.\scripts\build_driver.ps1 `
$CONFIGURATION $WIN_ARCH `
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $SDK_INSTALL_DIR
Set-Location $CURRENT_DIR

# Move driver dependencies to bin directory for testing
$DRIVER_BIN_DIR = "$DRIVER_BUILD_DIR\..\bin\$CONFIGURATION"
New-Item -Path $DRIVER_BIN_DIR -ItemType Directory -Force | Out-Null

# Download the JDBC driver
$JDBC_DRIVER_VERSION = if ($JDBC_DRIVER_VERSION -eq $null) { "1.2.4" } else { $JDBC_DRIVER_VERSION }
$JDBC_DRIVER_FILENAME = "documentdb-jdbc-$JDBC_DRIVER_VERSION-all.jar"
$JDBC_DRIVER_FULLPATH = "$DRIVER_BIN_DIR\libs\$JDBC_DRIVER_FILENAME"
$JDBC_DRIVER_FULLPATH = "$DRIVER_BUILD_DIR\$CONFIGURATION\libs\$JDBC_DRIVER_FILENAME"
if (-not (Test-Path -Path $JDBC_DRIVER_FULLPATH -PathType Leaf)) {
New-Item -Path "$DRIVER_BIN_DIR\libs" -ItemType Directory -Force | Out-Null
New-Item -Path "$DRIVER_BUILD_DIR\$CONFIGURATION\libs" -ItemType Directory -Force | Out-Null
Write-Output "Downloading version $JDBC_DRIVER_VERSION of JDBC driver..."
$progresspreference = 'silentlyContinue'
Invoke-WebRequest `
Expand All @@ -43,6 +34,18 @@ if (-not (Test-Path -Path $JDBC_DRIVER_FULLPATH -PathType Leaf)) {
Write-Output "Download complete."
}

# Build driver

.\scripts\build_driver.ps1 `
$CONFIGURATION $WIN_ARCH `
$DRIVER_SOURCE_DIR $DRIVER_BUILD_DIR $SDK_INSTALL_DIR
Set-Location $CURRENT_DIR

# Move driver dependencies to bin directory for testing
$DRIVER_BIN_DIR = "$DRIVER_BUILD_DIR\..\bin\$CONFIGURATION"
New-Item -Path $DRIVER_BIN_DIR -ItemType Directory -Force | Out-Null


if (Test-Path -Path $DRIVER_BUILD_DIR\$CONFIGURATION) {
Copy-Item $DRIVER_BUILD_DIR\$CONFIGURATION\* $DRIVER_BIN_DIR
Copy-Item $DRIVER_BUILD_DIR\$CONFIGURATION\* $DRIVER_BIN_DIR -force -recurse
}
39 changes: 31 additions & 8 deletions src/odbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ endif ()

include_directories(${OS_INCLUDE})


add_library(${TARGET} SHARED ${SOURCES})
add_library(${TARGET} SHARED ${SOURCES} version.rc)

set_target_properties(${TARGET} PROPERTIES VERSION ${CMAKE_PROJECT_VERSION})

Expand Down Expand Up @@ -218,25 +217,45 @@ if (WIN32 AND ${WITH_ODBC_MSI})
endif()

set(WIX_ODBC_LIBRARY_PATH ".\\documentdb.odbc.dll")
set(WIX_ODBC_BSON1_PATH ".\\bson-1.0.dll")
set(WIX_ODBC_BSONCXX_PATH ".\\bsoncxx.dll")
set(WIX_ODBC_MONGOC_PATH ".\\mongoc-1.0.dll")
set(WIX_ODBC_MONGOCXX_PATH ".\\mongocxx.dll")
set(WIX_ODBC_ZLIB1_PATH ".\\zlib1.dll")
set(WIX_ODBC_JDBC_PATH ".\\libs\\documentdb-jdbc-1.2.4-all.jar")

set(WIX_PROJECT_NAME "Amazon DocumentDB")
set(WIX_MANUFACTURER "Amazon Web Services")
set(WIX_COPYRIGHT_COMMENT "Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are trademarks of The Apache Software Foundation.")

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(WIX_BIT_SUFFIX "64-bit")
set(WIX_PRODUCT_ID "F3E308E4-910C-4AF5-82DE-2ACF4D64830E")
set(WIX_UPGRADE_CODE "1D7AEFDF-6CD2-4FB5-88F2-811A89832D6D")
set(WIX_COMPONENT_ID "E5F0DDF2-DD3C-4196-8A08-70921858A52F")
set(WIX_PRODUCT_ID "ae863f63-39ce-4f61-9b19-011bc63d89e9")
set(WIX_UPGRADE_CODE "b23e4250-96ba-4ad7-ada0-64f307d2e1fd")
set(WIX_COMPONENT_ID_ODBC_LIBRARY "7cb71911-a963-41ba-8dcc-fe5de6ddfaf1")
set(WIX_COMPONENT_ID_BSON1 "950288ae-f70b-459a-b079-02887797e3d0")
set(WIX_COMPONENT_ID_BSONCXX "ce855f2b-384d-4bf2-a62c-f921722eef7e")
set(WIX_COMPONENT_ID_MONGOC "7ee7d64d-2f03-4c8e-9da1-6995deb7c9ac")
set(WIX_COMPONENT_ID_MONGOCXX "88eb3917-63e0-4e7c-ae6e-04dae66df013")
set(WIX_COMPONENT_ID_ZLIB1 "2c920532-81fa-4088-a446-47aaa8db83ae")
set(WIX_COMPONENT_ID_JDBC "70020c86-713b-423d-b782-79f72ec7a388")
set(WIX_COMPONENT_ID_DOCUMNETDB_HOME_ENV_VAR "281ea3c0-192c-4a3c-9ddf-5bc1cd77a790")
set(WIX_PROGRAM_FILES_FOLDER_ID "ProgramFiles64Folder")
set(WIX_COMPONENT_IS_WIN64 "yes")
set(WIX_PACKAGE_PLATFORM "x64")
set(WIX_INSTALLER_PREFIX ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/documentdb-odbc-amd64)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(WIX_BIT_SUFFIX "32-bit")
set(WIX_PRODUCT_ID "D39CBABA-1E21-4701-AA5C-91EDA07B383B")
set(WIX_UPGRADE_CODE "743902A4-365C-424E-B226-5B2898A3941E")
set(WIX_COMPONENT_ID "4AFA26EE-C639-4EF2-A9B2-281119BB4BB5")
set(WIX_PRODUCT_ID "60cb757b-69cb-412c-9d06-f22cd96914ed")
set(WIX_UPGRADE_CODE "1bc0039e-b824-45ff-8a85-45492bf7eb46")
set(WIX_COMPONENT_ID_ODBC_LIBRARY "46b68e84-8f98-4c00-a8f9-d81a06bba694")
set(WIX_COMPONENT_ID_BSON1 "c34b6eaa-3f17-4e54-b3dd-ce95f6a95c5b")
set(WIX_COMPONENT_ID_BSONCXX "f9d57dda-9051-4032-a23d-251ba681e64a")
set(WIX_COMPONENT_ID_MONGOC "694ecd9b-7d68-4998-bc82-83d82ba2bde6")
set(WIX_COMPONENT_ID_MONGOCXX "0aa05333-e7ff-4f32-9d89-0b637475425e")
set(WIX_COMPONENT_ID_ZLIB1 "41f84e00-d899-493b-a0c4-c59b53998538")
set(WIX_COMPONENT_ID_JDBC "1ff0aa89-8a06-4c21-b0ce-ff9523ac8f10")
set(WIX_COMPONENT_ID_DOCUMNETDB_HOME_ENV_VAR "04aff702-9fe4-4dc1-9979-daa94aca5a03")
set(WIX_PROGRAM_FILES_FOLDER_ID "ProgramFilesFolder")
set(WIX_COMPONENT_IS_WIN64 "no")
set(WIX_PACKAGE_PLATFORM "x86")
Expand Down Expand Up @@ -279,3 +298,7 @@ elseif(APPLE)
else()
target_link_libraries(${TARGET} odbcinst)
endif()

set(VERSIONINFO ${CMAKE_PROJECT_VERSION_MAJOR},${CMAKE_PROJECT_VERSION_MINOR},${CMAKE_PROJECT_VERSION_PATCH})
set(VERSIONINFO_STR ${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}.${CMAKE_PROJECT_VERSION_PATCH})
configure_file("version.rc.in" "version.rc" @ONLY)
32 changes: 31 additions & 1 deletion src/odbc/install/ignite-odbc.wxs.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Directory Id='@WIX_PROGRAM_FILES_FOLDER_ID@' Name='ProgramFiles'>
<Directory Id='AmazonDocumentDB' Name='Amazon DocumentDB'>
<Directory Id='INSTALLDIR' Name='ODBC Driver'>
<Component Id='Driver' Guid='@WIX_COMPONENT_ID@' Win64='@WIX_COMPONENT_IS_WIN64@'>
<Component Id='Driver' Guid='@WIX_COMPONENT_ID_ODBC_LIBRARY@' Win64='@WIX_COMPONENT_IS_WIN64@'>
<File Id='IgniteOdbcDll' Name='documentdb.odbc.dll' DiskId='1' Source='@WIX_ODBC_LIBRARY_PATH@' KeyPath='yes'/>

<RegistryValue Root='HKLM' Key='Software\ODBC\ODBCINST.INI\ODBC Drivers' Name='Amazon DocumentDB' Type='string' Value='Installed'/>
Expand All @@ -46,6 +46,29 @@
<RegistryValue Type='integer' Name='UsageCount' Value='1'/>
</RegistryKey>
</Component>
<Component Id='bson1' Guid='@WIX_COMPONENT_ID_BSON1@' Win64='@WIX_COMPONENT_IS_WIN64@'>
<File Id='bson1' Name='bson-1.0.dll' DiskId='1' Source='@WIX_ODBC_BSON1_PATH@' KeyPath='yes'/>
</Component>
<Component Id='bsoncxx' Guid='@WIX_COMPONENT_ID_BSONCXX@' Win64='@WIX_COMPONENT_IS_WIN64@'>
<File Id='bsoncxx' Name='bsoncxx.dll' DiskId='1' Source='@WIX_ODBC_BSONCXX_PATH@' KeyPath='yes'/>
</Component>
<Component Id='mongoc' Guid='@WIX_COMPONENT_ID_MONGOC@' Win64='@WIX_COMPONENT_IS_WIN64@'>
<File Id='mongoc' Name='mongoc-1.0.dll' DiskId='1' Source='@WIX_ODBC_MONGOC_PATH@' KeyPath='yes'/>
</Component>
<Component Id='mongocxx' Guid='@WIX_COMPONENT_ID_MONGOCXX@' Win64='@WIX_COMPONENT_IS_WIN64@'>
<File Id='mongocxx' Name='mongocxx.dll' DiskId='1' Source='@WIX_ODBC_MONGOCXX_PATH@' KeyPath='yes'/>
</Component>
<Component Id='zlib' Guid='@WIX_COMPONENT_ID_ZLIB1@' Win64='@WIX_COMPONENT_IS_WIN64@'>
<File Id='zlib' Name='zlib1.dll' DiskId='1' Source='@WIX_ODBC_ZLIB1_PATH@' KeyPath='yes'/>
</Component>
<Directory Id='JDBCDIR' Name='libs'>
<Component Id='JDBC' Guid='@WIX_COMPONENT_ID_JDBC@' Win64='@WIX_COMPONENT_IS_WIN64@'>
<File Id='JDBC' Name='documentdb-jdbc-1.2.4-all.jar' DiskId='1' Source='@WIX_ODBC_JDBC_PATH@' KeyPath='yes'/>
</Component>
</Directory>
<Component Id='DOCUMENTDBHOMEVAR' Guid='@WIX_COMPONENT_ID_DOCUMNETDB_HOME_ENV_VAR@' Win64='@WIX_COMPONENT_IS_WIN64@' KeyPath='yes' >
<Environment Id='DOCUMENTDBHOME' Name='DOCUMENTDB_HOME' Action='set' System='yes' Part='all' Value='[INSTALLDIR]' />
</Component>
</Directory>
</Directory>
</Directory>
Expand All @@ -54,6 +77,13 @@
<Feature Id='Complete' Title='ODBC Driver' Description='@WIX_PRODUCT_NAME@.' Level='1'
ConfigurableDirectory='INSTALLDIR' Absent='disallow' AllowAdvertise='no' InstallDefault='local'>
<ComponentRef Id='Driver' />
<ComponentRef Id='bson1' />
<ComponentRef Id='bsoncxx' />
<ComponentRef Id='mongoc' />
<ComponentRef Id='mongocxx' />
<ComponentRef Id='zlib' />
<ComponentRef Id='JDBC' />
<ComponentRef Id='DOCUMENTDBHOMEVAR' />
</Feature>

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
Expand Down
36 changes: 36 additions & 0 deletions src/odbc/version.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#define VER_FILEVERSION @VERSIONINFO@
#define VER_FILEVERSION_STR "@VERSIONINFO_STR@\0"

#define VER_PRODUCTVERSION @VERSIONINFO@
#define VER_PRODUCTVERSION_STR "@VERSIONINFO_STR@\0"
#define VER_COMPANYNAME_STR "Amazon Web Services"
#define VER_PRODUCTNAME_STR "Amazon DocumentDB ODBC driver"
affonsov marked this conversation as resolved.
Show resolved Hide resolved

1 VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END

BLOCK "VarFileInfo"
BEGIN
/* The following line should only be modified for localized versions. */
/* It consists of any number of WORD,WORD pairs, with each pair */
/* describing a language,codepage combination supported by the file. */
/* */
/* For example, a file might have values "0x409,1252" indicating that it */
/* supports English language (0x409) in the Windows ANSI codepage (1252). */

VALUE "Translation", 0x409, 1252

END
END
affonsov marked this conversation as resolved.
Show resolved Hide resolved