-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c32244
commit ce4479b
Showing
10 changed files
with
207 additions
and
15 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
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,5 @@ | ||
ScalaNativePlugin.projectSettings | ||
|
||
scalaVersion := "2.11.8" | ||
|
||
Check.setup |
79 changes: 79 additions & 0 deletions
79
scripted-tests/run/external-dependencies/project/Check.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import sbt._ | ||
import Keys._ | ||
|
||
import scala.scalanative.sbtplugin.ScalaNativePluginInternal.nativeExternalDependencies | ||
|
||
object Check { | ||
lazy val check = | ||
TaskKey[Unit]("check", "make sure we list external dependencies correctly") | ||
|
||
val setup = Seq( | ||
check := { | ||
val deps = (nativeExternalDependencies in Compile).value.toSet | ||
|
||
// most propably not implemented | ||
val applets = Set( | ||
"@java.applet.Applet", | ||
"@java.applet.Applet::destroy_unit", | ||
"@java.applet.Applet::init", | ||
"@java.applet.Applet::init_unit", | ||
"@java.applet.Applet::start_unit", | ||
"@java.applet.Applet::stop_unit" | ||
) | ||
|
||
val awt = Set( | ||
"@java.awt.Component", | ||
"@java.awt.Component::addMouseListener_trait.java.awt.event.MouseListener_unit", | ||
"@java.awt.Component::getHeight_i32", | ||
"@java.awt.Component::getWidth_i32", | ||
"@java.awt.Component::paint_class.java.awt.Graphics_unit", | ||
"@java.awt.Component::repaint_unit", | ||
"@java.awt.Container", | ||
"@java.awt.Container::paint_class.java.awt.Graphics_unit", | ||
"@java.awt.Graphics", | ||
"@java.awt.Graphics::drawRect_i32_i32_i32_i32_unit", | ||
"@java.awt.Graphics::drawString_class.java.lang.String_i32_i32_unit", | ||
"@java.awt.event.MouseEvent", | ||
"@java.awt.event.MouseListener", | ||
"@java.awt.event.MouseListener::mouseClicked_class.java.awt.event.MouseEvent_unit", | ||
"@java.awt.event.MouseListener::mouseEntered_class.java.awt.event.MouseEvent_unit", | ||
"@java.awt.event.MouseListener::mouseExited_class.java.awt.event.MouseEvent_unit", | ||
"@java.awt.event.MouseListener::mousePressed_class.java.awt.event.MouseEvent_unit", | ||
"@java.awt.event.MouseListener::mouseReleased_class.java.awt.event.MouseEvent_unit" | ||
) | ||
|
||
assert(((applets ++ awt) -- deps).isEmpty) | ||
|
||
// most propably implemented | ||
val rest = Set( | ||
"@java.io.PrintStream", | ||
"@java.io.PrintStream::println_class.java.lang.String_unit", | ||
"@java.lang.Object", | ||
"@java.lang.String", | ||
"@java.lang.StringBuffer", | ||
"@java.lang.StringBuffer::append_class.java.lang.String_class.java.lang.StringBuffer", | ||
"@java.lang.StringBuffer::init", | ||
"@java.lang.StringBuffer::toString_class.java.lang.String", | ||
"@java.lang.System$", | ||
"@java.lang.System$::field.out", | ||
"@scala.LowPriorityImplicits", | ||
"@scala.LowPriorityImplicits::wrapIntArray_class.ssnr.IntArray_class.scala.collection.mutable.WrappedArray", | ||
"@scala.Predef$", | ||
"@scala.Predef$::Set_module.scala.collection.immutable.Set$", | ||
"@scala.collection.GenTraversable", | ||
"@scala.collection.Seq", | ||
"@scala.collection.generic.GenericCompanion", | ||
"@scala.collection.generic.GenericCompanion::apply_trait.scala.collection.Seq_trait.scala.collection.GenTraversable", | ||
"@scala.collection.immutable.Set", | ||
"@scala.collection.immutable.Set$", | ||
"@scala.collection.mutable.WrappedArray", | ||
"@scala.scalanative.runtime.IntArray", | ||
"@scala.scalanative.runtime.IntArray$", | ||
"@scala.scalanative.runtime.IntArray$::alloc_i32_class.ssnr.IntArray", | ||
"@scala.scalanative.runtime.IntArray::update_i32_i32_unit" | ||
) | ||
|
||
assert((rest -- deps).isEmpty) | ||
} | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
scripted-tests/run/external-dependencies/project/build.properties
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 = 0.13.13 |
8 changes: 8 additions & 0 deletions
8
scripted-tests/run/external-dependencies/project/scala-native.sbt
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 @@ | ||
{ | ||
val pluginVersion = System.getProperty("plugin.version") | ||
if (pluginVersion == null) | ||
throw new RuntimeException( | ||
"""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin) | ||
else addSbtPlugin("org.scala-native" % "sbt-scala-native" % pluginVersion) | ||
} |
66 changes: 66 additions & 0 deletions
66
scripted-tests/run/external-dependencies/src/main/scala/AppletTutorial.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import java.awt.event.MouseListener | ||
import java.awt.event.MouseEvent | ||
import java.applet.Applet | ||
import java.awt.Graphics | ||
|
||
// We need linking errors, We will never port java.applet._ | ||
object AppletTutorial extends Applet with Mouse { | ||
def sc = Set(1) | ||
|
||
override def init(): Unit = { | ||
strBuffer = new StringBuffer() | ||
addItem("initializing the apple ") | ||
} | ||
|
||
override def start(): Unit = { | ||
addItem("starting the applet ") | ||
} | ||
|
||
override def stop(): Unit = { | ||
addItem("stopping the applet ") | ||
} | ||
|
||
override def destroy(): Unit = { | ||
addItem("unloading the applet") | ||
} | ||
|
||
override def paint(g: Graphics): Unit = { | ||
g.drawRect(0, 0, getWidth() - 1, getHeight() - 1) | ||
g.drawString(strBuffer.toString(), 10, 20) | ||
} | ||
} | ||
|
||
trait Mouse extends MouseListener { self: Applet => | ||
protected var strBuffer: StringBuffer = _ | ||
|
||
override def init(): Unit = { | ||
addMouseListener(this); | ||
strBuffer = new StringBuffer() | ||
addItem("initializing the apple ") | ||
} | ||
|
||
override def start(): Unit = { | ||
addItem("starting the applet ") | ||
} | ||
|
||
override def stop(): Unit = { | ||
addItem("stopping the applet ") | ||
} | ||
|
||
override def destroy(): Unit = { | ||
addItem("unloading the applet") | ||
} | ||
|
||
protected def addItem(word: String): Unit = { | ||
System.out.println(word) | ||
strBuffer.append(word) | ||
repaint() | ||
} | ||
|
||
override def mouseEntered(event: MouseEvent): Unit = () | ||
override def mouseExited(event: MouseEvent): Unit = () | ||
override def mousePressed(event: MouseEvent): Unit = () | ||
override def mouseReleased(event: MouseEvent): Unit = () | ||
override def mouseClicked(event: MouseEvent): Unit = | ||
addItem("mouse clicked! ") | ||
} |
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 @@ | ||
> check |
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