This repository has been archived by the owner on Nov 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Adding DE support #9
Open
tgeens
wants to merge
1
commit into
master
Choose a base branch
from
dynamic-extensions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 0 additions & 5 deletions
5
...ializr/generator/alfresco/extensions/DynamicExtensionsProjectGenerationConfiguration.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
...itializr/generator/extensions/dynext/DynamicExtensionsProjectGenerationConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package eu.xenit.alfred.initializr.generator.extensions.dynext; | ||
|
||
import static org.springframework.util.StringUtils.quote; | ||
|
||
import eu.xenit.alfred.initializr.generator.alfresco.platform.PlatformBuild; | ||
import eu.xenit.alfred.initializr.generator.build.BuildCustomizer; | ||
import eu.xenit.alfred.initializr.generator.build.gradle.platform.PlatformGradleBuild; | ||
import eu.xenit.alfred.initializr.generator.build.gradle.root.RootGradleBuild; | ||
import eu.xenit.alfred.initializr.generator.condition.ConditionalOnRequestedFacet; | ||
import eu.xenit.alfred.initializr.generator.packaging.amp.AmpPackaging; | ||
import eu.xenit.alfred.initializr.generator.sdk.alfred.AlfredSdk; | ||
import eu.xenit.alfred.initializr.generator.sdk.alfred.AlfredSdk.Configurations; | ||
import io.spring.initializr.generator.buildsystem.Dependency; | ||
import io.spring.initializr.generator.buildsystem.gradle.GradleBuildSystem; | ||
import io.spring.initializr.generator.buildsystem.gradle.GradleDependency; | ||
import io.spring.initializr.generator.condition.ConditionalOnBuildSystem; | ||
import io.spring.initializr.generator.condition.ConditionalOnPackaging; | ||
import io.spring.initializr.generator.project.ProjectGenerationConfiguration; | ||
import io.spring.initializr.generator.project.ResolvedProjectDescription; | ||
import io.spring.initializr.generator.version.VersionReference; | ||
import io.spring.initializr.metadata.support.MetadataBuildItemResolver; | ||
import org.springframework.context.annotation.Bean; | ||
|
||
@ProjectGenerationConfiguration | ||
@ConditionalOnRequestedFacet("dynamic-extensions") | ||
public class DynamicExtensionsProjectGenerationConfiguration { | ||
|
||
private final static String DYN_EXT = "dynamic-extensions"; | ||
|
||
private final MetadataBuildItemResolver resolver; | ||
|
||
public DynamicExtensionsProjectGenerationConfiguration(MetadataBuildItemResolver resolver) { | ||
this.resolver = resolver; | ||
} | ||
|
||
@Bean | ||
@ConditionalOnBuildSystem(GradleBuildSystem.ID) | ||
public BuildCustomizer<RootGradleBuild> addRootDynamicExtensionsAmp(MetadataBuildItemResolver resolver) { | ||
return (build) -> { | ||
|
||
String dynamicExtensionVersion = this.getDynamicExtensionsDependency().getVersion().getValue(); | ||
build.ext("dynamicExtensionsVersion", quote(dynamicExtensionVersion)); | ||
|
||
Dependency alfrescoAmp = GradleDependency.from(this.getDynamicExtensionsDependency()) | ||
.type("amp") | ||
.version(VersionReference.ofProperty("dynamic-extensions-version")) | ||
.configuration(Configurations.ALFRESCO_AMP) | ||
.build(); | ||
build.dependencies().add(DYN_EXT, alfrescoAmp); | ||
}; | ||
} | ||
|
||
@Bean | ||
@ConditionalOnBuildSystem(GradleBuildSystem.ID) | ||
@ConditionalOnPackaging(AmpPackaging.ID) | ||
public BuildCustomizer<PlatformGradleBuild> packageDynamicExtensionBundleAsAmp() { | ||
return (build) -> { | ||
|
||
build.customizeTask("sourceSets", sourceSets -> { | ||
sourceSets.nested("main", main -> { | ||
main.nested("amp", amp -> { | ||
amp.invoke("dynamicExtension"); | ||
}); | ||
}); | ||
}); | ||
}; | ||
} | ||
|
||
@Bean | ||
@ConditionalOnBuildSystem(GradleBuildSystem.ID) | ||
public BuildCustomizer<PlatformGradleBuild> platformConfigureDynamicExtensionsPlugin( | ||
ResolvedProjectDescription project) { | ||
return (build) -> { | ||
|
||
String pluginVersion = this.getDynamicExtensionsDependency().getVersion().getValue(); | ||
build.addPlugin("eu.xenit.de", pluginVersion); | ||
|
||
// dependencies on -webscripts and -annotations are added by the plugin | ||
// TODO review we want to change this ?! | ||
|
||
build.customizeTask("jar", jar -> { | ||
jar.invoke("bnd", | ||
"'Alfresco-Spring-Configuration': '"+project.getPackageName()+"'" | ||
); | ||
}); | ||
}; | ||
} | ||
|
||
private Dependency getDynamicExtensionsDependency() { | ||
return resolver.resolveDependency("dynamic-extensions"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/test/java/eu/xenit/alfred/initializr/asserts/build/gradle/GradleTaskAssertion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package eu.xenit.alfred.initializr.asserts.build.gradle; | ||
|
||
import java.util.function.Consumer; | ||
import org.assertj.core.api.AbstractStringAssert; | ||
|
||
public class GradleTaskAssertion extends AbstractStringAssert<GradleTaskAssertion> { | ||
|
||
public GradleTaskAssertion(String actual) { | ||
super(actual, GradleTaskAssertion.class); | ||
} | ||
|
||
public GradleTaskAssertion nested(String task, Consumer<GradleTaskAssertion> callback) | ||
{ | ||
String section = GradleBuildParser.extractSection(task, this.actual); | ||
callback.accept(new GradleTaskAssertion(section)); | ||
return this; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printet ?