Skip to content

Commit

Permalink
Merge pull request #579 from lgmyrek/master
Browse files Browse the repository at this point in the history
Add support for setting Coursier's --extra-jars option when launching Scala Steward
  • Loading branch information
alejandrohdezma committed Mar 5, 2024
2 parents ccf03a8 + e0b735b commit 03a5951
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
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

0 comments on commit 03a5951

Please sign in to comment.