From 16c64e64f0f7d3caab4be37cba744add7cd76546 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Wed, 29 May 2019 10:12:50 -0600 Subject: [PATCH] Use external pantheon-plugin-api library (#1505) * Use the external jars to provide the plugin libraries. * Add mavenLocal to local repositories to aid development * Remove the :plugins project * Move the PantheonPluginContextImpl into :pantheon * rename a few files Signed-off-by: Adrian Sutton --- acceptance-tests/build.gradle | 8 +-- .../dsl/node/ThreadPantheonNodeRunner.java | 6 +- .../plugins/PantheonEventsPluginTest.java | 2 +- .../plugins/PicoCLIOptionsPluginTest.java | 9 +-- build.gradle | 1 + gradle/versions.gradle | 2 + gradle/wrapper/gradle-wrapper.properties | 2 +- pantheon/build.gradle | 21 ++++++- .../java/tech/pegasys/pantheon/Pantheon.java | 2 +- .../pegasys/pantheon/cli/PantheonCommand.java | 6 +- .../pantheon/services/PantheonEventsImpl.java | 2 +- .../services}/PantheonPluginContextImpl.java | 6 +- .../pantheon/services/PicoCLIOptionsImpl.java | 2 +- .../pantheon/cli/CommandTestAbstract.java | 2 +- .../plugins/TestPantheonEventsPlugin.java | 4 +- .../pantheon/plugins/TestPicoCLIPlugin.java | 6 +- .../PantheonPluginContextImplTest.java | 4 +- plugins/build.gradle | 58 ------------------- .../pantheon/plugins/PantheonContext.java | 20 ------- .../pantheon/plugins/PantheonPlugin.java | 22 ------- .../plugins/internal/package-info.java | 2 - .../plugins/services/PantheonEvents.java | 36 ------------ .../plugins/services/PicoCLIOptions.java | 27 --------- settings.gradle | 1 - 24 files changed, 56 insertions(+), 195 deletions(-) rename {plugins/src/main/java/tech/pegasys/pantheon/plugins/internal => pantheon/src/main/java/tech/pegasys/pantheon/services}/PantheonPluginContextImpl.java (97%) rename {plugins => pantheon}/src/test/java/tech/pegasys/pantheon/plugins/TestPantheonEventsPlugin.java (94%) rename {plugins => pantheon}/src/test/java/tech/pegasys/pantheon/plugins/TestPicoCLIPlugin.java (92%) rename {plugins/src/test/java/tech/pegasys/pantheon/plugins/internal => pantheon/src/test/java/tech/pegasys/pantheon/services}/PantheonPluginContextImplTest.java (98%) delete mode 100644 plugins/build.gradle delete mode 100644 plugins/src/main/java/tech/pegasys/pantheon/plugins/PantheonContext.java delete mode 100644 plugins/src/main/java/tech/pegasys/pantheon/plugins/PantheonPlugin.java delete mode 100644 plugins/src/main/java/tech/pegasys/pantheon/plugins/internal/package-info.java delete mode 100644 plugins/src/main/java/tech/pegasys/pantheon/plugins/services/PantheonEvents.java delete mode 100644 plugins/src/main/java/tech/pegasys/pantheon/plugins/services/PicoCLIOptions.java diff --git a/acceptance-tests/build.gradle b/acceptance-tests/build.gradle index 375731c560..b540c0ce6b 100644 --- a/acceptance-tests/build.gradle +++ b/acceptance-tests/build.gradle @@ -31,9 +31,8 @@ dependencies { testImplementation project(':ethereum:permissioning') testImplementation project(':ethereum:rlp') testImplementation project(':metrics:core') - testImplementation project(':plugins') - testImplementation project(path: ':plugins', configuration: 'testArtifacts') testImplementation project(':pantheon') + testImplementation project(path: ':pantheon', configuration: 'testArtifacts') testImplementation project(':services:kvstore') testImplementation project(':testutil') testImplementation project(':util') @@ -52,15 +51,16 @@ dependencies { testImplementation 'org.web3j:abi' testImplementation 'org.web3j:core' testImplementation 'org.web3j:crypto' + testImplementation 'tech.pegasys.pantheon:plugin-api' } test.enabled = false sourceSets { - test { resources { srcDirs "${rootDir}/plugins/build/libs" } } + test { resources { srcDirs "${rootDir}/pantheon/build/libs" } } } -processTestResources.dependsOn(':plugins:testJar') +processTestResources.dependsOn(':pantheon:testJar') task acceptanceTest(type: Test) { dependsOn(rootProject.installDist) diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/ThreadPantheonNodeRunner.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/ThreadPantheonNodeRunner.java index 09f1000e0c..c7283f9980 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/ThreadPantheonNodeRunner.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/ThreadPantheonNodeRunner.java @@ -26,10 +26,10 @@ import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions; import tech.pegasys.pantheon.ethereum.graphql.GraphQLConfiguration; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.noop.NoOpMetricsSystem; -import tech.pegasys.pantheon.plugins.internal.PantheonPluginContextImpl; -import tech.pegasys.pantheon.plugins.services.PantheonEvents; -import tech.pegasys.pantheon.plugins.services.PicoCLIOptions; +import tech.pegasys.pantheon.plugin.services.PantheonEvents; +import tech.pegasys.pantheon.plugin.services.PicoCLIOptions; import tech.pegasys.pantheon.services.PantheonEventsImpl; +import tech.pegasys.pantheon.services.PantheonPluginContextImpl; import tech.pegasys.pantheon.services.PicoCLIOptionsImpl; import tech.pegasys.pantheon.services.kvstore.RocksDbConfiguration; import tech.pegasys.pantheon.util.enode.EnodeURL; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/plugins/PantheonEventsPluginTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/plugins/PantheonEventsPluginTest.java index 77fbb3acbf..9f0819f648 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/plugins/PantheonEventsPluginTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/plugins/PantheonEventsPluginTest.java @@ -35,7 +35,7 @@ public class PantheonEventsPluginTest extends AcceptanceTestBase { minerNode = pantheon.createMinerNode("minerNode"); pluginNode = pantheon.createPluginsNode( - "node1", Collections.singletonList("testPlugin"), Collections.emptyList()); + "node1", Collections.singletonList("testPlugins"), Collections.emptyList()); cluster.start(pluginNode, minerNode); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/plugins/PicoCLIOptionsPluginTest.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/plugins/PicoCLIOptionsPluginTest.java index 3519ba688f..8e60067744 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/plugins/PicoCLIOptionsPluginTest.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/plugins/PicoCLIOptionsPluginTest.java @@ -41,14 +41,15 @@ public class PicoCLIOptionsPluginTest extends AcceptanceTestBase { node = pantheon.createPluginsNode( "node1", - Collections.singletonList("testPlugin"), + Collections.singletonList("testPlugins"), Collections.singletonList("--Xtest-option=" + MAGIC_WORDS)); cluster.start(node); } @Test public void shouldRegister() throws IOException { - final Path registrationFile = node.homeDirectory().resolve("plugins/testPlugin.registered"); + final Path registrationFile = + node.homeDirectory().resolve("plugins/pluginLifecycle.registered"); waitForFile(registrationFile); // this assert is false as CLI will not be parsed at this point @@ -58,7 +59,7 @@ public class PicoCLIOptionsPluginTest extends AcceptanceTestBase { @Test public void shouldStart() throws IOException { - final Path registrationFile = node.homeDirectory().resolve("plugins/testPlugin.started"); + final Path registrationFile = node.homeDirectory().resolve("plugins/pluginLifecycle.started"); waitForFile(registrationFile); // this assert is true as CLI will be parsed at this point @@ -70,7 +71,7 @@ public class PicoCLIOptionsPluginTest extends AcceptanceTestBase { @Ignore("No way to do a graceful shutdown of Pantheon at the moment.") public void shouldStop() { cluster.stopNode(node); - waitForFile(node.homeDirectory().resolve("plugins/testPlugin.stopped")); + waitForFile(node.homeDirectory().resolve("plugins/pluginLifecycle.stopped")); } private void waitForFile(final Path path) { diff --git a/build.gradle b/build.gradle index 40bafd7525..565f69d95f 100644 --- a/build.gradle +++ b/build.gradle @@ -89,6 +89,7 @@ allprojects { } else { jcenter() mavenCentral() + mavenLocal() maven { url "https://consensys.bintray.com/pegasys-repo" } } } diff --git a/gradle/versions.gradle b/gradle/versions.gradle index f07556f839..3b554f502d 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -84,5 +84,7 @@ dependencyManagement { dependency 'org.web3j:crypto:4.3.0' dependency 'org.xerial.snappy:snappy-java:1.1.7.3' + + dependency "tech.pegasys.pantheon:plugin-api:${rootProject.version}" } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f4d7b2bf61..d757f3d33f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/pantheon/build.gradle b/pantheon/build.gradle index 4f97f3a1d4..7c007c1551 100644 --- a/pantheon/build.gradle +++ b/pantheon/build.gradle @@ -41,7 +41,6 @@ dependencies { implementation project(':ethereum:permissioning') implementation project(':ethereum:p2p') implementation project(':ethereum:rlp') - implementation project(':plugins') implementation project(':metrics:core') implementation project(':services:kvstore') @@ -53,6 +52,7 @@ dependencies { implementation 'net.consensys.cava:cava-toml' implementation 'org.apache.logging.log4j:log4j-api' implementation 'org.springframework.security:spring-security-crypto' + implementation 'tech.pegasys.pantheon:plugin-api' runtime 'org.apache.logging.log4j:log4j-core' runtime 'org.apache.logging.log4j:log4j-slf4j-impl' @@ -61,6 +61,7 @@ dependencies { testImplementation project(path: ':ethereum:core', configuration: 'testSupportArtifacts') testImplementation 'com.squareup.okhttp3:okhttp' + testImplementation 'com.google.auto.service:auto-service' testImplementation 'junit:junit' testImplementation 'org.assertj:assertj-core' testImplementation 'org.awaitility:awaitility' @@ -75,3 +76,21 @@ task writeInfoFile(type: ProjectPropertiesFile) { } compileJava.dependsOn(writeInfoFile) + +task testJar(type: Jar) { + archiveName 'testPlugins.jar' + manifest { + attributes( + 'Specification-Title': baseName, + 'Specification-Version': project.version, + 'Implementation-Title': baseName, + 'Implementation-Version': calculateVersion() + ) + } + archiveClassifier = 'tests' + from sourceSets.test.output +} + +configurations { testArtifacts } + +artifacts { testArtifacts testJar } diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/Pantheon.java b/pantheon/src/main/java/tech/pegasys/pantheon/Pantheon.java index 2f4557e18f..2ab80980f7 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/Pantheon.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/Pantheon.java @@ -18,7 +18,7 @@ import tech.pegasys.pantheon.cli.PantheonCommand; import tech.pegasys.pantheon.controller.PantheonController; import tech.pegasys.pantheon.ethereum.eth.EthereumWireProtocolConfiguration; import tech.pegasys.pantheon.ethereum.eth.sync.SynchronizerConfiguration; -import tech.pegasys.pantheon.plugins.internal.PantheonPluginContextImpl; +import tech.pegasys.pantheon.services.PantheonPluginContextImpl; import tech.pegasys.pantheon.services.kvstore.RocksDbConfiguration; import tech.pegasys.pantheon.util.BlockImporter; diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java index 339f20cc0d..72fc90fe91 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java @@ -65,10 +65,10 @@ import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; import tech.pegasys.pantheon.metrics.prometheus.PrometheusMetricsSystem; import tech.pegasys.pantheon.metrics.vertx.VertxMetricsAdapterFactory; -import tech.pegasys.pantheon.plugins.internal.PantheonPluginContextImpl; -import tech.pegasys.pantheon.plugins.services.PantheonEvents; -import tech.pegasys.pantheon.plugins.services.PicoCLIOptions; +import tech.pegasys.pantheon.plugin.services.PantheonEvents; +import tech.pegasys.pantheon.plugin.services.PicoCLIOptions; import tech.pegasys.pantheon.services.PantheonEventsImpl; +import tech.pegasys.pantheon.services.PantheonPluginContextImpl; import tech.pegasys.pantheon.services.PicoCLIOptionsImpl; import tech.pegasys.pantheon.services.kvstore.RocksDbConfiguration; import tech.pegasys.pantheon.util.BlockImporter; diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/services/PantheonEventsImpl.java b/pantheon/src/main/java/tech/pegasys/pantheon/services/PantheonEventsImpl.java index 5028bd3371..792a98cbf1 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/services/PantheonEventsImpl.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/services/PantheonEventsImpl.java @@ -14,7 +14,7 @@ package tech.pegasys.pantheon.services; import tech.pegasys.pantheon.ethereum.core.Block; import tech.pegasys.pantheon.ethereum.eth.sync.BlockBroadcaster; -import tech.pegasys.pantheon.plugins.services.PantheonEvents; +import tech.pegasys.pantheon.plugin.services.PantheonEvents; import com.google.common.collect.ImmutableMap; import io.vertx.core.json.Json; diff --git a/plugins/src/main/java/tech/pegasys/pantheon/plugins/internal/PantheonPluginContextImpl.java b/pantheon/src/main/java/tech/pegasys/pantheon/services/PantheonPluginContextImpl.java similarity index 97% rename from plugins/src/main/java/tech/pegasys/pantheon/plugins/internal/PantheonPluginContextImpl.java rename to pantheon/src/main/java/tech/pegasys/pantheon/services/PantheonPluginContextImpl.java index 6086875688..3ade459a86 100644 --- a/plugins/src/main/java/tech/pegasys/pantheon/plugins/internal/PantheonPluginContextImpl.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/services/PantheonPluginContextImpl.java @@ -10,13 +10,13 @@ * 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. */ -package tech.pegasys.pantheon.plugins.internal; +package tech.pegasys.pantheon.services; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkState; -import tech.pegasys.pantheon.plugins.PantheonContext; -import tech.pegasys.pantheon.plugins.PantheonPlugin; +import tech.pegasys.pantheon.plugin.PantheonContext; +import tech.pegasys.pantheon.plugin.PantheonPlugin; import java.io.IOException; import java.net.MalformedURLException; diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/services/PicoCLIOptionsImpl.java b/pantheon/src/main/java/tech/pegasys/pantheon/services/PicoCLIOptionsImpl.java index 07d5581d09..69437cbbaa 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/services/PicoCLIOptionsImpl.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/services/PicoCLIOptionsImpl.java @@ -12,7 +12,7 @@ */ package tech.pegasys.pantheon.services; -import tech.pegasys.pantheon.plugins.services.PicoCLIOptions; +import tech.pegasys.pantheon.plugin.services.PicoCLIOptions; import picocli.CommandLine; diff --git a/pantheon/src/test/java/tech/pegasys/pantheon/cli/CommandTestAbstract.java b/pantheon/src/test/java/tech/pegasys/pantheon/cli/CommandTestAbstract.java index 60a2056184..3e3581a984 100644 --- a/pantheon/src/test/java/tech/pegasys/pantheon/cli/CommandTestAbstract.java +++ b/pantheon/src/test/java/tech/pegasys/pantheon/cli/CommandTestAbstract.java @@ -34,7 +34,7 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration; import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; -import tech.pegasys.pantheon.plugins.internal.PantheonPluginContextImpl; +import tech.pegasys.pantheon.services.PantheonPluginContextImpl; import tech.pegasys.pantheon.services.kvstore.RocksDbConfiguration; import tech.pegasys.pantheon.util.BlockImporter; import tech.pegasys.pantheon.util.bytes.BytesValue; diff --git a/plugins/src/test/java/tech/pegasys/pantheon/plugins/TestPantheonEventsPlugin.java b/pantheon/src/test/java/tech/pegasys/pantheon/plugins/TestPantheonEventsPlugin.java similarity index 94% rename from plugins/src/test/java/tech/pegasys/pantheon/plugins/TestPantheonEventsPlugin.java rename to pantheon/src/test/java/tech/pegasys/pantheon/plugins/TestPantheonEventsPlugin.java index b6468913ca..abd27649aa 100644 --- a/plugins/src/test/java/tech/pegasys/pantheon/plugins/TestPantheonEventsPlugin.java +++ b/pantheon/src/test/java/tech/pegasys/pantheon/plugins/TestPantheonEventsPlugin.java @@ -12,7 +12,9 @@ */ package tech.pegasys.pantheon.plugins; -import tech.pegasys.pantheon.plugins.services.PantheonEvents; +import tech.pegasys.pantheon.plugin.PantheonContext; +import tech.pegasys.pantheon.plugin.PantheonPlugin; +import tech.pegasys.pantheon.plugin.services.PantheonEvents; import java.io.File; import java.io.IOException; diff --git a/plugins/src/test/java/tech/pegasys/pantheon/plugins/TestPicoCLIPlugin.java b/pantheon/src/test/java/tech/pegasys/pantheon/plugins/TestPicoCLIPlugin.java similarity index 92% rename from plugins/src/test/java/tech/pegasys/pantheon/plugins/TestPicoCLIPlugin.java rename to pantheon/src/test/java/tech/pegasys/pantheon/plugins/TestPicoCLIPlugin.java index 7cea3ad100..0cf006dee1 100644 --- a/plugins/src/test/java/tech/pegasys/pantheon/plugins/TestPicoCLIPlugin.java +++ b/pantheon/src/test/java/tech/pegasys/pantheon/plugins/TestPicoCLIPlugin.java @@ -12,7 +12,9 @@ */ package tech.pegasys.pantheon.plugins; -import tech.pegasys.pantheon.plugins.services.PicoCLIOptions; +import tech.pegasys.pantheon.plugin.PantheonContext; +import tech.pegasys.pantheon.plugin.PantheonPlugin; +import tech.pegasys.pantheon.plugin.services.PicoCLIOptions; import java.io.File; import java.io.IOException; @@ -91,7 +93,7 @@ public class TestPicoCLIPlugin implements PantheonPlugin { /** This is used to signal to the acceptance test that certain tasks were completed. */ private void writeSignal(final String signal) { try { - final File callbackFile = new File(callbackDir, "testPlugin." + signal); + final File callbackFile = new File(callbackDir, "pluginLifecycle." + signal); if (!callbackFile.getParentFile().exists()) { callbackFile.getParentFile().mkdirs(); callbackFile.getParentFile().deleteOnExit(); diff --git a/plugins/src/test/java/tech/pegasys/pantheon/plugins/internal/PantheonPluginContextImplTest.java b/pantheon/src/test/java/tech/pegasys/pantheon/services/PantheonPluginContextImplTest.java similarity index 98% rename from plugins/src/test/java/tech/pegasys/pantheon/plugins/internal/PantheonPluginContextImplTest.java rename to pantheon/src/test/java/tech/pegasys/pantheon/services/PantheonPluginContextImplTest.java index abe8f85b89..6ea6bee984 100644 --- a/plugins/src/test/java/tech/pegasys/pantheon/plugins/internal/PantheonPluginContextImplTest.java +++ b/pantheon/src/test/java/tech/pegasys/pantheon/services/PantheonPluginContextImplTest.java @@ -10,12 +10,12 @@ * 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. */ -package tech.pegasys.pantheon.plugins.internal; +package tech.pegasys.pantheon.services; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -import tech.pegasys.pantheon.plugins.PantheonPlugin; +import tech.pegasys.pantheon.plugin.PantheonPlugin; import tech.pegasys.pantheon.plugins.TestPicoCLIPlugin; import java.io.File; diff --git a/plugins/build.gradle b/plugins/build.gradle deleted file mode 100644 index bf2471bf09..0000000000 --- a/plugins/build.gradle +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2018 ConsenSys AG. - * - * Licensed 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. - */ - -apply plugin: 'java-library' - -jar { - baseName 'pantheon-plugins' - manifest { - attributes( - 'Specification-Title': baseName, - 'Specification-Version': project.version, - 'Implementation-Title': baseName, - 'Implementation-Version': calculateVersion() - ) - } -} - -dependencies { - implementation 'com.google.guava:guava' - implementation 'org.apache.logging.log4j:log4j-api' - - testAnnotationProcessor 'com.google.auto.service:auto-service' - - testImplementation 'com.google.auto.service:auto-service' - testImplementation 'info.picocli:picocli' - testImplementation 'junit:junit' - testImplementation 'org.apache.logging.log4j:log4j-api' - testImplementation 'org.assertj:assertj-core' - testImplementation 'org.mockito:mockito-core' -} - -task testJar(type: Jar) { - archiveName 'testPlugin.jar' - manifest { - attributes( - 'Specification-Title': baseName, - 'Specification-Version': project.version, - 'Implementation-Title': baseName, - 'Implementation-Version': calculateVersion() - ) - } - archiveClassifier = 'tests' - from sourceSets.test.output -} - -configurations { testArtifacts } - -artifacts { testArtifacts testJar } diff --git a/plugins/src/main/java/tech/pegasys/pantheon/plugins/PantheonContext.java b/plugins/src/main/java/tech/pegasys/pantheon/plugins/PantheonContext.java deleted file mode 100644 index 7f106f5f89..0000000000 --- a/plugins/src/main/java/tech/pegasys/pantheon/plugins/PantheonContext.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2019 ConsenSys AG. - * - * Licensed 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. - */ -package tech.pegasys.pantheon.plugins; - -import java.util.Optional; - -public interface PantheonContext { - - Optional getService(Class serviceType); -} diff --git a/plugins/src/main/java/tech/pegasys/pantheon/plugins/PantheonPlugin.java b/plugins/src/main/java/tech/pegasys/pantheon/plugins/PantheonPlugin.java deleted file mode 100644 index 6eefa7b51b..0000000000 --- a/plugins/src/main/java/tech/pegasys/pantheon/plugins/PantheonPlugin.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2019 ConsenSys AG. - * - * Licensed 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. - */ -package tech.pegasys.pantheon.plugins; - -public interface PantheonPlugin { - - void register(PantheonContext context); - - void start(); - - void stop(); -} diff --git a/plugins/src/main/java/tech/pegasys/pantheon/plugins/internal/package-info.java b/plugins/src/main/java/tech/pegasys/pantheon/plugins/internal/package-info.java deleted file mode 100644 index b0bd537acc..0000000000 --- a/plugins/src/main/java/tech/pegasys/pantheon/plugins/internal/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -/** This package will be hidden from external users once Pantheon migrates to Java 11. */ -package tech.pegasys.pantheon.plugins.internal; diff --git a/plugins/src/main/java/tech/pegasys/pantheon/plugins/services/PantheonEvents.java b/plugins/src/main/java/tech/pegasys/pantheon/plugins/services/PantheonEvents.java deleted file mode 100644 index 2b356989cd..0000000000 --- a/plugins/src/main/java/tech/pegasys/pantheon/plugins/services/PantheonEvents.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2019 ConsenSys AG. - * - * Licensed 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. - */ -package tech.pegasys.pantheon.plugins.services; - -public interface PantheonEvents { - - /** - * Returns the raw RLP of a block that Pantheon has received and that has passed basic validation - * checks. - * - * @param blockJSONListener The listener that will accept a JSON string as the event. - * @return an object to be used as an identifier when de-registering the event. - */ - Object addNewBlockPropagatedListener(NewBlockPropagatedListener blockJSONListener); - - /** - * Remove the blockAdded listener from pantheon notifications. - * - * @param listenerIdentifier The instance that was returned from addBlockAddedListener; - */ - void removeNewBlockPropagatedListener(Object listenerIdentifier); - - interface NewBlockPropagatedListener { - void newBlockPropagated(String jsonBlock); - } -} diff --git a/plugins/src/main/java/tech/pegasys/pantheon/plugins/services/PicoCLIOptions.java b/plugins/src/main/java/tech/pegasys/pantheon/plugins/services/PicoCLIOptions.java deleted file mode 100644 index 8b5ce0b518..0000000000 --- a/plugins/src/main/java/tech/pegasys/pantheon/plugins/services/PicoCLIOptions.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2019 ConsenSys AG. - * - * Licensed 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. - */ -package tech.pegasys.pantheon.plugins.services; - -/** This service will be available during the registration callbacks. */ -public interface PicoCLIOptions { - - /** - * During the registration callback plugins can register CLI options that should be added to - * Pantheon's CLI startup. - * - * @param namespace A namespace prefix. All registered options must start with this prefix - * @param optionObject The instance of the object to be inspected. PicoCLI will reflect the fields - * of this object to extract the CLI options. - */ - void addPicoCLIOptions(String namespace, Object optionObject); -} diff --git a/settings.gradle b/settings.gradle index d353ede10b..b7ea0a722a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -35,7 +35,6 @@ include 'ethereum:trie' include 'metrics:core' include 'metrics:rocksdb' include 'pantheon' -include 'plugins' include 'services:kvstore' include 'services:pipeline' include 'services:tasks'