Skip to content

Commit

Permalink
Merge branch 'chore/native-build-validations' into test/chore/native-…
Browse files Browse the repository at this point in the history
…build-validations
  • Loading branch information
mcollovati authored Nov 16, 2024
2 parents ef3669a + 90b2377 commit 1b8e08e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validation-native.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,5 @@ jobs:
- uses: actions/upload-artifact@v4
if: ${{ failure() || success() }}
with:
name: tests-output-it-native-${{ matrix.name }}
name: tests-output-it-native-${{ matrix.module.name }}
path: tests-report-*.tgz
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.vaadin.hilla.Endpoint;
import com.vaadin.hilla.EndpointExposed;
import com.vaadin.hilla.crud.filter.Filter;
import com.vaadin.hilla.endpointransfermapper.EndpointTransferMapper;
import com.vaadin.hilla.push.PushEndpoint;
import io.quarkus.arc.deployment.ExcludedTypeBuildItem;
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
Expand Down Expand Up @@ -224,15 +225,29 @@ void hillaNativeSupport(
.includePatterns("META-INF/microprofile-config\\.properties")
.build());

// explicitly register classes not present in the index
reflectiveClass.produce(ReflectiveClassBuildItem.builder(
com.github.mcollovati.quarkus.hilla.crud.panache.CrudRepositoryService.class,
com.github.mcollovati.quarkus.hilla.crud.panache.ListRepositoryService.class,
com.github.mcollovati.quarkus.hilla.crud.spring.CrudRepositoryService.class,
com.github.mcollovati.quarkus.hilla.crud.spring.ListRepositoryService.class)
.constructors()
.methods()
.build());

IndexView index = combinedIndex.getComputingIndex();
Set<ClassInfo> classes = new HashSet<>();
classes.addAll(index.getAllKnownImplementors(EndpointTransferMapper.Mapper.class));
classes.addAll(getAnnotatedClasses(index, DotName.createSimple(BrowserCallable.class)));
classes.addAll(getAnnotatedClasses(index, DotName.createSimple(Endpoint.class)));
classes.addAll(getAnnotatedClasses(index, DotName.createSimple(EndpointExposed.class)));
classes.add(index.getClassByName(PushEndpoint.class));
classes.add(index.getClassByName(Filter.class));
classes.add(index.getClassByName(Pageable.class));
classes.addAll(getJsonClasses(index));
classes.addAll(index.getAllKnownImplementors(EndpointTransferMapper.Mapper.class));
classes.addAll(index.getClassesInPackage("com.vaadin.hilla.mappedtypes"));
classes.addAll(index.getClassesInPackage("com.vaadin.hilla.runtime.transfertypes"));

if (capabilities.isPresent(QuarkusHillaExtensionProcessor.SPRING_DATA_SUPPORT)) {
classes.add(index.getClassByName("org.springframework.data.repository.Repository"));
Expand Down Expand Up @@ -312,9 +327,7 @@ void vaadinNativeSupport(
.map(classInfo -> classInfo.name().toString())
.toArray(String[]::new))
.constructors()
.queryConstructors()
.methods()
.queryMethods()
.fields()
.build());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import com.vaadin.hilla.signals.core.registry.SecureSignalsRegistry;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem;
import io.quarkus.gizmo.ClassTransformer;
import io.quarkus.gizmo.MethodDescriptor;
import org.springframework.data.domain.Sort;

import com.github.mcollovati.quarkus.hilla.SpringReplacements;

Expand Down Expand Up @@ -95,6 +98,14 @@ public static void addClassVisitors(BuildProducer<BytecodeTransformerBuildItem>
producer.produce(new BytecodeTransformerBuildItem(
ConfigList.Processor.class.getName(),
(s, classVisitor) -> new NonnullPluginConfigProcessorClassVisitor(classVisitor)));
// Remove sort method that references a type that is not in the shaded deps jar
producer.produce(new BytecodeTransformerBuildItem(Sort.class.getName(), (className, classVisitor) -> {
ClassTransformer transformer = new ClassTransformer(className);
MethodDescriptor sortMethod =
MethodDescriptor.ofMethod(className, "sort", className + "$TypedSort", "java.lang.Class");
transformer.removeMethod(sortMethod);
return transformer.applyTo(classVisitor);
}));
}

@SafeVarargs
Expand Down
1 change: 1 addition & 0 deletions commons/hilla-shaded-deps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<include>org/springframework/data/domain/AbstractPageRequest.class</include>
<include>org/springframework/data/domain/Chunk.class</include>
<include>org/springframework/data/domain/KeysetScrollPosition.class</include>
<include>org/springframework/data/domain/Limit**.class</include>
<include>org/springframework/data/domain/OffsetScrollPosition.class</include>
<include>org/springframework/data/domain/ScrollPosition.class</include>
<include>org/springframework/data/domain/ScrollPosition$Direction.class
Expand Down

0 comments on commit 1b8e08e

Please sign in to comment.