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

Add support for setting Coursier's --extra-jars option when launching Scala Steward #579

Merged
merged 2 commits into from
Mar 5, 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
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ inputs:
Url to download the coursier linux CLI from.
default: https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz
required: false
extra-jars:
description: |
Extra JARs to be added to the classpath of the
launched application. Directories accepted too.
required: false
github-api-url:
description: |
The URL of the GitHub API, only use this input if
Expand Down
2 changes: 1 addition & 1 deletion src/action/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async function run(): Promise<void> {
'--do-not-fork',
'--disable-sandbox',
inputs.steward.extraArgs?.value.split(' ') ?? [],
])
], inputs.steward.extraJars)

if (files.existsSync(workspace.runSummary_md)) {
logger.info(`✓ Run Summary file: ${workspace.runSummary_md}`)
Expand Down
3 changes: 3 additions & 0 deletions src/modules/coursier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ export async function install(): Promise<void> {
*
* @param app - The application to launch
* @param arguments_ - The args to pass to the application launcher.
* @param extraJars - Extra JARs to be added to the classpath of the launched application. Directories accepted too.
*/
export async function launch(
app: string,
arguments_: Array<string | string[]> = [],
extraJars: NonEmptyString | undefined = undefined,
): Promise<void> {
core.startGroup(`Launching ${app}`)

Expand All @@ -78,6 +80,7 @@ export async function launch(
'-r',
'sonatype:snapshots',
app,
...(extraJars ? ['--extra-jars', extraJars.value] : []),
'--',
...arguments_.flatMap((argument: string | string[]) => (typeof argument === 'string' ? [argument] : argument)),
]
Expand Down
2 changes: 2 additions & 0 deletions src/modules/input.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ test('`Input.all` → returns all inputs', t => {
.with('scalafix-migrations', () => '.github/scalafix-migrations.conf')
.with('other-args', () => '--help')
.with('signing-key', () => '42')
.with('extra-jars', () => 'path/to/my/jars')
.otherwise(() => '')

const booleanInputs = (name: string) => match(name)
Expand Down Expand Up @@ -56,6 +57,7 @@ test('`Input.all` → returns all inputs', t => {
timeout: nonEmpty('60s'),
ignoreOptsFiles: true,
extraArgs: nonEmpty('--help'),
extraJars: nonEmpty('path/to/my/jars'),
},
migrations: {
scalafix: nonEmpty('.github/scalafix-migrations.conf'),
Expand Down
1 change: 1 addition & 0 deletions src/modules/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class Input {
timeout: nonEmpty(this.inputs.getInput('timeout')),
ignoreOptsFiles: this.inputs.getBooleanInput('ignore-opts-files'),
extraArgs: nonEmpty(this.inputs.getInput('other-args')),
extraJars: nonEmpty(this.inputs.getInput('extra-jars')),
},
migrations: {
scalafix: nonEmpty(this.inputs.getInput('scalafix-migrations')),
Expand Down