-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactoring extracting JstackTextualFormatParser. Fix warnings
- Loading branch information
Haim Yadid
committed
Dec 2, 2022
1 parent
58e2647
commit 157c737
Showing
6 changed files
with
106 additions
and
98 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/com/performizeit/mjprof/plugin/PluginRepoBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Class> resolvePluginListFromClassPath(ArrayList<Class> discoveredClasses) { | ||
|
||
Reflections reflections = new Reflections("com.performizeit"); | ||
Set<Class<?>> 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<Class> 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); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters