Skip to content

Commit

Permalink
Copy solution from another PR so that CI can pass
Browse files Browse the repository at this point in the history
  • Loading branch information
antkmsft committed Jul 20, 2023
1 parent dbee995 commit 3673e06
Showing 1 changed file with 54 additions and 55 deletions.
109 changes: 54 additions & 55 deletions cmake-modules/FolderList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@ macro(GetFolderList project)
message ("project found ${project}")
message ("FLAG VALUE : ${FETCH_SOURCE_DEPS}")
if(${project} STREQUAL CERTIFICATES)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/identity azure-identity "LATEST")
DownloadDepVersion(sdk/core azure-core 1.5.0)
DownloadDepVersion(sdk/identity azure-identity 1.1.0)
elseif(${project} STREQUAL IDENTITY)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/core azure-core 1.2.0)
elseif(${project} STREQUAL SECRETS)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/identity azure-identity "LATEST")
DownloadDepVersion(sdk/core azure-core 1.5.0)
DownloadDepVersion(sdk/identity azure-identity 1.1.0)
elseif(${project} STREQUAL KEYS)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/identity azure-identity "LATEST")
DownloadDepVersion(sdk/core azure-core 1.5.0)
DownloadDepVersion(sdk/identity azure-identity 1.1.0)
elseif(${project} STREQUAL ADMINISTRATION)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/identity azure-identity "LATEST")
DownloadDepVersion(sdk/core azure-core 1.5.0)
DownloadDepVersion(sdk/identity azure-identity 1.1.0)
elseif(${project} STREQUAL STORAGE_COMMON)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/core azure-core 1.9.0)
elseif(${project} STREQUAL STORAGE_BLOBS)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common "LATEST")
DownloadDepVersion(sdk/core azure-core 1.8.0)
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.3.1)
elseif(${project} STREQUAL STORAGE_FILES_DATALAKE)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common "LATEST")
DownloadDepVersion(sdk/storage/azure-storage-blobs azure-storage-blobs "LATEST")
DownloadDepVersion(sdk/core azure-core 1.8.0)
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.3.1)
DownloadDepVersion(sdk/storage/azure-storage-blobs azure-storage-blobs 12.7.0)
elseif(${project} STREQUAL STORAGE_FILES_SHARES)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common "LATEST")
DownloadDepVersion(sdk/core azure-core 1.9.0)
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.3.2)
elseif(${project} STREQUAL STORAGE_QUEUES)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common "LATEST")
DownloadDepVersion(sdk/core azure-core 1.5.0)
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.2.3)
elseif(${project} STREQUAL EVENTHUBS)
DownloadDepVersion(sdk/core azure-core "LATEST")
DownloadDepVersion(sdk/core azure-core-amqp "LATEST")
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common "LATEST")
DownloadDepVersion(sdk/storage/azure-storage-blobs azure-storage-blobs "LATEST")
DownloadDepVersion(sdk/core azure-core 1.10.1)
DownloadDepVersion(sdk/core azure-core-amqp 1.0.0-beta.1)
DownloadDepVersion(sdk/storage/azure-storage-common azure-storage-common 12.3.3)
DownloadDepVersion(sdk/storage/azure-storage-blobs azure-storage-blobs 12.8.0)
endif()
list(REMOVE_DUPLICATES BUILD_FOLDERS)
endmacro()
Expand Down Expand Up @@ -62,40 +62,39 @@ macro(SetCompileOptions project)
endmacro()

macro(DownloadDepVersion DEP_FOLDER DEP_NAME DEP_VERSION)
list(FIND BUILD_FOLDERS build/${DEP_FOLDER}/${DEP_NAME} EXISTING_INDEX)
if (EXISTING_INDEX LESS 0)
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/build/${DEP_FOLDER})
set(DOWNLOAD_FOLDER ${CMAKE_SOURCE_DIR}/build/downloads)
set(DOWNLOAD_FILE ${DEP_NAME}_${DEP_VERSION}.zip)
set(DEP_PREFIX azure-sdk-for-cpp)

