laher / goxc

a build tool for Go, with a focus on cross-compiling, packaging and deployment
1.68k stars 79 forks source link

Bug: difference between zip contents, when the "ResourcesInclude" config setting has a path that is above the main path your building from, and its a windows build. #98

Closed joeblew99 closed 8 years ago

joeblew99 commented 8 years ago

I am doing a Windows and a Darwin build and getting slightly different folder structure inside the final zip file. The files are all there correctly, its just that with windows build it adds an extra "Parent" folder.

Screenshots to highlight difference (see the Red circle !!!!) For the Darwin build it works fine. See Screen shot. For the Windows build, it adds a "Parent", with its sub folder called "toolbin" See Screen shot.

Windows Build:

windows

Darwin Build:

darwin

Steps to Reproduce: The bug is caused when, in the build config, the "ResourcesInclude" has a path that is above the main path your building from, and its a windows build. I my case its the "./../toolbin/*" path that i am referencing in my config.

On your side side, to reproduce the bug, all you need to do is copy my config(s) and bash script(1), and just reference a folder in the "ResourcesInclude" that is above your main terminal path. I have included all config and scripts below.

My go env:

x-MacBook-Pro:backend apple$ go env
GOARCH="amd64"
GOBIN="/Users/apple/workspace/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/apple/workspace/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT=""
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
x-MacBook-Pro:backend apple$ 

My bash script that kicks each off (tool-dist.sh):

#!/bin/bash

# Globals
BUILD_DIR=$PWD"/_build/snapshot"
TOOLBIN_DIR=$PWD"/_build/toolbin"

## delete leftover build artifacts
rm -rf $BUILD_DIR
rm -rf $TOOLBIN_DIR

# Toggle which one you want to build.
#goxc -c=tool-dist-windows

goxc -c=tool-dist-darwin

my Windows conf (tool-dist-windows.goxc.json):

{
    "ConfigVersion": "0.9",
    "TasksExclude": [
        "go-test",
        "go-vet"
    ],
    "ArtifactsDest": "_build",
    "AppName": "backend",
    "Arch": "amd64",
    "Os": "windows",
    "ResourcesInclude": "VERSIONDATE,VERSIONHASH,config*.*,_data/etlserver/*,run*.bat,./../toolbin/rethinkdb/windows_amd64/*,./../toolbin/caddy/windows_amd64/*,./../toolbin/chromium-portable/windows_amd64/*",
    "ResourcesExclude": "*.gitkeep,*.gitignore,*.go,*.vagrant",
    "MainDirsExclude": "Godeps,amzs3,./_infra/dev/rethinkdb-vm/.clear"
}

my Darwin conf (tool-dist-darwin.goxc.json):

{
    "ConfigVersion": "0.9",
    "TasksExclude": [
        "go-test",
        "go-vet"
    ],
    "ArtifactsDest": "_build",
    "AppName": "backend",
    "Arch": "amd64",
    "Os": "darwin",
    "ResourcesInclude": "VERSIONDATE,VERSIONHASH,config*.*,_data/etlserver/*,run*.sh,./../toolbin/rethinkdb/darwin_amd64/*,./../toolbin/caddy/darwin_amd64/*,./../toolbin/chromium-portable/darwin_amd64/*",
    "ResourcesExclude": "*.gitkeep,*.gitignore,*.go,*.vagrant",
    "MainDirsExclude": "Godeps,amzs3,./_infra/dev/rethinkdb-vm/.clear"
}
joeblew99 commented 8 years ago

I tried building to Linux and its fine. Its just the windows one with the bug.

screen shot 2016-03-07 at 19 34 15
joeblew99 commented 8 years ago

I have nailed it down further: On Windows, when i unzip the windows build zip file, the "Parent" folder does not exist in the output On OSX, when i unzip that same windows build zip on OSX, the "Parent" folder does exist in the output.