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

ndk-build: Add support for <queries> element #259

Merged
merged 11 commits into from
May 6, 2022
Merged

ndk-build: Add support for <queries> element #259

merged 11 commits into from
May 6, 2022

Conversation

korejan
Copy link
Contributor

@korejan korejan commented Apr 5, 2022

Adds support for <queries> element added to API level 30: https://developer.android.com/guide/topics/manifest/queries-element

Note: <provider> elements contained with <queries> only require an android:authorities attribute however aapt does not seem to understand this and throws errors about missing android:name attribuites so I have added an extra android:name attribute as a workaround. Maybe ndk-build needs to update to use aapt2?

Also note there are suppose to be restrictions on what child elements and attributes for those are usuable for <intent> elements within an <queries> element but this change only reueses the same structs used by <intent-filter>.

korejan added 2 commits April 5, 2022 16:36
Adds support for <queries> element added to API level 30: https://developer.android.com/guide/topics/manifest/queries-element

Note: <provider> elements contained with <queries> only require an android:authorities attribute however aapt does not seem recognize this and throw errors about missing android:name attribuites. Maybe ndk-build needs to update to use aapt2?
Applying cargo fmt to code.
ndk-build/src/manifest.rs Outdated Show resolved Hide resolved
ndk-build/src/manifest.rs Outdated Show resolved Hide resolved
ndk-build/src/manifest.rs Outdated Show resolved Hide resolved
ndk-build/src/manifest.rs Outdated Show resolved Hide resolved
@@ -29,6 +29,9 @@ pub struct AndroidManifest {
#[serde(default)]
pub uses_permission: Vec<Permission>,

#[serde(default)]
pub queries: Vec<Query>,
Copy link
Member

Choose a reason for hiding this comment

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

Can this element be specified multiple times?

Copy link
Contributor Author

@korejan korejan Apr 5, 2022

Choose a reason for hiding this comment

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

I assume not but i can't find any definitive claification in the docs, I'll change it to only one optional.

Copy link
Member

Choose a reason for hiding this comment

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

I thought I had removed this comment again, it seems like this is possible.

Since you have a use case for <queries> and have presumably tested this PR, could you perhaps add this element twice (with "bogus" values) and see if aapt complains?

Copy link
Member

Choose a reason for hiding this comment

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

@korejan Did you manage to test this, seeing as the current revision of this PR uses Option<Queries> instead of Vec<Queries>?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you mean test the change then yes, I'm using these features for my own project.

Copy link
Member

Choose a reason for hiding this comment

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

Have you tested it with multiple Queries elements, specifically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it changed to an Option type, not the way around and that it is what I'm using.

Copy link
Member

Choose a reason for hiding this comment

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

The request is to test that while it is a Vec, instead of assuming my question above implies that it does not, nor being confirmed by the lack of definitive documentation on the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It initially started as a Vec and changed to an Option because I can't get any clarification on if more than 1 is correct, so when I say I tested the change I mean, the current change.

I'm getting a feed-up with all these constant request to change minor things, I've never had this experinice with PRs I made to other projects. I have more changes I'd like to submit a PR for but I can't because it depends on these changes as well. I'm not working on this project, I'm working on project that depends on this project, I don't have time to spend on investigating various things on it. If you don't want this PR then I'll just leave it in my fork.

Copy link
Member

Choose a reason for hiding this comment

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

That's a bit harsh isn't it? I'm asking for you to undo and test a simple change, which you seem to have made on my request while I was really just asking because I have no idea either. This should be a trivial thing to test on your end.

I've never had this experinice with PRs I made to other projects

Maybe their level of quality assurance just isn't as high? I'm also mainly maintaining and contributing to this project in my free time, if I "just leave it" there's unlikely to be someone else with more time on their hands to review and approve your PR. And I don't want to merge in something that requires maintainer cleanup afterwards, nor incomplete/incorrect docs for end users. The only obvious solution is handling it in PR review.

@MarijnS95
Copy link
Member

Don't forget to document all the new elements in the README :)

@MarijnS95 MarijnS95 linked an issue Apr 5, 2022 that may be closed by this pull request
korejan and others added 3 commits April 5, 2022 17:09
Applying requested changes:
* Fixes comment typos and better wording
* Adds new elements to cargo-apk README
* Minor type renaming
* Changes manifest's `queries` member from a vec to singular option.
Copy link
Contributor Author

@korejan korejan left a comment

Choose a reason for hiding this comment

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

Pushed requested changes.

cargo-apk/README.md Outdated Show resolved Hide resolved
cargo-apk/README.md Outdated Show resolved Hide resolved
cargo-apk/README.md Outdated Show resolved Hide resolved
ndk-build/src/manifest.rs Outdated Show resolved Hide resolved
Applying suggested changes to documentation, adding some missing new elements.
cargo-apk/README.md Show resolved Hide resolved
cargo-apk/README.md Outdated Show resolved Hide resolved
@MarijnS95
Copy link
Member

Also note that we're slowly working towards deprecating ndk-build/cargo-apk in favour of xbuild (previously named x): #260

@dvc94ch and I still have to figure out how to forward-port recent changes (to ie. this manifest and some other bugfixes) including your PR to the new tool.

@MarijnS95 MarijnS95 added the status: waiting Waiting for a response or another PR label Apr 19, 2022
ndk-build/src/manifest.rs Outdated Show resolved Hide resolved
cargo-apk/README.md Outdated Show resolved Hide resolved
@MarijnS95 MarijnS95 changed the title Adds support for <queries> element ndk-build: Adds support for <queries> element May 6, 2022
@MarijnS95 MarijnS95 changed the title ndk-build: Adds support for <queries> element ndk-build: Add support for <queries> element May 6, 2022
@MarijnS95 MarijnS95 merged commit 52b0b07 into rust-mobile:master May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting Waiting for a response or another PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<queries> element
2 participants