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

Give some love to the project #70

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
48 changes: 28 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI
on:
push:
branches:
- master
- main
pull_request:

jobs:
native-image:
name: Compile
Expand All @@ -13,33 +13,41 @@ jobs:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
java: [8]
java: ['17.0.7']

steps:
- uses: actions/checkout@v3
- uses: olafurpg/setup-scala@v13
- uses: graalvm/setup-graalvm@v1
with:
java-version: "adopt@1.${{ matrix.java }}"
- name: Setup Windows C++ toolchain
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-latest' }}
java-version: ${{ matrix.java }}
cache: sbt
components: native-image

- name: sbt test plugin/scripted
if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
env:
NATIVE_IMAGE_COMMAND: native-image
run: |
export JABBA=/home/runner/bin/jabba
$JABBA install [email protected]
export GRAALVM_HOME=$($JABBA which --home [email protected])
$GRAALVM_HOME/bin/gu install native-image
export NATIVE_IMAGE_COMMAND=$GRAALVM_HOME/bin/native-image
# Copied from https://github.com/graalvm/setup-graalvm#quickstart-template
echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
sbt test plugin/scripted
- name: sbt test
shell: bash
if: ${{ matrix.os == 'windows-latest' }}
run: |
sbt example/nativeImage

# - name: sbt test
# shell: bash
# if: ${{ matrix.os == 'windows-latest' }}
# run: |
# sbt example/nativeImage

check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: olafurpg/setup-scala@v13
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'sbt'
- run: sbt checkAll
8 changes: 7 additions & 1 deletion .github/workflows/native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: Native Image
on:
push:
branches:
- master
- main
pull_request:
release:
types: [published]

jobs:
native-image:
runs-on: ${{ matrix.os }}
Expand All @@ -29,6 +29,7 @@ jobs:
# define Java options for both official sbt and sbt-extras
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8

steps:
- uses: actions/checkout@v3
- name: Setup JDK
Expand All @@ -37,19 +38,24 @@ jobs:
distribution: temurin
java-version: 8
cache: sbt

- run: git fetch --tags || true

- name: Setup Windows C++ toolchain
uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-latest' }}

- name: Build
shell: bash
run: |
echo $(pwd)
sbt clean example/nativeImage
- uses: actions/upload-artifact@v2
with:
path: ${{ matrix.local_path }}
name: ${{ matrix.uploaded_filename }}

- name: Upload release
if: github.event_name == 'release'
uses: actions/[email protected]
Expand Down
25 changes: 24 additions & 1 deletion .scalafix.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
rules = [
OrganizeImports,
DisableSyntax
ExplicitResultTypes
LeakingImplicitClassVal
NoAutoTupling
NoValInForComprehension
ProcedureSyntax
RemoveUnused
OrganizeImports
]

RemoveUnused {
imports = false // See https://github.com/scalacenter/scalafix/blob/v0.11.0/docs/rules/OrganizeImports.md#configuration
}
Comment on lines +12 to +14
Copy link
Member

Choose a reason for hiding this comment

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

Super nit, but we are sort of mixing styles with how we have this setting defined and how we have the ones below defined. Can we change this to

Suggested change
RemoveUnused {
imports = false // See https://github.com/scalacenter/scalafix/blob/v0.11.0/docs/rules/OrganizeImports.md#configuration
}
RemoveUnused.imports = false

Just to be consistent with how we do the DisableSyntax down below. We can do the same with Disable.ifSynthetic


Disable {
ifSynthetic = [
"scala/Option.option2Iterable"
"scala/Predef.any2stringadd"
]
}

DisableSyntax.noReturns = true
DisableSyntax.noXml = true
DisableSyntax.noFinalize = true
DisableSyntax.noValPatterns = true

ExplicitResultTypes.rewriteStructuralTypesToNamedSubclass = false

OrganizeImports.groupedImports = Explode
Expand Down
14 changes: 7 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
def scala212 = "2.12.12"
def scala212 = "2.12.18"

Global / onChangedBuildSource := ReloadOnSourceChanges

inThisBuild(
List(
organization := "org.scalameta",
Expand All @@ -15,16 +18,14 @@ inThisBuild(
)
),
scalaVersion := scala212,
scalafixDependencies +=
"com.github.liancheng" %% "organize-imports" % "0.5.0",
scalacOptions ++= List("-Ywarn-unused-import"),
ckipp01 marked this conversation as resolved.
Show resolved Hide resolved
scalafixCaching := true,
semanticdbEnabled := true
)
)

crossScalaVersions := Nil
skip.in(publish) := true
publish / skip := true

commands +=
Command.command("fixAll") { s =>
Expand All @@ -42,7 +43,6 @@ lazy val plugin = project
.settings(
moduleName := "sbt-native-image",
sbtPlugin := true,
sbtVersion.in(pluginCrossBuild) := "1.0.0",
crossScalaVersions := List(scala212),
buildInfoPackage := "sbtnativeimage",
Copy link
Member

Choose a reason for hiding this comment

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

Is this still needed at all?

buildInfoKeys := Seq[BuildInfoKey](version),
Expand All @@ -55,8 +55,8 @@ lazy val plugin = project
lazy val example = project
.in(file("example"))
.settings(
skip.in(publish) := true,
mainClass.in(Compile) := Some("example.Hello"),
publish / skip := true,
Compile / mainClass := Some("example.Hello"),
test := {
val binary = nativeImage.value
val output = scala.sys.process.Process(List(binary.toString)).!!.trim
Expand Down
Loading
Loading