Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
wkornewald committed Oct 17, 2021
0 parents commit 32ce3ab
Show file tree
Hide file tree
Showing 17 changed files with 7,892 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM golang:1.17

ENV DEBIAN_FRONTEND=noninteractive

ENV PATH=$PATH:~/bin

COPY . /dockerbuild/app
RUN /dockerbuild/app/build-dev.sh
13 changes: 13 additions & 0 deletions .devcontainer/build-common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euxo pipefail

DIR="$(cd "$(dirname "$0")" && pwd)"

source "$DIR/utils.sh"

mkdir -p ~/bin

# Install goreleaser
download_tgz https://github.com/goreleaser/goreleaser/releases/download/v0.174.2/goreleaser_Linux_x86_64.tar.gz \
38155642fb10a75205f20e390474f3bad9fbf61f2614500b02b179d05907348e ~/bin \
goreleaser
43 changes: 43 additions & 0 deletions .devcontainer/build-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -euxo pipefail

DIR="$(cd "$(dirname "$0")" && pwd)"

"$DIR/build-common.sh"

source "$DIR/utils.sh"

cat >> ~/.bashrc <<EOF
if [ -z "\$BUILD_VERSION_CHECK_DONE" ] && ! diff -q "$DIR" ".devcontainer/" > /dev/null; then
echo -e "\e[1m\e[31mThis container is outdated. Please rebuild.\e[0m" > /dev/stderr
fi
export BUILD_VERSION_CHECK_DONE=true
EOF

# Make sure a few common tools are installed
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends curl gettext git gnupg less procps apt-utils locales bash-completion zip unzip

# Enable bash auto completion
cat >> ~/.bashrc <<EOF
source /etc/profile.d/bash_completion.sh
EOF

# This fixed the locale and is required for diff-so-fancy
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen en_US.UTF-8

# Install diff-so-fancy
DIFF_SO_FANCY_VERSION="1.2.6"
download https://raw.githubusercontent.com/so-fancy/diff-so-fancy/v${DIFF_SO_FANCY_VERSION}/third_party/build_fatpack/diff-so-fancy \
ed9de2669c789d1aba8456d0a7cf95adb326e220c99af4336405f21add8f0852 /usr/bin/diff-so-fancy
chmod a+x /usr/bin/diff-so-fancy

# Install protoc
PROTOC_VERSION="3.18.1"
download_zip https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \
220bd1704c73dbf4d0a91399a2ecf9d19938b5cd80c8a38839a023d8b87bb772 /usr/bin/ bin/protoc
chmod a+x /usr/bin/protoc

go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Dev",
"dockerFile": "Dockerfile",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined",
// Additionally we copy the .ssh folder into the container (see postCreateCommand below) to
// reuse the host's ssh config and known_hosts.
"-v", "${env:HOME}${env:USERPROFILE}/.ssh:/root/.ssh-localhost:ro",
],
"postCreateCommand": "mkdir -p ~/.ssh && cp -r ~/.ssh-localhost/* ~/.ssh && chmod 700 ~/.ssh && chmod 600 ~/.ssh/*",
"extensions": [
"golang.go",
],
}
34 changes: 34 additions & 0 deletions .devcontainer/utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euxo pipefail

download() {
local url="$1"
local checksum="$2"
local dst="$3"
curl -qsSL -o "$dst" "$url"
echo "$checksum $dst" > "$dst.sum"
sha256sum -c "$dst.sum"
rm -rf "$dst.sum"
}

download_tgz() {
local url="$1"
local checksum="$2"
local dst="$3"
local tmp="$(mktemp)"
download "$url" "$checksum" "$tmp"
shift 3
tar -C "$dst" -xzf "$tmp" "$@"
rm -rf "$tmp"
}

download_zip() {
local url="$1"
local checksum="$2"
local dst="$3"
local tmp="$(mktemp)"
download "$url" "$checksum" "$tmp"
shift 3
unzip -j "$tmp" "$@" -d "$dst"
rm -rf "$tmp"
}
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.DS_Store
._*
.Spotlight-V100
.Trashes
desktop.ini
ehthumbs.db
Thumbs.db
AlbumArt*

.idea/*
!/.idea/codeStyleSettings.xml
!/.idea/inspectionProfiles
!/.idea/runConfigurations
.idea_*
.vscode
.sublime-*
.settings
atlassian-ide-plugin.xml

~*
*~
*.bak
*.orig
*.swp
*.tmp
*.exe

build/
dist/

/.tmp
54 changes: 54 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
project_name: androidmanifest-changer
before:
hooks:
- go mod download
- go generate ./...
env:
- CGO_ENABLED=0
builds:
- id: windows
goos:
- windows
goarch:
- amd64
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
- id: unix
goos:
- linux
- darwin
goarch:
- amd64
- arm
- arm64
goarm:
- 7
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
archives:
- id: windows
builds:
- windows
format: zip
replacements:
windows: Windows
amd64: x86_64
- id: unix
builds:
- unix
replacements:
darwin: macOS
linux: Linux
amd64: x86_64
snapshot:
name_template: "{{ .Tag }}-next"
release:
draft: true
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- Merge pull request
- Merge branch
Loading

0 comments on commit 32ce3ab

Please sign in to comment.