Skip to content

Commit

Permalink
Merge 8eee26a into add53bd
Browse files Browse the repository at this point in the history
  • Loading branch information
fdodino committed Jul 27, 2019
2 parents add53bd + 8eee26a commit 74eea78
Show file tree
Hide file tree
Showing 11 changed files with 301 additions and 50 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ eclipse
.classpath
.project
.recommenders
.history
scripts/libs
scripts/jars
scripts/wollok-site
scripts/wollok-cli
63 changes: 29 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,47 @@ jdk:
- oraclejdk8
before_install:
- df -h
- openssl aes-256-cbc -K $encrypted_1cc7b892dc78_key -iv $encrypted_1cc7b892dc78_iv -in settings.xml.enc -out settings.xml -d
- openssl aes-256-cbc -K $encrypted_1cc7b892dc78_key -iv $encrypted_1cc7b892dc78_iv
-in settings.xml.enc -out settings.xml -d
- mv settings.xml ~/.m2/settings.xml

after_success:
- |
if [ $TRAVIS_PULL_REQUEST == "false" -a $TRAVIS_BRANCH == "master" ] ; then
cd scripts
chmod 777 ./updateRestOfWollokRepos
"./updateRestOfWollokRepos"
fi
script:
# Creates the correct profile to run
- cd org.uqbar.project.wollok.releng/
- export PROFILES=normalProfile
- export UPDATE_SITE=none
- if [ $TRAVIS_PULL_REQUEST == "false" -a $TRAVIS_BRANCH == "dev" ] ; then export UPDATE_SITE="dev" ; fi
- if [ $TRAVIS_PULL_REQUEST == "false" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9.]* ]] ; then export UPDATE_SITE="stable" ; fi
- if [ $TRAVIS_PULL_REQUEST == "false" -a $TRAVIS_BRANCH == "dev" ] ; then export
UPDATE_SITE="dev" ; fi
- if [ $TRAVIS_PULL_REQUEST == "false" ] && [[ "$TRAVIS_TAG" =~ ^v[0-9.]* ]] ; then
export UPDATE_SITE="stable" ; fi
- echo "Running with profiles $PROFILES"
- echo "Running with UPDATE_SITE $UPDATE_SITE"


