Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Use external pantheon-plugin-api library (#1505)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Danno Ferrin authored May 29, 2019
1 parent e7dcca5 commit e43fa91
Show file tree
Hide file tree
Showing 24 changed files with 56 additions and 195 deletions.
8 changes: 4 additions & 4 deletions acceptance-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void setUp() throws Exception {
minerNode = pantheon.createMinerNode("minerNode");
pluginNode =
pantheon.createPluginsNode(
"node1", Collections.singletonList("testPlugin"), Collections.emptyList());
"node1", Collections.singletonList("testPlugins"), Collections.emptyList());
cluster.start(pluginNode, minerNode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ public void setUp() throws Exception {
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
Expand All @@ -58,7 +59,7 @@ public void shouldRegister() throws IOException {

@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
Expand All @@ -70,7 +71,7 @@ public void shouldStart() throws IOException {
@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) {
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ allprojects {
} else {
jcenter()
mavenCentral()
mavenLocal()
maven { url "https://consensys.bintray.com/pegasys-repo" }
}
}
Expand Down
2 changes: 2 additions & 0 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
21 changes: 20 additions & 1 deletion pantheon/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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 }
2 changes: 1 addition & 1 deletion pantheon/src/main/java/tech/pegasys/pantheon/Pantheon.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -91,7 +93,7 @@ public String getState() {
/** 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
58 changes: 0 additions & 58 deletions plugins/build.gradle

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit e43fa91

Please sign in to comment.