-
Notifications
You must be signed in to change notification settings - Fork 341
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
feat: Support for android build variants without requiring a fully qualified value in the --apk-component
flag
#1941
feat: Support for android build variants without requiring a fully qualified value in the --apk-component
flag
#1941
Conversation
…alified value in the `--apk-component` flag
tests/unit/test-util/test.adb.js
Outdated
'org.mozilla.geckoview_example', | ||
'org.mozilla.geckoview_example.GeckoViewActivity', // firefoxApkComponent | ||
'org.mozilla.geckoview_example.release', | ||
'GeckoViewActivity', // firefoxApkComponent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those tests should not be modified (because the old syntax should still work).
Please add a new test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing - I'll add a new test for org.mozilla.fenix.nightly
|
||
export const browserList = [ | ||
'org.mozilla.fennec', | ||
'org.mozilla.fenix', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you run an actual test with org.mozilla.fenix.nightly
to verify that it works, and if it does work, add a unit test for it? It is not entirely obvious that org.mozilla.fenix.nightly
ought to use org.mozilla.fenix
as the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, just added the test in the new commit
src/firefox/package-identifiers.js
Outdated
@@ -0,0 +1,10 @@ | |||
/* @flow */ | |||
|
|||
export const browserList = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to packageIdBases
?
or just export default
. The file name, packageIdentifiers
, is already a nice name on its own.
if (!apkComponent) { | ||
apkComponent = '.App'; | ||
} else if (!apkComponent.includes('.')) { | ||
apkComponent = `.${apkComponent}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This original logic should be kept. It allows users to use a custom app that isn't in the hardcoded list. For example if they develop their own GeckoView-based app.
The change that you need is to check if apk
starts with any of the known prefixes, and if it is, prepend that prefix before .${apkComponent}
.
…to support full and shortened apkComponents, added org.mozilla.fenix.nightly test
src/util/adb.js
Outdated
break; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully this isn't too hacky - it's mainly due to wanting to leave the loop if geckoview_example
has been checked, so it doesn't check again on geckoview
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break
after finding the matching apk
is not a hack, it looks normal.
src/util/adb.js
Outdated
break; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break
after finding the matching apk
is not a hack, it looks normal.
src/util/adb.js
Outdated
@@ -271,6 +272,17 @@ export default class ADBUtils { | |||
value: `-profile ${deviceProfileDir}`, | |||
}]; | |||
|
|||
for (const browser of packageIdentifiers) { | |||
if (apk.startsWith(browser) && apkComponent) { | |||
if (apk !== browser && !apkComponent.includes('.')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic should be after the following block below, to make sure that the browser
is also prepended by default (.App
):
if (!apkComponent) {
apkComponent = '.App';
} else if (!apkComponent.includes('.')) {
apkComponent = `.${apkComponent}`;
}
It would be nice to have unit tests to cover these cases.
And then the logic should be like this:
if (apkComponent.startsWith(".")) {
// loop over packageIdentifiers,
// and if apk is either identical to the package,
// or apk starts with `${package}.`,
// prepend the package identifier before `apkComponent`
// and break.
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or apk starts with
${package}.
Ah! That's a good idea for the whole "geckoview" vs "geckoview_example"
…upport-variants-without-fully-qualified-value
src/util/adb.js
Outdated
// before `apkComponent` | ||
if (apkComponent.startsWith('.')) { | ||
for (const browser of packageIdentifiers) { | ||
if (apk.startsWith(`${browser}.`)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick note (before I move on to adding tests):
In the previous comment, there was the condition:
if apk is either identical to the package, or apk starts with `${package}.`
For the tests to work, I took out the apk is identical to the package
part of the or
condition.
The offended test was: starts a given APK component without a period
- Incoming apk:
org.mozilla.geckoview_example
- Incoming apkComponent:
GeckoViewActivity
- Expected result:
org.mozilla.geckoview_example/.GeckoViewActivity
- Result received:
org.mozilla.geckoview_example/org.mozilla.geckoview_example.GeckoViewActivity
Would you like me to expand out the Expected Result of this test to match the received result and use the apk is identical to the package
condition on this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ADB the two results are equivalent.
The behavior of the received result is probably more desirable to support the .debug/. performancetest scenarios.
Hey, sorry I've been spotty on this PR - backlogged with work and class. On Aug 23rd I should have a nice break - this PR is a simple fix, but I like to have full attention for it before proceeding. Should be good then. |
Thanks for the heads-up @MikeM711 and no worries! Your contributions are appreciated, regardless of how much time it takes. |
…upport-variants-without-fully-qualified-value
…the respective test.adb case
Assuming that the previous commit looks good to you, For APK tests we currently have:
To take care of, #1941 (comment), what do you think about these few tests?
|
The proposed tests look good. Thanks for the table with the clear summarizing overview.
I would make this "starts without specifying an APK component" |
…upport-variants-without-fully-qualified-value
No problem! Let me know how it looks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #1935
Desired behavior from the original issue: