@@ -2166,35 +2166,15 @@ fn rocBuild(allocs: *Allocators, args: cli_args.BuildArgs) !void {
21662166 },
21672167 }
21682168
2169- // Only support int test platform for cross-compilation
2170- // Check if path contains "int" directory using cross-platform path handling
2171- const path_contains_int = blk : {
2172- var iter = std .fs .path .componentIterator (args .path ) catch break :blk false ;
2173- while (iter .next ()) | component | {
2174- if (std .mem .eql (u8 , component .name , "int" )) {
2175- break :blk true ;
2176- }
2177- }
2178- break :blk false ;
2179- };
2180-
2181- const platform_type = if (path_contains_int )
2182- "int"
2183- else {
2184- std .log .err ("roc build cross-compilation currently only supports the int test platform" , .{});
2185- std .log .err ("Your app path: {s}" , .{args .path });
2186- std .log .err ("For str platform and other platforms, please use regular 'roc' command" , .{});
2187- return error .UnsupportedPlatform ;
2169+ // Detect platform directory from app path (e.g., test/int/app.roc -> test/int/platform)
2170+ const platform_dir = blk : {
2171+ const app_dir = std .fs .path .dirname (args .path ) orelse {
2172+ std .log .err ("Could not determine directory from app path: {s}" , .{args .path });
2173+ return error .InvalidAppPath ;
2174+ };
2175+ break :blk try std .fs .path .join (allocs .arena , &.{ app_dir , "platform" });
21882176 };
21892177
2190- std .log .info ("Detected platform type: {s}" , .{platform_type });
2191-
2192- // Get platform directory path
2193- const platform_dir = if (std .mem .eql (u8 , platform_type , "int" ))
2194- try std .fs .path .join (allocs .arena , &.{ "test" , "int" , "platform" })
2195- else
2196- try std .fs .path .join (allocs .arena , &.{ "test" , "str" , "platform" });
2197-
21982178 // Check that platform exists
21992179 std .fs .cwd ().access (platform_dir , .{}) catch | err | {
22002180 std .log .err ("Platform directory not found: {s} ({})" , .{ platform_dir , err });
@@ -2220,9 +2200,18 @@ fn rocBuild(allocs: *Allocators, args: cli_args.BuildArgs) !void {
22202200 return err ;
22212201 };
22222202
2223- // Get expected entrypoints for this platform
2224- const entrypoints = try app_stub .getTestPlatformEntrypoints (allocs .gpa , platform_type );
2225- defer allocs .gpa .free (entrypoints );
2203+ // Get expected entrypoints by parsing the platform's main.roc file
2204+ const platform_source_path = try std .fs .path .join (allocs .arena , &.{ platform_dir , "main.roc" });
2205+ var entrypoints_list = std .array_list .Managed ([]const u8 ).init (allocs .arena );
2206+ defer entrypoints_list .deinit ();
2207+
2208+ try extractEntrypointsFromPlatform (allocs , platform_source_path , & entrypoints_list );
2209+
2210+ // Convert to PlatformEntrypoint array for generateAppStubObject
2211+ const entrypoints = try allocs .arena .alloc (app_stub .PlatformEntrypoint , entrypoints_list .items .len );
2212+ for (entrypoints_list .items , 0.. ) | name , i | {
2213+ entrypoints [i ] = app_stub.PlatformEntrypoint { .name = name };
2214+ }
22262215
22272216 std .log .info ("Expected entrypoints: {}" , .{entrypoints .len });
22282217 for (entrypoints , 0.. ) | ep , i | {
0 commit comments