if(FETCH_SOURCE_DEPS STREQUAL "LATEST" OR "${DEP_VERSION}" STREQUAL "LATEST")
message("Downloading latest version of ${DEP_NAME}")
#get the latest version from main
file(DOWNLOAD http://github.com/Azure/azure-sdk-for-cpp/archive/main.zip ${DOWNLOAD_FOLDER}/${DOWNLOAD_FILE})
else()
message("Downloading version ${DEP_VERSION} of ${DEP_NAME}")
# get the zip
file(DOWNLOAD https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/${DOWNLOAD_FILE} ${DOWNLOAD_FOLDER}/${DOWNLOAD_FILE})
endif()
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/build/${DEP_FOLDER})
set(DOWNLOAD_FOLDER ${CMAKE_SOURCE_DIR}/build/downloads)
set(DOWNLOAD_FILE ${DEP_NAME}_${DEP_VERSION}.zip)
set(DEP_PREFIX azure-sdk-for-cpp)

#extract the zip
file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_FOLDER}/${DOWNLOAD_FILE} DESTINATION ${DOWNLOAD_FOLDER}/${DEP_NAME})
#make target folder
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/build/${DEP_FOLDER})

# need a nicer way to copy/move folder
# i need to archive the folder then extract at new location
if(FETCH_SOURCE_DEPS STREQUAL "LATEST" OR "${DEP_VERSION}" STREQUAL "LATEST")
execute_process(COMMAND tar -cf ${DOWNLOAD_FOLDER}/${DEP_NAME}.tar -C ${DOWNLOAD_FOLDER}/${DEP_NAME}/azure-sdk-for-cpp-main/${DEP_FOLDER} .)
else()
execute_process(COMMAND tar -cf ${DOWNLOAD_FOLDER}/${DEP_NAME}.tar -C ${DOWNLOAD_FOLDER}/${DEP_NAME}/${DEP_PREFIX}-${DEP_NAME}_${DEP_VERSION}/${DEP_FOLDER} .)
endif()
if(FETCH_SOURCE_DEPS STREQUAL "LATEST")
message("Downloading latest version of ${DEP_NAME}")
#get the latest version from main
file(DOWNLOAD http://github.com/Azure/azure-sdk-for-cpp/archive/main.zip ${DOWNLOAD_FOLDER}/${DOWNLOAD_FILE})
else()
message("Downloading version ${DEP_VERSION} of ${DEP_NAME}")
# get the zip
file(DOWNLOAD https://github.com/Azure/azure-sdk-for-cpp/archive/refs/tags/${DOWNLOAD_FILE} ${DOWNLOAD_FOLDER}/${DOWNLOAD_FILE})
endif()

#extract the zip
file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_FOLDER}/${DOWNLOAD_FILE} DESTINATION ${DOWNLOAD_FOLDER}/${DEP_NAME})
#make target folder
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/build/${DEP_FOLDER})

file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_FOLDER}/${DEP_NAME}.tar DESTINATION ${CMAKE_SOURCE_DIR}/build/${DEP_FOLDER})
#cleanup
file(REMOVE_RECURSE ${DOWNLOAD_FOLDER})
#add dependency folder to build list
list(APPEND BUILD_FOLDERS build/${DEP_FOLDER}/${DEP_NAME})
# need a nicer way to copy/move folder
# i need to archive the folder then extract at new location
if(FETCH_SOURCE_DEPS STREQUAL "LATEST")
execute_process(COMMAND tar -cf ${DOWNLOAD_FOLDER}/${DEP_NAME}.tar -C ${DOWNLOAD_FOLDER}/${DEP_NAME}/azure-sdk-for-cpp-main/${DEP_FOLDER} .)
else()
execute_process(COMMAND tar -cf ${DOWNLOAD_FOLDER}/${DEP_NAME}.tar -C ${DOWNLOAD_FOLDER}/${DEP_NAME}/${DEP_PREFIX}-${DEP_NAME}_${DEP_VERSION}/${DEP_FOLDER} .)
endif()

file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_FOLDER}/${DEP_NAME}.tar DESTINATION ${CMAKE_SOURCE_DIR}/build/${DEP_FOLDER})
#cleanup
file(REMOVE_RECURSE ${DOWNLOAD_FOLDER})
#add dependency folder to build list
list(APPEND BUILD_FOLDERS build/${DEP_FOLDER})

endmacro()

0 comments on commit 3673e06

Please sign in to comment.