-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
daf1380
commit fcfdfc4
Showing
8 changed files
with
125 additions
and
1 deletion.
There are no files selected for viewing
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
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,34 @@ | ||
package fr.hammons.slinc.annotations | ||
|
||
import scala.annotation.StaticAnnotation | ||
import fr.hammons.slinc.fset.Dependency | ||
import java.nio.file.Paths | ||
import scala.quoted.* | ||
|
||
final case class NeedsFile(val path: String) | ||
extends StaticAnnotation, | ||
DependencyAnnotation: | ||
def toDependency: Dependency = | ||
val filePath = Paths.get(path).nn | ||
Dependency.FilePath(filePath) | ||
|
||
object NeedsFile: | ||
inline def apply[F]: List[NeedsFile] = ${ | ||
apply[F]() | ||
} | ||
|
||
private def apply[F]()(using Quotes, Type[F]): Expr[List[NeedsFile]] = | ||
import quotes.reflect.* | ||
|
||
Expr.ofList( | ||
TypeRepr | ||
.of[F] | ||
.classSymbol | ||
.get | ||
.annotations | ||
.view | ||
.map(_.asExpr) | ||
.collect: | ||
case n @ '{ new NeedsFile(${ _ }) } => n | ||
.toList | ||
) |
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
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
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,9 @@ | ||
#ifdef _WIN32 | ||
# define EXPORTED __declspec( dllexport ) | ||
#else | ||
# define EXPORTED | ||
#endif | ||
|
||
EXPORTED int test_fn(int i) { | ||
return i; | ||
} |