fix(ci): inline functions
This commit is contained in:
parent
7b8aae7921
commit
5bf9ae731f
3 changed files with 14 additions and 18 deletions
|
|
@ -63,10 +63,6 @@ local function build_command(cmd_template, executable, substitutions)
|
|||
return cmd
|
||||
end
|
||||
|
||||
local function ensure_directories()
|
||||
vim.system({ 'mkdir', '-p', 'build', 'io' }):wait()
|
||||
end
|
||||
|
||||
---@param language_config table
|
||||
---@param substitutions table<string, string>
|
||||
---@return {code: integer, stdout: string, stderr: string}
|
||||
|
|
@ -252,7 +248,7 @@ function M.run_problem(ctx, contest_config, is_debug)
|
|||
is_debug = { is_debug, 'boolean' },
|
||||
})
|
||||
|
||||
ensure_directories()
|
||||
vim.system({ 'mkdir', '-p', 'build', 'io' }):wait()
|
||||
|
||||
local language = get_language_from_file(ctx.source_file, contest_config)
|
||||
local language_config = contest_config[language]
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ local function set_platform(platform)
|
|||
end
|
||||
|
||||
state.platform = platform
|
||||
vim.fn.mkdir('build', 'p')
|
||||
vim.fn.mkdir('io', 'p')
|
||||
vim.system({ 'mkdir', '-p', 'build', 'io' }):wait()
|
||||
return true
|
||||
end
|
||||
|
||||
|
|
@ -145,12 +144,8 @@ local function setup_problem(contest_id, problem_id, language)
|
|||
logger.log(('switched to problem %s'):format(ctx.problem_name))
|
||||
end
|
||||
|
||||
local function ensure_io_directory()
|
||||
vim.fn.mkdir('io', 'p')
|
||||
end
|
||||
|
||||
local function scrape_missing_problems(contest_id, missing_problems)
|
||||
ensure_io_directory()
|
||||
vim.fn.mkdir('io', 'p')
|
||||
|
||||
logger.log(('scraping %d uncached problems...'):format(#missing_problems))
|
||||
|
||||
|
|
|
|||
|
|
@ -21,10 +21,6 @@ local function get_plugin_path()
|
|||
return vim.fn.fnamemodify(plugin_path, ':h:h:h')
|
||||
end
|
||||
|
||||
local function ensure_io_directory()
|
||||
vim.fn.mkdir('io', 'p')
|
||||
end
|
||||
|
||||
local function check_internet_connectivity()
|
||||
local result = vim.system({ 'ping', '-c', '1', '-W', '3', '8.8.8.8' }, { text = true }):wait()
|
||||
return result.code == 0
|
||||
|
|
@ -144,7 +140,7 @@ function M.scrape_problem(ctx)
|
|||
ctx = { ctx, 'table' },
|
||||
})
|
||||
|
||||
ensure_io_directory()
|
||||
vim.fn.mkdir('io', 'p')
|
||||
|
||||
if vim.fn.filereadable(ctx.input_file) == 1 and vim.fn.filereadable(ctx.expected_file) == 1 then
|
||||
local base_name = vim.fn.fnamemodify(ctx.input_file, ':r')
|
||||
|
|
@ -373,7 +369,16 @@ function M.scrape_problems_parallel(platform, contest_id, problems, config)
|
|||
scrape_result = data
|
||||
|
||||
if data.tests and #data.tests > 0 then
|
||||
local ctx = problem.create_context(platform, contest_id, problem_id, config)
|
||||
local ctx_contest_id, ctx_problem_id
|
||||
if platform == 'cses' then
|
||||
ctx_contest_id = problem_id
|
||||
ctx_problem_id = nil
|
||||
else
|
||||
ctx_contest_id = contest_id
|
||||
ctx_problem_id = problem_id
|
||||
end
|
||||
|
||||
local ctx = problem.create_context(platform, ctx_contest_id, ctx_problem_id, config)
|
||||
local base_name = vim.fn.fnamemodify(ctx.input_file, ':r')
|
||||
|
||||
for i, test_case in ipairs(data.tests) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue