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

Commit

Permalink
Moved plugins to JPMS
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Schimpf committed Jul 6, 2020
1 parent 17c7ab7 commit 207df53
Show file tree
Hide file tree
Showing 45 changed files with 180 additions and 533 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
### gradle
**/.gradle
!scraper-nodes-dev/gradle/wrapper/gradle-wrapper.jar

/**/build/
/**/builds/
/**/classes/

### intellij
.idea
*.iml
/**/out/

### vim
**/*.swp

## ignore antlr jar whereever it is
**/antlr.jar

### junit error logs and normal logs
**/errors.log
**/*.log

### generated editor html file
**/resources/**/scraper-editor.html
### generated class model file
**/*class-model.json
**/class-model.js


/**/*nodes*link*
45 changes: 45 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
plugins {
id 'jacoco'
}

allprojects {
repositories {
jcenter()
}
}

subprojects {
configurations {
providedCompile
}

afterEvaluate {
dependencies {
providedCompile fileTree(dir: 'libs', include: '*.jar')
testImplementation fileTree(dir: 'libs', include: '*.jar')

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.1'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.6.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

compileJava {
sourceSets.main.compileClasspath += configurations.providedCompile
}
}

group = 'org.scraper'

plugins.withType(JavaPlugin).configureEach {
java {
modularity.inferModulePath = true
}
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
}
}

// merge coverage
apply from: 'gradle/jacoco-merge.gradle'
31 changes: 31 additions & 0 deletions gradle/jacoco-merge.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
configure( subprojects ) {
apply plugin: 'jacoco'
}

tasks.register("codeCoverageReport", JacocoReport) {
// If a subproject applies the 'jacoco' plugin, add the result it to the report
subprojects { subproject ->
subproject.plugins.withType(JacocoPlugin).configureEach {
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).configureEach { testTask ->
sourceSets subproject.sourceSets.main
executionData(testTask)
}

// To automatically run `test` every time `./gradlew codeCoverageReport` is called,
// you may want to set up a task dependency between them as shown below.
// Note that this requires the `test` tasks to be resolved eagerly (see `forEach`) which
// may have a negative effect on the configuration time of your build.
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).forEach {
rootProject.tasks.codeCoverageReport.dependsOn(it)
}
}
}

// enable the different report types (html, xml, csv)
reports {
xml.enabled true
html.enabled true
csv.enabled true
}
}

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Sat Jul 04 10:44:41 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
31 changes: 14 additions & 17 deletions scraper-plugins-debugger/gradlew → gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
4 changes: 4 additions & 0 deletions scraper-plugins-debugger/gradlew.bat → gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Expand Down Expand Up @@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%*

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

Expand Down
Binary file added libs/antlr4-runtime-4.8-module.jar
Binary file not shown.
Binary file added libs/api-0.12.0.jar
Binary file not shown.
Binary file added libs/application-0.12.0.jar
Binary file not shown.
Binary file added libs/classgraph-4.8.47.jar
Binary file not shown.
Binary file added libs/core-0.12.0.jar
Binary file not shown.
Binary file added libs/core-parsers-0.12.0.jar
Binary file not shown.
Binary file added libs/jackson-annotations-2.10.4.jar
Binary file not shown.
Binary file added libs/jackson-core-2.10.4.jar
Binary file not shown.
Binary file added libs/jackson-databind-2.10.4.jar
Binary file not shown.
Binary file added libs/jackson-dataformat-yaml-2.10.4.jar
Binary file not shown.
Binary file added libs/snakeyaml-1.26-module.jar
Binary file not shown.
Binary file added libs/test-framework-0.12.0.jar
Binary file not shown.
Binary file added libs/utilities-0.12.0.jar
Binary file not shown.
16 changes: 0 additions & 16 deletions scraper-plugins-debugger/.gitignore

This file was deleted.

