[DO-169] Modify to add template with Avroid license
This commit is contained in:
21
main.go
21
main.go
@@ -1,19 +1,6 @@
|
|||||||
// Copyright 2018 Google LLC
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
// This program ensures source code files have copyright license headers.
|
// This program ensures source code files have copyright license headers.
|
||||||
// See usage with "addlicense -h".
|
// See usage with "addlicense -h".
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -54,9 +41,9 @@ var (
|
|||||||
ignorePatterns stringSlice
|
ignorePatterns stringSlice
|
||||||
spdx spdxFlag
|
spdx spdxFlag
|
||||||
|
|
||||||
holder = flag.String("c", "Google LLC", "copyright holder")
|
holder = flag.String("c", "Avroid, Ltd.", "copyright holder")
|
||||||
license = flag.String("l", "apache", "license type: apache, bsd, mit, mpl")
|
license = flag.String("l", "commercial", "license type: commercial, apache, bsd, mit, mpl")
|
||||||
licensef = flag.String("f", "", "license file")
|
licensef = flag.String("f", "", "license file path")
|
||||||
year = flag.String("y", fmt.Sprint(time.Now().Year()), "copyright year(s)")
|
year = flag.String("y", fmt.Sprint(time.Now().Year()), "copyright year(s)")
|
||||||
verbose = flag.Bool("v", false, "verbose mode: print the name of the files that are modified or were skipped")
|
verbose = flag.Bool("v", false, "verbose mode: print the name of the files that are modified or were skipped")
|
||||||
checkonly = flag.Bool("check", false, "check only mode: verify presence of license headers and exit with non-zero code if missing")
|
checkonly = flag.Bool("check", false, "check only mode: verify presence of license headers and exit with non-zero code if missing")
|
||||||
|
|||||||
30
tmpl.go
30
tmpl.go
@@ -1,17 +1,3 @@
|
|||||||
// Copyright 2018 Google LLC
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -25,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var licenseTemplate = map[string]string{
|
var licenseTemplate = map[string]string{
|
||||||
|
"Commercial": tmplCommercial,
|
||||||
"Apache-2.0": tmplApache,
|
"Apache-2.0": tmplApache,
|
||||||
"MIT": tmplMIT,
|
"MIT": tmplMIT,
|
||||||
"bsd": tmplBSD,
|
"bsd": tmplBSD,
|
||||||
@@ -34,9 +21,10 @@ var licenseTemplate = map[string]string{
|
|||||||
// maintain backwards compatibility by mapping legacy license types to their
|
// maintain backwards compatibility by mapping legacy license types to their
|
||||||
// SPDX equivalents.
|
// SPDX equivalents.
|
||||||
var legacyLicenseTypes = map[string]string{
|
var legacyLicenseTypes = map[string]string{
|
||||||
"apache": "Apache-2.0",
|
"commercial": "Commercial",
|
||||||
"mit": "MIT",
|
"apache": "Apache-2.0",
|
||||||
"mpl": "MPL-2.0",
|
"mit": "MIT",
|
||||||
|
"mpl": "MPL-2.0",
|
||||||
}
|
}
|
||||||
|
|
||||||
// licenseData specifies the data used to fill out a license template.
|
// licenseData specifies the data used to fill out a license template.
|
||||||
@@ -101,6 +89,14 @@ func executeTemplate(t *template.Template, d licenseData, top, mid, bot string)
|
|||||||
return out.Bytes(), nil
|
return out.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const tmplCommercial = `Copyright {{.Holder}} {{ if .Year }} 2023-{{.Year}}{{ end }}
|
||||||
|
|
||||||
|
You can not use the contents of the file in any way without
|
||||||
|
AVROID, Ltd. written permission.
|
||||||
|
|
||||||
|
To obtain such a permit, you should contact AVROID, Ltd.
|
||||||
|
at https://avroid.ru`
|
||||||
|
|
||||||
const tmplApache = `Copyright{{ if .Year }} {{.Year}}{{ end }} {{.Holder}}
|
const tmplApache = `Copyright{{ if .Year }} {{.Year}}{{ end }} {{.Holder}}
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|||||||
Reference in New Issue
Block a user