multiple: remove appengine specific build constraints and code (#4685)
This commit is contained in:

committed by
GitHub

parent
bfd964bba6
commit
46ab723bb2
2
Makefile
2
Makefile
@ -41,8 +41,6 @@ vetdeps:
|
|||||||
clean \
|
clean \
|
||||||
proto \
|
proto \
|
||||||
test \
|
test \
|
||||||
testappengine \
|
|
||||||
testappenginedeps \
|
|
||||||
testrace \
|
testrace \
|
||||||
vet \
|
vet \
|
||||||
vetdeps
|
vetdeps
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// +build !linux appengine
|
// +build !linux
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
TMP=$(mktemp -d /tmp/sdk.XXX) \
|
|
||||||
&& curl -o $TMP.zip "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.68.zip" \
|
|
||||||
&& unzip -q $TMP.zip -d $TMP \
|
|
||||||
&& export PATH="$PATH:$TMP/go_appengine"
|
|
@ -1,5 +1,3 @@
|
|||||||
// +build !appengine
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2018 gRPC authors.
|
* Copyright 2018 gRPC authors.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// +build !linux appengine
|
// +build !linux
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
@ -37,6 +37,6 @@ type SocketOptionData struct {
|
|||||||
// Windows OS doesn't support Socket Option
|
// Windows OS doesn't support Socket Option
|
||||||
func (s *SocketOptionData) Getsockopt(fd uintptr) {
|
func (s *SocketOptionData) Getsockopt(fd uintptr) {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
logger.Warning("Channelz: socket options are not supported on non-linux os and appengine.")
|
logger.Warning("Channelz: socket options are not supported on non-linux environments")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build linux,!appengine
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2018 gRPC authors.
|
* Copyright 2018 gRPC authors.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// +build !linux appengine
|
// +build !linux
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// +build linux,!appengine
|
// +build linux
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build !appengine
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2020 gRPC authors.
|
* Copyright 2020 gRPC authors.
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
// +build appengine
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2020 gRPC 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
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package credentials
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/tls"
|
|
||||||
"net/url"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SPIFFEIDFromState is a no-op for appengine builds.
|
|
||||||
func SPIFFEIDFromState(state tls.ConnectionState) *url.URL {
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,5 +1,3 @@
|
|||||||
// +build !appengine
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2018 gRPC authors.
|
* Copyright 2018 gRPC authors.
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
// +build appengine
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2018 gRPC 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
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package credentials
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net"
|
|
||||||
)
|
|
||||||
|
|
||||||
// WrapSyscallConn returns newConn on appengine.
|
|
||||||
func WrapSyscallConn(rawConn, newConn net.Conn) net.Conn {
|
|
||||||
return newConn
|
|
||||||
}
|
|
@ -1,5 +1,3 @@
|
|||||||
// +build !appengine
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2018 gRPC authors.
|
* Copyright 2018 gRPC authors.
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build !appengine
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2019 gRPC authors.
|
* Copyright 2019 gRPC authors.
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
// +build appengine
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2019 gRPC 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
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package buffer
|
|
||||||
|
|
||||||
// CircularBuffer is a no-op implementation for appengine builds.
|
|
||||||
//
|
|
||||||
// Appengine does not support stats because of lack of the support for unsafe
|
|
||||||
// pointers, which are necessary to efficiently store and retrieve things into
|
|
||||||
// and from a circular buffer. As a result, Push does not do anything and Drain
|
|
||||||
// returns an empty slice.
|
|
||||||
type CircularBuffer struct{}
|
|
||||||
|
|
||||||
// NewCircularBuffer returns a no-op for appengine builds.
|
|
||||||
func NewCircularBuffer(size uint32) (*CircularBuffer, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Push returns a no-op for appengine builds.
|
|
||||||
func (cb *CircularBuffer) Push(x interface{}) {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drain returns a no-op for appengine builds.
|
|
||||||
func (cb *CircularBuffer) Drain() []interface{} {
|
|
||||||
return nil
|
|
||||||
}
|
|
@ -1,5 +1,3 @@
|
|||||||
// +build !appengine
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2019 gRPC authors.
|
* Copyright 2019 gRPC authors.
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build !appengine
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2018 gRPC authors.
|
* Copyright 2018 gRPC authors.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// +build !linux appengine
|
// +build !linux
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
@ -35,41 +35,41 @@ var logger = grpclog.Component("core")
|
|||||||
|
|
||||||
func log() {
|
func log() {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
logger.Info("CPU time info is unavailable on non-linux or appengine environment.")
|
logger.Info("CPU time info is unavailable on non-linux environments.")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCPUTime returns the how much CPU time has passed since the start of this process.
|
// GetCPUTime returns the how much CPU time has passed since the start of this
|
||||||
// It always returns 0 under non-linux or appengine environment.
|
// process. It always returns 0 under non-linux environments.
|
||||||
func GetCPUTime() int64 {
|
func GetCPUTime() int64 {
|
||||||
log()
|
log()
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rusage is an empty struct under non-linux or appengine environment.
|
// Rusage is an empty struct under non-linux environments.
|
||||||
type Rusage struct{}
|
type Rusage struct{}
|
||||||
|
|
||||||
// GetRusage is a no-op function under non-linux or appengine environment.
|
// GetRusage is a no-op function under non-linux environments.
|
||||||
func GetRusage() *Rusage {
|
func GetRusage() *Rusage {
|
||||||
log()
|
log()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CPUTimeDiff returns the differences of user CPU time and system CPU time used
|
// CPUTimeDiff returns the differences of user CPU time and system CPU time used
|
||||||
// between two Rusage structs. It a no-op function for non-linux or appengine environment.
|
// between two Rusage structs. It a no-op function for non-linux environments.
|
||||||
func CPUTimeDiff(first *Rusage, latest *Rusage) (float64, float64) {
|
func CPUTimeDiff(first *Rusage, latest *Rusage) (float64, float64) {
|
||||||
log()
|
log()
|
||||||
return 0, 0
|
return 0, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTCPUserTimeout is a no-op function under non-linux or appengine environments
|
// SetTCPUserTimeout is a no-op function under non-linux environments.
|
||||||
func SetTCPUserTimeout(conn net.Conn, timeout time.Duration) error {
|
func SetTCPUserTimeout(conn net.Conn, timeout time.Duration) error {
|
||||||
log()
|
log()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTCPUserTimeout is a no-op function under non-linux or appengine environments
|
// GetTCPUserTimeout is a no-op function under non-linux environments.
|
||||||
// a negative return value indicates the operation is not supported
|
// A negative return value indicates the operation is not supported
|
||||||
func GetTCPUserTimeout(conn net.Conn) (int, error) {
|
func GetTCPUserTimeout(conn net.Conn) (int, error) {
|
||||||
log()
|
log()
|
||||||
return -1, nil
|
return -1, nil
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
// +build linux,!appengine
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2019 gRPC authors.
|
* Copyright 2019 gRPC authors.
|
@ -1,4 +1,4 @@
|
|||||||
// +build !appengine,go1.14
|
// +build go1.14
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
// +build appengine
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2020 gRPC 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
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package advancedtls
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/tls"
|
|
||||||
)
|
|
||||||
|
|
||||||
// buildGetCertificates is a no-op for appengine builds.
|
|
||||||
func buildGetCertificates(clientHello *tls.ClientHelloInfo, o *ServerOptions) (*tls.Certificate, error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
// +build !appengine,!go1.14
|
// +build !go1.14
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
@ -26,7 +26,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// buildGetCertificates returns the first cert contained in ServerOptions for
|
// buildGetCertificates returns the first cert contained in ServerOptions for
|
||||||
// non-appengine builds before version 1.4.
|
// builds before version 1.14.
|
||||||
func buildGetCertificates(clientHello *tls.ClientHelloInfo, o *ServerOptions) (*tls.Certificate, error) {
|
func buildGetCertificates(clientHello *tls.ClientHelloInfo, o *ServerOptions) (*tls.Certificate, error) {
|
||||||
if o.IdentityOptions.GetIdentityCertificatesForServer == nil {
|
if o.IdentityOptions.GetIdentityCertificatesForServer == nil {
|
||||||
return nil, fmt.Errorf("function GetCertificates must be specified")
|
return nil, fmt.Errorf("function GetCertificates must be specified")
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Copyright 2018 gRPC 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
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// vet checks whether files that are supposed to be built on appengine running
|
|
||||||
// Go 1.10 or earlier import an unsupported package (e.g. "unsafe", "syscall").
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"go/build"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fail := false
|
|
||||||
b := build.Default
|
|
||||||
b.BuildTags = []string{"appengine", "appenginevm"}
|
|
||||||
argsWithoutProg := os.Args[1:]
|
|
||||||
for _, dir := range argsWithoutProg {
|
|
||||||
p, err := b.Import(".", dir, 0)
|
|
||||||
if _, ok := err.(*build.NoGoError); ok {
|
|
||||||
continue
|
|
||||||
} else if err != nil {
|
|
||||||
fmt.Printf("build.Import failed due to %v\n", err)
|
|
||||||
fail = true
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for _, pkg := range p.Imports {
|
|
||||||
if pkg == "syscall" || pkg == "unsafe" {
|
|
||||||
fmt.Printf("Package %s/%s importing %s package without appengine build tag is NOT ALLOWED!\n", p.Dir, p.Name, pkg)
|
|
||||||
fail = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if fail {
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
4
vet.sh
4
vet.sh
@ -89,10 +89,6 @@ not git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go"
|
|||||||
# - Ensure all xds proto imports are renamed to *pb or *grpc.
|
# - Ensure all xds proto imports are renamed to *pb or *grpc.
|
||||||
git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' ':(exclude)*.pb.go' | not grep -v 'pb "\|grpc "'
|
git grep '"github.com/envoyproxy/go-control-plane/envoy' -- '*.go' ':(exclude)*.pb.go' | not grep -v 'pb "\|grpc "'
|
||||||
|
|
||||||
# - Check imports that are illegal in appengine (until Go 1.11).
|
|
||||||
# TODO: Remove when we drop Go 1.10 support
|
|
||||||
go list -f {{.Dir}} ./... | xargs go run test/go_vet/vet.go
|
|
||||||
|
|
||||||
misspell -error .
|
misspell -error .
|
||||||
|
|
||||||
# - Check that generated proto files are up to date.
|
# - Check that generated proto files are up to date.
|
||||||
|
Reference in New Issue
Block a user