mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-06 02:37:55 +00:00
(#17705) docs: remove mention of the migration test_v1_package
* Delete docs/package_templates/autotools_package/all/test_v1_package directory * Delete docs/package_templates/cmake_package/all/test_v1_package directory * Delete docs/package_templates/header_only/all/test_v1_package directory * Delete docs/package_templates/meson_package/all/test_v1_package directory * Delete docs/package_templates/msbuild_package/all/test_v1_package directory * Delete docs/package_templates/prebuilt_tool_package/all/test_v1_package directory * Update test_packages.md * Update error_knowledge_base.md
This commit is contained in:
@@ -8,19 +8,19 @@ themselves. It's possible to have ConanCenter run `conan test` on more then one
|
||||
<!-- toc -->
|
||||
## Contents
|
||||
|
||||
* [Files and Structure](#files-and-structure)
|
||||
* [CMake targets](#cmake-targets)
|
||||
* [Testing more generators with `test_<something>`](#testing-more-generators-with-test_something)
|
||||
* [Testing CMake variables from FindModules](#testing-cmake-variables-from-findmodules)
|
||||
* [How it works](#how-it-works)
|
||||
* [Minimalist Source Code](#minimalist-source-code)<!-- endToc -->
|
||||
* [Files and Structure](#files-and-structure)
|
||||
* [CMake targets](#cmake-targets)
|
||||
* [Testing more generators with `test_<something>`](#testing-more-generators-with-test_something)
|
||||
* [Testing CMake variables from FindModules](#testing-cmake-variables-from-findmodules)
|
||||
* [How it works](#how-it-works)
|
||||
* [Minimalist Source Code](#minimalist-source-code)<!-- endToc -->
|
||||
|
||||
### Files and Structure
|
||||
|
||||
See the [recipe files and structures](README.md#recipe-files-structure) for a visual.
|
||||
|
||||
All ConanCenterIndex recipe should have a two [test_folders](https://docs.conan.io/1/reference/commands/creator/create.html?highlight=test_folder)
|
||||
One for the current CMake generator in `test_package/` and on for the deprecated generators in `test_v1_package/`.
|
||||
One for the current CMake generator in `test_package/`.
|
||||
|
||||
Please refer to the [Package Templates](../package_templates/) for the current practices about which files and what their content should be.
|
||||
|
||||
@@ -39,11 +39,7 @@ target_link_libraries(test_ranges PRIVATE fmt::fmt)
|
||||
|
||||
Refer to the [package template](https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt) for more examples.
|
||||
|
||||
> **Notes** It's still important to test targets provided by `cmake_find_package[_multi]` generators.
|
||||
> It should help in the migration (and compatibility) with Conan v2. See [v1 test package template](https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt) for details.
|
||||
> You can see read [this conversation](https://github.com/conan-io/conan-center-index/issues/12888#issuecomment-1290817799) for more context.
|
||||
|
||||
In ConanCenter we try to accurately represent the names of the targets and the information provided by CMake's modules and config files that some libraries
|
||||
In ConanCenterIndex, we try to accurately represent the names of the targets and the information provided by CMake's modules and config files that some libraries
|
||||
provide. If CMake or the library itself don't enforce any target name, the default ones provided by Conan should be recommended. The minimal project
|
||||
in the `test_package` folder should serve as an example of the best way to consume the package, and targets are preferred over raw variables.
|
||||
|
||||
@@ -60,7 +56,7 @@ of them together in the testing logs.
|
||||
Sometimes it is useful to test the package using different build systems (CMake, Autotools,...). Instead of adding complex logic to one
|
||||
`test_package/conanfile.py` file, it is better to add another `test_<something>/conanfile.py` file with a minimal example for that build system. That
|
||||
way the examples will be short and easy to understand and maintain. In some other situations it could be useful to test different Conan generators
|
||||
(`cmake_find_package`, `CMakeDeps`,...) using different folders and `conanfile.py` files.
|
||||
(e.g. `CMakeDeps`) using different folders and `conanfile.py` files.
|
||||
|
||||
When using more than one `test_<something>` folder, create a different project for each of them to keep the content of the `conanfile.py` and the
|
||||
project files as simple as possible, without the need of extra logic to handle different scenarios.
|
||||
|
@@ -476,10 +476,6 @@ def package_info(self):
|
||||
|
||||
Pylint is executed by default over all `conanfile.py` files in ConanCenterIndex and it should not be skipped. It's an important tool which helps us keep a standard level of acceptance. Otherwise, it would be incredibly hard to review all recipes and keep them to the same level of standards.
|
||||
|
||||
#### **<a name="KB-H073">#KB-H073</a>: "TEST V1 PACKAGE FOLDER"**
|
||||
|
||||
The legacy content in test_package should not be removed. Instead, rename that folder to `test_v1_package` and create a new `test_package` folder following the [file structure](adding_packages/README.md#recipe-files-structure) related to Conan v2 and v1 compatibility. Also, you can obtain good examples of Conan v2 test packages from the [template packages](package_templates/README.md) folder.
|
||||
|
||||
#### **<a name="KB-H075">#KB-H075</a>: "REQUIREMENT OVERRIDE PARAMETER"**
|
||||
|
||||
The [self.requires()](https://docs.conan.io/1/reference/conanfile/methods.html#requirements) allows to override a dependency version, forcing to use that version imposed by the recipe only. As a side-effect, dependencies can use different versions of the same project at the same package, which may cause unpredicted errors, like ABI incompatibility. For that reason, the `override` parameter is forbidden and should not be used. Instead, all dependencies should align their package versions, even when it's necessary to open more pull requests to update dependency versions.
|
||||
|
@@ -1,11 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package LANGUAGES C) # if the project is pure C
|
||||
# project(test_package LANGUAGES CXX) # if the project uses c++
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
find_package(package REQUIRED CONFIG)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
|
@@ -1,19 +0,0 @@
|
||||
from conans import ConanFile, CMake
|
||||
from conan.tools.build import cross_building
|
||||
import os
|
||||
|
||||
|
||||
# legacy validation with Conan 1.x
|
||||
class TestPackageV1Conan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package_multi"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
@@ -1,8 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
|
@@ -1,19 +0,0 @@
|
||||
from conans import ConanFile, CMake
|
||||
from conan.tools.build import cross_building
|
||||
import os
|
||||
|
||||
|
||||
# legacy validation with Conan 1.x
|
||||
class TestPackageV1Conan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package_multi"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
@@ -1,9 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package LANGUAGES C) # if the project is pure C
|
||||
project(test_package LANGUAGES CXX) # if the project uses c++
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
|
@@ -1,19 +0,0 @@
|
||||
from conans import ConanFile, CMake
|
||||
from conan.tools.build import cross_building
|
||||
import os
|
||||
|
||||
|
||||
# legacy validation with Conan 1.x
|
||||
class TestPackageV1Conan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package_multi"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
@@ -1,23 +0,0 @@
|
||||
from conans import ConanFile, Meson
|
||||
from conan.tools.build import cross_building
|
||||
import os
|
||||
|
||||
|
||||
# legacy validation with Conan 1.x
|
||||
class TestPackageV1Conan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "pkg_config"
|
||||
|
||||
def build_requirements(self):
|
||||
self.build_requires("meson/0.63.3")
|
||||
self.build_requires("pkgconf/1.9.3")
|
||||
|
||||
def build(self):
|
||||
meson = Meson(self)
|
||||
meson.configure(build_folder="bin", source_folder="../test_package")
|
||||
meson.build()
|
||||
|
||||
def test(self):
|
||||
if not cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
@@ -1,12 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(test_package C) # if the project is pure C
|
||||
project(test_package CXX) # if the project uses c++
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
find_package(package REQUIRED CONFIG)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
|
@@ -1,19 +0,0 @@
|
||||
from conans import ConanFile, CMake
|
||||
from conan.tools.build import cross_building
|
||||
import os
|
||||
|
||||
|
||||
# legacy validation with Conan 1.x
|
||||
class TestPackageV1Conan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package_multi"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
@@ -1,13 +0,0 @@
|
||||
from conans import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
|
||||
|
||||
# legacy validation with Conan 1.x
|
||||
class TestPackageV1Conan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
# self.run checks the command exit code
|
||||
# the tool must be available on PATH, which is configured by self.env_info.PATH
|
||||
self.run("tool --version", run_environment=True)
|
Reference in New Issue
Block a user