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

Feature/579 automatic dependency deduction #589

Merged
merged 45 commits into from
Jul 31, 2023

Conversation

PengZheng
Copy link
Contributor

@PengZheng PengZheng commented Jul 15, 2023

This PR fixes #579 by implementing automatic dependency deduction among components within the Celix package.

Now we can specify only what we need, and a minimal Conan package with corresponding feature (and its internal dependencies, but nothing more) will be built for us automatically.

For example, if we only need PushStreams, the following snippet should be enough for any downstream project:

            self.requires("celix/2.3.0")
            self.options['celix'].build_pushstreams = True

Or we can create a minimal Conan package with only PushStreams and Promises support by the following command line:

conan create . -b missing -o celix:build_pushstreams=True

To this end:

  • All build_ options default to be False. Please note that CMake caches' defaults are not changed.
  • Error injectors for Celix components are under the control of corresponding build_ option. This is necessary to fix https://github.com/apache/celix/actions/runs/5560191654/jobs/10156995210 CodeCoverage.cmake has been updated to exclude them from Coverage statistics.
  • An Celix::celix dummy target is introduced. Now all components can be turned off, which will result in empty package. Without this target, install(TARGETS ...) will report unknown export "celix" error. Note that creating an empty package is the fastest way of publishing a new conan package (without actually building anything). In my day job, I normally publish package this way (CI has already guaranteed that the package can be built correctly).
  • A GitHub work flow is introduced to try to create various Conan packages with only one build_ option enabled.
  • etcdlib and promises can still be built the old way. Though building with Conan is my preferred way.
  • conan_test_package has been updated to discard usage of deprecated headers, and more tests are added.

Documentation has not been updated to reflect the above. We may need more usage experience.

@xuzhenbao I noticed if mdnsresponder/1790.80.10 were used, tests failed. Is that normal?

PengZheng added 30 commits June 28, 2023 17:53
Improve dependency specification of RSA.
# Conflicts:
#	libs/framework/CMakeLists.txt
#	libs/utils/CMakeLists.txt
Revert "Recover Findlibuuid.cmake"

This reverts commit fd2c5f2.

Revert "Recover Findlibuuid.cmake"

This reverts commit 3a36318.
@PengZheng PengZheng linked an issue Jul 15, 2023 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2023

Codecov Report

Merging #589 (e492c63) into master (8bcac0f) will increase coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head e492c63 differs from pull request most recent head c789b89. Consider uploading reports for the commit c789b89 to get more accurate results

@@            Coverage Diff             @@
##           master     #589      +/-   ##
==========================================
+ Coverage   78.50%   78.54%   +0.03%     
==========================================
  Files         234      234              
  Lines       35389    35431      +42     
==========================================
+ Hits        27782    27829      +47     
+ Misses       7607     7602       -5     
Files Changed Coverage Δ
libs/framework/src/celix_launcher.c 92.35% <100.00%> (ø)

... and 4 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@PengZheng PengZheng requested a review from pnoltes July 15, 2023 07:39
# avoid unknown export "celix" error when building nothing
add_library(celix INTERFACE)
add_library(Celix::celix ALIAS celix)
install(TARGETS celix EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT framework
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this will generate a imported target?

Copy link
Contributor Author

@PengZheng PengZheng Jul 24, 2023

Choose a reason for hiding this comment

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

Yes, this only serves to define the Celix export.

@@ -16,10 +16,11 @@
# under the License.

set(PUSHSTREAMS_DEFAULT_ON ${CELIX_CXX17})
celix_subproject(PUSHSTREAMS "Option to build the PushStreams library" ${PUSHSTREAMS_DEFAULT_ON} DEPS PROMISES)
celix_subproject(PUSHSTREAMS "Option to build the PushStreams library" ${PUSHSTREAMS_DEFAULT_ON})
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that the celix cmake function celix_subproject is no longer used to configure dependecies, but this is now done using the Conanfile?

So for pushstream the lines :

        if self.options.build_pushstreams:
            self.options.build_promises = True

Copy link
Contributor Author

@PengZheng PengZheng Jul 24, 2023

Choose a reason for hiding this comment

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

Yes. Previously celix_subproject will only hint our users to enable missing components without automatic configuration.
For a long chain of dependencies, users have to try several times to work out a working configuration for Celix.
Imagine that we have several Conan packages, each of them has intra-package dependencies like Celix, and they also have inter-package dependencies. Then working out a working configuration for a downstream user can be daunting.
With this in place, our users only specify what they need directly, everything else is automatically configured like charm.

@PengZheng PengZheng requested a review from pnoltes July 29, 2023 02:01
@PengZheng PengZheng merged commit d40cada into master Jul 31, 2023
@PengZheng PengZheng deleted the feature/579-automatic-dependency-deduction branch July 31, 2023 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic Dependency Deduction
3 participants