Skip to content

Commit 78e259b

Browse files
author
Jason Yellick
committed
FAB-14491 Split out platforms packaging component
The platforms package currently does two things. 1) It provides dockerfile/image generation tools 2) It provides packaging tools Generally speaking, consumers need only one of the two, or often even a subset of one of the two. This is a first step to break out the docker logic to allow for other, non-docker builders. Change-Id: I462df12bf73b7dbf15a8717c41fd1b193f1e1fe9 Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
1 parent aefce2a commit 78e259b

File tree

16 files changed

+686
-367
lines changed

16 files changed

+686
-367
lines changed

core/chaincode/exectransaction_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import (
5656
"github.com/hyperledger/fabric/core/policy/mocks"
5757
"github.com/hyperledger/fabric/core/scc"
5858
"github.com/hyperledger/fabric/core/scc/lscc"
59+
"github.com/hyperledger/fabric/internal/peer/packaging"
5960
"github.com/hyperledger/fabric/msp"
6061
mspmgmt "github.com/hyperledger/fabric/msp/mgmt"
6162
msptesttools "github.com/hyperledger/fabric/msp/mgmt/testtools"
@@ -382,7 +383,7 @@ func endTxSimulation(peerInstance *peer.Peer, chainID string, ccid *pb.Chaincode
382383
// Build a chaincode.
383384
func getDeploymentSpec(spec *pb.ChaincodeSpec) (*pb.ChaincodeDeploymentSpec, error) {
384385
fmt.Printf("getting deployment spec for chaincode spec: %v\n", spec)
385-
codePackageBytes, err := platforms.NewRegistry(&golang.Platform{}).GetDeploymentPayload(spec.Type.String(), spec.ChaincodeId.Path)
386+
codePackageBytes, err := packaging.NewRegistry(&golang.Platform{}).GetDeploymentPayload(spec.Type.String(), spec.ChaincodeId.Path)
386387
if err != nil {
387388
return nil, err
388389
}

core/chaincode/platforms/mock/platform.go

Lines changed: 0 additions & 229 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/chaincode/platforms/platforms.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ var SupportedPlatforms = []Platform{
3636
// the given platform
3737
type Platform interface {
3838
Name() string
39-
ValidatePath(path string) error
40-
ValidateCodePackage(code []byte) error
41-
GetDeploymentPayload(path string) ([]byte, error)
4239
GenerateDockerfile() (string, error)
4340
DockerBuildOptions(path string) (util.DockerBuildOptions, error)
4441
GetMetadataAsTarEntries(code []byte) ([]byte, error)
@@ -75,28 +72,6 @@ func NewRegistry(platformTypes ...Platform) *Registry {
7572
}
7673
}
7774

78-
func (r *Registry) ValidateSpec(ccType, path string) error {
79-
platform, ok := r.Platforms[ccType]
80-
if !ok {
81-
return fmt.Errorf("Unknown chaincodeType: %s", ccType)
82-
}
83-
return platform.ValidatePath(path)
84-
}
85-
86-
func (r *Registry) ValidateDeploymentSpec(ccType string, codePackage []byte) error {
87-
platform, ok := r.Platforms[ccType]
88-
if !ok {
89-
return fmt.Errorf("Unknown chaincodeType: %s", ccType)
90-
}
91-
92-
// ignore empty packages
93-
if len(codePackage) == 0 {
94-
return nil
95-
}
96-
97-
return platform.ValidateCodePackage(codePackage)
98-
}
99-
10075
func (r *Registry) GetMetadataProvider(ccType string, codePackage []byte) ([]byte, error) {
10176
platform, ok := r.Platforms[ccType]
10277
if !ok {
@@ -105,15 +80,6 @@ func (r *Registry) GetMetadataProvider(ccType string, codePackage []byte) ([]byt
10580
return platform.GetMetadataAsTarEntries(codePackage)
10681
}
10782

108-
func (r *Registry) GetDeploymentPayload(ccType, path string) ([]byte, error) {
109-
platform, ok := r.Platforms[ccType]
110-
if !ok {
111-
return nil, fmt.Errorf("Unknown chaincodeType: %s", ccType)
112-
}
113-
114-
return platform.GetDeploymentPayload(path)
115-
}
116-
11783
func (r *Registry) GenerateDockerfile(ccType, name, version string) (string, error) {
11884
platform, ok := r.Platforms[ccType]
11985
if !ok {

0 commit comments

Comments
 (0)