Skip to content

Commit 6640a14

Browse files
authored
Merge branch '12.x' into update/12.x/scala-project-template
2 parents 6a6c858 + e095e53 commit 6640a14

File tree

36 files changed

+5077
-10
lines changed

36 files changed

+5077
-10
lines changed

.git-blame-ignore-revs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
# Scala Steward: Reformat with scalafmt 3.1.2
22
fb6cfb8aea15a1b339e3ed69e1e96acd7df4cae6
3+
4+
# Scala Steward: Reformat with scalafmt 3.7.0
5+
9348974a79cbfbc260d1840a589b7c842dd56a7b
6+
7+
# Scala Steward: Reformat with scalafmt 3.7.3
8+
9949b27715a382afd78b992ced481ace61cc69b7

.github/workflows/scala-steward.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
on:
2-
push:
3-
branches-ignore:
4-
- "update/**"
5-
schedule:
6-
- cron: "0 0 * * 0"
72
workflow_dispatch:
83

94
name: Launch Scala Steward

.github/workflows/scala.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
scala:
19-
- 2.12.20
18+
include:
19+
- scala: 3.3.0
20+
sbt-args: -J-XX:MaxRAMPercentage=90.0
21+
- scala: 2.13.11
22+
sbt-args: -J-XX:MaxRAMPercentage=90.0
23+
- scala: 2.13.4
24+
sbt-args: -J-XX:MaxRAMPercentage=90.0 --addPluginSbtFile=project/plugins.sbt.scala-js.0.6
2025

