Skip to content

Commit

Permalink
Do not require libs on CI/CD (when providing Java only)
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian-panek-vmltech committed Dec 3, 2024
1 parent e64e89d commit 2d47b81
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/aem/vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *CLI) vendorPrepareCmd() *cobra.Command {
Short: "Prepare vendor tools",
Aliases: []string{"prep", "download", "dw"},
Run: func(cmd *cobra.Command, args []string) {
changed, err := c.aem.VendorManager().PrepareWithChanged()
changed, err := c.aem.VendorManager().PrepareWithChanged(false)
if err != nil {
c.Error(err)
return
Expand Down
4 changes: 4 additions & 0 deletions pkg/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ func (o *BaseOpts) PrepareWithChanged() (bool, error) {
}
return changed, nil
}

func (o *BaseOpts) HasLibs() bool {
return pathx.Exists(o.LibDir)
}
2 changes: 1 addition & 1 deletion pkg/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (p Project) InitWithChanged() (bool, error) {
return changed, err
}

vendorPrepared, err := p.aem.VendorManager().PrepareWithChanged()
vendorPrepared, err := p.aem.VendorManager().PrepareWithChanged(true)
changed = changed || vendorPrepared
if err != nil {
return changed, err
Expand Down
20 changes: 11 additions & 9 deletions pkg/vendor_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (vm *VendorManager) InstanceJar() (string, error) {
return vm.quickstart.FindDistFile()
}

func (vm *VendorManager) PrepareWithChanged() (bool, error) {
func (vm *VendorManager) PrepareWithChanged(requireLibs bool) (bool, error) {
changed := false

javaChanged, err := vm.javaManager.PrepareWithChanged()
Expand All @@ -39,15 +39,17 @@ func (vm *VendorManager) PrepareWithChanged() (bool, error) {
return changed, err
}

sdk, err := vm.quickstart.IsDistSDK()
if err != nil {
return false, err
}
if sdk {
sdkChanged, err := vm.sdk.PrepareWithChanged()
changed = changed || sdkChanged
if requireLibs || vm.aem.baseOpts.HasLibs() {
sdk, err := vm.quickstart.IsDistSDK()
if err != nil {
return changed, err
return false, err
}
if sdk {
sdkChanged, err := vm.sdk.PrepareWithChanged()
changed = changed || sdkChanged
if err != nil {
return changed, err
}
}
}

Expand Down

0 comments on commit 2d47b81

Please sign in to comment.