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

Add command line parser and entry points #1885

Merged
merged 2 commits into from
May 13, 2024
Merged

Conversation

ting-yuan
Copy link
Collaborator

So that it can be invoked like:

java -cp <KSP and Kotlin library classpath> \
      com.google.devtools.ksp.cmdline.KSPJvmMain \
      -module-name=MyModule \
      -source-roots /path/to/source/roots \
      -kotlin-output-dir=/path/to/output/Kotlin \
      -java-output-dir /path/to/output/Kotlin \
      ...
      /path/to/processor.jar

Help message can be printed with -h or --help:

Available options:

*   -module-name=String
*   -source-roots=List<File>
    -common-source-roots=List<File>
    -libraries=List<File>
    -processor-options=Map<String, String>
...
where:
 * is required
 List is colon separated. E.g., arg1:arg2:arg3
 Map is in the form key1=value1:key2=value2

@ting-yuan ting-yuan requested a review from neetopia May 11, 2024 00:30
@@ -20,7 +20,7 @@ repositories {
}

plugins {
kotlin("jvm") version "1.9.0"
kotlin("jvm") version "1.9.23"
Copy link
Collaborator

Choose a reason for hiding this comment

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

any context on the compiler version update?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Bumped to be used with the latest KSP.

)
os.appendLine(
" arg.startsWith(\"$optionName=\") -> " +
"$propName = parse$typeName(arg.substring(${optionNameLen + 1}))"
Copy link
Collaborator

Choose a reason for hiding this comment

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

substringAfter?

@ting-yuan ting-yuan merged commit 9418d44 into google:main May 13, 2024
3 checks passed
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.

None yet

2 participants