123456789101112131415161718192021222324252627282930 |
- package aapt
- import (
- "path/filepath"
- "notabug.org/Umnik/GoAndroidSDK/v2/components/misc"
- "notabug.org/Umnik/GoAndroidSDK/v2/components/sdk"
- )
- func aaptFromPath(dirPath string, err error) (*Aapt, error) {
- if err != nil {
- return nil, err
- }
- binPath := filepath.Join(dirPath, "aapt")
- if err = misc.TestFile(binPath); err != nil {
- return nil, err
- }
- return &Aapt{binPath: binPath}, nil
- }
- // NewAaptLastVersion creates Aapt from last available version of sdk.SDK "build-tools" dir
- func NewAaptLastVersion(sdk sdk.SDK) (*Aapt, error) {
- return aaptFromPath(sdk.LastBuildToolsVersion())
- }
- // NewAaptSpecificVersion creates Aapt from specified version of sdk.SDK "build-tools" dir
- func NewAaptSpecificVersion(sdk sdk.SDK, version string) (*Aapt, error) {
- return aaptFromPath(sdk.SpecificBuildToolsVersion(version))
- }
|