Skip to content

Commit

Permalink
global settings file for java provider
Browse files Browse the repository at this point in the history
Signed-off-by: Emily McMullan <[email protected]>
  • Loading branch information
eemcmullan committed Oct 29, 2024
1 parent efb7857 commit 81e490a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ const (

// provider specific config keys
const (
BUNDLES_INIT_OPTION = "bundles"
WORKSPACE_INIT_OPTION = "workspace"
MVN_SETTINGS_FILE_INIT_OPTION = "mavenSettingsFile"
JVM_MAX_MEM_INIT_OPTION = "jvmMaxMem"
BUNDLES_INIT_OPTION = "bundles"
WORKSPACE_INIT_OPTION = "workspace"
MVN_SETTINGS_FILE_INIT_OPTION = "mavenSettingsFile"
GLOBAL_SETTINGS_FILE_INIT_OPTION = "globalSettingsFile"
JVM_MAX_MEM_INIT_OPTION = "jvmMaxMem"
)

// Rule Location to location that the bundle understands
Expand Down Expand Up @@ -238,6 +239,11 @@ func (p *javaProvider) Init(ctx context.Context, log logr.Logger, config provide
mavenSettingsFile = ""
}

globalSettingsFile, ok := config.ProviderSpecificConfig[GLOBAL_SETTINGS_FILE_INIT_OPTION].(string)
if !ok {
globalSettingsFile = ""
}

lspServerPath, ok := config.ProviderSpecificConfig[provider.LspServerPathConfigKey].(string)
if !ok || lspServerPath == "" {
return nil, additionalBuiltinConfig, fmt.Errorf("invalid lspServerPath provided, unable to init java provider")
Expand Down Expand Up @@ -387,6 +393,7 @@ func (p *javaProvider) Init(ctx context.Context, log logr.Logger, config provide
depToLabels: map[string]*depLabelItem{},
isLocationBinary: isBinary,
mvnSettingsFile: mavenSettingsFile,
globalSettings: globalSettingsFile,
depsLocationCache: make(map[string]int),
includedPaths: provider.GetIncludedPathsFromConfig(config, false),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type javaServiceClient struct {
depToLabels map[string]*depLabelItem
isLocationBinary bool
mvnSettingsFile string
globalSettings string
depsMutex sync.RWMutex
depsCache map[uri.URI][]*provider.Dep
depsLocationCache map[string]int
Expand Down Expand Up @@ -241,7 +242,8 @@ func (p *javaServiceClient) initialization(ctx context.Context) {
"java": map[string]interface{}{
"configuration": map[string]interface{}{
"maven": map[string]interface{}{
"userSettings": p.mvnSettingsFile,
"userSettings": p.mvnSettingsFile,
"globalSettings": p.globalSettings,
},
},
"autobuild": map[string]interface{}{
Expand Down

0 comments on commit 81e490a

Please sign in to comment.