Exemplo n.º 1
0
func (a *Ant) Install(args ...string) {
	a.ComponentId = args[0]

	myutils.Decompress(args[2], args[3])

	//Add enviroment variables
	//1. add ant/bin to PATH
	a.Version = args[1]
	ant_path := filepath.Join(args[3], "apache-ant-"+args[1])
	bin_path := filepath.Join(ant_path, "bin")
	myutils.Set_Environment("PATH", bin_path)

	//2. add ANT_HOME
	myutils.Set_Environment("ANT_HOME", ant_path)
	fmt.Println(ant_path)
}
Exemplo n.º 2
0
func (s *SDK) Install(args ...string) {
	s.ComponentId = args[0]

	myutils.Decompress(args[2], args[3])

	//Add enviroment variables
	//1. add platform-tools,build-tools,tools to PATH

	sdk_path := filepath.Join(args[3], "android-sdk-"+myutils.Global_OS)
	t_path := filepath.Join(sdk_path, "tools")
	myutils.Set_Environment("PATH", t_path)

	//2. add ANDROID_HOME
	myutils.Set_Environment("ANDROID_HOME", sdk_path)
	fmt.Println(sdk_path)
}
Exemplo n.º 3
0
func (g *Gradle) Install(args ...string) {
	g.ComponentId = args[0]

	myutils.Decompress(args[2], args[3])

	//Add enviroment variables
	//1. add gradle/bin to PATH
	g.Version = args[1]
	gradle_path := filepath.Join(args[3], "gradle-"+args[1])
	bin_path := filepath.Join(gradle_path, "bin")
	myutils.Set_Environment("PATH", bin_path)

	//2. add ANT_HOME
	myutils.Set_Environment("GRADLE_HOME", gradle_path)
	fmt.Println(gradle_path)
}
Exemplo n.º 4
0
func (j *JavaSDK) Install(args ...string) {
	j.ComponentId = args[0]
	j.Version = args[1]
	j.InstallLocation = args[3]

	if _, e1 := os.Open(filepath.Join(j.InstallLocation, "jdk"+j.Version)); e1 == nil {
		//destination directory exist
		myutils.Rmdir(filepath.Join(j.InstallLocation, "jdk"+j.Version))
	}
	myutils.Decompress(args[2], args[3])

	//Add enviroment variables
	//1. add java/bin to PATH
	j.Version = args[1]
	java_path := filepath.Join(args[3], "jdk"+args[1])
	bin_path := filepath.Join(java_path, "bin")
	myutils.Set_Environment("PATH", bin_path)

	//2. add ANT_HOME
	myutils.Set_Environment("JAVA_HOME", java_path)
	fmt.Println(java_path)
}
Exemplo n.º 5
0
func (n *NDK) Install(args ...string) {
	if len(args) < 4 {
		fmt.Println("wrong args input")
		return
	}
	n.ComponentId = args[0]
	n.Version = args[1]
	n.ExecFile = args[2]
	n.InstallLocation = args[3]

	os.Chmod(n.ExecFile, 0777)
	_, e := exec.Command(n.ExecFile, "-y", "-o"+n.InstallLocation).Output()
	myutils.CheckError(e)

	//Add enviroment variables
	//1. add platform-tools,build-tools,tools to PATH

	ndk_path := filepath.Join(args[3], "android-ndk-r"+n.Version)
	//os.Mkdir(ndk_path, os.ModePerm)
	myutils.Set_Environment("PATH", ndk_path)

	//2. add ANDROID_NDK_HOME, NDKROOT,NDK_ROOT
	myutils.Set_Environment("ANDROID_NDK_ROOT", ndk_path)
	myutils.Set_Environment("NDK_ROOT", ndk_path)
	myutils.Set_Environment("NDKROOT", ndk_path)
	myutils.Set_Environment("NVPACK_NDK_VERSION", "android-ndk-r"+n.Version)
	//3. generate standalone toolchain

	if myutils.Global_OS == "linux" && runtime.GOARCH == "amd64" {
		genscript := filepath.Join(ndk_path, "build", "tools", "make-standalone-toolchain.sh")

		//generate 32 bit standalone toolchain
		s_path := filepath.Join(ndk_path, "toolchains", "arm-linux-androideabi-4.6", "gen_standalone", "linux-x86_64")
		gencmd := "bash " + genscript + " --platform=android-14 --system=linux-x86_64 --arch=arm --install-dir=" + s_path

		_, e1 := exec.Command("bash", "-c", gencmd).Output()
		myutils.CheckError(e1)
		myutils.Set_Environment("NDK_STANDALONE_46_ANDROID9_32", s_path)

		//generate 64 bit standalone toolchain
		s_path_64 := filepath.Join(ndk_path, "toolchains", "aarch64-linux-android-4.9", "gen_standalone", "linux-x86_64")
		gencmd_64 := "bash " + genscript + " --platform=android-21 --system=linux-x86_64 --arch=arm64 --install-dir=" + s_path_64 + " --toolchain=aarch64-linux-android-4.9"

		_, e2 := exec.Command("bash", "-c", gencmd_64).Output()
		myutils.CheckError(e2)
		myutils.Set_Environment("NDK_STANDALONE_46_ANDROID9_64", s_path_64)
	}
	fmt.Println(ndk_path)
}
Exemplo n.º 6
0
func (p *PlatformTools) Install(args ...string) {
	if len(args) < 4 {
		fmt.Println("wrong args input")
		return
	}
	p.ComponentId = args[0]

	myutils.Decompress(args[2], args[3])

	//Add enviroment variables
	//add platform-tools to PATH

	sdk_path := args[3]
	pt_path := filepath.Join(sdk_path, "platform-tools")
	myutils.Set_Environment("PATH", pt_path)
	fmt.Println(pt_path)
}
Exemplo n.º 7
0
func (b *BuildTools) Install(args ...string) {
	if len(args) < 4 {
		fmt.Println("wrong args input")
		return
	}
	b.ComponentId = args[0]
	b.Version = args[1]
	bt_path := args[3]
	myutils.Decompress(args[2], bt_path)
	flocation := filepath.Join(bt_path, "android-5.1")

	//os.Rename(flocation, filepath.Join(bt_path, b.Version))
	myutils.CopyFile(flocation, filepath.Join(bt_path, b.Version))
	//Add enviroment variables
	//add build-tools to PATH

	myutils.Set_Environment("PATH", bt_path)
	fmt.Println(filepath.Join(bt_path, ""))
}