Skip to content

Commit

Permalink
chore: replace MatCalciteDependencies with Import-Package in META-INF…
Browse files Browse the repository at this point in the history
…/MANIFEST.MF
  • Loading branch information
vlsi committed Nov 13, 2023
1 parent e3f6c7f commit 44c590e
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 154 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ jobs:
with:
distribution: zulu
java-version: ${{ matrix.java }}
- name: Build MatCalciteDependencies
run: |
cd MatCalciteDependencies
../mvnw --color=always -B install
- name: Test
run: |
./mvnw --color=always -B verify
Expand Down
1 change: 0 additions & 1 deletion MatCalciteDependencies/.gitignore

This file was deleted.

119 changes: 0 additions & 119 deletions MatCalciteDependencies/pom.xml

This file was deleted.

34 changes: 33 additions & 1 deletion MatCalcitePlugin/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,37 @@ Require-Bundle: org.eclipse.mat.api;bundle-version="1.14.0",
org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.jface.text;bundle-version="3.7.2",
org.eclipse.core.resources;bundle-version="3.7.101"
Bundle-ClassPath: .,target/dependency/MatCalciteDependencies.jar
Export-Package: com.github.vlsi.mat.calcite
Import-Package: com.fasterxml.jackson.core.util,
com.google.common.base,
com.google.common.cache,
com.google.common.collect,
com.google.protobuf,
com.jayway.jsonpath.spi.mapper,
org.apache.calcite.adapter.enumerable,
org.apache.calcite.adapter.java,
org.apache.calcite.avatica,
org.apache.calcite.jdbc,
org.apache.calcite.linq4j,
org.apache.calcite.linq4j.tree,
org.apache.calcite.plan,
org.apache.calcite.rel,
org.apache.calcite.rel.core,
org.apache.calcite.rel.rules,
org.apache.calcite.rel.type,
org.apache.calcite.rex,
org.apache.calcite.schema,
org.apache.calcite.schema.impl,
org.apache.calcite.sql,
org.apache.calcite.sql.advise,
org.apache.calcite.sql.parser,
org.apache.calcite.sql.type,
org.apache.calcite.sql.validate,
org.apache.calcite.tools,
org.apache.calcite.util,
org.apache.commons.codec,
org.apache.commons.math3.fraction,
org.apache.commons.text.similarity,
org.codehaus.commons.compiler,
org.codehaus.janino,
org.locationtech.jts.geom
2 changes: 0 additions & 2 deletions MatCalcitePlugin/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
target/dependency/MatCalciteDependencies.jar,\
resources/
jars.compile.order = .
jars.extra.classpath = target/dependency/MatCalciteDependencies.jar
67 changes: 57 additions & 10 deletions MatCalcitePlugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,49 @@

<dependencies>
<dependency>
<groupId>com.github.vlsi.mat.calcite</groupId>
<artifactId>MatCalciteDependencies</artifactId>
<version>${project.version}</version>
<groupId>net.minidev</groupId>
<artifactId>accessors-smart</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
<version>1.36.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.3-jre</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
<version>3.1.9</version>
</dependency>
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>3.1.9</version>
</dependency>
</dependencies>

Expand All @@ -33,6 +73,20 @@
</resources>

<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.9</version>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
Expand Down Expand Up @@ -67,13 +121,6 @@
<version>${tycho-version}</version>
<configuration>
<verbose>true</verbose>
<extraClasspathElements>
<extraClasspathElement>
<groupId>com.github.vlsi.mat.calcite</groupId>
<artifactId>MatCalciteDependencies</artifactId>
<version>${project.version}</version>
</extraClasspathElement>
</extraClasspathElements>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.apache.calcite.schema.Schema;
import org.apache.calcite.schema.SchemaPlus;
import org.codehaus.commons.compiler.CompilerFactoryFactory;
import org.codehaus.janino.CompilerFactory;
import org.eclipse.mat.snapshot.ISnapshot;

import java.sql.Connection;
Expand Down Expand Up @@ -85,7 +86,7 @@ private static void initJanino() throws SQLException {
Thread currentThread = Thread.currentThread();
ClassLoader cl = currentThread.getContextClassLoader();
try {
currentThread.setContextClassLoader(CompilerFactoryFactory.class.getClassLoader());
currentThread.setContextClassLoader(CompilerFactory.class.getClassLoader());
if (CompilerFactoryFactory.getDefaultCompilerFactory() == null) {
throw new SQLException("Janino compiler is not initialized: CompilerFactoryFactory.getDefaultCompilerFactory" +
"() == null");
Expand Down
31 changes: 30 additions & 1 deletion MatCalciteTargetPlatform/MatCalciteTargetPlatform.target
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.5"?>

<target name="eclipse 4.5.0">
<target name="eclipse 4.5.0" includeMode="feature">
<locations>
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
<unit id="org.eclipse.rcp.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.p2.user.ui.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/releases/2023-09"/>
</location>
<location includeDependencyDepth="infinite" includeDependencyScopes="compile,provided,runtime" includeSource="true" label="Maven Central" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>accessors-smart</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
<version>1.36.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.3-jre</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>
</location>
</locations>
</target>
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,24 +240,12 @@ Eclipse plugin cannot depend on jars from maven repository.
It has to be a OSGi bundle, however Calcite is easier to reach via maven.
So we use two-phase approach: bundle the dependencies in a single jar, then use this jar in eclipse project.

1. Build dependencies.jar
1. Build the plugin

```
cd MatCalciteDependencies
mvn install
./mvnw install # from the top-level folder
```
This will create a jar with all the dependencies in `dependencies/target` folder.
You do not need to touch/move/copy the jar.
2. Build the plugin
```
mvn install # from the top-level folder
```
Note: this will copy `MatCalciteDependencies` to `MatCalcitePlugin/MatCalcitePlugin/target/dependency` so Eclipse can find it.
The final repository (aka "update site") with the plugin will be created in `eclipse-repository/target/eclipse-repository-1.0.0-SNAPSHOT.zip`
Expand Down
17 changes: 16 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>validate-pom</id>
<phase>verify</phase>
<goals>
<goal>verify-osgi-pom</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<addMavenDescriptor>true</addMavenDescriptor>
</archive>
<mapP2Dependencies>true</mapP2Dependencies>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
Expand All @@ -102,7 +117,7 @@
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<!--<pomDependencies>consider</pomDependencies>-->
<pomDependencies>wrapAsBundle</pomDependencies>
<executionEnvironment>JavaSE-17</executionEnvironment>
<target>
<artifact>
Expand Down

0 comments on commit 44c590e

Please sign in to comment.