[ https://issues.apache.org/jira/browse/TINKERPOP-1489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16311484#comment-16311484 ]
ASF GitHub Bot commented on TINKERPOP-1489: ------------------------------------------- Github user spmallette commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/695#discussion_r159677279 --- Diff: gremlin-javascript/pom.xml --- @@ -0,0 +1,366 @@ +<!-- +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>tinkerpop</artifactId> + <version>3.2.7-SNAPSHOT</version> + </parent> + <artifactId>gremlin-javascript</artifactId> + <name>Apache TinkerPop :: Gremlin Javascript</name> + <dependencies> + <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>tinkergraph-gremlin</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-test</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-server</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <properties> + <maven.test.skip>false</maven.test.skip> + <skipTests>${maven.test.skip}</skipTests> + <gremlin.server.dir>${project.parent.basedir}/gremlin-server</gremlin.server.dir> + </properties> + <build> + <directory>${basedir}/target</directory> + <finalName>${project.artifactId}-${project.version}</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-install-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <!-- + Use gmavenplus-plugin to: + - Generate js sources + - Start and stop gremlin server for integration tests + --> + <groupId>org.codehaus.gmavenplus</groupId> + <artifactId>gmavenplus-plugin</artifactId> + <dependencies> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.17</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>gremlin-server</artifactId> + <version>${project.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.codehaus.groovy</groupId> + <artifactId>groovy-ant</artifactId> + <version>${groovy.version}</version> + </dependency> + </dependencies> + <executions> + <execution> + <id>generate-javascript</id> + <phase>generate-sources</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <scripts> + <script><![CDATA[ +import org.apache.tinkerpop.gremlin.jsr223.CoreImports +import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource +import org.apache.tinkerpop.gremlin.process.traversal.P +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__ +import java.lang.reflect.Modifier + +def toJsMap = ["in": "in_", + "from": "from_"] + +def toJs = { symbol -> toJsMap.getOrDefault(symbol, symbol) } + +def decapitalize = { + String string = it; + if (string == null || string.length() == 0) { + return string; + } + def c = string.toCharArray(); + c[0] = Character.toLowerCase(c[0]); + return new String(c); +} + +def determineVersion = { + def env = System.getenv() + def mavenVersion = env.containsKey("TP_RELEASE_VERSION") ? env.get("JS_RELEASE_VERSION") : '${project.version}' + return mavenVersion.replace("-SNAPSHOT", "-alpha1") +} + +def binding = ["enums": CoreImports.getClassImports() + .findAll { Enum.class.isAssignableFrom(it) } + .sort { a, b -> a.getSimpleName() <=> b.getSimpleName() }, + "pmethods": P.class.getMethods(). + findAll { Modifier.isStatic(it.getModifiers()) }. + findAll { P.class.isAssignableFrom(it.returnType) }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }, + "sourceStepMethods": GraphTraversalSource.getMethods(). // SOURCE STEPS + findAll { GraphTraversalSource.class.equals(it.returnType) }. + findAll { + !it.name.equals("clone") && + // Use hardcoded name to be for forward-compatibility + !it.name.equals("withBindings") && + !it.name.equals(TraversalSource.Symbols.withRemote) && + !it.name.equals(TraversalSource.Symbols.withComputer) + }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }, + "sourceSpawnMethods": GraphTraversalSource.getMethods(). // SPAWN STEPS + findAll { GraphTraversal.class.equals(it.returnType) }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }, + "graphStepMethods": GraphTraversal.getMethods(). + findAll { GraphTraversal.class.equals(it.returnType) }. + findAll { !it.name.equals("clone") && !it.name.equals("iterate") }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }, + "anonStepMethods": __.class.getMethods(). + findAll { GraphTraversal.class.equals(it.returnType) }. + findAll { Modifier.isStatic(it.getModifiers()) }. + findAll { !it.name.equals("__") && !it.name.equals("start") }. + collect { it.name }. + unique(). + sort { a, b -> a <=> b }, + "toJs": toJs, + "version": determineVersion(), + "decapitalize": decapitalize] + +def engine = new groovy.text.GStringTemplateEngine() +def graphTraversalTemplate = engine.createTemplate(new File('${project.basedir}/glv/GraphTraversalSource.template')).make(binding) +def graphTraversalFile = new File('${project.basedir}/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js') +graphTraversalFile.newWriter().withWriter{ it << graphTraversalTemplate } + +def traversalTemplate = engine.createTemplate(new File('${project.basedir}/glv/TraversalSource.template')).make(binding) +def traversalFile = new File('${project.basedir}/src/main/javascript/gremlin-javascript/lib/process/traversal.js') +traversalFile.newWriter().withWriter{ it << traversalTemplate } + +def packageJsonTemplate = engine.createTemplate(new File('${project.basedir}/glv/PackageJson.template')).make(binding) +def packageJsonFile = new File('${project.basedir}/src/main/javascript/gremlin-javascript/package.json') +packageJsonFile.newWriter().withWriter{ it << packageJsonTemplate } +]]> </script> + </scripts> + </configuration> + </execution> + <execution> + <id>gremlin-server-start</id> + <phase>pre-integration-test</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <properties> + <property> + <name>skipTests</name> + <value>${skipTests}</value> + </property> + <property> + <name>python</name> + <value>false</value> + </property> + <property> + <name>gremlinServerDir</name> + <value>${gremlin.server.dir}</value> + </property> + <property> + <name>settingsFile</name> + <value>${gremlin.server.dir}/src/test/resources/org/apache/tinkerpop/gremlin/driver/remote/gremlin-server-integration.yaml</value> + </property> + <property> + <name>executionName</name> + <value>${project.name}</value> + </property> + <property> + <name>projectBaseDir</name> + <value>${project.basedir}</value> + </property> + </properties> + <scripts> + <script>${gremlin.server.dir}/src/test/scripts/test-server-start.groovy</script> + </scripts> + </configuration> + </execution> + <execution> + <id>gremlin-server-stop</id> + <phase>post-integration-test</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <properties> + <property> + <name>skipTests</name> + <value>${skipTests}</value> + </property> + <property> + <name>executionName</name> + <value>${project.name}</value> + </property> + </properties> + <scripts> + <script>${gremlin.server.dir}/src/test/scripts/test-server-stop.groovy</script> + </scripts> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <version>3.0.0</version> + <executions> + <execution> + <goals> + <goal>clean</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>com.github.eirslett</groupId> + <artifactId>frontend-maven-plugin</artifactId> + <version>1.4</version> + <executions> + <execution> + <id>install node and npm</id> + <phase>generate-test-resources</phase> + <goals> + <goal>install-node-and-npm</goal> + </goals> + </execution> + <execution> + <id>npm install</id> + <phase>generate-test-resources</phase> + <goals> + <goal>npm</goal> + </goals> + <configuration> + <arguments>install</arguments> + </configuration> + </execution> + <execution> + <id>npm test</id> + <phase>integration-test</phase> + <goals> + <goal>npm</goal> + </goals> + <configuration> + <arguments>test</arguments> + <failOnError>true</failOnError> + </configuration> + </execution> + <execution> + <id>npm test gherkin features</id> + <phase>integration-test</phase> + <goals> + <goal>npm</goal> + </goals> + <configuration> + <arguments>run-script features</arguments> + <failOnError>true</failOnError> + </configuration> + </execution> + </executions> + <configuration> + <skip>${skipIntegrationTests}</skip> + <workingDirectory>src/main/javascript/gremlin-javascript</workingDirectory> + <nodeVersion>v4.8.3</nodeVersion> + </configuration> + </plugin> + </plugins> + </build> + <profiles> + <!-- + Provides a way to deploy the gremlin-javascript GLV to npm. This cannot be part of the standard maven execution + because npm does not have a staging environment like sonatype for releases. As soon as the release is + published it is public. In our release workflow, deploy occurs prior to vote on the release and we can't + make this stuff public until the vote is over. + --> + <profile> + <id>glv-javascript-deploy</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <build> + <plugins> --- End diff -- is there any special configuration required in the release manager's local environment for this to work? Either way, It would be a massive help if you could provide a "Javascript Environment" section in the dev docs here: http://tinkerpop.apache.org/docs/current/dev/developer/#system-configuration > Provide a Javascript Gremlin Language Variant > --------------------------------------------- > > Key: TINKERPOP-1489 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1489 > Project: TinkerPop > Issue Type: Improvement > Components: javascript > Affects Versions: 3.2.5 > Reporter: Jorge Bay > > It would be nice to have a Javascript Gremlin Language Variant that could > work with any ES5 runtime, specially the ones that support > [CommonJs|http://requirejs.org/docs/commonjs.html], like Node.js. > Nashorn, the engine shipped with JDK 8+, does not implement CommonJs but > provides [additional > extensions|https://wiki.openjdk.java.net/display/Nashorn/Nashorn+extensions] > making modular JavaScript possible. Nashorn should be supported in order to > run glv tests under the same infrastructure (JDK8). -- This message was sent by Atlassian JIRA (v6.4.14#64029)