-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies and migrate to Mill (#6)
* start porting to sn 0.4.0 * libui * fix pointer conversion errors * build.sbt * libui * fix 'requirement failed' exception * [cosmetic] type annotations for unit definitions and public members, unnecessary brackets * update C types to the corresponding Scala Native 0.4.0 types * Migrate to Mill and other improvements * Other fixes * Add Mill script Co-authored-by: Edward A Maxedon, Sr <[email protected]>
- Loading branch information
Showing
81 changed files
with
620 additions
and
461 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,100 @@ | ||
name: ci | ||
|
||
on: | ||
push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Mill cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.mill | ||
key: mill-${{ hashFiles('.mill-version') }} | ||
- name: Ivy cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/coursier | ||
key: ivy-${{ hashFiles('build.sc') }} | ||
restore-keys: | | ||
ivy-${{ hashFiles('build.sc') }} | ||
ivy | ||
- name: Compilation cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./out | ||
key: out | ||
- name: Install Dependencies | ||
run: | | ||
# TODO | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: '8' | ||
architecture: x64 | ||
- name: Check formatting | ||
run: | ||
./mill -i --disable-ticker -j 0 mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll __.sources | ||
# ./mill -j 0 mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll --sources buildSources | ||
# - name: Check scalafix | ||
# run: | ||
# ./mill -i --disable-ticker -j 0 __.fix --check | ||
- name: Compile | ||
run: | ||
./mill -i --disable-ticker -j 0 __.compile | ||
# - name: Integration Test | ||
# run: | | ||
# sudo systemctl stop unit.service | ||
# ./mill -i --disable-ticker -j 0 integration.test | ||
publish-sonatype: | ||
if: github.repository == 'lolgab/scalaui' && contains(github.ref, 'refs/tags/') | ||
needs: build | ||
runs-on: ubuntu-18.04 | ||
env: | ||
SONATYPE_PGP_PRIVATE_KEY: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY }} | ||
SONATYPE_PGP_PRIVATE_KEY_PASSWORD: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY_PASSWORD }} | ||
SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
LANG: "en_US.UTF-8" | ||
LC_MESSAGES: "en_US.UTF-8" | ||
LC_ALL: "en_US.UTF-8" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Mill cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.mill | ||
key: mill-${{ hashFiles('.mill-version') }} | ||
- name: Ivy cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/coursier | ||
key: ivy-${{ hashFiles('build.sc') }} | ||
restore-keys: | | ||
ivy-${{ hashFiles('build.sc') }} | ||
ivy | ||
- name: Compilation cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./out | ||
key: out | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: '8' | ||
architecture: x64 | ||
- name: Publish to Maven Central | ||
run: | | ||
if [[ $(git tag --points-at HEAD) != '' ]]; then | ||
echo $SONATYPE_PGP_PRIVATE_KEY | base64 --decode > gpg_key | ||
gpg --import --no-tty --batch --yes gpg_key | ||
rm gpg_key | ||
./mill -i --disable-ticker mill.scalalib.PublishModule/publishAll \ | ||
--sonatypeCreds $SONATYPE_USER:$SONATYPE_PASSWORD \ | ||
--gpgArgs --passphrase=$SONATYPE_PGP_PRIVATE_KEY_PASSWORD,--no-tty,--pinentry-mode,loopback,--batch,--yes,-a,-b \ | ||
--publishArtifacts __.publishArtifacts \ | ||
--readTimeout 600000 \ | ||
--awaitTimeout 600000 \ | ||
--release true \ | ||
--signed true | ||
fi |
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,14 +1,2 @@ | ||
.ensime | ||
.ensime_cache | ||
.gitignore | ||
.idea/ | ||
project/target | ||
src/main/scala-2.11 | ||
src/main/java | ||
src/test/scala-2.11 | ||
src/test/java | ||
target | ||
ensime-langeserver.log | ||
pc.stdout.log | ||
*.class | ||
*.log | ||
/out | ||
/.bsp |
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 @@ | ||
0.10.3 |
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
import mill._ | ||
import mill.scalalib._ | ||
import mill.scalanativelib._ | ||
import mill.scalalib.publish._ | ||
import $ivy.`com.goyeau::mill-scalafix::0.2.8` | ||
import com.goyeau.mill.scalafix.ScalafixModule | ||
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.1.4` | ||
import de.tobiasroeser.mill.vcs.version.VcsVersion | ||
|
||
trait Common extends ScalaNativeModule { | ||
def scalaVersion = "2.13.8" | ||
def scalaNativeVersion = "0.4.4" | ||
} | ||
|
||
trait Publish extends PublishModule { | ||
def pomSettings = | ||
PomSettings( | ||
description = "Scala Native GUI library based on libui", | ||
organization = "com.github.lolgab", | ||
url = "https://github.com/lolgab/scalaui", | ||
licenses = Seq(License.MIT), | ||
versionControl = VersionControl.github(owner = "lolgab", repo = "scalaui"), | ||
developers = Seq( | ||
Developer("lolgab", "Lorenzo Gabriele", "https://github.com/lolgab") | ||
) | ||
) | ||
def publishVersion = VcsVersion.vcsState().format() | ||
} | ||
|
||
object scalaui extends Common with Publish | ||
object integration extends Module { | ||
object tests extends Module { | ||
object `border-panel` extends Common { | ||
def moduleDeps = Seq(scalaui) | ||
} | ||
object `content-size` extends Common { | ||
def moduleDeps = Seq(scalaui) | ||
} | ||
object `font` extends Common { | ||
def moduleDeps = Seq(scalaui) | ||
} | ||
object `hello-world` extends Common { | ||
def moduleDeps = Seq(scalaui) | ||
} | ||
object `multiple-windows` extends Common { | ||
def moduleDeps = Seq(scalaui) | ||
} | ||
object `on-closing` extends Common { | ||
def moduleDeps = Seq(scalaui) | ||
} | ||
object paint extends Common { | ||
def moduleDeps = Seq(scalaui) | ||
} | ||
object complex extends Common { | ||
def moduleDeps = Seq(scalaui) | ||
} | ||
object `write-on-screen` extends Common { | ||
def moduleDeps = Seq(scalaui) | ||
} | ||
} | ||
} |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
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
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,49 @@ | ||
#!/usr/bin/env sh | ||
|
||
# This is a wrapper script, that automatically download mill from GitHub release pages | ||
# You can give the required mill version with MILL_VERSION env variable | ||
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION | ||
DEFAULT_MILL_VERSION=0.10.3 | ||
|
||
set -e | ||
|
||
if [ -z "$MILL_VERSION" ] ; then | ||
if [ -f ".mill-version" ] ; then | ||
MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)" | ||
elif [ -f "mill" ] && [ "$0" != "mill" ] ; then | ||
MILL_VERSION=$(grep -F "DEFAULT_MILL_VERSION=" "mill" | head -n 1 | cut -d= -f2) | ||
else | ||
MILL_VERSION=$DEFAULT_MILL_VERSION | ||
fi | ||
fi | ||
|
||
if [ "x${XDG_CACHE_HOME}" != "x" ] ; then | ||
MILL_DOWNLOAD_PATH="${XDG_CACHE_HOME}/mill/download" | ||
else | ||
MILL_DOWNLOAD_PATH="${HOME}/.cache/mill/download" | ||
fi | ||
MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}" | ||
|
||
version_remainder="$MILL_VERSION" | ||
MILL_MAJOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}" | ||
MILL_MINOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}" | ||
|
||
if [ ! -s "$MILL_EXEC_PATH" ] ; then | ||
mkdir -p "$MILL_DOWNLOAD_PATH" | ||
if [ "$MILL_MAJOR_VERSION" -gt 0 ] || [ "$MILL_MINOR_VERSION" -ge 5 ] ; then | ||
ASSEMBLY="-assembly" | ||
fi | ||
DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download | ||
MILL_VERSION_TAG=$(echo $MILL_VERSION | sed -E 's/([^-]+)(-M[0-9]+)?(-.*)?/\1\2/') | ||
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION_TAG}/$MILL_VERSION${ASSEMBLY}" | ||
curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL" | ||
chmod +x "$DOWNLOAD_FILE" | ||
mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH" | ||
unset DOWNLOAD_FILE | ||
unset MILL_DOWNLOAD_URL | ||
fi | ||
|
||
unset MILL_DOWNLOAD_PATH | ||
unset MILL_VERSION | ||
|
||
exec $MILL_EXEC_PATH "$@" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
src/main/scala/scalaui/AboutMenuItem.scala → scalaui/src/scalaui/AboutMenuItem.scala
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
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,24 @@ | ||
package scalaui | ||
|
||
import scala.scalanative.unsafe._ | ||
import scala.scalanative.runtime._ | ||
import scala.scalanative.libc.stdlib.malloc | ||
import ui._ | ||
import uiOps._ | ||
|
||
abstract class AbstractArea( | ||
draw: DrawCallback, | ||
onMouseEvent: MouseEventCallback, | ||
onMouseCrossed: MouseCrossedCallback, | ||
onKeyEvent: KeyEventCallback, | ||
onDragBroken: DragBrokenCallback = doNothingOnDragBroken _ | ||
) extends Component { | ||
private val handlerArray = ByteArray.alloc(sizeof[uiAreaHandler].toInt) | ||
val handler: Ptr[uiAreaHandler] = | ||
handlerArray.at(0).asInstanceOf[Ptr[uiAreaHandler]] | ||
handler.Draw = draw | ||
handler.MouseEvent = onMouseEvent | ||
handler.MouseCrossed = onMouseCrossed.asInstanceOf[uiMouseCrossedCallback] | ||
handler.DragBroken = onDragBroken | ||
handler.KeyEvent = onKeyEvent.asInstanceOf[uiKeyEventCallback] | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...main/scala/scalaui/AbstractTextArea.scala → scalaui/src/scalaui/AbstractTextArea.scala
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.