2
0
mirror of synced 2025-02-24 23:38:22 +00:00
Elias Naur f16143114e bind, cmd/gobind/test: remove GOOS build tags from test packages
The gobind command is about to get more powerful and able to generate
complete and standalone bindings. Platform specific build tags based
on GOOS or GOARCH are now meaningless to generate bindings from, so
remove them from the test packages.

The tags mattered to the reverse bound packages, since the go tool can't
build them without the Go wrappers for the imported Java packages.
Before this CL, the `android` tag was used to fool the go tool since
the host GOOS is unlikely to be android.

A fix is to check in the generated Go wrappers, but since the
packages are for testing we don't want that. Instead, move the test
packages to the testdata directory so the go tool ignores them.

Change-Id: I57178e930a400f690ebd7a65758bed894eeb10b0
Reviewed-on: https://go-review.googlesource.com/99315
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2018-03-14 22:25:02 +00:00

73 lines
1.4 KiB
Go

// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package objcpkg
import (
"ObjC/Foundation"
gopkg "ObjC/Objcpkg"
"ObjC/UIKit"
)
const (
DescriptionStr = "Descriptrion from Go"
Hash = 42
)
type GoNSDate struct {
Foundation.NSDate
}
func (d *GoNSDate) Hash(self gopkg.GoNSDate) int {
return Hash
}
func (d *GoNSDate) Description(self gopkg.GoNSDate) string {
// Test self call
if h := self.Hash(); h != Hash {
panic("hash mismatch")
}
return DescriptionStr
}
func (d *GoNSDate) GetSelf(self gopkg.GoNSDate) Foundation.NSDate {
return self
}
func NewGoNSDate() *GoNSDate {
return new(GoNSDate)
}
type GoNSObject struct {
C Foundation.NSObjectC // The class
P Foundation.NSObjectP // The protocol
UseSelf bool
}
func (o *GoNSObject) Description(self gopkg.GoNSObject) string {
if o.UseSelf {
return DescriptionStr
} else {
return self.Super().Description()
}
}
func DupNSDate(date Foundation.NSDate) Foundation.NSDate {
return date
}
type GoUIResponder struct {
UIKit.UIResponder
Called bool
}
func (r *GoUIResponder) PressesBegan(_ Foundation.NSSet, _ UIKit.UIPressesEvent) {
r.Called = true
}
// Check that implicitly referenced types are wrapped.
func implicitType(r UIKit.UIResponder) {
r.MotionBegan(0, nil)
}