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