Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/cmd/gobind: Allow custom java package prefix #9660

Closed
sridharv opened this issue Jan 22, 2015 · 6 comments
Closed

x/mobile/cmd/gobind: Allow custom java package prefix #9660

sridharv opened this issue Jan 22, 2015 · 6 comments

Comments

@sridharv
Copy link

Currently the gobind command defaults to putting all generated java code into the go top level package. If the tool allowed for a custom package prefix this would provide for cleaner namespacing. I have code for this that I'd be happy to contribute via Gerrit if this of interest.

Go version and architecture:

go version go1.4 / darwin/amd64

What I did:

Run

gobind -lang=java github.com/surullabs/mypackage

The generated file uses the following package:

package go.mypackage;

I would like to use

package com.surul.mypackage;

@crawshaw
Copy link
Member

/cc @hyangah

@hyangah
Copy link
Contributor

hyangah commented Jan 27, 2015

I don't have any objection. Is this what you want?
gobind -lang=java -pkg=com.surul.mypackage github.com/surullabs/mypackage

@sridharv
Copy link
Author

Yes. That is it exactly. I'll send you a gerrit code review request with the changes I have once I add a test. However, if you'd prefer to write this yourself please let me know.

Thanks again for taking the time to look at this!
Sridhar

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gobind: Allow custom java package prefix x/mobile/cmd/gobind: Allow custom java package prefix Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-mobile label Apr 14, 2015
@gopherbot
Copy link

CL https://golang.org/cl/13969 mentions this issue.

hyangah added a commit to golang/mobile that referenced this issue Aug 28, 2015
Introduce options -javapkg and -prefix for gobind command.

The following generates java class Testpkg with package name com.example.

gobind -lang=java -javapkg=com.example testpkg

The following generates objective-c files where function and type names
are prefixed with ExampleTestpkg.

gobind -lang=objc -prefix=Example testpkg

As discussed in golang/go#9660 and golang/go#12245.

Gomobile support is not yet implemented.

Change-Id: Ib9e39997ce915580a5a2e25643c0c28373f27ee1
Reviewed-on: https://go-review.googlesource.com/13969
Reviewed-by: David Crawshaw <crawshaw@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/14023 mentions this issue.

@sridharv
Copy link
Author

Thanks for the fix!

@golang golang locked and limited conversation to collaborators Sep 22, 2016
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
New option -javapkg for -target=android, and -prefix for -target=ios.
Fixes golang/go#9660.

Change-Id: I9143f30672672527876524b38f450629452a3161
Reviewed-on: https://go-review.googlesource.com/14023
Reviewed-by: David Crawshaw <crawshaw@golang.org>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
New option -javapkg for -target=android, and -prefix for -target=ios.
Fixes golang/go#9660.

Change-Id: I9143f30672672527876524b38f450629452a3161
Reviewed-on: https://go-review.googlesource.com/14023
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants