-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Propagate project directory to CodeGenContext #34489
base: main
Are you sure you want to change the base?
Conversation
@@ -49,6 +52,16 @@ public ApplicationModel applicationModel() { | |||
return model; | |||
} | |||
|
|||
/** | |||
* Current project directory. | |||
* The directory would typically be resolved as {@code <project.build.directory>}. |
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.
project.build.directory
is already there via workDir. What I am asking for is project.basedir
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.
Ah yes, sorry, I messed up the javadoc.
Consumer.class, ApplicationModel.class, Properties.class, String.class, | ||
boolean.class); | ||
initAndRun.invoke(null, deploymentClassLoader, sourceParents, | ||
initAndRun.invoke(null, deploymentClassLoader, baseDir().toPath(), sourceParents, |
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.
It looks like basedir is passed, so perhaps only the javadoc above needs to get fixed?
Thanks for the effort, @gsmet! |
@@ -47,11 +47,11 @@ public class CodeGenerator { | |||
"META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider"); | |||
|
|||
// used by Gradle and Maven | |||
public static void initAndRun(QuarkusClassLoader classLoader, | |||
public static void initAndRun(QuarkusClassLoader classLoader, Path projectDir, | |||
PathCollection sourceParentDirs, Path generatedSourcesDir, Path buildDir, | |||
Consumer<Path> sourceRegistrar, ApplicationModel appModel, Properties properties, | |||
String launchMode, boolean test) throws CodeGenException { |
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.
Just FYI, you have an ApplicationModel
here, you could do
var appModule = appModel.getApplicationModule();
Path projectDir = appModule == null ? Path.of("") : appModule.getModuleDir().toPath();
appModule
might not be available in case we are re-augmenting from a JAR w/o sources.
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.
@aloubyansky not sure this will help with my original issue quarkiverse/quarkus-cxf#907 where maven is run with -f my-module/pom.xml
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.
That will be the project dir as Quarkus sees it.
bb1d0c4
to
4e76edc
Compare
I was hacking around some codegen code again where the project dir would come in handy. Is there any chance to move this forward? |
Fixes #34422
Created as draft for now to get proper CI testing.