Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
dbb010b
support JAVA_HOME environment variable
adnbrownie Jan 6, 2023
b430560
Merge branch 'master' into patch-2
mok-liee Feb 28, 2024
ac4a81c
test(generator-cmd): add consideration of the JAVA_HOME variable
mok-liee Feb 28, 2024
f96430c
docs: add instructions for the use of JAVA_HOME
mok-liee Feb 28, 2024
ce2ac4c
fix: add quotes to accept spaces in the JAVA_HOME path
mok-liee Feb 28, 2024
a5724ae
fix: add quotation marks only for windows paths
mok-liee Feb 29, 2024
00fda13
ci: add windows-latest to build workflow
mok-liee Mar 1, 2024
25fb817
ci: add windows condition to test script
mok-liee Mar 1, 2024
2371c0a
fix: use path.join for generating java bin path
mok-liee Mar 5, 2024
a708d4b
Merge branch 'master' into patch-2
mok-liee Mar 5, 2024
5f0dbf8
fix: add surrounding quotation marks for the whole concurrently command
mok-liee Mar 5, 2024
8c3eb47
fix: remove quotation marks for non-windows systems
mok-liee Mar 5, 2024
7538ffa
Merge branch 'patch-2' into feature/add-windows-to-build
mok-liee Mar 5, 2024
15956c1
chore(windows-build): try powershell commands
mok-liee Mar 5, 2024
9a23c8a
chore(windows-build): try powershell commands
mok-liee Mar 5, 2024
c39ef8a
chore(windows-build): switch to Java 17 on windows build
mok-liee Mar 5, 2024
960b21e
chore(windows-build): add test case without JAVA_HOME
mok-liee Mar 5, 2024
15ac43e
chore(config.service): use process-cwd() for windows
mok-liee Mar 6, 2024
2a9aef9
Revert "support JAVA_HOME environment variable (#756)" (#761)
wing328 Mar 6, 2024
7e43a4e
feat(release): trigger a release
wing328 Mar 6, 2024
805bb0b
Merge pull request #2 from mok-liee/feature/add-windows-to-build
mok-liee Mar 6, 2024
04007fd
chore(windows-build): remove JAVA_HOME env var correctly
mok-liee Mar 6, 2024
34dd0de
chore(deps): update dependency prettier to v3 (#749)
renovate[bot] Mar 12, 2024
4042a6e
chore(deps): update dependency @types/jest to v29.5.12 (#755)
renovate[bot] Mar 12, 2024
2092e90
chore(deps): update dependency jest-environment-jsdom to v29 (#748)
renovate[bot] Mar 12, 2024
b115451
chore(deps): update dependency ts-jest to v29.1.2 (#764)
renovate[bot] Mar 12, 2024
fcb2f83
chore(deps): update commitlint monorepo to v19 (#744)
renovate[bot] Mar 12, 2024
ad97182
feat(release): trigger a release
wing328 Mar 12, 2024
f980618
chore(deps): update dependency dotenv to v16.4.5 (#767)
renovate[bot] Mar 12, 2024
bcd1ff6
chore(deps): update dependency eslint to ~8.57.0 (#768)
renovate[bot] Mar 12, 2024
2178d3c
support JAVA_HOME environment variable (#756)
mok-liee Mar 3, 2024
583bde9
chore(deps): update dependency @types/lodash to v4.17.0 (#769)
renovate[bot] Mar 13, 2024
bc85db4
chore(deps): update nrwl monorepo to v17.3.2 (#771)
renovate[bot] Mar 17, 2024
4b058b6
chore(deps): update dependency @commitlint/cli to v19.2.0 (#772)
renovate[bot] Mar 18, 2024
f6dcb95
fix(deps): update dependency reflect-metadata to v0.2.1 (#773)
renovate[bot] Mar 19, 2024
7f41abc
chore(deps): update dependency husky to v9 (#774)
renovate[bot] Mar 19, 2024
c042887
chore(deps): update dependency type-fest to v4 (#775)
renovate[bot] Mar 19, 2024
1d2a1a2
feat(#644): add cli option for openapitools.json (#754)
nicholasphair Mar 19, 2024
fb01b0b
Revert "fix(deps): update dependency reflect-metadata to v0.2.1 (#773…
wing328 Mar 19, 2024
7787f07
fix(app): configure http with proxy url if present in environment (#762)
jontze Apr 16, 2024
5dff424
fix(deps): update dependency axios to v1.6.8 (#766)
renovate[bot] Apr 21, 2024
5f00242
chore(deps): update commitlint monorepo to v19.2.2 (#778)
renovate[bot] Apr 21, 2024
37597a2
fix(deps): update dependency @nestjs/axios to v3.0.2 (#765)
renovate[bot] Apr 22, 2024
76dfb19
Update README.md with JDK version required
wing328 Jun 28, 2024
6b76bbb
Update README.md with openjdk
wing328 Jun 28, 2024
18abce4
fix(deps): update dependency axios to v1.7.4 [security] (#789)
renovate[bot] Aug 20, 2024
67f6457
update versions mentioned in Readme (#795)
wing328 Sep 4, 2024
45e1633
docs: how to use local JARs and `SNAPSHOT`builds. (#794)
joscha Sep 4, 2024
41585e7
support JAVA_HOME environment variable
adnbrownie Sep 5, 2024
bc9352d
test(generator-cmd): add consideration of the JAVA_HOME variable
mok-liee Sep 5, 2024
1a94743
docs: add instructions for the use of JAVA_HOME
mok-liee Sep 5, 2024
26cde5d
fix: add quotes to accept spaces in the JAVA_HOME path
mok-liee Sep 5, 2024
47b0abb
fix: add quotation marks only for windows paths
mok-liee Sep 5, 2024
55ad5be
ci: add windows-latest to build workflow
mok-liee Sep 5, 2024
aadd8ed
ci: add windows condition to test script
mok-liee Sep 5, 2024
2dc0c8e
fix: use path.join for generating java bin path
mok-liee Sep 5, 2024
5eb3b82
fix: add surrounding quotation marks for the whole concurrently command
mok-liee Sep 5, 2024
9d8c2f6
fix: remove quotation marks for non-windows systems
mok-liee Sep 5, 2024
4c35653
chore(windows-build): try powershell commands
mok-liee Sep 5, 2024
29f99a6
chore(windows-build): try powershell commands
mok-liee Sep 5, 2024
adc00ea
chore(windows-build): switch to Java 17 on windows build
mok-liee Sep 5, 2024
f08c18f
chore(windows-build): add test case without JAVA_HOME
mok-liee Sep 5, 2024
f17d771
chore(config.service): use process-cwd() for windows
mok-liee Sep 5, 2024
78e6f06
chore(windows-build): remove JAVA_HOME env var correctly
mok-liee Sep 5, 2024
55be5d0
support JAVA_HOME environment variable (#756)
mok-liee Sep 5, 2024
4aba432
Merge branch 'patch-2' of https://github.com/mok-liee/openapi-generat…
mok-liee Sep 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/generator-cli/src/app/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import path from 'path';

const isWin = () => process.platform === 'win32';

/**
Expand All @@ -6,6 +8,6 @@ const isWin = () => process.platform === 'win32';
*/
export const javaCmd: string = process.env['JAVA_HOME']
? isWin()
? `"${process.env['JAVA_HOME']}/bin/java"`
: `${process.env['JAVA_HOME']}/bin/java`
? `"${path.join(process.env['JAVA_HOME'], 'bin', 'java')}"`
: `${path.join(process.env['JAVA_HOME'], 'bin', 'java')}`
: 'java';
10 changes: 9 additions & 1 deletion apps/generator-cli/src/app/services/generator.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,17 @@ export class GeneratorService {
)}" org.openapitools.codegen.OpenAPIGenerator`
: `-jar "${cliPath}"`;

return [javaCmd, process.env['JAVA_OPTS'], subCmd, 'generate', appendix]
const command = [
javaCmd,
process.env['JAVA_OPTS'],
subCmd,
'generate',
appendix,
]
.filter(isString)
.join(' ');

return this.isWin() ? `"${command}"` : command;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if command contains " ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the generated commands already have " inside and only run successfully with these quotes in the windows build and without it will not.

concurrently expects it in this case if there are spaces in the paths, which is very common in windows. therefore i would generalize this.

i was also been able to reproduce the behavior with concurrently alone.

i can send later some examples.

the most important part of the windows build plan already looks promising. there is only one error in the last step that i can't get locally.

Error: spawn ENAMETOOLONG

sounds really special to me. i think the command is too long. i try to figure out why this is. i mean foo is not longer then bar 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i got it. i removed the JAVA_HOME env wrong. for now all tests are passed.

can you tell me how i can resolve the conflicts? why does this not behave like the first PR, where i was able to resolve the conflicts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will need to cherry-pick 3e949d8, which was reverted by me last week.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the generated commands already have " inside and only run successfully with these quotes in the windows build and without it will not.

did you test with something like --additional-properties option="test-double-quote" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tried to cherry-pick but after resolving the conflicts there was nothing to commit. i commited with git commit --allow-empty but it will not resolve the conflicts.

did you test with something like --additional-properties option="test-double-quote" ?

i try to implement something like this to the test.

on my local env (windows - git bash) the following succeeded:

$ npm run oa generate -- -g ruby -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o ./out/ruby --additional-properties option="test-double-quote"

> [email protected] oa
> openapi-generator-cli generate -g ruby -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o ./out/ruby --additional-properties option=test-double-quote

[main] INFO  o.o.codegen.DefaultGenerator - Generating with dryRun=false
[main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: ruby (client)
[main] INFO  o.o.codegen.DefaultGenerator - Generator 'ruby' is considered stable.
...

$ echo $?
0

};

private isWin = () => process.platform === 'win32';
Expand Down