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

http_request: new recipe #24778

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Nevermore1994
Copy link

Summary

Changes to recipe: http_request/1.0.0

Motivation

A modern C++ lightweight cross-platform HTTP request library
https://github.com/Nevermore1994/http-request

Details

changes


@CLAassistant
Copy link

CLAassistant commented Jul 31, 2024

CLA assistant check
All committers have signed the CLA.

@Nevermore1994 Nevermore1994 changed the title add conanfile http_request: new recipe Jul 31, 2024
@conan-center-bot

This comment has been minimized.

@AbrilRBS AbrilRBS self-assigned this Aug 1, 2024
Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Some minor comments after a first pass :)

Comment on lines +35 to +45
def _min_cppstd(self):
return 17

@property
def _compilers_minimum_version(self):
return {
"apple-clang": "10",
"clang": "7",
"gcc": "7.1",
"msvc": "192",
"Visual Studio": "15.3",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a missing validate() method to check these values, see the template in https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/conanfile.py#L80 as to how to do it

homepage = "https://github.com/Nevermore1994/http-request"
url = "https://github.com/conan-io/conan-center-index"
topics = ("http", "https", "modern C++")
package_type = "library"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a header-only recipe, so

Suggested change
package_type = "library"
package_type = "header-only"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking upstream, there are .cpp files, shouldnt we be building those then?

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"with_openssl": [True, False]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In upstream, this option is called DISABLE_HTTPS, we might want to have symmetry there :)

@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for v1 test packages for new recipes :)

Comment on lines +74 to +76
# TODO: to remove in conan v2 once legacy generators removed
self.cpp_info.names["cmake_find_package"] = "http_request"
self.cpp_info.names["cmake_find_package_multi"] = "http_request"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed :)

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@AbrilRBS
Copy link
Member

AbrilRBS commented Sep 5, 2024

Quite sorry about the incesant bot noise, it got a bit confused there :/

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments!

find_package(http-request REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE http-request)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified this to be in line with upstream's cmakelist

Comment on lines +30 to +31
if self.options.with_openssl:
self.requires("openssl/[>=1.1 <4]")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/Nevermore1994/http-request#notes seems to note that openssl is required in Windows and not optional. Is this right? Should this not be an option to disable it on Windows? Or how does this work? Thanks!

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ❌

Failure in build 15 (bea53aa3fe29e5516da3746326b70b12312d7b3d):

  • http-request/1.0.0:
    CI failed to create some packages (All logs)

    Logs for packageID 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.libcxx=libstdc++11
    compiler.version=9
    os=Linux
    
    [...]
    [HOOK - conan-center.py] pre_build(): [FPIC MANAGEMENT (KB-H007)] OK
    http-request/1.0.0 (test package): Calling build()
    http-request/1.0.0 (test package): CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/build/Release/generators/conan_toolchain.cmake" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/."
    
    ----Running------
    > cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/build/Release/generators/conan_toolchain.cmake" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/."
    -----------------
    -- Using Conan toolchain: /home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/build/Release/generators/conan_toolchain.cmake
    -- The CXX compiler identification is GNU 9.2.1
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/g++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Conan: Target declared 'http-request'
    -- Conan: Component target declared 'OpenSSL::Crypto'
    -- Conan: Component target declared 'OpenSSL::SSL'
    -- Conan: Target declared 'openssl::openssl'
    -- Conan: Target declared 'ZLIB::ZLIB'
    -- Conan: Including build module from '/home/conan/workspace/prod-v1/bsr/92898/fbdef/.conan/data/openssl/3.3.1/_/_/package/3b92fb92d86b5880d7fcd3124cd3e37e04f7e25f/lib/cmake/conan-official-openssl-variables.cmake'
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/build/Release
    http-request/1.0.0 (test package): CMake command: cmake --build "/home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/build/Release" '--' '-j3'
    
    ----Running------
    > cmake --build "/home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/build/Release" '--' '-j3'
    -----------------
    Scanning dependencies of target test_package
    [ 50%] Building CXX object CMakeFiles/test_package.dir/test_package.cpp.o
    CMake Warning:
      Manually-specified variables were not used by the project:
    
        CMAKE_POLICY_DEFAULT_CMP0091
    
    
    /home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/test_package.cpp:1:10: fatal error: Request.h: No such file or directory
        1 | #include <Request.h>
          |          ^~~~~~~~~~~
    compilation terminated.
    make[2]: *** [CMakeFiles/test_package.dir/build.make:82: CMakeFiles/test_package.dir/test_package.cpp.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/test_package.dir/all] Error 2
    make: *** [Makefile:103: all] Error 2
    WARN: *** Conan 1 is legacy and on a deprecation path ***
    WARN: *** Please upgrade to Conan 2 ***
    http-request/1.0.0 (test package): WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    http-request/1.0.0 (test package): WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    ERROR: http-request/1.0.0 (test package): Error in build() method, line 20
    	cmake.build()
    	ConanException: Error 2 while executing cmake --build "/home/conan/workspace/prod-v1/bsr/cci-350d030d/recipes/http-request/all/test_package/build/Release" '--' '-j3'
    

Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.


