Skip to content

Conversation

@jonathanpeppers
Copy link
Member

Context: #19611

Ignoring tasks related to AOT and trimming, one of the slower steps during a remote iOS build from Windows for me is:

Task _CoreCompileImageAssets 524ms
Building target "_CoreCompileImageAssets" completely.
Output file "obj\Debug\net9.0-ios\iossimulator-arm64\actool\_PartialAppManifest.items" does not exist.

When building locally on Mac, the same build will say:

Target _CoreCompileImageAssets
Skipping target "_CoreCompileImageAssets" because all output files are up-to-date with respect to the input files.

The MSBuild target has the code:

<Target Name="_CoreCompileImageAssets"
    Inputs="@(ImageAsset);$(_TemporaryAppManifest)"
    Outputs="$(_ACTool_PartialAppManifestCache);$(_ACTool_BundleResourceCache)"
    ...>

    <ACTool ... />

    <WriteItemsToFile Items="@(_ACTool_PartialAppManifest)" ... />
    <WriteItemsToFile Items="@(_ACTool_BundleResources)" ... />
    <ItemGroup>
        <FileWrites Include="$(_ACTool_PartialAppManifestCache);$(_ACTool_BundleResourceCache)" />
    </ItemGroup>
</Target>

I think all that needs to be done is to implement ITaskCallback in the <WriteItemsToFile/> MSBuild task:

public bool ShouldCreateOutputFile (ITaskItem item) => true;

I updated WindowsTest.cs to verify that the
_CoreCompileImageAssets MSBuild target is skipped on incremental builds.

jonathanpeppers and others added 2 commits May 6, 2025 09:08
Context: #19611

Ignoring tasks related to AOT and trimming, one of the slower steps
during a remote iOS build from Windows for me is:

    Task _CoreCompileImageAssets 524ms
    Building target "_CoreCompileImageAssets" completely.
    Output file "obj\Debug\net9.0-ios\iossimulator-arm64\actool\_PartialAppManifest.items" does not exist.

When building locally on Mac, the same build will say:

    Target _CoreCompileImageAssets
    Skipping target "_CoreCompileImageAssets" because all output files are up-to-date with respect to the input files.

The MSBuild target has the code:

    <Target Name="_CoreCompileImageAssets"
        Inputs="@(ImageAsset);$(_TemporaryAppManifest)"
        Outputs="$(_ACTool_PartialAppManifestCache);$(_ACTool_BundleResourceCache)"
        ...>

        <ACTool ... />

        <WriteItemsToFile Items="@(_ACTool_PartialAppManifest)" ... />
        <WriteItemsToFile Items="@(_ACTool_BundleResources)" ... />
        <ItemGroup>
            <FileWrites Include="$(_ACTool_PartialAppManifestCache);$(_ACTool_BundleResourceCache)" />
        </ItemGroup>
    </Target>

I think all that needs to be done is to implement `ITaskCallback`
in the `<WriteItemsToFile/>` MSBuild task:

    public bool ShouldCreateOutputFile (ITaskItem item) => true;

I updated `WindowsTest.cs` to verify that the
`_CoreCompileImageAssets` MSBuild target is skipped on incremental
builds.
public bool ShouldCopyToBuildServer (ITaskItem item) => false;

//We want empty output files to be created in Windows
public bool ShouldCreateOutputFile (ITaskItem item) => true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remote tasks create empty output files by default for each ITaskItem output property, so this should not be needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

@emaf is there a deeper problem here? It's not working in this log:

RecipeFinder_Debug_AnyCPU_net9.0-ios_Build_2025-05-05T16_03_13.6534537-05_00.zip

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to be copying the outputs and run the write items locally because of the missing SessionId, as Ema mentioned:

image

Copy link
Contributor

@mauroa mauroa May 6, 2025

Choose a reason for hiding this comment

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

Somehow:

Output file "obj\Debug\net9.0-ios\iossimulator-arm64\actool\_PartialAppManifest.items" does not exist.

Copy link
Member Author

Choose a reason for hiding this comment

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

Going to leave this open and review what my test changes did.

@emaf
Copy link
Contributor

emaf commented May 6, 2025

WriteItemsToFile should be executed locally on Windows for _CoreCompileImageAssets as we are not passing a SessionId, so it should be creating the files locally 😕 . Could you share your binlog?

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #1b69c18] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 1b69c182c1acb938acb471108d761a826b5934e5 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #1b69c18] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 1b69c182c1acb938acb471108d761a826b5934e5 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

✅ API diff vs stable

.NET ( No breaking changes )

✅ Generator diff

Generator diff is empty

Pipeline on Agent
Hash: 1b69c182c1acb938acb471108d761a826b5934e5 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #1b69c18] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 1b69c182c1acb938acb471108d761a826b5934e5 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #1b69c18] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 1b69c182c1acb938acb471108d761a826b5934e5 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #1b69c18] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 1b69c182c1acb938acb471108d761a826b5934e5 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #1b69c18] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 1b69c182c1acb938acb471108d761a826b5934e5 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #fda8a09] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 1 tests failed, 112 tests passed.

Failures

❌ windows tests

1 tests failed, 0 tests passed.
Details

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 8 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: fda8a0980a158f9e54316f5524699683dd271f94 [PR build]

Copy link
Member Author

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

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

My test works! This part is useful at least:

Xamarin.Tests.WindowsTest.BundleStructureWithRemoteMac(iOS,"ios-arm64",All,"Debug") (Failed): The target '_CoreCompileImageAssets' was unexpectedly executed (_CoreCompileImageAssets Rebuild 1)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #1b69c18] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 1b69c182c1acb938acb471108d761a826b5934e5 [PR build]

@jonathanpeppers
Copy link
Member Author

Going to close this one and address this one instead:

I'll probably reuse the test.

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.

4 participants