From 48c337471f0812e4970d0df03cc88ab72b566c3e Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 24 Dec 2014 14:28:27 +0100 Subject: [PATCH] Update xtend and embed it 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 --- code-generator/binding-generator-impl/pom.xml | 10 ++- .../generator/impl/TransformerGenerator.xtend | 65 ++++++++++--------- common/artifacts/pom.xml | 5 -- common/features/pom.xml | 5 -- common/features/src/main/feature/features.xml | 1 - common/parent/pom.xml | 4 +- integration-test/bundle-test/pom.xml | 5 -- .../bundle/test/BundleStartTest.java | 1 - third-party/pom.xml | 1 - third-party/xtend-lib-osgi/pom.xml | 63 ------------------ 10 files changed, 42 insertions(+), 118 deletions(-) delete mode 100644 third-party/xtend-lib-osgi/pom.xml diff --git a/code-generator/binding-generator-impl/pom.xml b/code-generator/binding-generator-impl/pom.xml index 774a8446da..c5ed3cfdb6 100644 --- a/code-generator/binding-generator-impl/pom.xml +++ b/code-generator/binding-generator-impl/pom.xml @@ -17,6 +17,7 @@ 4.0.0 binding-generator-impl + bundle @@ -73,9 +74,6 @@ - - maven-jar-plugin - org.apache.felix maven-bundle-plugin @@ -87,6 +85,12 @@ org.opendaylight.yangtools.sal.binding.generator.impl.*, org.opendaylight.yangtools.sal.binding.generator.util.* + + org.eclipse.xtend.lib;inline=true, + org.eclipse.xtend.lib.macro;inline=true, + org.eclipse.xtext.xbase.lib;inline=true, + + true diff --git a/code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/TransformerGenerator.xtend b/code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/TransformerGenerator.xtend index 6c557aca43..3937e0bb01 100644 --- a/code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/TransformerGenerator.xtend +++ b/code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/TransformerGenerator.xtend @@ -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 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 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 childNodes, Map properties, diff --git a/common/artifacts/pom.xml b/common/artifacts/pom.xml index a58b447674..ef3f8c7a26 100644 --- a/common/artifacts/pom.xml +++ b/common/artifacts/pom.xml @@ -41,11 +41,6 @@ antlr4-runtime-osgi-nohead 4.0 - - org.opendaylight.yangtools.thirdparty - xtend-lib-osgi - 2.4.3 - org.opendaylight.yangtools concepts diff --git a/common/features/pom.xml b/common/features/pom.xml index 9910970400..dbf95156e7 100644 --- a/common/features/pom.xml +++ b/common/features/pom.xml @@ -223,11 +223,6 @@ org.opendaylight.yangtools binding-data-codec - - org.opendaylight.yangtools.thirdparty - xtend-lib-osgi - compile - com.google.code.gson gson diff --git a/common/features/src/main/feature/features.xml b/common/features/src/main/feature/features.xml index ba174b1678..673c7bced9 100644 --- a/common/features/src/main/feature/features.xml +++ b/common/features/src/main/feature/features.xml @@ -79,7 +79,6 @@ mvn:org.opendaylight.yangtools/binding-model-api/{{VERSION}} mvn:org.opendaylight.yangtools/binding-type-provider/{{VERSION}} mvn:org.opendaylight.yangtools/binding-data-codec/{{VERSION}} - mvn:org.opendaylight.yangtools.thirdparty/xtend-lib-osgi/{{VERSION}} mvn:org.opendaylight.yangtools/yang-model-api/{{VERSION}} mvn:org.opendaylight.yangtools/yang-model-util/{{VERSION}} mvn:org.opendaylight.yangtools/yang-parser-api/{{VERSION}} diff --git a/common/parent/pom.xml b/common/parent/pom.xml index 7a21395934..f045623fcc 100644 --- a/common/parent/pom.xml +++ b/common/parent/pom.xml @@ -133,7 +133,7 @@ org.eclipse.xtend org.eclipse.xtend.lib - 2.4.3 + 2.7.3 org.osgi @@ -436,7 +436,7 @@ org.eclipse.xtend xtend-maven-plugin - ${xtend.version} + 2.7.3 diff --git a/integration-test/bundle-test/pom.xml b/integration-test/bundle-test/pom.xml index 5767124eb2..63de755288 100644 --- a/integration-test/bundle-test/pom.xml +++ b/integration-test/bundle-test/pom.xml @@ -60,11 +60,6 @@ antlr4-runtime-osgi-nohead test - - org.opendaylight.yangtools.thirdparty - xtend-lib-osgi - test - diff --git a/integration-test/bundle-test/src/test/java/org/opendaylight/yangtools/bundle/test/BundleStartTest.java b/integration-test/bundle-test/src/test/java/org/opendaylight/yangtools/bundle/test/BundleStartTest.java index f0bbe6d77c..932ed416bb 100644 --- a/integration-test/bundle-test/src/test/java/org/opendaylight/yangtools/bundle/test/BundleStartTest.java +++ b/integration-test/bundle-test/src/test/java/org/opendaylight/yangtools/bundle/test/BundleStartTest.java @@ -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()); diff --git a/third-party/pom.xml b/third-party/pom.xml index 0d2c3fc18e..c22c469cc2 100644 --- a/third-party/pom.xml +++ b/third-party/pom.xml @@ -24,7 +24,6 @@ pom - xtend-lib-osgi antlr4-runtime-osgi diff --git a/third-party/xtend-lib-osgi/pom.xml b/third-party/xtend-lib-osgi/pom.xml deleted file mode 100644 index ca98a46737..0000000000 --- a/third-party/xtend-lib-osgi/pom.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - 4.0.0 - - org.opendaylight.yangtools - third-party-parent - 0.7.0-SNAPSHOT - ../pom.xml - - - xtend-lib-osgi - 2.4.3 - bundle - - - - - org.apache.felix - maven-bundle-plugin - true - - - Xtend Runtime Library - org.eclipse.xtend.lib - - 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)" - - - - - - - - - - org.eclipse.xtend - org.eclipse.xtend.lib - 2.4.3 - - - org.eclipse.xtext - org.eclipse.xtext.xbase.lib - 2.4.3 - - - com.google.guava - guava - [10.0.1,15.0) - provided - - - -- 2.36.6