Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
16efc1b9
Commit
16efc1b9
authored
10 years ago
by
Mick Jordan
Browse files
Options
Downloads
Patches
Plain Diff
BuiltinProcessor clean buildfix
parent
113c265f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.nodes.builtin.processor/src/com/oracle/truffle/r/nodes/builtin/processor/BuiltinProcessor.java
+19
-0
19 additions, 0 deletions
...e/truffle/r/nodes/builtin/processor/BuiltinProcessor.java
with
19 additions
and
0 deletions
com.oracle.truffle.r.nodes.builtin.processor/src/com/oracle/truffle/r/nodes/builtin/processor/BuiltinProcessor.java
+
19
−
0
View file @
16efc1b9
...
...
@@ -32,6 +32,17 @@ import javax.tools.*;
import
com.oracle.truffle.r.runtime.*
;
/**
* Analyzes classes annotated with {@code RBuiltin} and generates/updates a per-R-package class
* {@code RBuiltinClasses} that is used to drive the loading process on FastR startup. When the
* builtins are complete, this AP can be retired and the generated class migrated to the versioned
* source repository.
*
* The AP could also check builtins for invariants. None are currently defined.
*
* N.B. the AP cannot handle deleted builtins gracefully. Deleted builtins will manifest as
* compilation errors in {@code RBuiltinClasses}.
*/
@SupportedSourceVersion
(
SourceVersion
.
RELEASE_8
)
@SupportedAnnotationTypes
(
"com.oracle.truffle.r.runtime.RBuiltin"
)
public
class
BuiltinProcessor
extends
AbstractProcessor
{
...
...
@@ -96,9 +107,17 @@ public class BuiltinProcessor extends AbstractProcessor {
private
void
writeBuiltinsFiles
()
throws
IOException
{
for
(
PackageBuiltins
packageBuiltins
:
map
.
values
())
{
String
packageName
=
packageBuiltins
.
packageElement
.
getQualifiedName
().
toString
();
// Read the previous file content if any
SortedSet
<
String
>
classNames
=
readBuiltinsClass
(
packageName
);
// add in the classes from this step
for
(
TypeElement
builtinClassElement
:
packageBuiltins
.
builtinClassElements
)
{
String
qualName
=
builtinClassElement
.
getQualifiedName
().
toString
();
classNames
.
add
(
qualName
);
}
// write out the class
JavaFileObject
srcLocator
=
processingEnv
.
getFiler
().
createSourceFile
(
packageName
+
".RBuiltinClasses"
);
try
(
PrintWriter
wr
=
new
PrintWriter
(
new
BufferedWriter
(
srcLocator
.
openWriter
())))
{
wr
.
println
(
"// DO NOT EDIT, generated automatically"
);
wr
.
printf
(
"package %s;%n"
,
packageName
);
wr
.
println
(
"public final class RBuiltinClasses {"
);
wr
.
println
(
" public static final Class<?>[] RBUILTIN_CLASSES = {"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment