Update xtend and embed it 40/13540/11
authorRobert Varga <rovarga@cisco.com>
Wed, 24 Dec 2014 13:28:27 +0000 (14:28 +0100)
committerRobert Varga <rovarga@cisco.com>
Wed, 24 Dec 2014 21:17:00 +0000 (22:17 +0100)
Rather than requiring an osgified version of xtend, let's embed that
dependency. Also upgrade it do 2.7.3 to make things work with Java 8.

Change-Id: I975d9431f3e9bb31a0a364e7b7abfd4155191548
Signed-off-by: Robert Varga <rovarga@cisco.com>
code-generator/binding-generator-impl/pom.xml
code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/TransformerGenerator.xtend
common/artifacts/pom.xml
common/features/pom.xml
common/features/src/main/feature/features.xml
common/parent/pom.xml
integration-test/bundle-test/pom.xml
integration-test/bundle-test/src/test/java/org/opendaylight/yangtools/bundle/test/BundleStartTest.java
third-party/pom.xml
third-party/xtend-lib-osgi/pom.xml [deleted file]

index 774a8446da9e6e26ca8e847cf36aff559bf82062..c5ed3cfdb6e8028c117216799a60177ead59d70b 100644 (file)
@@ -17,6 +17,7 @@
 
     <modelVersion>4.0.0</modelVersion>
     <artifactId>binding-generator-impl</artifactId>
+    <packaging>bundle</packaging>
 
     <dependencies>
         <dependency>
@@ -73,9 +74,6 @@
 
     <build>
         <plugins>
-            <plugin>
-                <artifactId>maven-jar-plugin</artifactId>
-            </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                             org.opendaylight.yangtools.sal.binding.generator.impl.*,
                             org.opendaylight.yangtools.sal.binding.generator.util.*
                         </Export-Package>
+                        <Embed-Dependency>
+                            org.eclipse.xtend.lib;inline=true,
+                            org.eclipse.xtend.lib.macro;inline=true,
+                            org.eclipse.xtext.xbase.lib;inline=true,
+                        </Embed-Dependency>
+                        <Embed-Transitive>true</Embed-Transitive>
                     </instructions>
                 </configuration>
             </plugin>
index 6c557aca4388d7fff3f35a51487ff765c1653e9f..3937e0bb01f7bbc2aeb699a3af17f853c341da8f 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.sal.binding.generator.impl
 
 import com.google.common.base.Joiner
+import com.google.common.base.Supplier
 import java.io.File
 import java.security.ProtectionDomain
 import java.util.AbstractMap.SimpleEntry
