Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/clean-dependency-project/cdprun/internal/runtime"
intellijAdapter "github.com/clean-dependency-project/cdprun/internal/runtimes/intellij"
nodejsAdapter "github.com/clean-dependency-project/cdprun/internal/runtimes/nodejs"
pycharmAdapter "github.com/clean-dependency-project/cdprun/internal/runtimes/pycharm"
pythonAdapter "github.com/clean-dependency-project/cdprun/internal/runtimes/python"
temurinAdapter "github.com/clean-dependency-project/cdprun/internal/runtimes/temurin"
tomcatAdapter "github.com/clean-dependency-project/cdprun/internal/runtimes/tomcat"
Expand Down Expand Up @@ -95,7 +96,7 @@ func NewApp() *cli.App {
&cli.StringFlag{
Name: "runtime",
Aliases: []string{"r"},
Usage: "runtime name (nodejs, python, tomcat, yarn, temurin, vscode, intellij_idea_ultimate). If not specified, downloads all enabled runtimes from config",
Usage: "runtime name (nodejs, python, tomcat, yarn, temurin, vscode, intellij_idea_ultimate, pycharm_professional). If not specified, downloads all enabled runtimes from config",
},
&cli.StringFlag{
Name: "version",
Expand Down Expand Up @@ -643,6 +644,15 @@ func initializeManager(configPath string, db *storage.DB, stdout, stderr *slog.L
"runtime", runtimeName,
"endoflife_product", runtimeConfig.EndOfLifeProduct,
"policy_file", runtimeConfig.PolicyFile)
case "pycharm_professional":
adapter := pycharmAdapter.NewAdapterWithConfig(&runtimeConfig, &cfg.Config, stdout, stderr)
if err := registry.Register("pycharm_professional", adapter); err != nil {
return nil, nil, fmt.Errorf("failed to register pycharm adapter: %w", err)
}
stdout.Info("registered runtime adapter",
"runtime", runtimeName,
"endoflife_product", runtimeConfig.EndOfLifeProduct,
"policy_file", runtimeConfig.PolicyFile)
default:
stderr.Warn("unsupported runtime", "runtime", runtimeName)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func (c *Config) Validate() error {
// RuntimeSkipsPolicyFile reports runtimes that resolve versions from an upstream API and do not use policies/*.json.
func RuntimeSkipsPolicyFile(name string) bool {
switch strings.ToLower(strings.TrimSpace(name)) {
case "vscode", "intellij_idea_ultimate":
case "vscode", "intellij_idea_ultimate", "pycharm_professional":
return true
default:
return false
Expand All @@ -299,7 +299,7 @@ func RuntimeSkipsPolicyFile(name string) bool {
// RuntimeSkipsEndOfLifeProduct reports runtimes not indexed on endoflife.date; endoflife_product may be omitted.
func RuntimeSkipsEndOfLifeProduct(name string) bool {
switch strings.ToLower(strings.TrimSpace(name)) {
case "intellij_idea_ultimate":
case "intellij_idea_ultimate", "pycharm_professional":
return true
default:
return false
Expand Down
13 changes: 13 additions & 0 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,19 @@ func TestRuntime_Validate(t *testing.T) {
runtimeName: "intellij_idea_ultimate",
expectError: false,
},
{
name: "pycharm_professional skips endoflife.date and policy",
runtime: Runtime{
Enabled: true,
EndOfLifeProduct: "",
PolicyFile: "",
Verification: Verification{
Enabled: false,
},
},
runtimeName: "pycharm_professional",
expectError: false,
},
}

for _, tt := range tests {
Expand Down
Loading
Loading