github.com/coming-chat/gomobile@v0.0.0-20220601074111-56995f7d7aba/internal/binres/genarsc.go (about)

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