Skip to content

Commit

Permalink
Merging dev-1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
matifreyre committed Aug 26, 2016
2 parents eb074b9 + a200eb1 commit 5afede1
Show file tree
Hide file tree
Showing 67 changed files with 848 additions and 264 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ script:
- if [ $TRAVIS_PULL_REQUEST == "false" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9.]* ]] ; then
export PROFILES="uploadRepo,uploadProducts"; export UPDATE_SITE="stable" ; fi
- echo "Running with profiles $PROFILES"

# Maven build
- mvn -U -DupdateSiteFolder=$UPDATE_SITE -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean install
- mvn -e -DupdateSiteFolder=$UPDATE_SITE -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean install
jacoco:report coveralls:report -P $PROFILES
notifications:
webhooks:
Expand Down Expand Up @@ -53,7 +51,7 @@ deploy:
branch:
- dev
- master
- dev-*.*
- dev-1.5

- provider: s3
access_key_id: AKIAJLCGMGO45ZQFSLJA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.uqbar.project.wollok.interpreter.api.XDebugger
import org.uqbar.project.wollok.interpreter.api.XInterpreter

import static extension org.uqbar.project.wollok.utils.XTextExtensions.*
import org.eclipse.xtend.lib.annotations.Accessors

/**
* xdebugger implementation that actually
Expand All @@ -18,7 +19,7 @@ import static extension org.uqbar.project.wollok.utils.XTextExtensions.*
class XDebuggerImpl implements XDebugger {
static Logger log = Logger.getLogger(XDebuggerImpl)
XInterpreter<?> interpreter
var XTextInterpreterEventPublisher eventSender
@Accessors var XTextInterpreterEventPublisher eventSender
val breakpoints = <XBreakpoint>newArrayList
val Object suspendedLock = new Object
EObject currentStepObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,32 @@ class AsyncXTextInterpreterEventPublisher implements XTextInterpreterEventPublis
}

override started() {
service.execute([ wrapped.started ])
async [ wrapped.started ]
}

override terminated() {
service.execute([ wrapped.terminated ])
async [ wrapped.terminated ]
}

override suspendStep() {
service.execute([ wrapped.suspendStep ])
async [ wrapped.suspendStep ]
}

override resumeStep() {
service.execute([ wrapped.resumeStep ])
async [ wrapped.resumeStep ]
}

override breakpointHit(String fileName, int lineNumber) {
service.execute([ wrapped.breakpointHit(fileName, lineNumber) ])
async [ wrapped.breakpointHit(fileName, lineNumber) ]
}

protected def async(Runnable r) {
if (!service.isShutdown)
service.execute(r)
}

def close() {
service.shutdown()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ import org.uqbar.project.wollok.interpreter.api.XDebugger
*/
class CommandHandlerFactory {

def static void createCommandHandler(XDebugger debugger, int port, ()=>void onReady) {
def static Server createCommandHandler(XDebugger debugger, int port, ()=>void onReady) {
val server = new Server
new CallHandler => [
val server = new Server
registerGlobal(DebugCommandHandler, new DebugCommandHandlerImpl(debugger, server, onReady))
// server.bind(port, it, new DebuggingProtocolFilter) // use this to debug RMI
server.bind(port, it)
]
server
}

def static remoteObjectName() { DebugCommandHandler.simpleName }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ interface DebugCommandHandler {
def void setBreakpoint(URI fileURI, int lineNumber)
def void clearBreakpoint(URI fileURI, int lineNumber)

def List<XDebugStackFrame> getStackFrames()
def List<XDebugStackFrame> getStackFrames() throws WollokDebuggerException

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.uqbar.project.wollok.interpreter.api.XDebugger
*
* @author jfernandes
*/
// this should probably have a better name
class DebugCommandHandlerImpl implements DebugCommandHandler {
Server server
XDebugger debugger
Expand Down Expand Up @@ -48,10 +49,15 @@ class DebugCommandHandlerImpl implements DebugCommandHandler {
debugger.clearBreakpoint(fileURI.toString, lineNumber)
}

override getStackFrames() {
Lists.newArrayList(debugger.stack.map[
new XDebugStackFrame(it)
])
override getStackFrames() throws WollokDebuggerException {
try {
Lists.newArrayList(debugger.stack.map[
new XDebugStackFrame(it)
])
}
catch (RuntimeException e) {
throw new WollokDebuggerException("Error while getting current stack trace", e)
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.uqbar.project.wollok.debugger.server.rmi

/**
* Base class for remote debugger exceptions
*
* @author jfernandes
*/
class WollokDebuggerException extends RuntimeException {

new(String message, Throwable cause) {
super(message, cause)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class XDebugStackFrameVariable implements Serializable {
}

def asRemoteValue(WollokObject object) {
if (object.hasNativeType(LIST) || object.hasNativeType(COLLECTION))
new XWollokListDebugValue(object)
if (object.hasNativeType(LIST))
new XWollokListDebugValue(object, LIST)
else if (object.hasNativeType(SET))
new XWollokListDebugValue(object, SET)
else
new XWollokObjectDebugValue(variable.name, object)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.uqbar.project.wollok.debugger.server.rmi

import java.io.Serializable
import java.util.ArrayList
import java.util.List
import org.eclipse.xtend.lib.annotations.Accessors

/**
Expand All @@ -15,6 +16,6 @@ class XDebugValue implements Serializable {
this.stringValue = stringValue
}

def ArrayList<XDebugStackFrameVariable> getVariables() { EMPTY_LIST }
def List<XDebugStackFrameVariable> getVariables() { EMPTY_LIST }

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.uqbar.project.wollok.debugger.server.rmi

import java.util.ArrayList
import java.util.Collection
import java.util.Collections
import java.util.List
import org.eclipse.xtend.lib.annotations.Accessors
import org.uqbar.project.wollok.interpreter.context.WVariable
import org.uqbar.project.wollok.interpreter.core.WollokObject
import org.uqbar.project.wollok.interpreter.nativeobj.JavaWrapper
import wollok.lang.WCollection

import static org.uqbar.project.wollok.sdk.WollokDSK.*

Expand All @@ -16,18 +17,18 @@ import static org.uqbar.project.wollok.sdk.WollokDSK.*
* @author jfernandes
*/
class XWollokListDebugValue extends XDebugValue {
@Accessors ArrayList<XDebugStackFrameVariable> variables = newArrayList
@Accessors List<XDebugStackFrameVariable> variables = newArrayList

new(WollokObject list) {
new(WollokObject list, String concreteNativeType) {
super('''List (id=«System.identityHashCode(list)»)''')
var i = 0
for (e : list.elements)
for (e : list.getElements(concreteNativeType))
variables.add(new XDebugStackFrameVariable(new WVariable(String.valueOf(i++), false), e))
}

def getElements(WollokObject object) {
val wrapped = object.getNativeObject(LIST) as JavaWrapper<List<WollokObject>>
wrapped.wrapped
def getElements(WollokObject object, String concreteNativeType) {
val native = object.getNativeObject(concreteNativeType) as WCollection<Collection<WollokObject>>
if (native.wrapped == null) Collections.EMPTY_LIST else native.wrapped
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.uqbar.project.wollok.debugger.server.rmi

import java.util.ArrayList
import java.util.List
import org.eclipse.xtend.lib.annotations.Accessors
import org.uqbar.project.wollok.interpreter.core.WollokObject
import org.uqbar.project.wollok.interpreter.nativeobj.JavaWrapper
Expand All @@ -20,7 +20,7 @@ import static extension org.uqbar.project.wollok.sdk.WollokDSK.*
class XWollokObjectDebugValue extends XDebugValue {
String typeName
String varName
@Accessors ArrayList<XDebugStackFrameVariable> variables = newArrayList
@Accessors List<XDebugStackFrameVariable> variables = newArrayList

new(String varName, WollokObject obj) {
super(obj.description)
Expand Down
4 changes: 2 additions & 2 deletions org.uqbar.project.wollok.lib/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Wollok Lib
Bundle-SymbolicName: org.uqbar.project.wollok.lib
Bundle-Version: 1.6.0.qualifier
Bundle-SymbolicName: org.uqbar.project.wollok.lib;singleton:=true
Bundle-Version: 1.5.1.qualifier
Bundle-Activator: org.uqbar.project.wollok.lib.WollokLibActivator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
Expand Down
3 changes: 2 additions & 1 deletion org.uqbar.project.wollok.lib/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ bin.includes = META-INF/,\
build.properties,\
src/wollok.wollokmf,\
src/wollok/,\
src/org/
src/org/,\
plugin.xml
source.. = src/,\
xtend-gen/

5 changes: 5 additions & 0 deletions org.uqbar.project.wollok.lib/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

</plugin>
4 changes: 2 additions & 2 deletions org.uqbar.project.wollok.lib/src/wollok/lang.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,11 @@ class Collection {
* Answers a new collection that contains the result of transforming each of self collection's elements
* using a given closure.
* The condition is a closure argument that takes a single element and Answers an object.
* @returns another collection (same type as self one)
* @returns another list
* Example:
* const ages = users.map({ user => user.age() })
*/
method map(closure) = self.fold(self.newInstance(), { acc, e =>
method map(closure) = self.fold([], { acc, e =>
acc.add(closure.apply(e))
acc
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import static extension org.uqbar.project.wollok.lib.WollokSDKExtensions.*
/**
* @author jfernandes
*/
class WCollection<T extends Collection> {
class WCollection<T extends Collection<WollokObject>> {
@Accessors var T wrapped
protected extension WollokInterpreterAccess = new WollokInterpreterAccess

Expand Down
2 changes: 1 addition & 1 deletion org.uqbar.project.wollok.lib/src/wollok/lang/WList.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import static extension org.uqbar.project.wollok.lib.WollokSDKExtensions.*
*
* @author jfernandes
*/
class WList extends WCollection<List> implements JavaWrapper<List> {
class WList extends WCollection<List<WollokObject>> implements JavaWrapper<List<WollokObject>> {

val WollokObject wollokInstance

Expand Down
2 changes: 1 addition & 1 deletion org.uqbar.project.wollok.lib/src/wollok/lang/WSet.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.uqbar.project.wollok.interpreter.core.WollokObject
/**
* @author jfernandes
*/
class WSet extends WCollection<Set> {
class WSet extends WCollection<Set<WollokObject>> {

new() {
wrapped = new TreeSet<WollokObject>(new WollokObjectComparator)
Expand Down
13 changes: 11 additions & 2 deletions org.uqbar.project.wollok.lib/src/wollok/lib.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ object game {
method whenKeyPressedSay(key, function) native
method whenCollideDo(element, action) native
method getObjectsIn(position) native
method colliders(visual) native
method say(element, message) native
method clear() native
method stop() native
Expand All @@ -194,6 +195,9 @@ object game {
}

method at(x, y) = new Position(x, y)
method origin() = self.at(0, 0)
method center() = self.at(self.getWidth().div(2), self.getHeight().div(2))


method setTitle(title) native
method getTitle() native
Expand Down Expand Up @@ -233,6 +237,12 @@ class Position {

method clone() = new Position(x, y)

method distance(position) {
const deltaX = self.getX() - position.getX()
const deltaY = self.getY() - position.getY()
return (deltaX.square() + deltaY.square()).squareRoot()
}

method clear() {
self.allElements().forEach{it => game.removeVisual(it)}
}
Expand All @@ -242,8 +252,7 @@ class Position {
method getY() = y
method setY(_y) { y = _y }

override method ==(other) =
x == other.getX() && y == other.getY()
override method ==(other) = x == other.getX() && y == other.getY()
}

object error {
Expand Down
9 changes: 9 additions & 0 deletions org.uqbar.project.wollok.lib/src/wollok/lib/GameObject.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ class GameObject {
.toList.javaToWollok
}

def colliders(WollokObject visual) {
val visualObject = board.findVisual(visual)
board.getComponentsInPosition(visualObject.position)
.map[ it as WVisual ]
.filter [ !it.equals(visualObject)]
.map [ it.wObject ]
.toList.javaToWollok
}

def say(WollokObject visual, WollokObject message) {
board.findVisual(visual).say(message.asString)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions org.uqbar.project.wollok.product/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
</property>
<property
name="aboutImage"
value="platform:/plugin/org.uqbar.project.wollok.ui/icons/wollok-logo-about.fw.png">
value="platform:/plugin/org.uqbar.project.wollok.product/icons/wollok-logo-about.fw.png">
</property>
<property
name="aboutText"
value="Wollok Programming Language and IDE&#x0A;Version 1.6.0&#x0A;&#x0A;http://uqbar-project.org&#x0A;http://wollok.uqbar-project.org&#x0A;&#x0A;© Copyright 2014, Uqbar Project Foundation, All right reserved">
value="Wollok Programming Language and IDE&#x0A;Version 1.5.1&#x0A;&#x0A;http://uqbar-project.org&#x0A;http://wollok.uqbar-project.org&#x0A;&#x0A;© Copyright 2016, Uqbar Project Foundation, All right reserved">
</property>
<property
name="windowImages"
Expand Down Expand Up @@ -74,7 +74,7 @@
<introProductBinding
introId="org.uqbar.project.wollok.product.intro"
productId="org.uqbar.project.wollok.product.org_uqbar_project_wollok_product">
</introProductBinding
</introProductBinding>
-->
</extension>
<extension
Expand Down
Loading

0 comments on commit 5afede1

Please sign in to comment.