Skip to content

feat(generator): make TOS_CLI_GEN generate jobs headlessly#7

Open
stbischof wants to merge 7 commits into
Talaxie:feat/cli_generatorfrom
stbischof:feat/cli_generator-headless
Open

feat(generator): make TOS_CLI_GEN generate jobs headlessly#7
stbischof wants to merge 7 commits into
Talaxie:feat/cli_generatorfrom
stbischof:feat/cli_generator-headless

Conversation

@stbischof

Copy link
Copy Markdown
Collaborator

CodeGeneratorApplication launched but produced no code on a fresh, non-GUI workspace: it never ran the project-open lifecycle the Studio does on login, and a few services assumed a Workbench / imported workspace / component server.

It now runs that lifecycle headlessly so a plain
TOS_CLI_GEN -data <workspace> <PROJECT>/process/<job>.properties emits the full Maven project (code.Master + routines + job .java) for a normal Maven reactor to build — no GUI, no Talend CommandLine server.

  • CodeGeneratorApplication: set headless + ci.mode; import workspace projects; init the RepositoryContext.fields map; init JET templates; sync routines/beans; write the poms without forking Maven; then generate.
  • AggregatorPomsHelper: add syncAllPomsNoBuild() — write poms without the internal forked mvn install (the downstream reactor compiles).
  • CodeGenerator: generate source only (GENERATE_WITHOUT_COMPILING).
  • Lookups / TCKUIService / ComponentsFactory: tolerate a missing TaCoKit cache instead of NPE in headless mode.
  • org.talend.designer.core.generator MANIFEST: require org.talend.designer.maven.

What is the current behavior? (You can also link to an open issue here)
cant use current draft in a cli/maven build

What is the new behavior?
works on my mashine

Please check if the PR fulfills these requirements

  • [] The commit message follows Talaxie standard
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features) ?
  • The code coverage on new code >75%
  • The new code does not introduce new technical issues (sonar / eslint)

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build / CI related changes
  • Other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

Other information:

vhemery and others added 7 commits May 13, 2026 15:18
Isolate the code generator from the designer plugin to its own plugin
and feature.
Isolate the code generator from the designer plugin to its own plugin
and feature.
Isolate the code generator from the designer plugin to its own plugin
and feature.

FIXME: dependency loop on Process implementation
Create the generator application and product.
Fixing project initialization and application dependencies
Fixing project initialization and application dependencies
CodeGeneratorApplication launched but produced no code on a fresh, non-GUI
workspace: it never ran the project-open lifecycle the Studio does on login,
and a few services assumed a Workbench / imported workspace / component server.

It now runs that lifecycle headlessly so a plain
`TOS_CLI_GEN -data <workspace> <PROJECT>/process/<job>.properties` emits the
full Maven project (code.Master + routines + job .java) for a normal Maven
reactor to build — no GUI, no Talend CommandLine server.

- CodeGeneratorApplication: set headless + ci.mode; import workspace projects;
  init the RepositoryContext.fields map; init JET templates; sync routines/beans;
  write the poms without forking Maven; then generate.
- AggregatorPomsHelper: add syncAllPomsNoBuild() — write poms without the internal
  forked `mvn install` (the downstream reactor compiles).
- CodeGenerator: generate source only (GENERATE_WITHOUT_COMPILING).
- Lookups / TCKUIService / ComponentsFactory: tolerate a missing TaCoKit cache
  instead of NPE in headless mode.
- org.talend.designer.core.generator MANIFEST: require org.talend.designer.maven.
@stbischof

Copy link
Copy Markdown
Collaborator Author

@vhemery could you please have a look. or just take this as ideas for your branch work

@vhemery

vhemery commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Thank you for your suggestions.

Quick feedback:

My feat/cli_generator branch is still work in progress, for which I will rework the history. So this does not make much sense merging this PR.

About the TacoKit cache and service-related aspects, I prefer staying closer to the original generation. So I'd rather (and have already locally) use the initialization performed by login. For some code, such as
if (repoCtx.getFields() == null) { repoCtx.setFields(new HashMap<String, String>()); }
I however reach the same conclusion as you.

For the System properties, I think it's enough if the CI set it itself and we keep the generation the same as the UI product one.

The most interesting part here IMHO is the workspace initialization, which was not at all in my scope. I'd rather import the holding project in the workspace, in case we have an external URI not in the workspace, because we may checkout projects out of the workspace location (this achieves the same goal).
I'll first focus on mu initial scope. But this is definitely a use case I will discuss with my stakeholder.

I'm keeping this opened for the moment to peek the parts I need.

@stbischof

Copy link
Copy Markdown
Collaborator Author

I am happy to see any progess on your headles source generator. and will test you work.

@vhemery vhemery force-pushed the feat/cli_generator branch from b5dd9bb to b210975 Compare June 24, 2026 15:23
@stbischof

stbischof commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator Author

@vhemery

i tries to build:


Wrong module path in tdi-studio-se/pom.xml

[ERROR] Child subproject main/plugins/org.talaxie.cli.branding.generator.feature
        of .../tdi-studio-se does not exist

tdi-studio-se/pom.xml listed the feature module under main/plugins/, but the
feature actually lives under main/features/:

- <module>main/plugins/org.talaxie.cli.branding.generator.feature</module>
+ <module>main/features/org.talaxie.cli.branding.generator.feature</module>

(The plugin org.talaxie.cli.branding.generator is correctly under
main/plugins/; only its feature sibling was pointed at the wrong directory —
a copy/paste slip.) This one-line fix is required for the build to start and
should be committed to the branch.

@vhemery vhemery force-pushed the feat/cli_generator branch from b210975 to 4ebc550 Compare July 1, 2026 06:53
@vhemery

vhemery commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

[ERROR] Child subproject main/plugins/org.talaxie.cli.branding.generator.feature
of .../tdi-studio-se does not exist

I did fix it last week. But didn't see the push failed...
My bad. 🤕

@stbischof

Copy link
Copy Markdown
Collaborator Author

i am sure you did!

@vhemery vhemery force-pushed the feat/cli_generator branch from 4ebc550 to 4d27b2e Compare July 8, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants