Skip to content

Commit

Permalink
Merge pull request #188 from fyne-io/merge/develop
Browse files Browse the repository at this point in the history
Merge/develop
  • Loading branch information
Bluebugs committed Apr 26, 2023
2 parents 57f1874 + 7070259 commit cd55fb1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Changelog - Fyne.io fyne-cross

## Unreleased
## 1.4.0 - 13 Mar 2023

### Added

- Add support for Kubernetes
- Add ability to specify a different registry
- Support for fyne metadata

### Changed

- Pull image from fyne-cross-image repository
- Simplify `fyne-cross darwin-sdk-extract` by getting the needed files from the Apple SDK and then mounting them in the container image for each build
- Provide a darwin image and mount the SDK from the host
- Use `fyne build` for all targets

## 1.3.0 - 16 Jul 2022

Expand Down
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Supported targets are:
> - starting from v1.1.0:
> - cross-compile from NOT `darwin` (i.e. linux) to `darwin`: requires a copy of the macOS SDK on the host. The fyne-cross `darwin-sdk-extractor` command can be used to extract the SDK from the XCode CLI Tool file, see the [Extract the macOS SDK](#extract_macos_sdk) section below.
> - cross-compile from `darwin` to `darwin` by default will use under the hood the fyne CLI tool and requires Go and the macOS SDK installed on the host.
> - starting from v1.4.0, Arm64 hosts are supported for all platforms except Android.
## Requirements

Expand All @@ -45,7 +46,7 @@ For go >= 1.16:
go install github.com/fyne-io/fyne-cross@latest
```

To install a fyne-cross with kubernetes engine:
To install a fyne-cross with kubernetes engine support:
```
go install -tags k8s github.com/fyne-io/fyne-cross@latest
```
Expand Down Expand Up @@ -88,18 +89,6 @@ The commands are:
Use "fyne-cross <command> -help" for more information about a command.
```

### Apple Arm Silicon special

On Apple Arm64 architecture, the container have to run in a vm. This vm put some constraint on getting fyne-cross to work in that setup.

## podman on Mac Mini M1

You need to create a `podman machine` that has a short name as the access path on Mac can not be over 104 and that limit can be reached quickly when the machine name is to long. Additionally you need to specify in the machine the path that you might need during your build. An example of possible machine to use:

```
podman machine init --now machine --cpus=8 --memory=6096 -v /tmp:/tmp -v ${HOME}:${HOME}
```

### Wildcards

The `arch` flag support wildcards in case want to compile against all supported GOARCH for a specified GOOS
Expand Down
2 changes: 2 additions & 0 deletions internal/command/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type Context struct {
Pull bool // Pull if true attempts to pull a newer version of the docker image
NoProjectUpload bool // NoProjectUpload if true, the build will be done with the artifact already stored on S3
NoResultDownload bool // NoResultDownload if true, the result of the build will be left on S3 and not downloaded locally
NoNetwork bool // NoNetwork if true, the build will be done without network access

//Build context
BuildMode string // The -buildmode argument to pass to go build
Expand Down Expand Up @@ -142,6 +143,7 @@ func makeDefaultContext(flags *CommonFlags, args []string) (Context, error) {
Name: flags.Name,
StripDebug: !flags.NoStripDebug,
Debug: flags.Debug,
NoNetwork: flags.NoNetwork,
Volume: vol,
Pull: flags.Pull,
Release: flags.Release,
Expand Down
6 changes: 6 additions & 0 deletions internal/command/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type localContainerEngine struct {

pull bool
cacheEnabled bool
noNetwork bool
}

func newLocalContainerEngine(context Context) (containerEngine, error) {
Expand All @@ -39,6 +40,7 @@ func newLocalContainerEngine(context Context) (containerEngine, error) {
engine: &context.Engine,
pull: context.Pull,
cacheEnabled: context.CacheEnabled,
noNetwork: context.NoNetwork,
}, nil
}

Expand Down Expand Up @@ -151,6 +153,10 @@ func (i *localContainerImage) cmd(vol volume.Volume, opts options, cmdArgs []str
"-e", fmt.Sprintf("GOCACHE=%s", vol.GoCacheDirContainer()), // mount GOCACHE to reuse cache between builds
)

if i.runner.noNetwork {
args = append(args, "--network=none")
}

// add custom env variables
args = AppendEnv(args, i.runner.env, i.env["GOOS"] != freebsdOS)
args = AppendEnv(args, i.env, i.env["GOOS"] != freebsdOS)
Expand Down
3 changes: 3 additions & 0 deletions internal/command/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ type CommonFlags struct {
NoResultDownload bool
// NoStripDebug if true will not strip debug information from binaries
NoStripDebug bool
// NoNetwork if true will not setup network inside the container
NoNetwork bool
// Name represents the application name
Name string
// Release represents if the package should be prepared for release (disable debug etc)
Expand Down Expand Up @@ -133,6 +135,7 @@ func newCommonFlags() (*CommonFlags, error) {
flagSet.BoolVar(&flags.Debug, "debug", false, "Debug mode")
flagSet.BoolVar(&flags.Pull, "pull", false, "Attempt to pull a newer version of the docker image")
flagSet.StringVar(&flags.DockerRegistry, "docker-registry", "docker.io", "The docker registry to be used instead of dockerhub (only used with defualt docker images)")
flagSet.BoolVar(&flags.NoNetwork, "no-network", false, "If set, the build will be done without network access")
return flags, nil
}

Expand Down

0 comments on commit cd55fb1

Please sign in to comment.