mirror of https://github.com/perkeep/perkeep.git
clients/android: remove last camli remnants
Signed-off-by: Sebastien Binet <binet@cern.ch>
This commit is contained in:
parent
60bd47b272
commit
b88e15c92b
|
@ -41,10 +41,8 @@ var flagRelease = flag.Bool("release", false, "Whether to assemble the release b
|
||||||
const appVersion = "0.7"
|
const appVersion = "0.7"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
camliDir = filepath.Join(os.Getenv("GOPATH"), "src/perkeep.org")
|
pkDir = filepath.Join(os.Getenv("GOPATH"), "src/perkeep.org")
|
||||||
projectDir = filepath.Join(os.Getenv("GOPATH"), "src/perkeep.org/clients/android")
|
projectDir = filepath.Join(os.Getenv("GOPATH"), "src/perkeep.org/clients/android")
|
||||||
pkputBin = filepath.Join(projectDir, "app/build/generated/assets/pk-put.arm")
|
|
||||||
assetsDir = filepath.Join(projectDir, "app/src/main/assets")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -53,8 +51,7 @@ func main() {
|
||||||
fmt.Fprintf(os.Stderr, "Usage error: this program should be run within a docker container\n")
|
fmt.Fprintf(os.Stderr, "Usage error: this program should be run within a docker container\n")
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
buildCamput()
|
buildPkput()
|
||||||
writeVersion()
|
|
||||||
buildApp()
|
buildApp()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,26 +79,20 @@ keyPassword=gopher
|
||||||
}
|
}
|
||||||
defer os.Remove("./keystore.properties")
|
defer os.Remove("./keystore.properties")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func writeVersion() {
|
if err := cmd.Run(); err != nil {
|
||||||
if err := ioutil.WriteFile(filepath.Join(assetsDir, "pk-put-version.txt"), []byte(version()), 0600); err != nil {
|
log.Fatalf("Error building Android app: %v", err)
|
||||||
log.Fatalf("Error writing app version file: %v", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildCamput() {
|
func buildPkput() {
|
||||||
os.Setenv("GOARCH", "arm")
|
cmd := exec.Command("make")
|
||||||
os.Setenv("GOARM", "7")
|
cmd.Dir = "./app"
|
||||||
cmd := exec.Command("go", "build", "-o", pkputBin, "perkeep.org/cmd/pk-put")
|
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
if err := cmd.Run(); err != nil {
|
err := cmd.Run()
|
||||||
log.Fatalf("Error building pk-put for Android: %v", err)
|
if err != nil {
|
||||||
}
|
log.Fatalf("could not build pk-put for Android: %+v", err)
|
||||||
|
|
||||||
if err := os.Rename(pkputBin, filepath.Join(assetsDir, "pk-put.arm")); err != nil {
|
|
||||||
log.Fatalf("Error moving pk-put to assets dir: %v", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +111,7 @@ func goVersion() string {
|
||||||
// getVersion returns the version of Perkeep. Either from a VERSION file at the root,
|
// getVersion returns the version of Perkeep. Either from a VERSION file at the root,
|
||||||
// or from git.
|
// or from git.
|
||||||
func getVersion() string {
|
func getVersion() string {
|
||||||
slurp, err := ioutil.ReadFile(filepath.Join(camliDir, "VERSION"))
|
slurp, err := ioutil.ReadFile(filepath.Join(pkDir, "VERSION"))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return strings.TrimSpace(string(slurp))
|
return strings.TrimSpace(string(slurp))
|
||||||
}
|
}
|
||||||
|
@ -129,16 +120,16 @@ func getVersion() string {
|
||||||
|
|
||||||
var gitVersionRx = regexp.MustCompile(`\b\d\d\d\d-\d\d-\d\d-[0-9a-f]{10,10}\b`)
|
var gitVersionRx = regexp.MustCompile(`\b\d\d\d\d-\d\d-\d\d-[0-9a-f]{10,10}\b`)
|
||||||
|
|
||||||
// gitVersion returns the git version of the git repo at camRoot as a
|
// gitVersion returns the git version of the git repo at pkDir as a
|
||||||
// string of the form "yyyy-mm-dd-xxxxxxx", with an optional trailing
|
// string of the form "yyyy-mm-dd-xxxxxxx", with an optional trailing
|
||||||
// '+' if there are any local uncommitted modifications to the tree.
|
// '+' if there are any local uncommitted modifications to the tree.
|
||||||
func gitVersion() string {
|
func gitVersion() string {
|
||||||
cmd := exec.Command("git", "rev-list", "--max-count=1", "--pretty=format:'%ad-%h'",
|
cmd := exec.Command("git", "rev-list", "--max-count=1", "--pretty=format:'%ad-%h'",
|
||||||
"--date=short", "--abbrev=10", "HEAD")
|
"--date=short", "--abbrev=10", "HEAD")
|
||||||
cmd.Dir = camliDir
|
cmd.Dir = pkDir
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error running git rev-list in %s: %v", camliDir, err)
|
log.Fatalf("Error running git rev-list in %s: %v", pkDir, err)
|
||||||
}
|
}
|
||||||
v := strings.TrimSpace(string(out))
|
v := strings.TrimSpace(string(out))
|
||||||
if m := gitVersionRx.FindStringSubmatch(v); m != nil {
|
if m := gitVersionRx.FindStringSubmatch(v); m != nil {
|
||||||
|
@ -147,7 +138,7 @@ func gitVersion() string {
|
||||||
panic("Failed to find git version in " + v)
|
panic("Failed to find git version in " + v)
|
||||||
}
|
}
|
||||||
cmd = exec.Command("git", "diff", "--exit-code")
|
cmd = exec.Command("git", "diff", "--exit-code")
|
||||||
cmd.Dir = camliDir
|
cmd.Dir = pkDir
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
v += "+"
|
v += "+"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue