Skip to content

Option to run Smithy CLI without isolated classpath? #27

@jeskew

Description

@jeskew

Thanks for this plugin! I've been using it without issue on OS X and Linux environments, but a colleague on Windows is getting classpath errors from the smithyBuildJar task. A typical error looks like this:

> Task :model:smithyBuildJar FAILED
Running smithy build
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\C
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-openapi\1.0.8\cbebc91325ac824ccc71a0738aeeab6a3b828b12\smithy-openapi-1.0.8.jar;C
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-build\1.0.8\1943056b6e6d61e51b16396d4343b9d6fcf3c9a5\smithy-build-1.0.8.jar;C
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-jsonschema\1.0.8\969868b1cc2c693001f33093f46d07df597ed362\smithy-jsonschema-1.0.8
.jar;C
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-aws-traits\1.0.8\4c75784ac723e64b88f7f8ce39b9633582a48444\smithy-aws-traits-1.0.8
.jar;C
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-model\1.0.8\97ec736517441a7ea61e505b6fea5c555e3c4685\smithy-model-1.0.8.jar;C
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-utils\1.0.8\27d4c21862631385c91749c228cff090e8bafffd\smithy-utils-1.0.8.jar
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-gradle-plugin\0.5.1\4ed8279d17a81f9f9fbbc30789d8dd23ea85694c\smithy-gradle-plugin
-0.5.1.jar;C
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-cli\1.0.8\de64615e551d89ce77649d37d2d72cbc73a5791c\smithy-cli-1.0.8.jar;C
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-linters\1.0.8\57410fcb69eeb9e9fdae26dbf5219262d0bdde1\smithy-linters-1.0.8.jar;C
CLI classpath JAR does not exist: C:\Users\tooth\Workspaces\psf-api\model\Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-diff\1.0.8\5fc218b017f3737695d4ac724f61257afe02e414\smithy-diff-1.0.8.jar;C
software.amazon.smithy.cli.Cli

FAILURE: Build failed with an exception.

Gradle seems to be prepending the module root (C:\Users\tooth\Workspaces\psf-api\model) to the enumerated classpath when those entries start with a backslash. I ran the plugin in a debugger and saw that the fileset stored by the collection passed to executeCliThread is correct (e.g., the entries look like \Users\tooth\.gradle\caches\modules-2\files-2.1\software.amazon.smithy\smithy-aws-traits\1.0.8\4c75784ac723e64b88f7f8ce39b9633582a48444\smithy-aws-traits-1.0.8 .jar;C), but when getFiles is called, the classpath entries get the unwanted prefix of the module root path, and when the CLI is invoked with that classpath, it of course can't find any files. I don't think this is due to anything in the plugin itself (at least not as far as I could tell) but may be a more general bug in how classpath entries get translated into a FileCollection in Gradle's plugin support classes.

My ask here is, could you add a configuration flag to the plugin to not run the Smithy CLI in an isolated manner? I see I can choose between a forked process or a Java thread, but both of those options use an incorrect classpath on Windows.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions