Skip to content

Commit

Permalink
Merge pull request #453 from scala-steward-org/feature/simplify-pre
Browse files Browse the repository at this point in the history
Stop installing JVM
  • Loading branch information
alejandrohdezma authored Jan 9, 2023
2 parents f779e5c + ebfbc4c commit e90c822
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 24 deletions.
8 changes: 8 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ inputs:
or `.sbtopts`) when found on repositories or not.
default: "true"
required: false
mill-version:
description: |
Mill version to install. Take into account this will
just affect the global `mill` executable. Scala
Steward will still respect the version specified in
your repository while updating it.
default: "0.10.9"
required: false
other-args:
description: |
Other Scala Steward arguments not yet supported by
Expand Down
1 change: 0 additions & 1 deletion src/action/pre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as mill from '../modules/mill'
*
* - Check connection with Maven Central
* - Install Coursier
* - Install JVM
* - Install Scalafmt
* - Install Scalafix
* - Install Mill
Expand Down
6 changes: 3 additions & 3 deletions src/modules/coursier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function install(): Promise<void> {

await exec.exec(
'cs',
['setup', '--yes', '--jvm', 'adoptium:17', '--apps', 'scalafmt,scalafix', '--install-dir', binPath],
['install', 'scalafmt', 'scalafix', '--install-dir', binPath],
{
silent: true,
listeners: {stdline: core.debug, errline: core.debug},
Expand All @@ -43,11 +43,11 @@ export async function install(): Promise<void> {

core.info(`✓ Coursier installed, version: ${coursierVersion.trim()}`)

const scalafmtVersion = await execute('scalafmt', '--version')
const scalafmtVersion = await execute('cs', 'launch', 'scalafmt', '--', '--version')

core.info(`✓ Scalafmt installed, version: ${scalafmtVersion.replace(/^scalafmt /, '').trim()}`)

const scalafixVersion = await execute('scalafix', '--version')
const scalafixVersion = await execute('cs', 'launch', 'scalafix', '--', '--version')

core.info(`✓ Scalafix installed, version: ${scalafixVersion.trim()}`)
} catch (error: unknown) {
Expand Down
22 changes: 2 additions & 20 deletions src/modules/mill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as exec from '@actions/exec'
*/
export async function install(): Promise<void> {
try {
const millVersion = core.getInput('mill-version') || '0.10.9'
const millVersion = core.getInput('mill-version')

const cachedPath = tc.find('mill', millVersion)

Expand All @@ -33,25 +33,7 @@ export async function install(): Promise<void> {
await tc.cacheFile(mill, 'mill', 'mill', millVersion)
}

let output = ''

const code = await exec.exec('mill', ['--version'], {
silent: true,
ignoreReturnCode: true,
listeners: {
stdout(data) {
(output += data.toString())
}, errline: core.debug,
},
})

if (code !== 0) {
throw new Error('Unable to install Mill')
}

const version = output.split('\n')[0].replace(/^Mill Build Tool version /, '').trim()

core.info(`✓ Mill installed, version: ${version}`)
core.info(`✓ Mill installed, version: ${millVersion}`)
} catch (error: unknown) {
core.error((error as Error).message)
throw new Error('Unable to install Mill')
Expand Down

0 comments on commit e90c822

Please sign in to comment.