Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hack around rebar3 compiling your project to output its version #256

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10562,8 +10562,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'erl'
const args = ['-version']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
win32: {
Expand All @@ -10579,8 +10580,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'erl.exe'
const args = ['+V']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
}
Expand Down Expand Up @@ -10608,8 +10610,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'elixir'
const args = ['-v']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
}
Expand Down Expand Up @@ -10648,8 +10651,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'gleam'
const args = ['--version']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
win32: {
Expand Down Expand Up @@ -10681,8 +10685,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'gleam.exe'
const args = ['--version']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
}
Expand Down Expand Up @@ -10713,8 +10718,12 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'rebar3'
const args = ['version']
const env = {
REBAR_GLOBAL_CONFIG_DIR: '/fake-dir',
REBAR_CONFIG: 'fake.config',
}
Comment on lines +10721 to +10724
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the relevant change.


return [cmd, args]
return [cmd, args, env]
},
},
win32: {
Expand Down Expand Up @@ -10749,8 +10758,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'rebar3.cmd'
const args = ['version']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
}
Expand Down Expand Up @@ -10804,8 +10814,8 @@ async function installTool(opts) {
core.exportVariable(installDirForVarName, runnerToolPath)

core.info(`Installed ${installOpts.tool} version`)
const [cmd, args] = platformOpts.reportVersion()
await exec(cmd, args)
const [cmd, args, env] = platformOpts.reportVersion()
await exec(cmd, args, { env: { ...process.env, ...env } })
}

function checkPlatform() {
Expand Down
28 changes: 19 additions & 9 deletions src/setup-beam.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'erl'
const args = ['-version']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
win32: {
Expand All @@ -748,8 +749,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'erl.exe'
const args = ['+V']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
}
Expand Down Expand Up @@ -777,8 +779,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'elixir'
const args = ['-v']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
}
Expand Down Expand Up @@ -817,8 +820,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'gleam'
const args = ['--version']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
win32: {
Expand Down Expand Up @@ -850,8 +854,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'gleam.exe'
const args = ['--version']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
}
Expand Down Expand Up @@ -882,8 +887,12 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'rebar3'
const args = ['version']
const env = {
REBAR_GLOBAL_CONFIG_DIR: '/fake-dir',
REBAR_CONFIG: 'fake.config',
}

return [cmd, args]
return [cmd, args, env]
},
},
win32: {
Expand Down Expand Up @@ -918,8 +927,9 @@ async function install(toolName, opts) {
reportVersion: () => {
const cmd = 'rebar3.cmd'
const args = ['version']
const env = {}

return [cmd, args]
return [cmd, args, env]
},
},
}
Expand Down Expand Up @@ -973,8 +983,8 @@ async function installTool(opts) {
core.exportVariable(installDirForVarName, runnerToolPath)

core.info(`Installed ${installOpts.tool} version`)
const [cmd, args] = platformOpts.reportVersion()
await exec(cmd, args)
const [cmd, args, env] = platformOpts.reportVersion()
await exec(cmd, args, { env: { ...process.env, ...env } })
}

function checkPlatform() {
Expand Down