Skip to content

Commit

Permalink
Investigating using manifest for offering 'extension methods'.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanGiles committed Jul 15, 2024
1 parent 623fcf5 commit 296149b
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 2 deletions.
24 changes: 24 additions & 0 deletions aspire4j/extensions/manifest/azure/storage-ext/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.microsoft.aspire</groupId>
<artifactId>aspire4j-extensions-manifest-ext</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>aspire4j-extensions-azure-storage-ext</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>com.microsoft.aspire</groupId>
<artifactId>aspire4j-extensions-azure-storage</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package azure.storage.manifest.extensions.com.microsoft.aspire.DistributedApplication;

import com.microsoft.aspire.extensions.azure.storage.resources.AzureStorageResource;
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.This;
import com.microsoft.aspire.DistributedApplication;

@Extension
public class AzureStorageDistributedApplication {

public static AzureStorageResource addAzureStorage(@This DistributedApplication app, String name) {
return app.addResource(new AzureStorageResource(name));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

/**
* An Aspire extension providing support for Azure Storage.
*/
module com.microsoft.aspire.extensions.manifest.azure.storage {
requires transitive com.microsoft.aspire.extensions.azure.storage;
requires manifold.ext.rt;

exports azure.storage.manifest.extensions.com.microsoft.aspire.DistributedApplication;
}
54 changes: 54 additions & 0 deletions aspire4j/extensions/manifest/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.microsoft.aspire</groupId>
<artifactId>aspire4j-sdk-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>aspire4j-extensions-manifest-ext</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<manifold.version>2024.1.23</manifold.version>
</properties>

<dependencies>
<dependency>
<groupId>systems.manifold</groupId>
<artifactId>manifold-ext-rt</artifactId>
<version>${manifold.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>21</source>
<target>21</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-Xplugin:Manifold</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>systems.manifold</groupId>
<artifactId>manifold-ext</artifactId>
<version>${manifold.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
24 changes: 24 additions & 0 deletions aspire4j/extensions/manifest/spring-ext/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.microsoft.aspire</groupId>
<artifactId>aspire4j-extensions-manifest-ext</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>aspire4j-extensions-spring-ext</artifactId>
<version>1.0-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>com.microsoft.aspire</groupId>
<artifactId>aspire4j-extensions-spring</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package azure.storage.manifest.extensions.com.microsoft.aspire.DistributedApplication;

import com.microsoft.aspire.extensions.microservice.common.resources.EurekaServiceDiscovery;
import com.microsoft.aspire.extensions.spring.resources.SpringProject;
import manifold.ext.rt.api.Extension;
import manifold.ext.rt.api.This;
import com.microsoft.aspire.DistributedApplication;

@Extension
public class SpringDistributedApplication {

public static SpringProject addSpringProject(@This DistributedApplication app, String name) {
return app.addResource(new SpringProject(name));
}

public static EurekaServiceDiscovery addEurekaServiceDiscovery(@This DistributedApplication app, String name) {
return app.addResource(new EurekaServiceDiscovery(name));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

/**
* An Aspire extension providing support for <a href="https://spring.io">Spring</a> projects.
*/
module com.microsoft.aspire.extensions.manifest.spring {
requires transitive com.microsoft.aspire.extensions.spring;
requires manifold.ext.rt;

exports azure.storage.manifest.extensions.com.microsoft.aspire.DistributedApplication;
}
1 change: 1 addition & 0 deletions aspire4j/extensions/spring/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
module com.microsoft.aspire.extensions.spring {
requires transitive com.microsoft.aspire.extensions.microservice.common;
requires manifold.ext.rt;

exports com.microsoft.aspire.extensions.spring;
exports com.microsoft.aspire.extensions.spring.resources;
Expand Down
4 changes: 4 additions & 0 deletions aspire4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<module>extensions/micronaut</module>
<module>extensions/quarkus</module>
<module>extensions/spring</module>

<!-- manifest extension libraries -->
<module>extensions/manifest/azure/storage-ext</module>
<module>extensions/manifest/spring-ext</module>
</modules>

<build>
Expand Down
4 changes: 2 additions & 2 deletions samples/storage-explorer/storage-explorer-apphost/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
</dependency>
<dependency>
<groupId>com.microsoft.aspire</groupId>
<artifactId>aspire4j-extensions-azure-storage</artifactId>
<artifactId>aspire4j-extensions-azure-storage-ext</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.microsoft.aspire</groupId>
<artifactId>aspire4j-extensions-spring</artifactId>
<artifactId>aspire4j-extensions-spring-ext</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
Expand Down

0 comments on commit 296149b

Please sign in to comment.