Commit 952e5297 authored by Madhura Bhave's avatar Madhura Bhave

Rename "classes" to "application" in custom layer configuration

Closes gh-20539
parent 29c89f3c
......@@ -23,7 +23,7 @@ bootJar {
}
}
}
classes {
application {
layerContent("resources") {
locations {
include "META-INF/resources/**", "resources/**"
......
......@@ -21,7 +21,7 @@ tasks.getByName<BootJar>("bootJar") {
}
}
}
classes {
application {
layerContent("resources") {
locations {
include("META-INF/resources/**", "resources/**")
......
......@@ -214,7 +214,7 @@ public class BootJar extends Jar implements BootArchive {
else {
List<Layer> customLayers = this.layerConfiguration.getLayersOrder().stream().map(Layer::new)
.collect(Collectors.toList());
this.layers = new CustomLayers(customLayers, this.layerConfiguration.getClasses(),
this.layers = new CustomLayers(customLayers, this.layerConfiguration.getApplication(),
this.layerConfiguration.getLibraries());
}
......
......@@ -79,16 +79,16 @@ public class LayerConfiguration {
}
@Input
public List<ResourceStrategy> getClasses() {
public List<ResourceStrategy> getApplication() {
return this.resourceStrategies;
}
public void classes(ResourceStrategy... resourceStrategies) {
public void application(ResourceStrategy... resourceStrategies) {
assertLayersOrderConfigured();
this.resourceStrategies = Arrays.asList(resourceStrategies);
}
public void classes(Action<LayerConfiguration> config) {
public void application(Action<LayerConfiguration> config) {
assertLayersOrderConfigured();
this.strategySpec = StrategySpec.forResources();
config.execute(this);
......@@ -135,7 +135,8 @@ public class LayerConfiguration {
}
public void locations(Action<LayerConfiguration> config) {
Assert.state(this.strategySpec.isResourcesStrategy(), "The 'locations' filter must be used only with classes");
Assert.state(this.strategySpec.isResourcesStrategy(),
"The 'locations' filter must be used only with application");
this.strategySpec.newFilter();
config.execute(this);
this.strategySpec
......
......@@ -126,7 +126,7 @@ class BootJarTests extends AbstractBootArchiveTests<BootJar> {
configuration.libraries(createLibraryStrategy("my-snapshot-deps", "com.example:*:*.SNAPSHOT"),
createLibraryStrategy("my-internal-deps", "com.example:*:*"),
createLibraryStrategy("my-deps", "*:*"));
configuration.classes(createResourceStrategy("resources", "static/**"),
configuration.application(createResourceStrategy("resources", "static/**"),
createResourceStrategy("application", "**"));
});
List<String> entryNames = getEntryNames(jar);
......
......@@ -12,7 +12,7 @@ bootJar {
layerContent("commons-dependencies") { coordinates { include "org.apache.commons:*" } }
layerContent("dependencies") { coordinates { include "*:*" } }
}
classes {
application {
layerContent("static") {
locations {
include "META-INF/resources/**", "resources/**"
......
......@@ -164,7 +164,7 @@ The following example shows what the implicit layer configuration described abov
</coordinates>
</layer-content>
</libraries>
<classes>
<application>
<layer-content layer="resources">
<locations>
<include>META-INF/resources/**</include>
......@@ -178,7 +178,7 @@ The following example shows what the implicit layer configuration described abov
<include>**</include>
</locations>
</layer-content>
</classes>
</application>
</layers-configuration>
----
......@@ -589,9 +589,9 @@ This allows to reuse the cache for external dependencies when an internal depend
</coordinates>
</layer-content>
</libraries>
<classes>
<application>
...
</classes>
</application>
</layers-configuration>
----
......
......@@ -20,7 +20,7 @@
</coordinates>
</layer-content>
</libraries>
<classes>
<application>
<layer-content layer="configuration">
<locations>
<include>**/application*.*</include>
......@@ -31,5 +31,5 @@
<include>**</include>
</locations>
</layer-content>
</classes>
</application>
</layers-configuration>
\ No newline at end of file
......@@ -71,7 +71,7 @@ public class CustomLayersProvider {
(StrategyFactory<LibraryFilter, LibraryStrategy>) FilteredLibraryStrategy::new,
CoordinateFilter::new, "coordinates"::equals));
}
if ("classes".equals(nodeName)) {
if ("application".equals(nodeName)) {
resourceStrategies.addAll(getStrategies(contents,
(StrategyFactory<ResourceFilter, ResourceStrategy>) FilteredResourceStrategy::new,
LocationFilter::new, "locations"::equals));
......
......@@ -8,7 +8,7 @@
<xsd:sequence>
<xsd:element type="layersType" name="layers"/>
<xsd:element type="librariesType" name="libraries" minOccurs="0"/>
<xsd:element type="classesType" name="classes" minOccurs="0"/>
<xsd:element type="applicationType" name="application" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="layersType">
......@@ -48,25 +48,25 @@
</xsd:sequence>
<xsd:attribute type="xsd:string" name="layer" use="required"/>
</xsd:complexType>
<xsd:complexType name="classesType">
<xsd:complexType name="applicationType">
<xsd:annotation>
<xsd:documentation><![CDATA[
Strategies that should be applied to classes. If no strategies are defined, a single
Strategies that should be applied to application classes and resources. If no strategies are defined, a single
"application" layer is created out-of-the-box.
]]></xsd:documentation>
</xsd:annotation>
<xsd:choice maxOccurs="unbounded">
<xsd:element type="classesLayerContentType" name="layer-content" maxOccurs="unbounded"
<xsd:element type="applicationLayerContentType" name="layer-content" maxOccurs="unbounded"
minOccurs="0">
<xsd:annotation>
<xsd:documentation><![CDATA[
Strategy to apply on classes.
Strategy to apply on application classes and resources.
]]></xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="classesLayerContentType" mixed="true">
<xsd:complexType name="applicationLayerContentType" mixed="true">
<xsd:sequence>
<xsd:element type="filterType" name="locations" minOccurs="0"/>
</xsd:sequence>
......
......@@ -27,7 +27,7 @@
</coordinates>
</layer-content>
</libraries>
<classes>
<application>
<layer-content layer="my-resources">
<locations>
<include>META-INF/resources/**</include>
......@@ -43,5 +43,5 @@
<include>**</include>
</locations>
</layer-content>
</classes>
</application>
</layers-configuration>
\ No newline at end of file
......@@ -5,7 +5,7 @@
<layers>
<layer>my-layer</layer>
</layers>
<classes>
<application>
<layer-content layer="my-layer"/>
</classes>
</application>
</layers-configuration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment