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

Propagate project directory to CodeGenContext #34489

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gsmet
Copy link
Member

@gsmet gsmet commented Jul 3, 2023

Fixes #34422

Created as draft for now to get proper CI testing.

@quarkus-bot quarkus-bot bot added area/core area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle area/maven labels Jul 3, 2023
@@ -49,6 +52,16 @@ public ApplicationModel applicationModel() {
return model;
}

/**
* Current project directory.
* The directory would typically be resolved as {@code <project.build.directory>}.
Copy link
Contributor

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

Copy link
Member Author

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,
Copy link
Contributor

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?

@ppalaga
Copy link
Contributor

ppalaga commented Jul 3, 2023

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 {
Copy link
Member

@aloubyansky aloubyansky Jul 3, 2023

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.

Copy link
Contributor

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

Copy link
Member

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.

@gsmet gsmet force-pushed the codegencontext-projectdir branch from bb1d0c4 to 4e76edc Compare July 3, 2023 16:40
@ppalaga
Copy link
Contributor

ppalaga commented Nov 4, 2023

I was hacking around some codegen code again where the project dir would come in handy. Is there any chance to move this forward?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle area/maven
Projects
None yet
Development

Successfully merging this pull request may close these issues.

io.quarkus.deployment.CodeGenContext should provide projectDirectory
3 participants