Skip to content

Commit

Permalink
Last fixes for 2.0 (#39)
Browse files Browse the repository at this point in the history
A few last fixes in preparation for the 2.0 release.
  • Loading branch information
aaron-siegel authored Apr 4, 2023
1 parent 5181a66 commit 8807287
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion desktop-app/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</filterset>
</copy>

<copy file="${basedir}/../lib/core/target/cgsuite-core-${cgsuite.lib.version}-jar-with-dependencies.jar" todir="${cluster}/modules/ext"/>
<!--<copy file="${basedir}/../lib/core/target/cgsuite-core-${cgsuite.lib.version}-jar-with-dependencies.jar" todir="${cluster}/modules/ext"/>-->

</target>

Expand Down
6 changes: 3 additions & 3 deletions desktop-app/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ app.conf=nbproject/cgsuite-app.conf
app.icon=branding/core/core.jar/org/netbeans/core/startup/frame48.gif
app.name=CGSuite
app.title=CGSuite
app.version=2.0-beta6
app.version=2.0
app.icon.icns=etc/cgsuite.icns
auxiliary.org-netbeans-modules-apisupport-installer.license-file=release/license.txt
auxiliary.org-netbeans-modules-apisupport-installer.os-linux=true
Expand All @@ -13,7 +13,7 @@ auxiliary.org-netbeans-modules-apisupport-installer.pack200-enabled=true
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
branding.token=cgsuite
cgsuite.copyright=2003-2023
cgsuite.lib.version=2.0.0-SNAPSHOT
cgsuite.lib.version=2.0.0
cgsuite.nb.version=12.0
deploy.icon.native=etc/cgsuite.ico
modules=\
Expand All @@ -39,4 +39,4 @@ project.org.cgsuite.ui.history=CommandHistory
project.org.cgsuite.ui.script=CGScriptEditor
project.org.cgsuite.ui.tips=TipOfTheDay
project.org.cgsuite.ui.worksheet=Worksheet
run.args.extra=-J-Xmx2048m -J-Dorg.cgsuite.devbuild=${basedir}
run.args.extra=-J-Xmx2g -J-Dorg.cgsuite.devbuild=${basedir}
2 changes: 1 addition & 1 deletion lib/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.cgsuite</groupId>
<artifactId>cgsuite</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>2.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion lib/core/repl.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

java -Dorg.cgsuite.devbuild=.. -cp target/cgsuite-core-2.0.0-SNAPSHOT-jar-with-dependencies.jar org.cgsuite.lang.Repl
java -Dorg.cgsuite.devbuild=.. -cp target/cgsuite-core-*-jar-with-dependencies.jar org.cgsuite.lang.Repl
4 changes: 3 additions & 1 deletion lib/core/src/main/scala/org/cgsuite/lang/CgscriptClass.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ class CgscriptClass(
Profiler.start(reflect)
try {
logger.debug(javaMethod.toString)
logger.debug(target.getClass.toString)
if (!isStatic) logger.debug(target.getClass.toString)
internalize(javaMethod.invoke(target, args.asInstanceOf[Array[AnyRef]] : _*))
} catch {
case exc: IllegalArgumentException => throw EvalException(
Expand All @@ -1424,6 +1424,8 @@ class CgscriptClass(
case nestedExc: CgsuiteException =>
// TODO nestedExc.setInvocationTarget(qualifiedName)
throw nestedExc
case nestedExc: StackOverflowError =>
throw EvalException("Maximum recursive depth exceeded. (Possible infinite recursion?)", nestedExc)
case nestedExc => throw EvalException(s"Error in call to `$qualifiedName`: ${nestedExc.getMessage}", nestedExc)
}
)
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/main/scala/org/cgsuite/lang/Resolver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ case class Resolution(cls: CgscriptClass, id: Symbol, static: Boolean = false) {
exc addToken referenceToken
throw exc
case _: StackOverflowError =>
throw EvalException("Possible infinite recursion.")
throw EvalException("Maximum recursive depth exceeded. (Possible infinite recursion?)")
}

} else if (asFunctionCallAntecedent) {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/main/scala/org/cgsuite/lang/System.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object System extends LazyLogging {

val copyrightYear = "2003-2023"

val version = "2.0-beta6"
val version = "2.0"

def clearAll(): Unit = {
UiHarness.uiHarness.clearUiVars()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ case class FunctionCallNode(
exc addToken token
throw exc
case _: StackOverflowError =>
throw EvalException("Possible infinite recursion.", token = Some(token))
throw EvalException("Maximum recursive depth exceeded. (Possible infinite recursion?)", token = Some(token))
}

}
Expand Down Expand Up @@ -196,7 +196,7 @@ case class FunctionCallNode(
exc addToken token
throw exc
case _: StackOverflowError =>
throw EvalException("Possible infinite recursion.", token = Some(token))
throw EvalException("Maximum recursive depth exceeded. (Possible infinite recursion?)", token = Some(token))
}

}
Expand Down Expand Up @@ -237,7 +237,7 @@ case class FunctionCallNode(
exc addToken token
throw exc
case _: StackOverflowError =>
throw EvalException("Possible infinite recursion.", token = Some(token))
throw EvalException("Maximum recursive depth exceeded. (Possible infinite recursion?)", token = Some(token))
}

}
Expand Down
14 changes: 13 additions & 1 deletion lib/core/src/main/scala/org/cgsuite/util/UiHarness.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.cgsuite.core.Game

object UiHarness {

var uiHarnessRef: UiHarness = _
var uiHarnessRef: UiHarness = NullUiHarness

def uiHarness = uiHarnessRef

Expand All @@ -24,6 +24,18 @@ trait UiHarness {

}

object NullUiHarness extends UiHarness {

override def clearUiVars(): Unit = ()

override def createExplorer(g: Game): Explorer = {
throw new UnsupportedOperationException("NullUiHarness.createExplorer")
}

override def print(obj: AnyRef): Unit = ()

}

object Explorer {

def newExplorer(g: Game): Explorer = UiHarness.uiHarness.createExplorer(g)
Expand Down
4 changes: 2 additions & 2 deletions lib/core/src/test/scala/org/cgsuite/lang/DeclTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ class DeclTest extends CgscriptSpec {
("Instantiate InstanceClass", "test.init.NestedNoConstructor.Nested", "InstanceClass.instance"),
("Attempt to instantiate nested class with no constructor", "test.init.NestedNoConstructor.Nested()",
"!!The class `test.init.NestedNoConstructor.Nested` has no constructor and cannot be directly instantiated."),
("Infinite recursion (method call)", "test.init.InfiniteRecursion.Infinite()", "!!Possible infinite recursion."),
("Infinite recursion (autoinvoke)", "test.init.InfiniteRecursion.InfiniteAuto", "!!Possible infinite recursion.")
("Infinite recursion (method call)", "test.init.InfiniteRecursion.Infinite()", "!!Maximum recursive depth exceeded. (Possible infinite recursion?)"),
("Infinite recursion (autoinvoke)", "test.init.InfiniteRecursion.InfiniteAuto", "!!Maximum recursive depth exceeded. (Possible infinite recursion?)")
))

}
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/test/scala/org/cgsuite/lang/EvalTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class EvalTest extends CgscriptSpec {
""".stripMargin, """["foo","bar"]"""),
("Function involving assignment - syntax error", "x -> y := x", "!!Syntax error."),
("False eval", "5(3)", "!!No method `Eval` for class: `game.Integer`"),
("Function eval - infinite recursion", "j := n -> j(n); j(5)", "!!Possible infinite recursion.")
("Function eval - infinite recursion", "j := n -> j(n); j(5)", "!!Maximum recursive depth exceeded. (Possible infinite recursion?)")
))

}
Expand Down
2 changes: 1 addition & 1 deletion lib/discord-bot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.cgsuite</groupId>
<artifactId>cgsuite</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>2.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cgsuite</groupId>
<artifactId>cgsuite</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>2.0.0</version>
<packaging>pom</packaging>

<name>${project.artifactId}</name>
Expand Down

0 comments on commit 8807287

Please sign in to comment.