diff --git a/assembly/bin.xml b/assembly/bin.xml
deleted file mode 100644
index 0a1a82c..0000000
--- a/assembly/bin.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
- bin
-
- zip
-
-
-
-
- README*
- LICENSE*
- NOTICE*
-
-
-
- target
-
-
- mjprof-${project.version}-jar-with-dependencies.jar
-
-
-
- src/main/scripts
-
- *
-
-
- /
-
-
-
- ./
-
-
-
-
- /plugins
-
-
-
-
diff --git a/pom.xml b/pom.xml
index 4e33ede..c7c3ae7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,6 +34,28 @@
${java.compiler.target}
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.1.0
+
+
+
+ exec
+
+ process-classes
+
+
+
+ java
+
+ -classpath
+
+ com.performizeit.mjprof.plugin.PluginRepoBuilder
+ ${project.build.outputDirectory}/supported_monads.txt
+
+
+
org.apache.maven.plugins
@@ -58,21 +80,6 @@
single
-
- create-zip
-
-
- assembly/bin.xml
-
- mjprof${project.version}
-
-
- package
-
-
- single
-
-
diff --git a/src/main/java/com/performizeit/mjprof/monads/StepsRepository.java b/src/main/java/com/performizeit/mjprof/monads/StepsRepository.java
index ad68241..fe1f170 100644
--- a/src/main/java/com/performizeit/mjprof/monads/StepsRepository.java
+++ b/src/main/java/com/performizeit/mjprof/monads/StepsRepository.java
@@ -17,10 +17,11 @@
package com.performizeit.mjprof.monads;
+import java.io.BufferedInputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Set;
-import org.reflections.Reflections;
import com.performizeit.mjprof.api.Plugin;
@@ -28,13 +29,37 @@ public class StepsRepository {
static HashMap repo = new HashMap<>();
static {
- Reflections reflections = new Reflections("com.performizeit");
- Set> annotatedPlugin = reflections.getTypesAnnotatedWith(Plugin.class);
- for (Class cla : annotatedPlugin) {
- Plugin pluginAnnotation = (Plugin) cla.getAnnotation(Plugin.class);
- StepInfo stepInit = new StepInfo(cla, pluginAnnotation.params(), pluginAnnotation.description());
- repo.put(pluginAnnotation.name(), stepInit);
+ ArrayList plugins = new ArrayList<>();
+
+ try {
+ String inputStream = new String(new BufferedInputStream(StepsRepository.class.getResourceAsStream("/supported_monads.txt")).readAllBytes());
+ for (var line : inputStream.split("\n")) {
+ try {
+ plugins.add(Class.forName(line));
+ } catch (Exception e) {
+ System.out.println("Unable to find class "+line);
+ throw new RuntimeException(e);
+ }
+ }
+ } catch (Exception e) {
+
+ throw new RuntimeException(e);
+ }
+ for (Class cla : plugins) {
+ addPluginToRepo(cla);
+ }
+ }
+
+ private static void addPluginToRepo(Class cla) {
+ Plugin pluginAnnotation = (Plugin) cla.getAnnotation(Plugin.class);
+ StepInfo stepInit = new StepInfo(cla, pluginAnnotation.params(), pluginAnnotation.description());
+ try {
+ var cons = cla.getConstructor(stepInit.getParamTypes());
+ System.out.println("Cons"+ cons.getName());
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
}
+ repo.put(pluginAnnotation.name(), stepInit);
}
public static boolean stepValid(MJStep a) {
diff --git a/src/main/java/com/performizeit/mjprof/plugin/PluginRepoBuilder.java b/src/main/java/com/performizeit/mjprof/plugin/PluginRepoBuilder.java
new file mode 100644
index 0000000..de9a3da
--- /dev/null
+++ b/src/main/java/com/performizeit/mjprof/plugin/PluginRepoBuilder.java
@@ -0,0 +1,42 @@
+package com.performizeit.mjprof.plugin;
+
+import com.performizeit.mjprof.api.Plugin;
+import org.reflections.Reflections;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Set;
+
+public class PluginRepoBuilder {
+
+
+ // java -cp `mvn dependency:build-classpath | grep jar:`:target/classes com.performizeit.mjprof.plugin.PluginRepoBuilder
+ //java -jar -agentlib:native-image-agent=config-output-dir=META_INF/native-config -jar target/mjprof-1.0-jar-with-dependencies.jar
+ //native-image -H:ReflectionConfigurationFiles=META-INF/native-config/reflect-config.json -H:IncludeResources=".*/*.txt" -jar target/mjprof-1.0-jar-with-dependencies.jar mjprof
+ public static ArrayList resolvePluginListFromClassPath(ArrayList discoveredClasses) {
+
+ Reflections reflections = new Reflections("com.performizeit");
+ Set> annotatedPlugin = reflections.getTypesAnnotatedWith(Plugin.class);
+ for (Class cla : annotatedPlugin) {
+ discoveredClasses.add(cla);
+ }
+ return discoveredClasses;
+ }
+
+ public static void main(String[] args) {
+ System.out.println("I got this file to write to :" + args[0]);
+ ArrayList plugins = new ArrayList<>();
+ resolvePluginListFromClassPath(plugins);
+ try (var f = new BufferedWriter(new FileWriter(args[0]))) {
+ for (Class cla : plugins) {
+ f.write(cla.getName());
+ f.newLine();
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+}
diff --git a/src/main/java/com/performizeit/mjprof/plugin/PluginUtils.java b/src/main/java/com/performizeit/mjprof/plugin/PluginUtils.java
index a20dd63..27487b5 100644
--- a/src/main/java/com/performizeit/mjprof/plugin/PluginUtils.java
+++ b/src/main/java/com/performizeit/mjprof/plugin/PluginUtils.java
@@ -17,14 +17,10 @@
package com.performizeit.mjprof.plugin;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Set;
+import com.performizeit.mjprof.plugin.types.DataSource;
+import com.performizeit.mjprof.plugin.types.Outputer;
-import com.performizeit.mjprof.api.*;
-import com.performizeit.mjprof.plugin.types.*;
-import org.reflections.Reflections;
+import java.lang.reflect.Constructor;
public class PluginUtils {
@@ -41,27 +37,9 @@ public static Object initObj(Class> clazz, Class[] paramTypes, Object[] paramA
//conParameter - constructor parameters
- public static HashMap getAllPlugins() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException, ClassNotFoundException {
- HashMap map = new HashMap<>();
- //TODO
- Reflections reflections = new Reflections("com.performizeit");
- Set> annotatedPlugin = reflections.getTypesAnnotatedWith(Plugin.class);
-
- for (Class cla : annotatedPlugin) {
- if (BasePlugin.class.isAssignableFrom(cla)) {
- invokeGetHelpLine(cla);
- map.put(cla, cla);
- } else {
- System.out.println("ERROR: class " + cla.getName() + " needs to extend BasePlugin child");
- }
- }
- return map;
- }
- private static String invokeGetHelpLine(Class> cla) {
- Plugin pluginAnnotation = cla.getAnnotation(Plugin.class);
- return pluginAnnotation.description();
- }
+
+
public static boolean isDataSource(Object o) {
diff --git a/src/test/java/com/performizeit/mjprof/plugin/PluginTest.java b/src/test/java/com/performizeit/mjprof/plugin/PluginTest.java
index 89a6f91..2b6791a 100644
--- a/src/test/java/com/performizeit/mjprof/plugin/PluginTest.java
+++ b/src/test/java/com/performizeit/mjprof/plugin/PluginTest.java
@@ -6,18 +6,14 @@
import java.util.Set;
import com.performizeit.mjprof.MJProf;
-import com.performizeit.mjprof.plugins.mappers.GroupByProp;
import com.performizeit.mjprof.plugins.mappers.singlethread.StackTop;
import com.performizeit.mjprof.plugins.terminals.ListProps;
import org.junit.jupiter.api.Test;
-import org.reflections.Reflections;
import com.performizeit.mjprof.api.Plugin;
import com.performizeit.mjprof.plugins.mappers.singlethread.StackFrameContains;
-import com.performizeit.mjprof.monads.StepInfo;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class PluginTest {
@@ -54,10 +50,10 @@ public class PluginTest {
""";
- @Test
+ /*@Test
public void testPlugin() throws Exception {
assertNotNull(PluginUtils.getAllPlugins().get(GroupByProp.class));
- }
+ }*/
@Test
public void testInitObject() {
@@ -77,7 +73,7 @@ public void testSynopsis() {
assertTrue(MJProf.getSynopsisString().contains(ListProps.class.getAnnotation(Plugin.class).description()));
}
-
+ /*
@Test
public void testGetDtaSourcePlugins() {
HashMap repo = new HashMap();
@@ -88,5 +84,5 @@ public void testGetDtaSourcePlugins() {
StepInfo stepInit = new StepInfo(cla, pluginAnnotation.params(),pluginAnnotation.description());
repo.put(pluginAnnotation.name(), stepInit);
}
- }
+ }*/
}