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

fix build with samples on linux #3724

Closed
wants to merge 4 commits into from

Conversation

vhvb1989
Copy link
Member

@vhvb1989 vhvb1989 commented Jun 8, 2022

fixes: #3723

@vhvb1989 vhvb1989 requested a review from RickWinter as a code owner June 8, 2022 00:47
@vhvb1989 vhvb1989 self-assigned this Jun 8, 2022
@check-enforcer
Copy link

check-enforcer bot commented Jun 8, 2022

This pull request is protected by Check Enforcer.

What is Check Enforcer?

Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass.

Why am I getting this message?

You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged.

What should I do now?

If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows:
/check-enforcer evaluate
Typically evaluation only takes a few seconds. If you know that your pull request is not covered by a pipeline and this is expected you can override Check Enforcer using the following command:
/check-enforcer override
Note that using the override command triggers alerts so that follow-up investigations can occur (PRs still need to be approved as normal).

What if I am onboarding a new service?

Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment:
/azp run prepare-pipelines
This will run a pipeline that analyzes the source tree and creates the pipelines necessary to build and validate your pull request. Once the pipeline has been created you can trigger the pipeline using the following comment:
/azp run cpp - [service] - ci

@vhvb1989
Copy link
Member Author

vhvb1989 commented Jun 8, 2022

/azp run cpp - core

@vhvb1989
Copy link
Member Author

vhvb1989 commented Jun 8, 2022

/azp run cpp - identity

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vhvb1989 vhvb1989 requested a review from schaabs as a code owner June 8, 2022 01:44
@vhvb1989
Copy link
Member Author

vhvb1989 commented Jun 8, 2022

/azp run cpp - core

@vhvb1989
Copy link
Member Author

vhvb1989 commented Jun 8, 2022

/azp run cpp - identity

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@vhvb1989
Copy link
Member Author

vhvb1989 commented Jun 8, 2022

/azp run cpp - core

@vhvb1989
Copy link
Member Author

vhvb1989 commented Jun 8, 2022

/azp run cpp - identity

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@RickWinter
Copy link
Member

This looks to stop the sample from ever building. What am I missing. Also I see its still failing the core builds.

target_include_directories(client_secret_credential_sample PRIVATE .)
target_include_directories(
client_secret_credential_sample PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../../../samples/helpers/service/inc>
Copy link
Member

Choose a reason for hiding this comment

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

Instead of navigating ../../../.. etc, why not put this in a variable once and then use the variable everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

We decided not to do that for CMake files long time ago, as per Charlie's advice (since we were doing the C SDK)

I remember because I used to set all re-usable strings from a CMake file in the top and then I would just use the variables everywhere.

So, yeah, I am not against it, but I have been following that advise of keeping the duplication.
The only real benefit of the variables was to make it easier to update in the future, but using any editor from this days can select and replace all occurrences at the same time (and I couldn't argue with that )

Copy link
Contributor

Choose a reason for hiding this comment

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

@barcharcraz can you please share some guidance and rationale for when and why we should avoid creating reusable string variables within CMake files?

@vhvb1989
Copy link
Member Author

vhvb1989 commented Jun 8, 2022

This looks to stop the sample from ever building. What am I missing. Also I see its still failing the core builds.

It was never a sample. It is a helper library for samples. But it is just a header without any .cpp files, so the library was created as an INTERFACE, which somehow works on Windows, but makes no sense for linux.

All we need is to make this header available for building samples

@vhvb1989
Copy link
Member Author

vhvb1989 commented Jun 8, 2022

Also I see its still failing the core builds.

false positive. I have triggered re-run failed.

@@ -101,7 +101,6 @@ include(AzureVersion)

if(BUILD_SAMPLES)
add_subdirectory(samples/helpers/get-env)
add_subdirectory(samples/helpers/service)
Copy link
Member

Choose a reason for hiding this comment

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

Let's try to find the other way... Basically, what we have is header-only library, let's fix cmake so that it works on linux too. I would really like to avoid the ..\..\.., and make it look like any other azure-sdk library. Even at a cost of it having a .cpp file.

Copy link
Member

@antkmsft antkmsft Jun 8, 2022

Choose a reason for hiding this comment

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

Given that service is supposed to be a placeholder for azure-anyservice, I thikn it is better to add a .cpp file. We can make it an OBJECT library similar to get-env, consuming it is semantically the same as regular library, unlike INTERFACE library (http://www.mariobadr.com/creating-a-header-only-library-with-cmake.html#:~:text=Creating%20a%20Header-Only%20CMake%20Target%20Creating%20an%20interface,is%20not%20meant%20to%20generate%20any%20build%20output.).

Copy link
Member

Choose a reason for hiding this comment

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

@vhvb1989, how about this? - #3728

@vhvb1989
Copy link
Member Author

vhvb1989 commented Jun 8, 2022

closing on the benefit of #3728

@vhvb1989 vhvb1989 closed this Jun 8, 2022
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.

Can't generate project with samples
5 participants