# Maven build
- export MAVEN_OPTS=-Xmx2048m
- mvn -e -Darguments='-Dtycho.disableP2Mirrors=true' -Dtycho.disableP2Mirrors=true -U -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean install
jacoco:report coveralls:report -P $PROFILES
# I will delete the org.uqbar.wollok in the .m2 repo, as it is generated in every run, and is useless
- mvn -e -Darguments='-Dtycho.disableP2Mirrors=true' -Dtycho.disableP2Mirrors=true
-U -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean install jacoco:report coveralls:report -P
$PROFILES
- rm -rf /home/travis/.m2/repository/org/uqbar-project
# Moved from before_deploy, because it runs for each deploy, not only once
# I list the used space if there is a problem with the size of the build
- df -h
# Previously it was `du -h -d 4 ..` but since there are no longer any build problems, we use a deep level of 2
- du -h -d 2 ..
# Generating the release
- cd ..
- mkdir results-server
- mv org.uqbar.project.wollok.launch/target/org.uqbar.project.wollok.launch-*-wdk.zip results-server/
- mv org.uqbar.project.wollok.launch/target/org.uqbar.project.wollok.launch-*-wdk.zip
results-server/
- mkdir results-products
- cp results-server/org.uqbar.project.wollok.launch-*-wdk.zip results-products/org.uqbar.project.wollok.launch-wdk.zip
- mv org.uqbar.project.wollok.updatesite/target/org.uqbar.project.wollok.updatesite-*.zip results-products/
- mv org.uqbar.project.wollok.updatesite/target/org.uqbar.project.wollok.updatesite-*.zip
results-products/
- mv org.uqbar.project.wollok.updatesite/target/products/*.zip results-products/
- mkdir results-update
- unzip -q results-products/org.uqbar.project.wollok.updatesite-*.zip -d results-update/
- ls results-server
- ls results-products
- df -h

notifications:
webhooks:
urls:
Expand All @@ -53,31 +55,28 @@ notifications:
on_start: never
cache:
directories:
- $HOME/.m2

# If there is an error I will try to upload the logs
- "$HOME/.m2"
after_failure:
# I list the used space if there is a problem with the size of the build
- df -h
- du -h -d 4 ..
# I generate and upload a file with the output of the tests
- cd ..
- cd org.uqbar.project.wollok.tests
- zip -r -9 target.zip target/
- curl -T target.zip -u$BINTRAY_ID:$BINTRAY_API_KEY "https://api.bintray.com/content/wollok/TravisTestLog/WollokTestLogs/$TRAVIS_JOB_ID/target-$TRAVIS_JOB_ID.zip?publish=1&override=1"
- cd target
- zip -r -9 surefire-reports.zip surefire-reports/
- curl -T surefire-reports.zip -u$BINTRAY_ID:$BINTRAY_API_KEY "https://api.bintray.com/content/wollok/TravisTestLog/WollokTestLogs/$TRAVIS_JOB_ID/surefire-reports-$TRAVIS_JOB_ID.zip?publish=1&override=1"
- if [ -f work/data/.metadata/.log ] ; then curl -T work/data/.metadata/.log -u$BINTRAY_ID:$BINTRAY_API_KEY "https://api.bintray.com/content/wollok/TravisTestLog/WollokTestLogs/$TRAVIS_JOB_ID/log-$TRAVIS_JOB_ID.txt?publish=1&override=1" ; fi

- if [ -f work/data/.metadata/.log ] ; then curl -T work/data/.metadata/.log -u$BINTRAY_ID:$BINTRAY_API_KEY
"https://api.bintray.com/content/wollok/TravisTestLog/WollokTestLogs/$TRAVIS_JOB_ID/log-$TRAVIS_JOB_ID.txt?publish=1&override=1"
; fi
deploy:
- provider: s3
access_key_id: AKIAJLCGMGO45ZQFSLJA
secret_access_key:
secure: S2sP/SZJVO4uJtMrUYud3/qyLm7bN5ohTZrxO3TzONA5qiHYFnQdX+WUiEgbtUL0OZI6ZR5L29E/SRuH07zKEfWODsA7PDsAF7XfpgYi3LC20tqHBMq+07w4HPnRI/K19SC6V1/lnEBCRyGuOd5RIpC3VXccTRcPZDQIAqUviR4=
bucket: wollokserverrepo
local_dir: results-server
upload-dir: $TRAVIS_BRANCH
upload-dir: "$TRAVIS_BRANCH"
acl: public_read
skip_cleanup: true
region: us-west-2
Expand All @@ -87,23 +86,19 @@ deploy:
- dev
- master
- dev-1.5

- provider: s3
access_key_id: AKIAJLCGMGO45ZQFSLJA
secret_access_key:
secure: S2sP/SZJVO4uJtMrUYud3/qyLm7bN5ohTZrxO3TzONA5qiHYFnQdX+WUiEgbtUL0OZI6ZR5L29E/SRuH07zKEfWODsA7PDsAF7XfpgYi3LC20tqHBMq+07w4HPnRI/K19SC6V1/lnEBCRyGuOd5RIpC3VXccTRcPZDQIAqUviR4=
bucket: wollokversions
local_dir: results-products
upload-dir: $TRAVIS_TAG
upload-dir: "$TRAVIS_TAG"
acl: public_read
skip_cleanup: true
region: us-west-2
on:
repo: uqbar-project/wollok
tags: true

# Uploading download products

- provider: s3
access_key_id: AKIAJLCGMGO45ZQFSLJA
secret_access_key:
Expand All @@ -117,9 +112,6 @@ deploy:
on:
all_branches: true
condition: "$UPDATE_SITE =~ ^dev|stable$"

# Uploading update site

- provider: s3
access_key_id: AKIAJLCGMGO45ZQFSLJA
secret_access_key:
Expand All @@ -133,3 +125,6 @@ deploy:
on:
all_branches: true
condition: "$UPDATE_SITE =~ ^dev|stable$"
env:
global:
secure: IJCZW9xrLlUjs/HRkrpagk06zo2+FvKaMygUk6K9Fdim3uSsLmn4UyBazNli0a62oq3XuNpscsCmdVtofUCfZphEHnyIUUTToQ+u6j1KxbICjfIGFMmUEoY/7tZVscQ5SBgiqtEVfUvolN6v4YUtx2FwaS27FW5SV3/x8j6toPw=
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DirExplorer {
def closeWith(()=>void closure) {
closure.apply
}

}

interface FileHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.io.BufferedWriter
import java.io.File
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.List
import org.eclipse.emf.common.util.URI
import org.eclipse.emf.ecore.EObject
import org.eclipse.xtext.documentation.impl.MultiLineCommentDocumentationProvider
Expand All @@ -19,6 +20,8 @@ import org.uqbar.project.wollok.wollokDsl.WFile
import org.uqbar.project.wollok.wollokDsl.WMethodContainer
import org.uqbar.project.wollok.wollokDsl.WMethodDeclaration

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

import static extension org.uqbar.project.wollok.model.WMethodContainerExtensions.*
import static extension org.uqbar.project.wollok.model.WollokModelExtensions.*

Expand Down Expand Up @@ -59,7 +62,9 @@ class WollokDocParser extends WollokChecker {
var String outputFolder

@Inject MultiLineCommentDocumentationProvider multilineProvider


val List<WMethodDeclaration> privateMethods = newArrayList

def static void main(String[] args) {
new WollokDocParser().doMain(args)
}
Expand All @@ -79,6 +84,7 @@ class WollokDocParser extends WollokChecker {
}

override launch(String folder, WollokLauncherParameters parameters) {
println("Looking Wollok library in folder " + folder)
new DirExplorer(filterWollokElements, launchWollokDocGeneration) => [
explore(new File(folder))
writeNavbar
Expand All @@ -87,8 +93,13 @@ class WollokDocParser extends WollokChecker {

def void writeNavbar() {
val path = URI.createFileURI(outputFolder).segmentsList
val parentOutputFolder = path.subList(0, path.length - 1)
val file = new File(File.separator + parentOutputFolder.join(File.separator) + File.separator + "wollokDoc.md")
var parentOutputFolder = path.subList(0, path.length - 1)
var mainFile = parentOutputFolder.join(File.separator) + File.separator + "wollokDoc.md"
if (outputFolder.startsWith(File.separator)) {
mainFile = File.separator + mainFile
}
println("Writing " + mainFile)
val file = new File(mainFile)
wollokDocFile = Files.newWriter(file, Charsets.UTF_8) => [
write('''
---
Expand Down Expand Up @@ -129,6 +140,7 @@ class WollokDocParser extends WollokChecker {
file => [
allFiles.add(mainFile)
val htmlFile = mainFile.name.toHtmlFile
println("Generating " + outputFolder + File.separator + htmlFile)
wollokDocFile = Files.newWriter(new File(outputFolder + File.separator + htmlFile), Charsets.UTF_8)
wollokDocFile
.write('''
Expand Down Expand Up @@ -178,11 +190,17 @@ class WollokDocParser extends WollokChecker {

def dispatch void generateWollokDoc(WMethodDeclaration m) {
val comment = m.comment
val abstractDescription = if (m.abstract) badge("abstract", "light-blue") + SPACE else ""
val nativeDescription = if (m.native) badge("native", "indigo") else ""
writeFile("<td width=\"30%\"id=\"" + m.anchor + "\">" + BOLD_ON + m.name + BOLD_OFF + SPACE + m.parametersAsString + SPACE + SPACE +
abstractDescription + SPACE + SPACE + nativeDescription + SPACE + TABLE_DATA_OFF +
TABLE_DATA_ON + comment + TABLE_DATA_OFF)
if (m.originalComment.contains(PRIVATE)) {
privateMethods.add(m)
} else {
writeFile(TABLE_ROW_ON)
val abstractDescription = if (m.abstract) badge("abstract", "light-blue") + SPACE else ""
val nativeDescription = if (m.native) badge("native", "indigo") else ""
writeFile("<td width=\"30%\"id=\"" + m.anchor + "\">" + BOLD_ON + m.name + BOLD_OFF + SPACE + m.parametersAsString + SPACE + SPACE +
abstractDescription + SPACE + SPACE + nativeDescription + SPACE + TABLE_DATA_OFF +
TABLE_DATA_ON + comment + TABLE_DATA_OFF)
writeFile(TABLE_ROW_OFF)
}
}

def dispatch getDefinedConstructors(WMethodContainer mc) { newArrayList }
Expand All @@ -206,9 +224,7 @@ class WollokDocParser extends WollokChecker {
tableHeader("Method", "Description")
writeFile(TABLE_BODY_ON)
mc.methods.sortBy [ name ].forEach [
writeFile(TABLE_ROW_ON)
generateWollokDoc
writeFile(TABLE_ROW_OFF)
]
writeFile(TABLE_BODY_OFF)
writeFile(TABLE_OFF)
Expand Down Expand Up @@ -263,9 +279,17 @@ class WollokDocParser extends WollokChecker {
}
val currentMc = mc.parent
val methodsOverriden = mc.methods.filter [ overrides ].map [ name ].toList
val inheritedMethods = currentMc.methods.filter [ !methodsOverriden.contains(it.name) ].map [
linkToMethod(messageName, anchor, currentMc.declaringContext.file.URI.lastSegment)
].sort.join(", ")
val inheritedMethods = currentMc
.methods
.filter [
currentMethod | !methodsOverriden.contains(currentMethod.name)
&& !privateMethods.exists [ privateMethod | privateMethod.matches(currentMethod) ]
]
.map [
linkToMethod(messageName, anchor, currentMc.declaringContext.file.URI.lastSegment)
]
.sort
.join(", ")
card("Methods inherited from " + currentMc.name, inheritedMethods)
writeInheritedMethods(currentMc)
}
Expand Down Expand Up @@ -313,6 +337,10 @@ class WollokDocParser extends WollokChecker {
''')
}

def String originalComment(EObject o) {
multilineProvider.getDocumentation(o) ?: ""
}

def String comment(EObject o) {
val comment = (multilineProvider.getDocumentation(o) ?: "")
.replace(System.lineSeparator, LINE_BREAK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import static extension org.uqbar.project.wollok.errorHandling.HumanReadableUtil
import static extension org.uqbar.project.wollok.model.WMethodContainerExtensions.*
import static extension org.uqbar.project.wollok.model.WollokModelExtensions.*

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

/**
*
* @author jfernandes
Expand All @@ -44,7 +46,6 @@ import static extension org.uqbar.project.wollok.model.WollokModelExtensions.*
class WollokDslProposalProvider extends AbstractWollokDslProposalProvider {
val extension BasicTypeResolver typeResolver = new BasicTypeResolver
val extension WollokClassFinder classFinder = WollokClassFinder.getInstance
public static val String PRIVATE = "@private"

WollokProposalBuilder builder

Expand Down Expand Up @@ -210,7 +211,7 @@ class WollokDslProposalProvider extends AbstractWollokDslProposalProvider {
builder.accessorKind = Accessor.SETTER
ref.allPropertiesSetters.forEach [ addProposal(it, acceptor) ]
builder.accessorKind = Accessor.NONE
ref.allMethods.forEach[ addProposal(it, acceptor) ]
ref.getInheritedMethods.forEach[ addProposal(it, acceptor) ]
}

def addProposal(EObject o, ICompletionProposalAcceptor acceptor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ class WMethodContainerExtensions extends WollokModelExtensions {
chain.addAll(parent.linearizeHierarchy)
chain
}

def static matches(WMethodDeclaration m1, WMethodDeclaration m2) {
m1.name.equals(m2.name) && m1.parameters.length === m2.parameters.length
}

def static matches(WMethodDeclaration it, String message, List<?> params) {
matches(message, params.size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ class WollokSDK {

public static val INITIALIZE_METHOD = "initialize"

// ************************************************************************
// ** Modifiers
// ************************************************************************
public static val String PRIVATE = "@private"

def static WollokObject getVoid(WollokInterpreter i, EObject context) {
(i.evaluator as WollokInterpreterEvaluator).getWKObject(VOID, context)
}
Expand Down
11 changes: 11 additions & 0 deletions scripts/ssh_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Host wollok_cli
HostName github.com
PreferredAuthentications publickey
IdentityFile /tmp/wollokcli_key
IdentitiesOnly yes

Host wollok_site
HostName github.com
PreferredAuthentications publickey
IdentityFile /tmp/wolloksite_key
IdentitiesOnly yes
Loading

0 comments on commit 74eea78

Please sign in to comment.