-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Android] Add option to skip generating apk for a specific project #80909
[Android] Add option to skip generating apk for a specific project #80909
Conversation
Tagging subscribers to this area: @directhex Issue DetailsFollow-up to #80391, supersedes #80874 /cc @lambdageek The I tried several ways of preventing the referenced project to be built into an .apk and the simplest and cleanest solution I arrived at is a new property that can be defined in the .csproj.
|
4df305f
to
289e726
Compare
/azp run runtime-android |
Azure Pipelines successfully started running 1 pipeline(s). |
The failing test on Android is #80863 |
<Target Name="_AndroidGenerateAppBundle" DependsOnTargets="_AndroidGenerateRuntimeConfig"> | ||
<Target | ||
Name="_AndroidGenerateAppBundle" | ||
Condition="$(_SkipAndroidGenerateAppBundle) != 'true'" |
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.
The WasmApp.targets makes a property IsBrowserWasmProject
that is only true if the OutputType is not Library, by default. and then gates all the wasm-specific build logic based on that.
runtime/src/mono/wasm/build/WasmApp.targets
Line 100 in a734aa4
<IsBrowserWasmProject Condition="'$(IsBrowserWasmProject)' == '' and '$(OutputType)' != 'Library'">true</IsBrowserWasmProject> |
Maybe something like that should be done for Android too? Although I didn't look if the test runners are Exe or Library and if all the functional tests are exe's, too.
/cc @radical
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.
I looked into the option of using OutputType
but from what I understand we can't use it because at least the library tests don't set the OutputType
and afaik the default is Library
.
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.
How does it work on wasm then?
It shouldn't matter if the library tests are OutputType=Library
- the test runner is an exe, right?
But I'm not sure what step is responsible for taking a FOO.Tests.dll
and the apropriate test runner and putting them together into a single app.
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.
I think from a managed perspective it's all going to be a library.
@simonrozsival I would make a property similar to
<WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">true</WasmGenerateAppBundle> |
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.
We explicitly set the properties for the test projects:
runtime/eng/testing/tests.wasm.targets
Lines 4 to 5 in 0e12347
<IsBrowserWasmProject Condition="'$(IsBrowserWasmProject)' == ''">true</IsBrowserWasmProject> | |
<WasmGenerateAppBundle Condition="'$(WasmGenerateAppBundle)' == ''">true</WasmGenerateAppBundle> |
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.
I replaced the _SkipAndroidGenerateAppBundle
with AndroidGenerateAppBundle
.
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 seems like an ok hack to me, but I'd like some feedback from someone who understands the android libraries test setup more than me.
It still doesn't make sense to me that src/FunctionalTests/TestAssets/**/*.csproj
should even be considered for APK creation if it's not IsTestProject
or IsFunctionalTest
or anything like that.
It doesn't look like we gate much on these properties. On Android/iOS, IsFunctionalTest helps understand where to look for the apk's. I don't think it was ever about opting in. |
/azp run runtime-android |
Azure Pipelines successfully started running 1 pipeline(s). |
Follow-up to #80391, supersedes #80874
/cc @lambdageek
The
Android.Device_Emulator.StartupHook.Test.csproj
functional test referencesStartupHookForFunctionalTest.csproj
. Counterintuitively, this causes theStartupHookForFunctionalTest
project to be built into an.apk
bundle and this APK is then executed as if it were a test executable and this "test" then obviously fails.https://github.com/dotnet/runtime/blob/main/src/tests/FunctionalTests/Android/Device_Emulator/StartupHook/Android.Device_Emulator.StartupHook.Test.csproj#L16-L18
I tried several ways of preventing the referenced project to be built into an .apk and the simplest and cleanest solution I arrived at is a new property that can be defined in the .csproj.