Skip to content

Commit

Permalink
Simulator: custom build errors from Solar2D directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Shchvova committed Jun 8, 2020
1 parent 0da9aec commit 9f728e3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
14 changes: 3 additions & 11 deletions platform/mac/OSXAppBuildController.mm
Expand Up @@ -518,21 +518,13 @@ - (IBAction)build:(id)sender
// Display the error
if (params->GetBuildMessage() != NULL)
{
msg = @"Build Failed\n\n";
msg = [msg stringByAppendingString:[NSString stringWithExternalString:params->GetBuildMessage()]];
msg = [msg stringByAppendingString:@"\n\n"];
msg = [NSString stringWithExternalString:params->GetBuildMessage()];
}
else
{
msg = @"Unexpected build error.\n\n";
msg = [msg stringByAppendingString:[NSString stringWithFormat:@"Error code: %ld\n\n", code]];
msg = [NSString stringWithFormat:@"Unexpected build error.\n\nError code: %ld", code];
}

details = [[NSDictionary alloc] initWithObjectsAndKeys:msg, NSLocalizedDescriptionKey, nil];
error = [[NSError alloc] initWithDomain:@"CoronaSimulator" code:101 userInfo:details];
[NSApp presentError:error modalForWindow:[self window] delegate:self didPresentSelector:@selector(didPresentErrorWithRecovery:contextInfo:) contextInfo:(void*)code];
[error release];
[details release];
[self showError:@"Build Failed" message:msg helpURL:nil parentWindow:[self window]];
}

[self saveBuildPreferences];
Expand Down
16 changes: 16 additions & 0 deletions platform/resources/CoronaBuilderPluginCollector.lua
Expand Up @@ -140,8 +140,12 @@ function PluginCollectorSolar2DDirectory:collect(destination, plugin, pluginTabl
if not pluginEntry then
return "Solar2D Directory: plugin " .. plugin .. " was not found at Solar2D Directory"
end

local pluginObject = pluginEntry.plugin
local repoOwner = pluginEntry.repo
if pluginObject.e then
return "! " .. pluginObject.e
end

local build = tonumber(params.build)
local vFoundBuid, vFoundObject, vFoundBuildName
Expand Down Expand Up @@ -406,6 +410,9 @@ local function fetchSinglePluginNoFallbacks(dstDir, plugin, pluginTable, pluginP
ok = true
break
elseif type(result) == 'string' then
if result:sub(1,2) == "! " then
return result
end
err = err .. '\n\t' .. result
end
end
Expand All @@ -427,6 +434,9 @@ local function fetchSinglePlugin(dstDir, plugin, pluginTable, basePluginPlatform
for i = 1, numFallbacks do
local fallbackRes = fetchSinglePluginNoFallbacks(dstDir, plugin, pluginTable, fallbackChain[i], params, pluginLocators, i == numFallbacks)
if not fallbackRes then return end -- success
if fallbackRes:sub(1,2) == "! " then
return fallbackRes
end
if res then
res = res .. "\n" .. fallbackRes
else
Expand Down Expand Up @@ -503,6 +513,9 @@ local function CollectCoronaPlugins(params)
if type(pluginTable) ~= 'table' then return 'Invalid plugin table for ' .. plugin end
local result = fetchSinglePlugin(dstDir, plugin, pluginTable, pluginPlatform, params, pluginLocators)
if type(result) == 'string' then
if result:sub(1,2) == "! " then
return result:sub(3)
end
if params.continueOnError then
ret = (ret or "") .. result .. "\n"
else
Expand All @@ -521,6 +534,9 @@ local function CollectCoronaPlugins(params)
log("Collecting dependency " .. plugin)
local result = fetchSinglePlugin(dstDir, plugin, pluginTable, pluginPlatform, params, pluginLocators)
if type(result) == 'string' then
if result:sub(1,2) == "! " then
return result:sub(3)
end
if params.continueOnError then
ret = (ret or "") .. result .. "\n"
else
Expand Down
3 changes: 2 additions & 1 deletion platform/resources/shell.lua
Expand Up @@ -426,7 +426,8 @@ function PluginSync:downloadQueuedPlugins( onComplete )
local updateTime = self.now
if type(result.result) == 'string' then
updateTime = nil
print("WARNING: there was an issue whilde downloading simulator plugin placeholders:\n" .. result.result)
local res = result.result:gsub('%[(.-)%]%((https?://.-)%)', '%1 (%2)')
print("WARNING: there was an issue whilde downloading simulator plugin placeholders:\n" .. res)
end
for i=1,#self.queue do
local key = self.queue[i].clientCatalogKey
Expand Down

0 comments on commit 9f728e3

Please sign in to comment.