-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from paketo-buildpacks/add-pkg
Add `libpak-tools package bundle` command which builds and packages a buildpack
- Loading branch information
Showing
12 changed files
with
765 additions
and
815 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ | |
- name: note:good-first-issue | ||
description: A good first issue to get started with | ||
color: 54f7a8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,5 @@ | |
|
||
bin/ | ||
binaries/ | ||
dist/ | ||
dist/ | ||
go.work* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright 2018-2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package commands | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/paketo-buildpacks/libpak-tools/packager" | ||
) | ||
|
||
func PackageBundleCommand() *cobra.Command { | ||
p := packager.NewBundleBuildpack() | ||
|
||
var packageBuildpackCmd = &cobra.Command{ | ||
Use: "bundle", | ||
Short: "Compile and package a single buildpack", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
if p.BuildpackID == "" && p.BuildpackPath == "" { | ||
log.Fatal("buildpack-id or buildpack-path must be set") | ||
} | ||
|
||
if p.BuildpackPath != "" && p.BuildpackID == "" { | ||
log.Fatal("buildpack-id and buildpack-path must both be set") | ||
} | ||
|
||
if p.BuildpackID != "" && p.BuildpackPath == "" { | ||
p.InferBuildpackPath() | ||
} | ||
|
||
if p.BuildpackVersion == "" { | ||
p.InferBuildpackVersion() | ||
} | ||
|
||
err := p.Execute() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
}, | ||
} | ||
|
||
packageBuildpackCmd.Flags().StringVar(&p.BuildpackID, "buildpack-id", "", "id of the buildpack to use") | ||
packageBuildpackCmd.Flags().StringVar(&p.BuildpackPath, "buildpack-path", "", "path to buildpack directory") | ||
packageBuildpackCmd.Flags().StringVar(&p.BuildpackVersion, "version", "", "version to substitute into buildpack.toml/extension.toml") | ||
packageBuildpackCmd.Flags().StringVar(&p.CacheLocation, "cache-location", "", "path to cache downloaded dependencies (default: $PWD/dependencies)") | ||
packageBuildpackCmd.Flags().BoolVar(&p.IncludeDependencies, "include-dependencies", false, "whether to include dependencies (default: false)") | ||
packageBuildpackCmd.Flags().StringArrayVar(&p.DependencyFilters, "dependency-filter", []string{}, "one or more filters that are applied to exclude dependencies") | ||
packageBuildpackCmd.Flags().BoolVar(&p.StrictDependencyFilters, "strict-filters", false, "require filter to match all data or just some data (default: false)") | ||
|
||
return packageBuildpackCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.