Skip to content

[android] Fix java runner to not assume zip format when unzipping - #112654

Merged
steveisok merged 3 commits into
dotnet:mainfrom
steveisok:fix-android-java-runner
Feb 18, 2025
Merged

[android] Fix java runner to not assume zip format when unzipping#112654
steveisok merged 3 commits into
dotnet:mainfrom
steveisok:fix-android-java-runner

Conversation

@steveisok

Copy link
Copy Markdown
Member

After #112256 landed, there was a change to zip the test assets using ZipFile.CreateFromDirectory for cross platform support. This regressed unzipAssets in MonoRunner.java because it naivley assumed that directories would come before files in the zip archive.

This change fixes the problem by making sure directories are created first before writing files to disk.

Fixes#112558

After dotnet#112256 landed, there was a change to zip the test assets
using `ZipFile.CreateFromDirectory` for cross platform support. This regressed `unzipAssets` in `MonoRunner.java`
because it naivley assumed that directories would come before files in the zip archive.
This change fixes the problem by making sure directories are created first before writing files to disk.
Fixesdotnet#112558
CopilotAI review requested due to automatic review settings February 18, 2025 15:13

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/tasks/AndroidAppBuilder/Templates/MonoRunner.java:170

  • The FileOutputStream should be closed in a finally block or using a try-with-resources statement to ensure it is always closed.
FileOutputStream fileOutputStream = new FileOutputStream(fullToPath);

Comment threadsrc/tasks/AndroidAppBuilder/Templates/MonoRunner.java Outdated
@steveisok

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-android

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment threadsrc/tasks/AndroidAppBuilder/Templates/MonoRunner.java
Comment threadsrc/tasks/AndroidAppBuilder/Templates/MonoRunner.java Outdated
steveisokand others added 2 commits February 18, 2025 10:53
@steveisok

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-android

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmiloskotlarmilos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android][Tests] Android library tests with content items fail: Could not find a part of the path /data/data

4 participants

@steveisok@akoeplinger@kotlarmilos