Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fractal
fractal
Commits
81a7fd27
Commit
81a7fd27
authored
Jan 02, 2018
by
Lionel Seinturier
Browse files
Remove CompilationRounfds.
parent
cdd5fc64
Changes
6
Hide whitespace changes
Inline
Side-by-side
juliac/core/src/main/java/org/objectweb/fractal/juliac/CompilationRounds.java
deleted
100644 → 0
View file @
cdd5fc64
/***
* Juliac
* Copyright (C) 2007-2017 Inria, Univ. Lille 1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Contact: fractal@ow2.org
*
* Author: Lionel Seinturier
*/
package
org.objectweb.fractal.juliac
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.objectweb.fractal.juliac.conf.JuliacConfig
;
/**
* This class manages the compilation rounds generated by Juliac.
* Each compilation round contains a list of input files which need to be
* compiled.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
*/
public
class
CompilationRounds
{
public
CompilationRounds
(
JuliacConfig
jconf
)
{
this
.
jconf
=
jconf
;
}
/**
* Return a new compilation round.
*/
public
CompilationRound
newCompilationRound
()
{
CompilationRound
round
=
new
CompilationRound
(
jconf
);
rounds
.
add
(
round
);
return
round
;
}
/**
* Return the compilation rounds.
*
* @since 2.2.4
*/
public
List
<
CompilationRound
>
getCompilationRounds
()
{
return
rounds
;
}
/**
* Return the current compilation round.
*/
public
CompilationRound
getCurrentCompilationRound
()
{
int
idx
=
rounds
.
size
();
if
(
idx
==
0
)
{
CompilationRound
round
=
newCompilationRound
();
return
round
;
}
CompilationRound
round
=
rounds
.
get
(
idx
-
1
);
return
round
;
}
/**
* Return <code>true</code> if the specified file has already been generated
* in one of the compilation rounds associated with this instance.
*/
public
boolean
contains
(
SourceFile
sf
)
{
for
(
CompilationRound
round
:
rounds
)
{
boolean
b
=
round
.
contains
(
sf
);
if
(
b
)
return
true
;
}
return
false
;
}
/**
* Return <code>true</code> if the specified qualified name has already been
* generated in one of the compilation rounds associated with this instance.
*
* @since 2.7
*/
public
boolean
contains
(
String
qname
)
{
for
(
CompilationRound
round
:
rounds
)
{
boolean
b
=
round
.
contains
(
qname
);
if
(
b
)
return
true
;
}
return
false
;
}
/**
* Return the source type that triggered the generation of the specified
* qualifed name type.
*
* @since 2.7
*/
public
Object
getSourceType
(
String
qname
)
{
for
(
CompilationRound
round
:
rounds
)
{
if
(
round
.
contains
(
qname
)
)
{
Object
sourceType
=
round
.
getSourceType
(
qname
);
return
sourceType
;
}
}
return
null
;
}
// --------------------------------------------------------------------
// Data
// --------------------------------------------------------------------
private
List
<
CompilationRound
>
rounds
=
new
ArrayList
<>();
private
JuliacConfig
jconf
;
}
juliac/core/src/main/java/org/objectweb/fractal/juliac/Juliac.java
View file @
81a7fd27
...
...
@@ -384,8 +384,7 @@ public class Juliac {
URI
uri
=
generateSourceCodeOverride
(
scg
);
JuliacConfig
jconf
=
getJuliacConfig
();
CompilationRounds
rounds
=
jconf
.
getCompilationRounds
();
CompilationRound
round
=
rounds
.
getCurrentCompilationRound
();
CompilationRound
round
=
jconf
.
getCompilationRound
();
Object
sourceType
=
scg
.
getSourceType
();
round
.
addGenerated
(
new
SourceFileDir
(
uri
,
targetClassName
,
"java"
),
sourceType
);
...
...
@@ -446,11 +445,11 @@ public class Juliac {
public
boolean
hasBeenGenerated
(
String
name
)
{
JuliacConfig
jconf
=
getJuliacConfig
();
CompilationRound
s
round
s
=
jconf
.
getCompilationRound
s
();
CompilationRound
round
=
jconf
.
getCompilationRound
();
// Check whether the type has been generated by Juliac
SourceFile
igf
=
new
SourceFileDir
(
null
,
name
,
"java"
);
if
(
round
s
.
contains
(
igf
)
)
{
if
(
round
.
contains
(
igf
)
)
{
return
true
;
}
...
...
@@ -505,7 +504,7 @@ public class Juliac {
// ----------------------------------------------------------------------
// Methods for compiling
and packaging
code
// Methods for compiling code
// ----------------------------------------------------------------------
/**
...
...
@@ -513,15 +512,13 @@ public class Juliac {
* contained in the current compilation round. Move to the next compilation
* round.
*
* @return the current compilation round
* @since 2.0
*/
public
CompilationRoun
d
build
()
throws
IOException
{
public
voi
d
build
()
throws
IOException
{
JuliacConfig
jconf
=
getJuliacConfig
();
Logger
logger
=
jconf
.
getLogger
();
CompilationRounds
rounds
=
jconf
.
getCompilationRounds
();
CompilationRound
round
=
rounds
.
getCurrentCompilationRound
();
CompilationRound
round
=
jconf
.
getCompilationRound
();
/*
* Compile input and generated source files.
...
...
@@ -559,14 +556,7 @@ public class Juliac {
total
+
" file(s) compiled to "
+
round
.
getClassDir
().
getAbsolutePath
();
logger
.
info
(
msg
);
}
/*
* Move to the next compilation round.
*/
rounds
.
newCompilationRound
();
return
round
;
}
}
/**
...
...
@@ -574,10 +564,9 @@ public class Juliac {
* contained in the current compilation round. Move to the next compilation
* round. Only errors are reported.
*
* @return the current compilation round
* @since 2.2.4
*/
public
CompilationRoun
d
buildQuiet
()
throws
IOException
{
public
voi
d
buildQuiet
()
throws
IOException
{
/*
* Copy/paste of the #compile() method without log invocations. Getting
...
...
@@ -589,17 +578,11 @@ public class Juliac {
*/
JuliacConfig
jconf
=
getJuliacConfig
();
CompilationRounds
rounds
=
jconf
.
getCompilationRounds
();
CompilationRound
round
=
rounds
.
getCurrentCompilationRound
();
CompilationRound
round
=
jconf
.
getCompilationRound
();
// Compile input and generated source files
CompileSupportItf
compiler
=
lookupUnique
(
CompileSupportItf
.
class
);
round
.
compile
(
compiler
);
// Move to the next compilation round
rounds
.
newCompilationRound
();
return
round
;
}
...
...
juliac/core/src/main/java/org/objectweb/fractal/juliac/conf/JuliacConfig.java
View file @
81a7fd27
...
...
@@ -37,10 +37,8 @@ import java.util.logging.Logger;
import
javax.annotation.processing.ProcessingEnvironment
;
import
org.objectweb.fractal.juliac.CompilationRound
;
import
org.objectweb.fractal.juliac.CompilationRounds
;
import
org.objectweb.fractal.juliac.SourceFile
;
import
org.objectweb.fractal.juliac.commons.io.FileHelper
;
import
org.objectweb.fractal.juliac.module.SpoonSupportItf
;
/**
* This class manages the Juliac configuration parameters.
...
...
@@ -141,7 +139,7 @@ public class JuliacConfig {
Charset
.
defaultCharset
().
displayName
();
private
ClassLoader
classLoader
;
private
CompilationRound
s
round
s
;
private
CompilationRound
round
;
/**
* The default logger.
...
...
@@ -236,9 +234,9 @@ public class JuliacConfig {
* Add the specified location to the list of locations. A location denotes
* either an absolute path or a path relative to {@link #baseDir}, for a
* directory or a jar file. All source files contained in the specified
* location are registered with the
{@link
CompilationRound
s}
API for being
* location are registered with the CompilationRound API for being
* compiled when requested (see {@link #build()}) or processed by the
* juliac-spoon module (see
{@link
SpoonSupportI
tf}
.)
* juliac-spoon module (see SpoonSupportI
mpl
.)
*
* @param src the location to add
* @throws IOException
...
...
@@ -257,8 +255,7 @@ public class JuliacConfig {
/*
* Register the source files with the current compilation round.
*/
CompilationRounds
rounds
=
getCompilationRounds
();
CompilationRound
round
=
rounds
.
getCurrentCompilationRound
();
CompilationRound
round
=
getCompilationRound
();
round
.
addInput
(
sfs
);
srcs
.
add
(
src
);
...
...
@@ -382,11 +379,11 @@ public class JuliacConfig {
// Setter/getter methods for loaders and compilation rounds
// ----------------------------------------------------------------------
public
CompilationRound
s
getCompilationRound
s
()
{
if
(
round
s
==
null
)
{
round
s
=
new
CompilationRound
s
(
this
);
public
CompilationRound
getCompilationRound
()
{
if
(
round
==
null
)
{
round
=
new
CompilationRound
(
this
);
}
return
round
s
;
return
round
;
}
public
ClassLoader
getClassLoader
()
{
...
...
juliac/extension/adlet/core/src/main/java/org/objectweb/fractal/juliac/adlet/MixinProcessor.java
View file @
81a7fd27
...
...
@@ -41,7 +41,6 @@ import javax.lang.model.element.TypeElement;
import
javax.tools.JavaFileObject
;
import
org.objectweb.fractal.juliac.CompilationRound
;
import
org.objectweb.fractal.juliac.CompilationRounds
;
import
org.objectweb.fractal.juliac.SourceFileDir
;
import
org.objectweb.fractal.juliac.adlet.api.annotation.Mixin
;
import
org.objectweb.fractal.juliac.adlet.helper.AnnotatedConstructHelper
;
...
...
@@ -153,8 +152,7 @@ public class MixinProcessor extends AbstractJuliacProcessor {
* Add the generated file to the current compilation round.
*/
JuliacConfig
jconf
=
jc
.
getJuliacConfig
();
CompilationRounds
rounds
=
jconf
.
getCompilationRounds
();
CompilationRound
round
=
rounds
.
getCurrentCompilationRound
();
CompilationRound
round
=
jconf
.
getCompilationRound
();
URI
uri
=
sourceFile
.
toUri
();
round
.
addGenerated
(
new
SourceFileDir
(
uri
,
targetClassName
,
"java"
),
null
);
}
...
...
juliac/extension/adlet/opt-oo/src/main/java/org/objectweb/fractal/juliac/adlet/opt/InitializerOOCtrlClassGenerator.java
View file @
81a7fd27
...
...
@@ -39,7 +39,7 @@ import javax.lang.model.util.Elements;
import
org.objectweb.fractal.api.type.ComponentType
;
import
org.objectweb.fractal.fraclet.annotations.Lifecycle
;
import
org.objectweb.fractal.fraclet.types.Step
;
import
org.objectweb.fractal.juliac.CompilationRound
s
;
import
org.objectweb.fractal.juliac.CompilationRound
;
import
org.objectweb.fractal.juliac.Juliac
;
import
org.objectweb.fractal.juliac.adlet.helper.TypeElementHelper
;
import
org.objectweb.fractal.juliac.api.JuliacRuntimeException
;
...
...
@@ -149,10 +149,10 @@ extends org.objectweb.fractal.juliac.fraclet.InitializerOOCtrlClassGenerator {
* by this method. This is then safe to retrieve the corresponding
* information contained in the source type.
*/
CompilationRound
s
round
s
=
jconf
.
getCompilationRound
s
();
boolean
b
=
round
s
.
contains
(
contentClassName
);
CompilationRound
round
=
jconf
.
getCompilationRound
();
boolean
b
=
round
.
contains
(
contentClassName
);
if
(
b
)
{
cl
=
(
TypeElement
)
round
s
.
getSourceType
(
contentClassName
);
cl
=
(
TypeElement
)
round
.
getSourceType
(
contentClassName
);
}
else
{
final
String
msg
=
...
...
juliac/module/spoon/src/main/java/org/objectweb/fractal/juliac/spoon/SpoonSupportImpl.java
View file @
81a7fd27
...
...
@@ -35,7 +35,6 @@ import java.util.Map;
import
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration
;
import
org.eclipse.jdt.internal.compiler.env.ICompilationUnit
;
import
org.objectweb.fractal.juliac.CompilationRound
;
import
org.objectweb.fractal.juliac.CompilationRounds
;
import
org.objectweb.fractal.juliac.Juliac
;
import
org.objectweb.fractal.juliac.SourceFile
;
import
org.objectweb.fractal.juliac.SourceFileDir
;
...
...
@@ -277,8 +276,7 @@ public class SpoonSupportImpl implements SpoonSupportItf {
throw
new
IOException
(
msg
);
}
CompilationRounds
rounds
=
jconf
.
getCompilationRounds
();
CompilationRound
round
=
rounds
.
getCurrentCompilationRound
();
CompilationRound
round
=
jconf
.
getCompilationRound
();
URI
uri
=
files
.
get
(
0
).
toURI
();
round
.
addGenerated
(
new
SourceFileDir
(
uri
,
name
,
"java"
),
null
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment