Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for building against Valhalla EA #684

Merged
merged 4 commits into from
Aug 29, 2024
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
45 changes: 45 additions & 0 deletions .github/workflows/valhalla-ea.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

name: Valhalla EA

on:
workflow_dispatch:
# push:
# pull_request:
schedule:
- cron: '39 1 * * 1,3,5'

jobs:
build:

runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
java_version: [valhalla]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: oracle-actions/setup-java@v1
with:
website: jdk.java.net
release: ${{ matrix.java_version }}
- name: Maven cache
uses: actions/cache@v4
env:
cache-name: maven-cache
with:
path:
~/.m2
key: build-${{ env.cache-name }}
- name: Maven version
run: mvn --version
- name: Prepare
run: ./jakarta-to-valhalla.sh
- name: Build with Maven
run: mvn package

1 change: 1 addition & 0 deletions .mvn/jvm.config.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--enable-preview
3 changes: 3 additions & 0 deletions inject-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<description>annotation processor generating source code for avaje-inject dependency injection</description>
<properties>
<avaje.prisms.version>1.31</avaje.prisms.version>
<!-- VALHALLA-START ___
<maven.compiler.enablePreview>false</maven.compiler.enablePreview>
____ VALHALLA-END -->
</properties>
<dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -24,6 +23,7 @@

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Disabled;

class InjectProcessorTest {

Expand All @@ -41,6 +41,7 @@ void deleteGeneratedFiles() {
}
}

@Disabled
SentryMan marked this conversation as resolved.
Show resolved Hide resolved
@Test
void testGeneration() throws Exception {
final String source =
Expand Down
1 change: 1 addition & 0 deletions inject/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<show>public</show>
<linksource>true</linksource>
<overview>src/main/javadoc/overview.html</overview>
<!-- Javadoc-No-Preview -->
</configuration>
<executions>
<execution>
Expand Down
2 changes: 1 addition & 1 deletion inject/src/main/java/io/avaje/inject/spi/ClosePair.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.avaje.inject.spi;

public final class ClosePair implements Comparable<ClosePair> {
public final /*value*/ class ClosePair implements Comparable<ClosePair> {

private final int priority;
private final AutoCloseable closeable;
Expand Down
2 changes: 1 addition & 1 deletion inject/src/main/java/io/avaje/inject/spi/DEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.avaje.inject.BeanEntry;

@NullMarked
final class DEntry implements BeanEntry {
final /*value*/ class DEntry implements BeanEntry {

private final String qualifierName;
private final int priority;
Expand Down
2 changes: 1 addition & 1 deletion inject/src/main/java/io/avaje/inject/spi/EnrichBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Holds Spy setup consumers for dependency injection using Mockito Spy.
*/
public final class EnrichBean<B> {
public final /*value*/ class EnrichBean<B> {

private final Type type;
private final String name;
Expand Down
3 changes: 1 addition & 2 deletions inject/src/main/java/io/avaje/inject/spi/KeyUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/**
* Build a "flat key" combining type and name.
*/
final class KeyUtil {

final /*value*/ class KeyUtil {

static String key(Type type, String name) {
return name == null ? type.getTypeName() : type.getTypeName() + "|" + name.toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion inject/src/main/java/io/avaje/inject/spi/RawType.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* Factory methods for types.
*/
final class RawType {
final /*value*/ class RawType {

private RawType() {
}
Expand Down
19 changes: 19 additions & 0 deletions jakarta-to-valhalla.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

## adjust code
find . -type f -name '*.java' -exec sed -i'' -e 's| /\*value\*/ class | value class |g' {} +

## required for the maven plugin to run (--enable-preview)
mv .mvn/jvm.config.disabled .mvn/jvm.config

## adjust poms
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|-Dnet.bytebuddy|--enable-preview -Dnet.bytebuddy|g' {} +
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- VALHALLA-START ___|<!-- VALHALLA-START -->|g' {} +
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|____ VALHALLA-END -->|<!-- VALHALLA-END -->|g' {} +
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- Javadoc-No-Preview -->|<additionalOptions>--enable-preview</additionalOptions> <!-- Valhalla -->|g' {} +



sed -i 's|//@Disabled|@Disabled|g' ./inject-generator/src/test/java/io/avaje/inject/generator/InjectProcessorTest.java


4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<nexus.staging.autoReleaseAfterClose>true</nexus.staging.autoReleaseAfterClose>
<surefire.useModulePath>false</surefire.useModulePath>
<argLine>-Dnet.bytebuddy.experimental=true</argLine>
<!-- VALHALLA-START ___
<maven.compiler.release>23</maven.compiler.release>
<maven.compiler.enablePreview>true</maven.compiler.enablePreview>
____ VALHALLA-END -->
</properties>

<modules>
Expand Down
14 changes: 14 additions & 0 deletions valhalla-to-jakarta.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

## adjust code
find . -type f -name '*.java' -exec sed -i'' -e 's| value class | /\*value\*/ class |g' {} +

## required for the maven plugin to run (--enable-preview)
mv .mvn/jvm.config .mvn/jvm.config.disabled

## adjust poms
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|--enable-preview -Dnet.bytebuddy|-Dnet.bytebuddy|g' {} +
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- VALHALLA-START -->|<!-- VALHALLA-START ___|g' {} +
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<!-- VALHALLA-END -->|____ VALHALLA-END -->|g' {} +
find . -type f -name 'pom.xml' -exec sed -i '' -e 's|<additionalOptions>--enable-preview</additionalOptions> <!-- Valhalla -->|<!-- Javadoc-No-Preview -->|g' {} +
sed -i 's|@Disabled|//@Disabled|g' ./inject-generator/src/test/java/io/avaje/inject/generator/InjectProcessorTest.java