Skip to content

Commit

Permalink
Rename property for DE in config + add README description. (#5)
Browse files Browse the repository at this point in the history
Update name for in extension for Dynamic Extension amps. Added a bit of documentation in the readme.
  • Loading branch information
thijslemmens authored and vierbergenlars committed Oct 26, 2018
1 parent 589969a commit 833c41e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ unit tests.
An amp has some typical files and folders. The module.properties file is required.
You can override their locations in the ```ampConfig``` extension:

| property | description | default location | required |
|------------------|-----------------------------------------------------------------|--------------------------------|----------|
| moduleProperties | The file that describes your extension. | src/main/amp/module.properties | false |
| configDir | This folder will be put on the classpath of the war. | src/main/amp/config | false |
| web | This folder will end up in the "web" directory of the amp file. | src/main/amp/web | false |
| property | description | default | required |
| ---------------- | ------------------------------------------------------------ | ---------------------------------------------------- | -------- |
| moduleProperties | The file that describes your extension. | ```project.file('src/main/amp/module.properties')``` | false |
| configDir | This folder will be put on the classpath of the war. | ```project.file('src/main/amp/config')``` | false |
| web | This folder will end up in the "web" directory of the amp file. | ```project.file('src/main/amp/web')``` | false |
| dynamicExtension | Jar and dependencies are treated as Dynamic Extensions. | false | false |

More information about Dynamic Extensions for Alfresco can be found
[here](https://github.com/xenit-eu/dynamic-extensions-for-alfresco).
This plugin can bundle Dynamic Extensions in an ```amp``` file. This means
that the jar and dependencies should be put in the correct location in
the ```amp``` file.

## Usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
apply plugin: 'alfresco-dynamic-extension'

ampConfig {
dynamicExtensionAmp = true
dynamicExtension = true
}

description = "HelloWorld Webscript, very useful"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/xenit/gradle/alfrescosdk/AmpPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void apply(Project project) {
FileCollection jars = runtime.plus(jarArtifact);
amp.setLibs(jars);
project.afterEvaluate(p -> {
if (ampConfig.getDynamicExtensionAmp()) {
if (ampConfig.getDynamicExtension()) {
amp.de((CopySpec c) -> c.from(jars));
// Reset libs only when they have not been changed directly in the task
if(amp.getLibs() == jars) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/eu/xenit/gradle/alfrescosdk/config/AmpConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class AmpConfig {
private Supplier<File> configDir;
private Supplier<File> webDir;
private Supplier<File> fileMappingProperties;
private boolean dynamicExtensionAmp = false;
private boolean dynamicExtension = false;

private final Project project;
public AmpConfig(Project project){
Expand Down Expand Up @@ -105,11 +105,11 @@ public Supplier<File> getFileMappingPropertiesSupplier() {
return this.fileMappingProperties;
}

public boolean getDynamicExtensionAmp() {
return this.dynamicExtensionAmp;
public boolean getDynamicExtension() {
return this.dynamicExtension;
}

public void setDynamicExtensionAmp(boolean dynamicExtensionAmp) {
this.dynamicExtensionAmp = dynamicExtensionAmp;
public void setDynamicExtension(boolean dynamicExtension) {
this.dynamicExtension = dynamicExtension;
}
}
4 changes: 2 additions & 2 deletions src/test/java/eu/xenit/gradle/alfrescosdk/AmpPluginTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void testConfigDirectoryExists(){
public void testDeProjectWithEmptyLib(){
DefaultProject project = getDefaultProject();
project.getPluginManager().apply(AlfrescoPlugin.class);
project.getExtensions().configure("ampConfig", (AmpConfig ampConfig) -> ampConfig.setDynamicExtensionAmp(true));
project.getExtensions().configure("ampConfig", (AmpConfig ampConfig) -> ampConfig.setDynamicExtension(true));

Amp ampTask = (Amp) project.getTasks().getByName("amp");
project.evaluate(); // Evaluate the project so that the afterEvaluate can run, which should clear the libs
Expand All @@ -49,7 +49,7 @@ public void testDeProjectWithEmptyLib(){
public void testDeProjectWithConfiguredLib(){
DefaultProject project = getDefaultProject();
project.getPluginManager().apply(AlfrescoPlugin.class);
project.getExtensions().configure("ampConfig", (AmpConfig ampConfig) -> ampConfig.setDynamicExtensionAmp(true));
project.getExtensions().configure("ampConfig", (AmpConfig ampConfig) -> ampConfig.setDynamicExtension(true));

Amp ampTask = (Amp) project.getTasks().getByName("amp");
ampTask.setLibs(project.files("this/doesnt/exist"));
Expand Down

0 comments on commit 833c41e

Please sign in to comment.