Skip to content

Commit b3d9c5a

Browse files
authored
Set copyright during build (#427)
* Set copyright during build * Spaces * Try different quotes * Remove reduntant quotes * Missed the symbol
1 parent 45d8edf commit b3d9c5a

File tree

7 files changed

+16
-4
lines changed

7 files changed

+16
-4
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016-2022 Chad Weimer
1+
Copyright (c) 2016-2024 Chad Weimer
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ ifdef BUILD_VERSION
77
ARCHIVE_SUFFIX:=-$(BUILD_VERSION)
88
endif
99

10+
COPYRIGHT := Copyright © 2016-$(shell date +%Y) Chad Weimer
11+
1012
BUILD_DIR=build
1113
BUILD_LIN_AMD64_DIR=$(BUILD_DIR)/linux/amd64
1214
BUILD_LIN_ARM_DIR=$(BUILD_DIR)/linux/arm/v7
@@ -26,7 +28,7 @@ GO_MODULE_NAME ?= github.com/$(REPO_NAME)
2628
GOOS := linux
2729
GOARCH := amd64
2830
GO_ENV=GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0
29-
GO_LD_FLAGS=-ldflags "-X '$(GO_MODULE_NAME)/metadata.BuildVersion=$(BUILD_VERSION)'"
31+
GO_LD_FLAGS=-ldflags '-X "$(GO_MODULE_NAME)/metadata.BuildVersion=$(BUILD_VERSION)" -X "$(GO_MODULE_NAME)/metadata.Copyright=$(COPYRIGHT)"'
3032

3133
CONTAINER_REGISTRY ?= ghcr.io
3234

api/app.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import (
99

1010
func (apiHandler) GetInfo(_ context.Context, _ GetInfoRequestObject) (GetInfoResponseObject, error) {
1111
return GetInfo200JSONResponse{
12-
Version: &metadata.BuildVersion,
12+
Copyright: &metadata.Copyright,
13+
Version: &metadata.BuildVersion,
1314
}, nil
1415
}
1516

metadata/copyright.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package metadata
2+
3+
// Copyright represents the application copyright information, if set during the build
4+
var Copyright string

models.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ components:
5959
appInfo:
6060
type: object
6161
required:
62+
- copyright
6263
- version
6364
properties:
65+
copyright:
66+
type: string
67+
readOnly: true
6468
version:
6569
type: string
6670
readOnly: true

static/src/components/app-root/app-root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class AppRoot {
9494
</ion-content>
9595

9696
<ion-footer color="medium" class="ion-text-center ion-padding">
97-
<div class="copyright">GOMP: Go Meal Plannner {appConfig.info.version}. Copyright © 2016-2022 Chad Weimer</div>
97+
<div class="copyright">GOMP: Go Meal Plannner {appConfig.info.version}. {appConfig.info.copyright}</div>
9898
</ion-footer>
9999
</ion-menu>
100100

static/src/stores/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ interface AppConfig {
88

99
const { state: appConfig } = createStore<AppConfig>({
1010
info: {
11+
copyright: 'Copyright © Chad Weimer',
1112
version: '<Unknown>'
1213
},
1314
config: {

0 commit comments

Comments
 (0)