-
Notifications
You must be signed in to change notification settings - Fork 32
perf(export): ignore Java-only changes when deciding whether an export model is affected #1548
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
Closed
joaodinissf
wants to merge
1
commit into
dsldevkit:master
from
joaodinissf:perf/export-ignore-java-deltas
Closed
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
This file contains hidden or 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 hidden or 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
58 changes: 58 additions & 0 deletions
58
...port/src/com/avaloq/tools/ddk/xtext/export/resource/ExportResourceDescriptionManager.java
This file contains hidden or 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,58 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2026 Avaloq Group AG and others. | ||
| * All rights reserved. This program and the accompanying materials | ||
| * are made available under the terms of the Eclipse Public License v1.0 | ||
| * which accompanies this distribution, and is available at | ||
| * http://www.eclipse.org/legal/epl-v10.html | ||
| * | ||
| * Contributors: | ||
| * Avaloq Group AG - initial API and implementation | ||
| *******************************************************************************/ | ||
| package com.avaloq.tools.ddk.xtext.export.resource; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.List; | ||
|
|
||
| import org.eclipse.xtext.common.types.access.impl.URIHelperConstants; | ||
| import org.eclipse.xtext.resource.IResourceDescription; | ||
| import org.eclipse.xtext.resource.IResourceDescription.Delta; | ||
| import org.eclipse.xtext.resource.IResourceDescriptions; | ||
| import org.eclipse.xtext.xbase.resource.XbaseResourceDescriptionManager; | ||
|
|
||
| import com.google.inject.Singleton; | ||
|
|
||
|
|
||
| /** | ||
| * Resource description manager for export models which ignores deltas of Java types. | ||
| * <p> | ||
| * The inferred JVM model of an export model references the Java interfaces of the exported EClasses, so the Xbase | ||
| * description manager records them as imported names and outgoing references. The builder then re-processes every export | ||
| * model whenever JDT reports a structural change to one of those interfaces, although the generated code only depends | ||
| * on the EMF model (the ecore and genmodel), whose own changes still affect export models. | ||
| * </p> | ||
| */ | ||
| @Singleton | ||
| public class ExportResourceDescriptionManager extends XbaseResourceDescriptionManager { | ||
|
|
||
| @Override | ||
| public boolean isAffected(final Delta delta, final IResourceDescription candidate) { | ||
| return !isJavaTypeDelta(delta) && super.isAffected(delta, candidate); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isAffected(final Collection<Delta> deltas, final IResourceDescription candidate, final IResourceDescriptions context) { | ||
| final List<Delta> nonJavaDeltas = deltas.stream().filter(delta -> !isJavaTypeDelta(delta)).toList(); | ||
| return !nonJavaDeltas.isEmpty() && super.isAffected(nonJavaDeltas, candidate, context); | ||
| } | ||
|
|
||
| /** | ||
| * Returns whether the given delta describes a Java type, as reported by JDT through the {@code java:/} URI scheme. | ||
| * | ||
| * @param delta | ||
| * the delta, must not be {@code null} | ||
| * @return {@code true} if the delta is about a Java type | ||
| */ | ||
| private static boolean isJavaTypeDelta(final Delta delta) { | ||
| return URIHelperConstants.PROTOCOL.equals(delta.getUri().scheme()); | ||
| } | ||
| } | ||
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.
This is for sure not true, export language can use java classes at will from extensions. For example:
extension com::foo::^export::Bar
and the
export lookup x::TypeN as qualified name [isBlaBla(this.eContainer)]{
object-fingerprint;
}
where isBlaBla is defined in com.foo.exportBar