github.com/SahandAslani/gomobile@v0.0.0-20210909130135-2cb2d44c09b2/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 ANDROID_HOME be set to the path of the Android SDK and the
    12  // current sdk platform installed that matches MinSDK.
    13  package main
    14  
    15  import (
    16  	"fmt"
    17  	"io/ioutil"
    18  	"log"
    19  	"strconv"
    20  
    21  	"github.com/SahandAslani/gomobile/internal/binres"
    22  )
    23  
    24  const tmpl = `// Copyright 2016 The Go Authors.  All rights reserved.
    25  // Use of this source code is governed by a BSD-style
    26  // license that can be found in the LICENSE file.
    27  
    28  // Code generated by genarsc.go. DO NOT EDIT.
    29  
    30  package binres
    31  
    32  var arsc = []byte(%s)`
    33  
    34  func main() {
    35  	arsc, err := binres.PackResources()
    36  	if err != nil {
    37  		log.Fatal(err)
    38  	}
    39  	if err := ioutil.WriteFile("arsc.go", []byte(fmt.Sprintf(tmpl, strconv.Quote(string(arsc)))), 0644); err != nil {
    40  		log.Fatal(err)
    41  	}
    42  }