@@ -195,38 +196,38 @@ class TransformerGenerator extends AbstractTransformerGenerator {
         if (cl === null) {
             cl = Thread.currentThread.contextClassLoader
         }
-        ClassLoaderUtils.withClassLoader(cl,
-            [ |
-                if (!(node instanceof DataNodeContainer)) {
-                    return null
-                }
-                var InstanceIdentifier<?> bindingId = getBindingIdentifierByPath(node.path)
-                if (bindingId != null) {
-                    return null
-                }
-                val ref = Types.typeForClass(inputType)
-                var typeSpecBuilder = getDefinition(ref)
-                if (typeSpecBuilder == null) {
-                    typeSpecBuilder = getTypeBuilder(node.path);
-                }
-                checkState(typeSpecBuilder !== null, "Could not find type definition for %s, $s", inputType.name, node);
-                val typeSpec = typeSpecBuilder.toInstance();
-                var InstanceIdentifier<?> parent
-                if (parentId == null) {
-                    bindingId = InstanceIdentifier.create(inputType as Class)
-                    parent = bindingId
-                    putPathToBindingIdentifier(node.path, bindingId)
-                } else {
-                    parent = putPathToBindingIdentifier(node.path, parentId, inputType)
-                }
-                val Map<String, Type> properties = typeSpec.allProperties
-                if (node instanceof DataNodeContainer) {
-                    mappingForNodes((node as DataNodeContainer).childNodes, properties, parent)
-                } else if (node instanceof ChoiceNode) {
-                    mappingForNodes((node as ChoiceNode).cases, properties, parent)
-                }
-                return null;
-            ])
+
+        val Supplier<?> sup = [ |
+            if (!(node instanceof DataNodeContainer)) {
+                return null
+            }
+            var InstanceIdentifier<?> bindingId = getBindingIdentifierByPath(node.path)
+            if (bindingId != null) {
+                return null
+            }
+            val ref = Types.typeForClass(inputType)
+            var typeSpecBuilder = getDefinition(ref)
+            if (typeSpecBuilder == null) {
+                typeSpecBuilder = getTypeBuilder(node.path);
+            }
+            checkState(typeSpecBuilder !== null, "Could not find type definition for %s, $s", inputType.name, node);
+            val typeSpec = typeSpecBuilder.toInstance();
+            var InstanceIdentifier<?> parent
+            if (parentId == null) {
+                bindingId = InstanceIdentifier.create(inputType as Class)
+                parent = bindingId
+                putPathToBindingIdentifier(node.path, bindingId)
+            } else {
+                parent = putPathToBindingIdentifier(node.path, parentId, inputType)
+            }
+            val Map<String, Type> properties = typeSpec.allProperties
+            if (node instanceof DataNodeContainer) {
+                mappingForNodes((node as DataNodeContainer).childNodes, properties, parent)
+            } else if (node instanceof ChoiceNode) {
+                mappingForNodes((node as ChoiceNode).cases, properties, parent)
+            }
+            return null ]
+        ClassLoaderUtils.withClassLoader(cl, sup)
     }
 
     private def void mappingForNodes(Collection<? extends DataSchemaNode> childNodes, Map<String, Type> properties,
index a58b44767471d86e365420d78147412f46a09a13..ef3f8c7a26ee9241e939c58e7bcdc8fbab2deb06 100644 (file)
                 <artifactId>antlr4-runtime-osgi-nohead</artifactId>
                 <version>4.0</version>
             </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.thirdparty</groupId>
-                <artifactId>xtend-lib-osgi</artifactId>
-                <version>2.4.3</version>
-            </dependency>
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>concepts</artifactId>
index 9910970400f63ba59fec35f09498aa1e2c33a087..dbf95156e7ee86a1fee7419e863edf9167ebd6ca 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>binding-data-codec</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools.thirdparty</groupId>
-            <artifactId>xtend-lib-osgi</artifactId>
-            <scope>compile</scope>
-        </dependency>
         <dependency>
             <groupId>com.google.code.gson</groupId>
             <artifactId>gson</artifactId>
index ba174b1678e90836bcc91264195b3def57cf7d70..673c7bced9c22e87bec86988dd0442ccb674f07f 100644 (file)
@@ -79,7 +79,6 @@
         <bundle>mvn:org.opendaylight.yangtools/binding-model-api/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.yangtools/binding-type-provider/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.yangtools/binding-data-codec/{{VERSION}}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools.thirdparty/xtend-lib-osgi/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.yangtools/yang-model-api/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.yangtools/yang-model-util/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.yangtools/yang-parser-api/{{VERSION}}</bundle>
index 7a213959341bd941e4f29f6a3d045d521fed8f3f..f045623fcc30aec64a3f2bab535b537259b45df0 100644 (file)
             <dependency>
                 <groupId>org.eclipse.xtend</groupId>
                 <artifactId>org.eclipse.xtend.lib</artifactId>
-                <version>2.4.3</version>
+                <version>2.7.3</version>
             </dependency>
             <dependency>
                 <groupId>org.osgi</groupId>
                 <plugin>
                     <groupId>org.eclipse.xtend</groupId>
                     <artifactId>xtend-maven-plugin</artifactId>
-                    <version>${xtend.version}</version>
+                    <version>2.7.3</version>
                     <executions>
                         <execution>
                             <goals>
index 5767124eb29c32376d380b0dfbc0706aa9650f1c..63de755288a069f5c5548348daca887848b6c388 100644 (file)
             <artifactId>antlr4-runtime-osgi-nohead</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools.thirdparty</groupId>
-            <artifactId>xtend-lib-osgi</artifactId>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <build>
index f0bbe6d77c3c3e1369bba8336780de74a6f5b10e..932ed416bbf3bddf33528ba7290eb88b09d4e914 100644 (file)
@@ -42,7 +42,6 @@ public class BundleStartTest {
         options.add(mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject());
         options.add(mavenBundle("org.opendaylight.yangtools.thirdparty", "antlr4-runtime-osgi-nohead")
                 .versionAsInProject());
-        options.add(mavenBundle("org.opendaylight.yangtools.thirdparty", "xtend-lib-osgi").versionAsInProject());
         options.add(mavenBundle("org.javassist", "javassist").versionAsInProject());
 
         options.add(mavenBundle(GROUP, "concepts").versionAsInProject());
index 0d2c3fc18efe09c82e6771699c4703a023947cb8..c22c469cc2f12640b191530b351e5e98d44ab405 100644 (file)
@@ -24,7 +24,6 @@
     <packaging>pom</packaging>
 
     <modules>
-        <module>xtend-lib-osgi</module>
         <module>antlr4-runtime-osgi</module>
     </modules>
 
diff --git a/third-party/xtend-lib-osgi/pom.xml b/third-party/xtend-lib-osgi/pom.xml
deleted file mode 100644 (file)
index ca98a46..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
-
- This program and the accompanying materials are made available under the
- terms of the Eclipse Public License v1.0 which accompanies this distribution,
- and is available at http://www.eclipse.org/legal/epl-v10.html
--->
-<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.opendaylight.yangtools</groupId>
-        <artifactId>third-party-parent</artifactId>
-        <version>0.7.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>xtend-lib-osgi</artifactId>
-    <version>2.4.3</version>
-    <packaging>bundle</packaging>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                       <Bundle-Name>Xtend Runtime Library</Bundle-Name>
-                        <Bundle-SymbolicName>org.eclipse.xtend.lib</Bundle-SymbolicName>
-                        <Import-Package>
-                        com.google.common.base;version="[10.0.1,16)",
-                        com.google.common.collect;version="[10.0.1,16)",
-                        com.google.common.primitives;version="[10.0.1,16)"
-                        </Import-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.eclipse.xtend</groupId>
-            <artifactId>org.eclipse.xtend.lib</artifactId>
-            <version>2.4.3</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.xtext</groupId>
-            <artifactId>org.eclipse.xtext.xbase.lib</artifactId>
-            <version>2.4.3</version>
-        </dependency>
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-            <version>[10.0.1,15.0)</version>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-</project>