Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/workflows/job.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@ jobs:
with:
channel: nightly
- name: "Build: Java Compiler"
run: ./mvnw clean install -pl plexus-compilers
run: ./mvnw clean install -pl java-compiler
- name: "Build: Kotlin Plugin"
run: ./mvnw clean install -pl kotlin-plugin
- name: "Build: Elide Plugin"
run: ./mvnw clean install -pl elide-plugin
- name: "Test: Java Compiler"
run: ./mvnw clean package -pl sample-java
run: ./mvnw test -pl java-compiler
- name: "Test: Java Compiler (Build Sample)"
run: ./mvnw clean package exec:java -f sample-java
- name: "Test: Kotlin Plugin"
run: ./mvnw clean package -pl sample-kotlin
- name: "Test: Mixed source"
run: ./mvnw clean package -pl sample-mixed
run: ./mvnw test -pl kotlin-plugin
- name: "Test: Kotlin Plugin (Build Sample)"
run: ./mvnw clean package exec:java -f sample-kotlin
- name: "Test: Elide Plugin (Build Sample)"
run: ./mvnw clean package exec:java -f sample-mixed
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
all: clean all-java all-kotlin all-plugin

clean:
./mvnw clean

all-java: build-java test-java install-java sample-java

all-kotlin: build-kotlin test-kotlin install-kotlin sample-kotlin

all-plugin: build-plugin test-plugin install-plugin sample-plugin

build-java:
./mvnw compile -pl java-compiler

build-kotlin:
./mvnw compile -pl kotlin-plugin

build-plugin:
./mvnw compile -pl elide-plugin

test-java:
./mvnw test -pl java-compiler

test-kotlin:
./mvnw test -pl kotlin-plugin

test-plugin:
./mvnw test -pl elide-plugin

install-java:
./mvnw install -pl java-compiler

install-kotlin:
./mvnw install -pl kotlin-plugin

install-plugin:
./mvnw install -pl elide-plugin

sample-java:
./mvnw clean package exec:java -f sample-java

sample-kotlin:
./mvnw clean package exec:java -f sample-kotlin

sample-plugin:
./mvnw clean package exec:java -f sample-mixed
Comment thread
melodicore marked this conversation as resolved.
117 changes: 19 additions & 98 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,69 +11,46 @@ This plugin can be consumed in a Maven project to use [Elide](https://elide.dev)
- [x] Supports explicit path to `elide`
- [x] Resolve `elide` via the `PATH`
- [x] Swap out `kotlinc ...` for `elide kotlinc -- ...`
- [ ] Usability of Elide as a Maven toolchain
- [x] Usability of Elide as a Maven toolchain

## Usage

### Java
### Elide Plugin

Configuring Elide as your `javac` compiler:
The easiest way to start using Elide in your project is the `elide-maven-plugin`. Enable it and set `extensions` to
`true` and all of your Java and Kotlin sources will be compiled with Elide `javac` and `kotlinc`.

**`pom.xml`**
```xml
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.15.0</version>
<dependencies>
<dependency>
<groupId>dev.elide</groupId>
<artifactId>elide-plexus-compilers</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<configuration>
<compilerId>elide</compilerId>
</configuration>
<groupId>dev.elide</groupId>
<artifactId>elide-maven-plugin</artifactId>
<version>1.0.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
```

> [!TIP]
> See the [Java sample project](sample-java) for a usage example. Elide also provides
> a [Gradle plugin](https://github.com/elide-dev/gradle).
> See the [Mixed sources sample project](sample-mixed) for a usage example.

### Kotlin
### Kotlin drop-in replacement

Configuring the Elide Kotlin plugin is done the exact same way as configuring the Kotlin Maven plugin, just replacing
the plugin coordinates:
If you already have a project that uses the `kotlin-maven-plugin`, you can use the `elide-kotlin-maven-plugin` as a
drop-in replacement. It supports all configuration you would expect from the Kotlin Maven plugin.

**`pom.xml`**
```xml
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>dev.elide</groupId>
<artifactId>elide-kotlin-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
Expand All @@ -82,89 +59,33 @@ the plugin coordinates:
> [!TIP]
> See the [Kotlin sample project](sample-kotlin) for a usage example.

### Mixed Java and Kotlin
### Java Compiler

By combining the Kotlin configuration and Java compiler replacement, mixed Java and Kotlin sources can be compiled with
Elide:
If you already have a complex project and just want the Elide Java compiler, you can set the `maven-compiler-plugin`'s
`compilerId` to `elide` to use Elide just as a Java compiler without using any plugins.

**`pom.xml`**

```xml
<build>
<plugins>
<plugin>
<groupId>dev.elide</groupId>
<artifactId>elide-kotlin-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/main/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/test/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.15.0</version>
<dependencies>
<dependency>
<groupId>dev.elide</groupId>
<artifactId>elide-plexus-compilers</artifactId>
<artifactId>elide-java-compiler</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<configuration>
<compilerId>elide</compilerId>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
```

> [!TIP]
> See the [Mixed sources sample project](sample-mixed) for a usage example.
> See the [Java sample project](sample-java) for a usage example. Elide also provides
> a [Gradle plugin](https://github.com/elide-dev/gradle).
Loading
Loading