-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename PlatformInfo Create scala.yml cleanup tests, remove duplication Merge branch 'main' of https://github.com/philwalk/pallet
- Loading branch information
Showing
33 changed files
with
5,094 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Scala CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: 'sbt' | ||
- name: Run tests | ||
run: sbt test | ||
# Optional: This step uploads information to the GitHub dependency graph and unblocking Dependabot alerts for the repository | ||
- name: Upload dependency graph | ||
uses: scalacenter/sbt-dependency-submission@ab086b50c947c9774b70f39fc7f6e20ca2706c91 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
../ | ||
*.class | ||
*.log | ||
sall | ||
s[0-9]* | ||
_vb | ||
tags | ||
|
||
.cache | ||
.env | ||
.envrc | ||
.history | ||
.sdkmanrc | ||
.lib/ | ||
dist/* | ||
target/ | ||
lib_managed/ | ||
local.conf | ||
src_managed/ | ||
project/boot/ | ||
project/plugins/project/ | ||
project/scalafix/* | ||
project/.sbtserver | ||
project/.sbtserver.lock | ||
project/project/ | ||
*.swp | ||
*.sw? | ||
|
||
jsrc/*.jar | ||
|
||
.idea* | ||
|
||
# Metals | ||
.metals/ | ||
.bsp/ | ||
.bloop/ | ||
metals.sbt | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--add-opens=java.base/java.util=ALL-UNNAMED | ||
--add-opens=java.base/java.lang=ALL-UNNAMED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-J--add-opens=java.base/java.lang=ALL-UNNAMED | ||
-J--add-opens=java.base/java.util=ALL-UNNAMED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
# pallet | ||
Platform Independent Tooling | ||
|
||
Provides support for various expressive idioms typical of scripting languages, | ||
with a goal of supporting portable code runnable in many environments with little or no customization. | ||
|
||
Target environments include Linux, OSX, Cygwin, Msys2, Mingw, WSL, Windows. | ||
|
||
Example script: | ||
```scala | ||
#!/usr/bin/env -S scala -cp target/scala-3.3.0/classes | ||
// hashbang line above is sufficient after 'sbt compile' | ||
import vastblue.pathextend.* | ||
|
||
def main(args: Array[String]): Unit = { | ||
// show system memory info | ||
for (line <- "/proc/meminfo".path.lines) { | ||
printf("%s\n", line) | ||
} | ||
// list child directories of the current working directory | ||
val cwd: Path = ".".path | ||
for ( (p: Path) <- cwd.paths.filter { _.isDirectory }){ | ||
printf("%s\n", p.norm) | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
lazy val scala213 = "2.13.11" | ||
lazy val scala330 = "3.3.0" | ||
//lazy val supportedScalaVersions = List(scala213, scala330) | ||
lazy val supportedScalaVersions = List(scala330) | ||
|
||
//ThisBuild / envFileName := "dev.env" // sbt-dotenv plugin gets build environment here | ||
ThisBuild / organization := "org.vastblue" | ||
ThisBuild / scalaVersion := "3.3.0" | ||
ThisBuild / version := "0.8.1-SNAPSHOT" | ||
|
||
ThisBuild / crossScalaVersions := supportedScalaVersions | ||
|
||
lazy val root = (project in file(".")) | ||
.settings( | ||
// crossScalaVersions := supportedScalaVersions, | ||
name := "pallet" | ||
) | ||
|
||
libraryDependencies ++= Seq( | ||
"org.scalacheck" %% "scalacheck" % "1.17.0" % Test, | ||
"org.scalatest" %% "scalatest" % "3.2.16" % Test, | ||
"com.github.sbt" % "junit-interface" % "0.13.3" % Test, | ||
) | ||
//def rtp: String = { | ||
// val psep = java.io.File.pathSeparator | ||
// val syspath: List[String] = Option(System.getenv("PATH")).getOrElse("").split(psep).map { _.toString }.toList | ||
// val javaLibraryPath: List[String] = sys.props("java.library.path").split(psep).map { _.toString }.toList | ||
// val entries: List[String] = (javaLibraryPath ::: syspath) | ||
// val path: String = entries.map { _.replace('\\', '/').toLowerCase }.distinct.mkString(";") | ||
// System.setProperty("java.library.path", path) | ||
// path | ||
//} | ||
//lazy val runtimePath = settingKey[String]("runtime path") | ||
// | ||
//runtimePath := rtp | ||
|
||
scalacOptions := Seq( | ||
//"-Xmaxerrs", "10", | ||
// Warnings as errors! | ||
//"-Xfatal-warnings", // must be commented out for scalafix actions, pre-2.13 | ||
//"-Wconf:any:error", // must be commented out for scalafix actions, 2.13+ | ||
|
||
//"-Wvalue-discard", | ||
|
||
"-encoding", "utf-8", | ||
"-explaintypes", | ||
"-language:existentials", | ||
"-language:experimental.macros", | ||
"-language:higherKinds", | ||
"-language:implicitConversions", | ||
|
||
// Linting options | ||
"-unchecked", | ||
|
||
"-Wunused:implicits", | ||
"-Wunused:imports", | ||
"-Wunused:locals", | ||
"-Wunused:params", | ||
"-Wunused:privates", | ||
) | ||
scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match { | ||
case Some((2, _)) => Seq( | ||
"-Xsource:3", | ||
"-Xmaxerrs", "10", | ||
"-Yscala3-implicit-resolution", | ||
"-language:implicitConversions", | ||
) | ||
case _ => Nil | ||
}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
JAVA_OPTS='--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env -S scala -cp target/scala-3.3.0/classes | ||
// the above hashbang line works after successful sbt compile | ||
import vastblue.pathextend._ | ||
|
||
def main(args: Array[String]): Unit = { | ||
// show system memory info | ||
for (line <- "/proc/meminfo".path.lines) { | ||
printf("%s\n", line) | ||
} | ||
// list child directories of the current working directory | ||
val cwd: Path = ".".path | ||
for ( (p: Path) <- cwd.paths.filter { _.isDirectory }){ | ||
printf("%s\n", p.norm) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env -S scala -cp target/scala-3.3.0/classes | ||
import vastblue.pathextend._ | ||
|
||
def main(args: Array[String]): Unit = { | ||
".".path.paths.filter { _.isDirectory }.foreach { (p: Path) => printf("%s\n", p.norm) } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env -S scala -cp target/scala-3.3.0/classes | ||
import vastblue.pathextend._ | ||
|
||
object PathsDemo { | ||
def main(args: Array[String]): Unit = { | ||
if (args.isEmpty) { | ||
printf("usage: %s <filepath-1> [<filepath2> ...]\n", scriptPath.path.name) | ||
} else { | ||
for (a <- args) { | ||
printf("========== arg[%s]\n", a) | ||
printf("stdpath [%s]\n", Paths.get(a).stdpath) | ||
printf("normpath [%s]\n", Paths.get(a).norm) | ||
printf("dospath [%s]\n", Paths.get(a).dospath) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env -S scala -cp target/scala-3.3.0/classes | ||
// the above hashbang line works after successful sbt compile | ||
|
||
import vastblue.Platform | ||
|
||
def main(args: Array[String]): Unit = | ||
Platform.main(args) | ||
for ((k,v) <- Platform.mountMap){ | ||
printf("%-22s: %s\n", k, v) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env -S scala -cp /Users/philwalk/.ivy2/local/org.vastblue/pallet_3/0.8.0-SNAPSHOT/jars/pallet_3.jar | ||
|
||
import vastblue.pathextend.* | ||
|
||
def main(args: Array[String]): Unit = { | ||
// show various info relevant to the current runtime environment | ||
vastblue.Platform.main(args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env -S scala -cp target/scala-3.3.0/classes | ||
|
||
import vastblue.pathextend._ | ||
|
||
def main(args: Array[String]): Unit = | ||
// show runtime scala VERSION | ||
val scalaHome = sys.props("scala.home") | ||
val version = Paths.get(s"$scalaHome/VERSION").contentAsString.trim | ||
printf("%s\n",version) | ||
|
||
// display output of uname -a | ||
import scala.sys.process._ | ||
printf("%s\n",Seq("uname","-a").lazyLines_!.toList.mkString("")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sbt.version=1.9.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
//addSbtPlugin("nl.gn0s1s" % "sbt-dotenv" % "3.0.0") | ||
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.10") |
Oops, something went wrong.