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 Scala Native support #2846
base: master
Are you sure you want to change the base?
Add Scala Native support #2846
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apt-get install -y clang-12.0 | ||
PATH=/usr/lib/llvm-12.0/bin:${PATH} | ||
clang --version |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apt-get install -y clang-12.0 | ||
PATH=/usr/lib/llvm-12.0/bin:${PATH} | ||
clang --version |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
choco install llvm | ||
echo "${env:ProgramFiles}\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
clang --version |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ To build a native image of the command-line interface using | |
|
||
- From the project root directory, | ||
- run `sbt cli/assembly` | ||
- run `java -jar scalafmt-cli/target/scala-2.13/scalafmt.jar`, to execute recently built artifacts | ||
- run `java -jar scalafmt-cli/jvm/target/scala-2.13/scalafmt.jar`, to execute recently built artifacts | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i assumed that no suffix for jvm meant perhaps that jvm wouldn't be added here... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately that's how cross building works in this case. We could probably override it for jvm? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No suffix only works for for the sbt commands I think, so f.e. in the cross project instead of cliJVM/run we only need to run cli/run for the JVM platform in this branch. The idea was to keep the previously used commands intact. |
||
|
||
## Random stuff | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.scalafmt.cli | ||
|
||
import com.martiansoftware.nailgun.NGContext | ||
import org.scalafmt.util.AbsoluteFile | ||
|
||
trait CliUtils { this: Cli => | ||
|
||
def nailMain(nGContext: NGContext): Unit = { | ||
val workingDirectory = | ||
AbsoluteFile.fromPath(nGContext.getWorkingDirectory).getOrElse { | ||
throw new IllegalStateException( | ||
s"Expected absolute path, " + | ||
s"obtained nGContext.getWorkingDirectory = ${nGContext.getWorkingDirectory}" | ||
) | ||
} | ||
val exit = mainWithOptions( | ||
nGContext.getArgs, | ||
CliOptions.default.copy( | ||
common = CliOptions.default.common.copy( | ||
cwd = workingDirectory, | ||
out = nGContext.out, | ||
in = nGContext.in, | ||
err = nGContext.err | ||
) | ||
) | ||
) | ||
nGContext.exit(exit.code) | ||
} | ||
|
||
protected val isNative: Boolean = false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.scalafmt.cli | ||
|
||
import java.sql.Timestamp | ||
|
||
trait TermUtils { | ||
|
||
// Copy/pasted over from coursier, but unused in scalafmt | ||
private val format = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss") | ||
protected def formatTimestamp(ts: Long): String = | ||
format.format(new Timestamp(ts)) | ||
|
||
def noConsole = System.console() == null | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this dependency remains. why not keep it here, instead pushing down?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's probably my bad, experimented a lot with the project and kind of left a mess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i must have misunderstood what that no suffix call does. just wanted to make sure this is correct.