2126
steps:
2227
- uses: actions/checkout@v3

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
1+
*.class
2+
*.log
3+
*.sjsir
4+
5+
# sbt specific
6+
.cache
7+
.history
8+
.lib/
9+
dist/*
110
target/
11+
lib_managed/
12+
src_managed/
13+
project/boot/
14+
project/plugins/project/
15+
16+
# Scala-IDE specific
17+
.scala_dependencies
18+
.worksheet
19+
.cache-*
20+
21+
# IntelliJ specific
22+
.idea/
23+
.classpath
24+
.project
25+
.settings/
26+
27+
# jenv
28+
.java-version
29+
30+
# Files created for deployment
231
local.sbt
332
secret/
433
.metals/

.sbtopts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-J-Xss5m
2+
-J-XX:MaxMetaspaceSize=9999g

.scalafmt.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
runner.dialect = scala212source3
2-
version = "3.8.3"
1+
runner.dialect = scala3
2+
version = "3.7.5"
33
maxColumn = 80

Binding/js/build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../shared/build.sbt
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package com.thoughtworks.binding
2+
3+
private[binding] object BindingJvmOrJs {
4+
5+
type ConstantsData[+A] = scalajs.js.Array[_ <: A]
6+
7+
@inline
8+
def toConstantsData[A](seq: IterableOnce[A]) = {
9+
import scalajs.js.JSConverters._
10+
seq.toJSArray
11+
}
12+
13+
@inline
14+
def toCacheData[A](seq: collection.Iterable[A]) = {
15+
import scalajs.js.JSConverters._
16+
seq.toJSArray
17+
}
18+
19+
@inline
20+
def emptyCacheData[A]: HasCache[A]#Cache = scalajs.js.Array()
21+
22+
trait HasCache[A] {
23+
24+
private[binding] type Cache = scalajs.js.Array[A]
25+
26+
private[binding] def cacheData: Cache
27+
28+
@inline
29+
private[binding] final def getCache(n: Int): A = cacheData(n)
30+
31+
@inline
32+
private[binding] final def updateCache(n: Int, newelem: A): Unit = {
33+
cacheData(n) = newelem
34+
}
35+
36+
@inline
37+
private[binding] final def cacheLength: Int = cacheData.length
38+
39+
@inline
40+
private[binding] final def clearCache(): Unit = {
41+
cacheData.length = 0
42+
}
43+
44+
@inline
45+
private[binding] final def removeCache(n: Int): A = {
46+
cacheData.remove(n)
47+
}
48+
49+
private[binding] final def removeCache(idx: Int, count: Int): Unit = {
50+
cacheData.remove(idx, count)
51+
}
52+
53+
@inline
54+
private[binding] final def appendCache(elements: IterableOnce[A]): Seq[A] = {
55+
val seq = Seq.from(elements)
56+
cacheData ++= seq
57+
seq
58+
}
59+
60+
@inline
61+
private[binding] final def appendCache(elem: A): Unit = {
62+
cacheData += elem
63+
}
64+
65+
@inline
66+
private[binding] final def prependCache(elem: A): Unit = {
67+
cacheData.unshift(elem)
68+
}
69+
70+
@inline
71+
private[binding] final def insertOneCache(n: Int, elem: A): Seq[A] = {
72+
cacheData.insert(n, elem)
73+
Seq(elem)
74+
}
75+
76+
@inline
77+
private[binding] final def insertCache(n: Int, elems: IterableOnce[A]): Seq[A] = {
78+
val seq = Seq.from(elems)
79+
cacheData.insertAll(n, elems)
80+
seq
81+
}
82+
83+
@inline
84+
private[binding] final def cacheIterator: Iterator[A] = {
85+
cacheData.iterator
86+
}
87+
88+
@inline
89+
private[binding] final def spliceCache(from: Int, mappedNewChildren: Cache, replaced: Int) = {
90+
cacheData.splice(from, replaced, scalajs.runtime.toScalaVarArgs(mappedNewChildren): _*)
91+
}
92+
93+
@inline
94+
private[binding] final def spliceCache(from: Int, mappedNewChildren: IterableOnce[A], replaced: Int) = {
95+
cacheData.splice(from, replaced, Seq.from(mappedNewChildren): _*)
96+
}
97+
98+
@inline
99+
private[binding] final def indexOfCache(a: A): Int = {
100+
cacheData.indexOf(a)
101+
}
102+
103+
}
104+
}

Binding/jvm/build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../shared/build.sbt
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.thoughtworks.binding
2+
3+
private[binding] object BindingJvmOrJs {
4+
5+
type ConstantsData[+A] = Seq[A]
6+
7+
@inline
8+
def toConstantsData[A](seq: IterableOnce[A]) = Seq.from(seq)
9+
10+
def toCacheData[A](seq: collection.Iterable[A]) = Vector.from(seq)
11+
12+
def emptyCacheData[A]: HasCache[A]#Cache = Vector.empty
13+
14+
trait HasCache[A] {
15+
16+
private[binding] type Cache = Vector[A]
17+
18+
private[binding] var cacheData: Cache
19+
20+
@inline
21+
private[binding] final def getCache(n: Int): A = cacheData(n)
22+
23+
@inline
24+
private[binding] final def updateCache(n: Int, newelem: A): Unit = {
25+
cacheData = cacheData.updated(n, newelem)
26+
}
27+
28+
@inline
29+
private[binding] final def cacheLength: Int = cacheData.length
30+
31+
@inline
32+
private[binding] final def clearCache(): Unit = {
33+
cacheData = Vector.empty
34+
}
35+
36+
private[binding] final def removeCache(n: Int): A = {
37+
val result = cacheData(n)
38+
cacheData = cacheData.patch(n, Nil, 1)
39+
result
40+
}
41+
42+
private[binding] final def removeCache(idx: Int, count: Int): Unit = {
43+
cacheData = cacheData.patch(idx, Nil, count)
44+
}
45+
46+
private[binding] final def appendCache(elements: IterableOnce[A]): Seq[A] = {
47+
val seq = Seq.from(elements)
48+
cacheData = cacheData ++ seq
49+
seq
50+
}
51+
52+
private[binding] final def appendCache(elem: A): Unit = {
53+
cacheData = cacheData :+ elem
54+
}
55+
56+
private[binding] final def prependCache(elem: A): Unit = {
57+
cacheData = elem +: cacheData
58+
}
59+
60+
private[binding] final def insertCache(n: Int, elems: IterableOnce[A]): Seq[A] = {
61+
val seq = Seq.from(elems)
62+
cacheData = cacheData.patch(n, seq, 0)
63+
seq
64+
}
65+
66+
private[binding] final def insertOneCache(n: Int, elem: A): Seq[A] = {
67+
val seq = Seq(elem)
68+
cacheData = cacheData.patch(n, seq, 0)
69+
seq
70+
}
71+
72+
private[binding] final def cacheIterator: Iterator[A] = {
73+
cacheData.iterator
74+
}
75+
76+
private[binding] final def spliceCache(from: Int, mappedNewChildren: IterableOnce[A], replaced: Int) = {
77+
val oldCache = cacheData
78+
if (from == 0) {
79+
cacheData = mappedNewChildren ++: oldCache.drop(replaced)
80+
} else {
81+
cacheData = oldCache.patch(from, mappedNewChildren, replaced)
82+
}
83+
oldCache.view.slice(from, from + replaced)
84+
}
85+
86+
private[binding] final def indexOfCache[B >: A](a: B): Int = {
87+
cacheData.indexOf(a)
88+
}
89+
90+
}
91+
92+
}

0 commit comments

Comments
 (0)