Skip to content

Commit

Permalink
chore: configure ldflags on gomobile bind to inject build context
Browse files Browse the repository at this point in the history
Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
  • Loading branch information
moul committed Jun 19, 2020
1 parent 1b58fa1 commit 6a1e733
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions js/packages/berty-i18n/dateFns.js
Expand Up @@ -76,3 +76,6 @@ export const fuzzy = (date) => {

export const startedAgo = (date) =>
i18n.t('time.started-ago', { date: distanceInWords(date, Date.now()) })

export const builtAgo = (date) =>
i18n.t('time.built-ago', { date: distanceInWords(date, Date.now()) })
3 changes: 2 additions & 1 deletion js/packages/berty-i18n/locale/en/messages.json
Expand Up @@ -4,7 +4,8 @@
"fuzzy-month-day": "dd/MM",
"fuzzy-year-month": "MM/YY",
"datetime": "MMM Do YYYY hh:mm",
"started-ago": "Started {{date}} ago"
"started-ago": "Started {{date}} ago",
"built-ago": "Built {{date}} ago"
},
"onboarding": {
"getstarted": "The secure peer-to-peer messaging app that works with or without internet access, cellular data or trust in the network",
Expand Down
8 changes: 7 additions & 1 deletion js/packages/components/settings/SystemInfo.tsx
Expand Up @@ -37,7 +37,13 @@ const SystemInfoList: React.FC<{}> = () => {
)
} else if (value[0] === 'buildTime') {
return (
<SystemInfoItem label='buildTime' value={moment.unix(value[1]).format('mm:ss')} />
<View>
<SystemInfoItem
label='buildTime'
value={moment.unix(value[1]).format('MMMM Do YYYY, h:mm:ss a')}
/>
<SystemInfoItem label='timeAgo' value={moment.unix(value[1]).from(moment())} />
</View>
)
}
return <SystemInfoItem label={value[0]} value={value[1]} key={key} />
Expand Down
9 changes: 7 additions & 2 deletions js/packages/go-bridge/Makefile
Expand Up @@ -19,6 +19,11 @@ GO_VENDOR := $(GOPATH)/src/berty.tech/berty/vendor
GOMOBILE := $(GOPATH)/bin/gomobile
GOBIND := $(GOPATH)/bin/gobind

VERSION ?= `git describe --tags --always`
VCS_REF ?= `git rev-parse --short HEAD`
BUILD_DATE ?= `date +%s`
EXT_LDFLAGS = -ldflags="-X berty.tech/berty/go/pkg/bertymessenger.VcsRef=$(VCS_REF) -X berty.tech/berty/go/pkg/bertymessenger.Version=$(VERSION) -X berty.tech/berty/go/pkg/bertymessenger.BuildTime=$(BUILD_DATE)"

deps.gobridge: $(GOMOBILE) $(GO_VENDOR)
cd $(PWD) && gomobile init

Expand All @@ -42,12 +47,12 @@ build.gobridge.android: $(AAR_TARGETS)

build.framework:
@mkdir -p "$(FRAMEWORK_DIR)"
GO111MODULE=off gomobile bind -o $(FRAMEWORK) -v -target ios berty.tech/berty/go/framework/bertybridge
GO111MODULE=off gomobile bind -o $(FRAMEWORK) -v $(EXT_LDFLAGS) -target ios berty.tech/berty/go/framework/bertybridge
touch "$(FRAMEWORK_DIR)"

build.aar:
@mkdir -p "$(AAR_DIR)"
GO111MODULE=off gomobile bind -o $(AAR) -v -target android berty.tech/berty/go/framework/bertybridge
GO111MODULE=off gomobile bind -o $(AAR) -v $(EXT_LDFLAGS) -target android berty.tech/berty/go/framework/bertybridge
touch "$(AAR_DIR)"


Expand Down

0 comments on commit 6a1e733

Please sign in to comment.