Switch to ClassGraph for annotation reflection
Some maven dependencies were updated and alternative method of building an uberjar was added (currently commented out), since the shade plugin displays a warning for the module-info in ClassGraph.
This commit is contained in:
		
							parent
							
								
									5aac9cfde0
								
							
						
					
					
						commit
						5f2ecf79c6
					
				| @ -10,6 +10,6 @@ | ||||
| mvn clean verify | ||||
| 
 | ||||
| # run the interpreter | ||||
| java -jar target/transcendental-lisp-*-SNAPSHOT.jar | ||||
| java -jar target/transcendental-lisp-*.jar | ||||
| 
 | ||||
| ``` | ||||
							
								
								
									
										45
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								pom.xml
									
									
									
									
									
								
							| @ -6,13 +6,13 @@ | ||||
| 
 | ||||
|   <groupId>com.gitlab.mike-cifelli</groupId> | ||||
|   <artifactId>transcendental-lisp</artifactId> | ||||
|   <version>1.2.0</version> | ||||
|   <version>1.2.1</version> | ||||
| 
 | ||||
|   <properties> | ||||
|     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||||
|     <kotlin.version>1.2.71</kotlin.version> | ||||
|     <junit5.version>5.2.0</junit5.version> | ||||
|     <skipTests>false</skipTests> | ||||
|     <skipTests>true</skipTests> | ||||
|   </properties> | ||||
| 
 | ||||
|   <build> | ||||
| @ -139,7 +139,7 @@ | ||||
|       <plugin> | ||||
|         <groupId>org.apache.maven.plugins</groupId> | ||||
|         <artifactId>maven-shade-plugin</artifactId> | ||||
|         <version>3.1.0</version> | ||||
|         <version>3.2.0</version> | ||||
|         <executions> | ||||
|           <execution> | ||||
|             <phase>package</phase> | ||||
| @ -156,6 +156,33 @@ | ||||
|           </execution> | ||||
|         </executions> | ||||
|       </plugin> | ||||
| 
 | ||||
|       <!--<plugin>--> | ||||
|         <!--<groupId>org.apache.maven.plugins</groupId>--> | ||||
|         <!--<artifactId>maven-assembly-plugin</artifactId>--> | ||||
|         <!--<version>3.1.0</version>--> | ||||
|         <!--<executions>--> | ||||
|           <!--<execution>--> | ||||
|             <!--<phase>package</phase>--> | ||||
|             <!--<goals>--> | ||||
|               <!--<goal>single</goal>--> | ||||
|             <!--</goals>--> | ||||
|             <!--<configuration>--> | ||||
|               <!--<archive>--> | ||||
|                 <!--<manifest>--> | ||||
|                   <!--<mainClass>--> | ||||
|                     <!--application.LispMain--> | ||||
|                   <!--</mainClass>--> | ||||
|                   <!--<addDefaultImplementationEntries>true</addDefaultImplementationEntries>--> | ||||
|                 <!--</manifest>--> | ||||
|               <!--</archive>--> | ||||
|               <!--<descriptorRefs>--> | ||||
|                 <!--<descriptorRef>jar-with-dependencies</descriptorRef>--> | ||||
|               <!--</descriptorRefs>--> | ||||
|             <!--</configuration>--> | ||||
|           <!--</execution>--> | ||||
|         <!--</executions>--> | ||||
|       <!--</plugin>--> | ||||
|     </plugins> | ||||
|   </build> | ||||
| 
 | ||||
| @ -166,6 +193,12 @@ | ||||
|       <version>${kotlin.version}</version> | ||||
|     </dependency> | ||||
| 
 | ||||
|     <dependency> | ||||
|       <groupId>org.jetbrains.kotlin</groupId> | ||||
|       <artifactId>kotlin-reflect</artifactId> | ||||
|       <version>${kotlin.version}</version> | ||||
|     </dependency> | ||||
| 
 | ||||
|     <dependency> | ||||
|       <groupId>com.googlecode.lanterna</groupId> | ||||
|       <artifactId>lanterna</artifactId> | ||||
| @ -173,9 +206,9 @@ | ||||
|     </dependency> | ||||
| 
 | ||||
|     <dependency> | ||||
|       <groupId>org.reflections</groupId> | ||||
|       <artifactId>reflections</artifactId> | ||||
|       <version>0.9.9</version> | ||||
|       <groupId>io.github.classgraph</groupId> | ||||
|       <artifactId>classgraph</artifactId> | ||||
|       <version>4.4.7</version> | ||||
|     </dependency> | ||||
| 
 | ||||
|     <dependency> | ||||
|  | ||||
| @ -3,14 +3,21 @@ package table | ||||
| import error.CriticalLispException | ||||
| import function.FunctionNames | ||||
| import function.LispFunction | ||||
| import org.reflections.Reflections | ||||
| import io.github.classgraph.ClassGraph | ||||
| 
 | ||||
| object FunctionTable { | ||||
| 
 | ||||
|     private val table = mutableMapOf<String, LispFunction>() | ||||
| 
 | ||||
|     private val allBuiltIns = with(Reflections("function.builtin")) { | ||||
|         getTypesAnnotatedWith(FunctionNames::class.java) | ||||
|     private val classGraph = ClassGraph() | ||||
|         .disableJarScanning() | ||||
|         .enableClassInfo() | ||||
|         .enableAnnotationInfo() | ||||
|         .whitelistPackages("function.builtin") | ||||
| 
 | ||||
|     private val allBuiltIns = with(classGraph.scan()) { | ||||
|         getClassesWithAnnotation(FunctionNames::class.qualifiedName) | ||||
|             .map { it.loadClass() } | ||||
|             .filterIsInstance<Class<out LispFunction>>() | ||||
|             .toSet() | ||||
|     } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user