genarsc.go 950 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2016 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. //go:build ignore
  5. // Genarsc generates stripped down version of android.jar resources used
  6. // for validation of manifest entries.
  7. //
  8. // Requires the selected Android SDK to support the MinSDK platform version.
  9. package main
  10. import (
  11. "fmt"
  12. "log"
  13. "os"
  14. "strconv"
  15. "golang.org/x/mobile/internal/binres"
  16. )
  17. const tmpl = `// Copyright 2016 The Go Authors. All rights reserved.
  18. // Use of this source code is governed by a BSD-style
  19. // license that can be found in the LICENSE file.
  20. // Code generated by genarsc.go. DO NOT EDIT.
  21. package binres
  22. var arsc = []byte(%s)`
  23. func main() {
  24. arsc, err := binres.PackResources()
  25. if err != nil {
  26. log.Fatal(err)
  27. }
  28. if err := os.WriteFile("arsc.go", []byte(fmt.Sprintf(tmpl, strconv.Quote(string(arsc)))), 0644); err != nil {
  29. log.Fatal(err)
  30. }
  31. }