Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
d124deeb
Commit
d124deeb
authored
Mar 22, 2016
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #23272 from wojtek-t/conversion_generator_with_framework
Auto commit by PR queue bot
parents
e2f4141b
f1248b9c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
7 deletions
+49
-7
conversion.go
cmd/libs/go2idl/conversion-gen/generators/conversion.go
+0
-0
main.go
cmd/libs/go2idl/conversion-gen/main.go
+47
-0
deepcopy.go
cmd/libs/go2idl/deepcopy-gen/generators/deepcopy.go
+2
-7
No files found.
cmd/libs/go2idl/conversion-gen/generators/conversion.go
0 → 100644
View file @
d124deeb
This diff is collapsed.
Click to expand it.
cmd/libs/go2idl/conversion-gen/main.go
0 → 100644
View file @
d124deeb
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
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
http://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.
*/
// conversion-gen is a tool for auto-generating Conversion functions.
//
// Structs in the input directories with the below line in their comments
// will be ignored during generation.
// // +genconversion=false
package
main
import
(
"k8s.io/kubernetes/cmd/libs/go2idl/args"
"k8s.io/kubernetes/cmd/libs/go2idl/conversion-gen/generators"
"github.com/golang/glog"
)
func
main
()
{
arguments
:=
args
.
Default
()
// Override defaults. These are Kubernetes specific input locations.
arguments
.
InputDirs
=
[]
string
{
"k8s.io/kubernetes/pkg/api/v1"
,
}
if
err
:=
arguments
.
Execute
(
generators
.
NameSystems
(),
generators
.
DefaultNameSystem
(),
generators
.
Packages
,
);
err
!=
nil
{
glog
.
Fatalf
(
"Error: %v"
,
err
)
}
glog
.
Info
(
"Completed successfully."
)
}
cmd/libs/go2idl/deepcopy-gen/generators/deepcopy.go
View file @
d124deeb
...
@@ -95,10 +95,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
...
@@ -95,10 +95,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
return
generators
return
generators
},
},
FilterFunc
:
func
(
c
*
generator
.
Context
,
t
*
types
.
Type
)
bool
{
FilterFunc
:
func
(
c
*
generator
.
Context
,
t
*
types
.
Type
)
bool
{
if
t
.
Name
.
Package
!=
path
{
return
t
.
Name
.
Package
==
path
return
false
}
return
copyableWithinPackage
(
t
)
},
},
})
})
}
}
...
@@ -111,7 +108,7 @@ const (
...
@@ -111,7 +108,7 @@ const (
conversionPackagePath
=
"k8s.io/kubernetes/pkg/conversion"
conversionPackagePath
=
"k8s.io/kubernetes/pkg/conversion"
)
)
// genDeepCopy produces a file with a
set for a single type
.
// genDeepCopy produces a file with a
utogenerated deep-copy functions
.
type
genDeepCopy
struct
{
type
genDeepCopy
struct
{
generator
.
DefaultGen
generator
.
DefaultGen
targetPackage
string
targetPackage
string
...
@@ -137,7 +134,6 @@ func (g *genDeepCopy) Namers(c *generator.Context) namer.NameSystems {
...
@@ -137,7 +134,6 @@ func (g *genDeepCopy) Namers(c *generator.Context) namer.NameSystems {
return
namer
.
NameSystems
{
"raw"
:
namer
.
NewRawNamer
(
g
.
targetPackage
,
g
.
imports
)}
return
namer
.
NameSystems
{
"raw"
:
namer
.
NewRawNamer
(
g
.
targetPackage
,
g
.
imports
)}
}
}
// Filter ignores all but one type because we're making a single file per type.
func
(
g
*
genDeepCopy
)
Filter
(
c
*
generator
.
Context
,
t
*
types
.
Type
)
bool
{
func
(
g
*
genDeepCopy
)
Filter
(
c
*
generator
.
Context
,
t
*
types
.
Type
)
bool
{
// Filter out all types not copyable within the package.
// Filter out all types not copyable within the package.
copyable
:=
copyableWithinPackage
(
t
)
copyable
:=
copyableWithinPackage
(
t
)
...
@@ -231,7 +227,6 @@ func (g *genDeepCopy) Init(c *generator.Context, w io.Writer) error {
...
@@ -231,7 +227,6 @@ func (g *genDeepCopy) Init(c *generator.Context, w io.Writer) error {
return
sw
.
Error
()
return
sw
.
Error
()
}
}
// GenerateType makes the body of a file implementing a set for type t.
func
(
g
*
genDeepCopy
)
GenerateType
(
c
*
generator
.
Context
,
t
*
types
.
Type
,
w
io
.
Writer
)
error
{
func
(
g
*
genDeepCopy
)
GenerateType
(
c
*
generator
.
Context
,
t
*
types
.
Type
,
w
io
.
Writer
)
error
{
sw
:=
generator
.
NewSnippetWriter
(
w
,
c
,
"$"
,
"$"
)
sw
:=
generator
.
NewSnippetWriter
(
w
,
c
,
"$"
,
"$"
)
funcName
:=
g
.
funcNameTmpl
(
t
)
funcName
:=
g
.
funcNameTmpl
(
t
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment