@CompileStatic final class ViewCompileEnvironment extends java.lang.Object
The Grails environment a build compiles its views for.
Pages, JSON views and markup views are compiled ahead of time by a forked compiler that reads the application's configuration for the environment it runs in, so what a view compiles to - the codecs a page carries, for one - depends on that environment. The compile tasks state the environment as an input and hand it to the compiler, rather than leaving the compiler to whatever it inherits. This is where the input's default comes from, and how the input is read.
| Type Params | Return Type | Name and description |
|---|---|---|
|
static java.lang.String |
canonicalName(java.lang.String name)The full name of the environment name refers to, read as the application reads the
name it is started with: dev, prod and test stand for the environments
they are short for, the full names in any case for theirs, and any other name - PROD
among them - is a custom environment, whose configuration block is named by it as given.
|
|
static Provider<java.lang.String> |
defaultFor(ProviderFactory providers, ViewCompileOptions options)The default for a compile task's grailsEnvironment: an environment the build gave the
compiler itself, as a -Dgrails.env JVM argument among the fork options of
options, which is how a build chose the environment before the task had an input for
it, else the one the build runs with. |
|
static java.lang.String |
forCompiler(Provider<java.lang.String> stated, java.lang.String task)The environment a compile task states to the compiler: its grailsEnvironment, by the
environment's full name. |
|
static Provider<java.lang.String> |
ofBuild(ProviderFactory providers)The environment the build runs with: the grails.env system property given to Gradle,
else the GRAILS_ENV environment variable, and development where neither is
set, which is what the compiler has always fallen back to, as the application does. |
|
static Provider<java.lang.String> |
resolve(Provider<java.lang.String> stated, Provider<java.lang.String> inherited)The environment stated names, else the one inherited names, else
development. |
|
static java.lang.String |
statedIn(java.util.List<java.lang.String> jvmArgs)The environment a build gave the compiler itself, as a -Dgrails.env JVM argument among
the fork options of its compile task. |
|
static java.util.List<java.lang.String> |
withoutStated(java.util.List<java.lang.String> jvmArgs)jvmArgs without any -Dgrails.env among them: the task states the environment to
the compiler from its input, which that argument was read into, so that the input is what the
compiler gets whatever the argument says. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
The full name of the environment name refers to, read as the application reads the
name it is started with: dev, prod and test stand for the environments
they are short for, the full names in any case for theirs, and any other name - PROD
among them - is a custom environment, whose configuration block is named by it as given.
null where name is blank, so that a blank setting counts as none.
name - the name as stated The default for a compile task's grailsEnvironment: an environment the build gave the
compiler itself, as a -Dgrails.env JVM argument among the fork options of
options, which is how a build chose the environment before the task had an input for
it, else the one the build runs with.
providers - the build's providersoptions - the task's compile options, whose fork options may name the environment The environment a compile task states to the compiler: its grailsEnvironment, by the
environment's full name. A blank one fails the build: the compiler would read an environment
from what it inherits instead, which the input would not record.
stated - the task's grailsEnvironmenttask - the path of the task, for the message The environment the build runs with: the grails.env system property given to Gradle,
else the GRAILS_ENV environment variable, and development where neither is
set, which is what the compiler has always fallen back to, as the application does.
providers - the build's providers, which read the property and the variable The environment stated names, else the one inherited names, else
development. Each is read as canonicalName reads it, so a blank one counts as
not set and leaves the choice to the next, as the application's own resolution does.
stated - the name the build was given, the grails.env system propertyinherited - the name the build inherited, the GRAILS_ENV environment variable The environment a build gave the compiler itself, as a -Dgrails.env JVM argument among
the fork options of its compile task. The last one wins, as it does on a JVM command line.
jvmArgs - the JVM arguments of the compiler, possibly null jvmArgs without any -Dgrails.env among them: the task states the environment to
the compiler from its input, which that argument was read into, so that the input is what the
compiler gets whatever the argument says.
jvmArgs - the JVM arguments of the compiler, possibly null