Conan v2 pipeline ❌

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping @conan-io/barbarians on the PR and we will help you.

Failure in build 8 (bea53aa3fe29e5516da3746326b70b12312d7b3d):

  • http-request/1.0.0:
    CI failed to create some packages (All logs)

    Logs for packageID da39a3ee5e6b4b0d3255bfef95601890afd80709:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.cppstd=17
    compiler.libcxx=libstdc++11
    compiler.version=11
    os=Linux
    
    [...]
    http-request/1.0.0 (test package): Generator 'CMakeDeps' calling 'generate()'
    http-request/1.0.0 (test package): CMakeDeps necessary find_package() and targets for your CMakeLists.txt
        find_package(http-request)
        target_link_libraries(... http-request)
    http-request/1.0.0 (test package): Generator 'VirtualRunEnv' calling 'generate()'
    http-request/1.0.0 (test package): Generating aggregated env files
    http-request/1.0.0 (test package): Generated aggregated env files: ['conanrun.sh', 'conanbuild.sh']
    
    ======== Testing the package: Building ========
    http-request/1.0.0 (test package): Calling build()
    http-request/1.0.0 (test package): Running CMake.configure()
    http-request/1.0.0 (test package): RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/conan/workspace/prod-v2/bsr/cci-f729e862/recipes/http-request/all/test_package" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/home/conan/workspace/prod-v2/bsr/cci-f729e862/recipes/http-request/all/test_package"
    -- Using Conan toolchain: /home/conan/workspace/prod-v2/bsr/cci-f729e862/recipes/http-request/all/test_package/build/gcc-11-x86_64-17-release/generators/conan_toolchain.cmake
    -- Conan toolchain: Defining architecture flag: -m64
    -- Conan toolchain: C++ Standard 17 with extensions OFF
    -- The CXX compiler identification is GNU 11.4.0
    -- Check for working CXX compiler: /usr/local/bin/c++
    -- Check for working CXX compiler: /usr/local/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Conan: Target declared 'http-request'
    -- Conan: Component target declared 'OpenSSL::Crypto'
    -- Conan: Component target declared 'OpenSSL::SSL'
    -- Conan: Target declared 'openssl::openssl'
    -- Conan: Target declared 'ZLIB::ZLIB'
    -- Conan: Including build module from '/home/conan/workspace/prod-v2/bsr/83454/adfbc/p/opens47f8922e04a22/p/lib/cmake/conan-official-openssl-variables.cmake'
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/conan/workspace/prod-v2/bsr/cci-f729e862/recipes/http-request/all/test_package/build/gcc-11-x86_64-17-release
    
    http-request/1.0.0 (test package): Running CMake.build()
    http-request/1.0.0 (test package): RUN: cmake --build "/home/conan/workspace/prod-v2/bsr/cci-f729e862/recipes/http-request/all/test_package/build/gcc-11-x86_64-17-release" -- -j3
    Scanning dependencies of target test_package
    [ 50%] Building CXX object CMakeFiles/test_package.dir/test_package.cpp.o
    /home/conan/workspace/prod-v2/bsr/cci-f729e862/recipes/http-request/all/test_package/test_package.cpp:1:10: fatal error: Request.h: No such file or directory
        1 | #include <Request.h>
          |          ^~~~~~~~~~~
    compilation terminated.
    CMakeFiles/test_package.dir/build.make:62: recipe for target 'CMakeFiles/test_package.dir/test_package.cpp.o' failed
    make[2]: *** [CMakeFiles/test_package.dir/test_package.cpp.o] Error 1
    CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/test_package.dir/all' failed
    make[1]: *** [CMakeFiles/test_package.dir/all] Error 2
    Makefile:83: recipe for target 'all' failed
    make: *** [all] Error 2
    
    ERROR: http-request/1.0.0 (test package): Error in build() method, line 20
    	cmake.build()
    	ConanException: Error 2 while executing
    

Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

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

Successfully merging this pull request may close these issues.

4 participants