39 changes: 16 additions & 23 deletions scraper-plugins-debugger/build.gradle
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
// treat this as a stand-alone project if not used in big scraper project
if (findProject(':scraper-plugins') == null) {
apply from: 'gradle/scraper-plugin.gradle'
apply from: 'gradle/gradle-module-fix.gradle'
plugins {
id 'java-library'
id 'java-library-distribution'
id("de.jjohannes.extra-java-module-info") version "0.1"
}

version = '0.1.0'

dependencies {
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.8.0-beta4'

// put your dependencies here
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.10.+'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.+'

// websocket
provided 'org.java-websocket:Java-WebSocket:1.4.0'
}

task bundleFatJar(type: Jar) { t ->
from {
configurations.provided.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
from {
sourceSets.main.output
extraJavaModuleInfo {
module("Java-WebSocket-1.4.0.jar", "Java.Websocket", "1.4.0") {
exports "org.java_websocket"
exports "org.java_websocket.drafts"
exports "org.java_websocket.exceptions"
exports "org.java_websocket.handshake"
exports "org.java_websocket.server"
}
module("slf4j-api-1.7.25.jar", "org.slf4j", "1.7.25") {}
}

archiveFileName = "scraper-plugins-debugger-${version}.jar"
destinationDirectory = file("$rootDir/build/libs")
dependencies {
// websocket
implementation 'org.java-websocket:Java-WebSocket:1.4.0'
}
41 changes: 0 additions & 41 deletions scraper-plugins-debugger/gradle/gradle-module-fix.gradle

This file was deleted.

13 changes: 0 additions & 13 deletions scraper-plugins-debugger/gradle/scraper-plugin.gradle

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file removed scraper-plugins-debugger/libs/scraper-0.11-api.jar
Binary file not shown.
Binary file not shown.
4 changes: 1 addition & 3 deletions scraper-plugins-debugger/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
open module scraper.plugins.debugger {
// only depend on api and annotations
requires scraper.api;
requires scraper.annotations;
requires scraper.utils;

requires java.net.http;
Expand All @@ -15,11 +14,10 @@
exports scraper.plugins.debugger;

// websocket
requires Java.WebSocket;
requires Java.Websocket;

requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.databind;
requires org.slf4j;

// NodeHook, Addon, Hook, PreHook have to be provided
provides NodeHook with DebuggerNodeHookAddon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import scraper.annotations.ArgsCommand;
import scraper.annotations.NotNull;
import scraper.api.di.DIContainer;
Expand All @@ -23,6 +21,8 @@
import java.util.Set;
import java.util.regex.Pattern;

import static java.lang.System.Logger.Level.INFO;


@ArgsCommand(
value = "debug",
Expand All @@ -41,7 +41,7 @@
)
public class DebuggerNodeHookAddon implements NodeHook, Hook, Addon {
/** Logger with the actual class name */
private Logger l = LoggerFactory.getLogger("Debugger");
private final System.Logger l = System.getLogger("Debugger");
private DebuggerWebsocketServer debugger;
private final ObjectMapper m = new ObjectMapper();
private Set<InstanceDTO> impls = new HashSet<>();
Expand Down Expand Up @@ -79,7 +79,7 @@ public void afterProcess(@NotNull NodeContainer<? extends Node> n, @NotNull Flow
@Override
public void load(@NotNull DIContainer loadedDependencies, @NotNull String[] args) {
if (StringUtil.getArgument(args, "debug") != null) {
l.warn("Debugging activated");
l.log(System.Logger.Level.WARNING,"Debugging activated");
String debugPort = StringUtil.getArgument(args, "debug-port");
String debugIp = StringUtil.getArgument(args, "debug-ip");
String bindingIp = "0.0.0.0";
Expand Down Expand Up @@ -111,15 +111,15 @@ private String wrap(String type, Object data) {

@SuppressWarnings("unused") // reflection
public void requestSpecifications(Map<String, Object> data) {
l.info("Requesting specifications");
l.log(INFO,"Requesting specifications");
for (InstanceDTO impls : impls) {
debugger.get().ifPresent(client -> client.send(wrap("instance", impls)));
}
}

@SuppressWarnings("unused") // reflection
public void setReady(Map<String, Object> data) {
l.info("Debugger is ready, waking up all flows");
l.log(INFO,"Debugger is ready, waking up all flows");
state.setReady(true);

}
Expand Down
Loading

0 comments on commit 207df53

Please sign in to comment.