diff --git a/internal/cmd/deploy/assets.go b/internal/cmd/deploy/assets.go index e5ccd7e3..9c2f974c 100644 --- a/internal/cmd/deploy/assets.go +++ b/internal/cmd/deploy/assets.go @@ -99,7 +99,7 @@ func android_config(target, path, depPath string) string { jsonStruct.Targetarchitecture = "x86" } - if utils.QT_DOCKER() { + if utils.QT_DOCKER() && target == "android" { jsonStruct.AndroidExtraLibs += "," + filepath.Join(os.Getenv("HOME"), "openssl-1.0.2k", "libcrypto.so") + "," + filepath.Join(os.Getenv("HOME"), "openssl-1.0.2k", "libssl.so") } @@ -110,43 +110,37 @@ func android_config(target, path, depPath string) string { return strings.Replace(string(out), `\\`, `/`, -1) } -func android_gradle_wrapper() string { - return `distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip` -} - //darwin -func darwin_sh(name string) string { - return fmt.Sprintf("#!/bin/bash\ncd \"${0%%/*}\"\n./%v_app \"$@\"", name) -} - func darwin_plist(name string) string { return fmt.Sprintf(` - NSPrincipalClass - NSApplication + CFBundleExecutable + %[1]v + CFBundleGetInfoString + Created by Qt/QMake CFBundleIconFile %[1]v.icns + CFBundleIdentifier + com.yourcompany.%[1]v CFBundleName %[1]v CFBundlePackageType APPL - CFBundleGetInfoString - Created by Qt/QMake + CFBundleShortVersionString + 1.0.0 CFBundleSignature ???? - CFBundleExecutable - %[1]v - CFBundleIdentifier - com.ident.%[1]v + LSMinimumSystemVersion + 10.11 NOTE This file was generated by Qt/QMake. + NSPrincipalClass + NSApplication + NSSupportsAutomaticGraphicsSwitching + `, name) @@ -177,32 +171,32 @@ func ios_plist(name string) string { - CFBundleDevelopmentRegion - en + CFBundleDisplayName + %[1]v CFBundleExecutable main + CFBundleGetInfoString + Created by Qt/QMake CFBundleIdentifier - com.identifier.%[1]v - CFBundleInfoDictionaryVersion - 6.0 + com.yourcompany.%[1]v CFBundleName %[1]v CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 1.0.0 CFBundleSignature ???? CFBundleVersion - 1.0 + 1.0.0 LSRequiresIPhoneOS + MinimumOSVersion + ${IPHONEOS_DEPLOYMENT_TARGET} + NOTE + This file was generated by Qt/QMake. UILaunchStoryboardName LaunchScreen - UIRequiredDeviceCapabilities - - arm64 - UISupportedInterfaceOrientations UIInterfaceOrientationPortrait @@ -210,20 +204,8 @@ func ios_plist(name string) string { UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - QtRunLoopIntegrationDisableSeparateStack - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - `, name) @@ -231,10 +213,9 @@ func ios_plist(name string) string { func ios_launchscreen(name string) string { return fmt.Sprintf(` - + - - + @@ -247,7 +228,7 @@ func ios_launchscreen(name string) string { @@ -339,7 +320,7 @@ func ios_appicon() string { } func ios_xcodeproject(depPath string) string { - return fmt.Sprintf(`// !$*UTF8*$! + return `// !$*UTF8*$! { archiveVersion = 1; classes = { @@ -393,7 +374,6 @@ func ios_xcodeproject(depPath string) string { buildConfigurationList = 254BB8611B1FD08900C56DE9 /* Build configuration list for PBXNativeTarget "main" */; buildPhases = ( 254BB83C1B1FD08900C56DE9 /* Resources */, - 259BC5361CE6BA19005B5A05 /* ShellScript */, ); buildRules = ( ); @@ -450,24 +430,6 @@ func ios_xcodeproject(depPath string) string { }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 259BC5361CE6BA19005B5A05 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cp %v/qt.conf $CODESIGNING_FOLDER_PATH/qt.conf; test -d $CODESIGNING_FOLDER_PATH/qt_qml && rm -r $CODESIGNING_FOLDER_PATH/qt_qml; mkdir -p $CODESIGNING_FOLDER_PATH/qt_qml && for p in %v/%v/ios/qml; do rsync -r --exclude='*.a' --exclude='*.prl' --exclude='*.qmltypes' $p/ $CODESIGNING_FOLDER_PATH/qt_qml; done"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin XCBuildConfiguration section */ 254BB8601B1FD08900C56DE9 /* Release */ = { isa = XCBuildConfiguration; @@ -512,7 +474,6 @@ func ios_xcodeproject(depPath string) string { buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -540,13 +501,6 @@ func ios_xcodeproject(depPath string) string { }; rootObject = 254BB8361B1FD08900C56DE9 /* Project object */; } -`, depPath, utils.QT_DIR(), utils.QT_VERSION_MAJOR()) -} - -func ios_qtconf() string { - return `[Paths] -Imports = qt_qml -Qml2Imports = qt_qml ` } diff --git a/internal/cmd/deploy/bundle.go b/internal/cmd/deploy/bundle.go index c506b639..911e35a7 100644 --- a/internal/cmd/deploy/bundle.go +++ b/internal/cmd/deploy/bundle.go @@ -336,13 +336,6 @@ func bundle(mode, target, path, name, depPath string) { utils.MkdirAll(assets) copy(assets+"/.", filepath.Join(depPath, "build")) - //create default gradle-wrapper.properties - if target == "android-emulator" { - path := filepath.Join(depPath, "build", "gradle", "wrapper") - utils.MkdirAll(path) - utils.Save(filepath.Join(path, "gradle-wrapper.properties"), android_gradle_wrapper()) - } - //wrap exported go main inside c main env, _, _, _ := cmd.BuildEnv(target, name, depPath) compiler := env["CXX"] @@ -403,13 +396,13 @@ func bundle(mode, target, path, name, depPath string) { "--android-platform", "android-25", "--jdk", utils.JDK_DIR(), "--gradle", + "--no-gdbserver", "--verbose", ) - if utils.ExistsFile(filepath.Join(path, target, name+".keystore")) { + if utils.ExistsFile(filepath.Join(path, target, name+".jks")) { dep.Args = append(dep.Args, - "--sign", filepath.Join(path, target, name+".keystore"), - strings.TrimSpace(utils.Load(filepath.Join(path, target, "alias.txt"))), - "--storepass", strings.TrimSpace(utils.Load(filepath.Join(path, target, "password.txt")))) + "--sign", filepath.Join(path, target, name+".jks"), strings.TrimSpace(utils.Load(filepath.Join(path, target, "jks_alias"))), + "--storepass", strings.TrimSpace(utils.Load(filepath.Join(path, target, "jks_pass")))) } if runtime.GOOS == "windows" { @@ -424,13 +417,13 @@ func bundle(mode, target, path, name, depPath string) { if utils.QT_VAGRANT() { depPathUNC := strings.Replace(depPath, "C:\\media\\sf_GOPATH", "C:\\media\\UNC\\vboxsrv\\media_sf_GOPATH", -1) - if utils.ExistsFile(filepath.Join(path, target, name+".keystore")) { + if utils.ExistsFile(filepath.Join(path, target, name+".jks")) { copy(filepath.Join(depPathUNC, "build", "build", "outputs", "apk", "build-release-signed.apk"), depPath) } else { copy(filepath.Join(depPathUNC, "build", "build", "outputs", "apk", "build-debug.apk"), depPath) } } else { - if utils.ExistsFile(filepath.Join(path, target, name+".keystore")) { + if utils.ExistsFile(filepath.Join(path, target, name+".jks")) { copy(filepath.Join(depPath, "build", "build", "outputs", "apk", "build-release-signed.apk"), depPath) } else { copy(filepath.Join(depPath, "build", "build", "outputs", "apk", "build-debug.apk"), depPath) @@ -452,13 +445,12 @@ func bundle(mode, target, path, name, depPath string) { //copy custom assets assets := filepath.Join(path, target) utils.MkdirAll(assets) - copy(assets+"/.", depPath) + copy(assets+"/.", buildPath) //add c_main_wrappers if !utils.ExistsFile(filepath.Join(depPath, target+"_qml_plugin_import.cpp")) { utils.Save(filepath.Join(depPath, target+"_qml_plugin_import.cpp"), "") } - utils.Save(filepath.Join(depPath, "qt.conf"), ios_qtconf()) var t string switch target { diff --git a/internal/cmd/deploy/run.go b/internal/cmd/deploy/run.go index 93e0015e..1efb02cb 100644 --- a/internal/cmd/deploy/run.go +++ b/internal/cmd/deploy/run.go @@ -20,9 +20,11 @@ func run(target, name, depPath, device string) { exec.Command(filepath.Join(utils.ANDROID_SDK_DIR(), "platform-tools", "adb"), "install", "-r", filepath.Join(depPath, "build-release-signed.apk")).Start() } + //TODO: parse manifest for ident and start app (+ logcat) + case "ios-simulator": if device == "" { - out, _ := exec.Command("xcrun", "instruments", "-s", "").Output() + out, _ := exec.Command("xcrun", "instruments", "-s").Output() lines := strings.Split(string(out), "iPhone") device = strings.Split(strings.Split(string(out), "iPhone 8 ("+strings.Split(strings.Split(lines[len(lines)-1], "(")[1], ")")[0]+") [")[1], "]")[0] } @@ -30,7 +32,7 @@ func run(target, name, depPath, device string) { time.Sleep(1 * time.Second) utils.RunCmdOptional(exec.Command("xcrun", "simctl", "uninstall", "booted", filepath.Join(depPath, "main.app")), "uninstall old app") utils.RunCmdOptional(exec.Command("xcrun", "simctl", "install", "booted", filepath.Join(depPath, "main.app")), "install new app") - utils.RunCmdOptional(exec.Command("xcrun", "simctl", "launch", "booted", fmt.Sprintf("com.identifier.%v", name)), "start app") + utils.RunCmdOptional(exec.Command("xcrun", "simctl", "launch", "booted", fmt.Sprintf("com.yourcompany.%v", name)), "start app") //TODO: parse ident from plist case "darwin": exec.Command("open", filepath.Join(depPath, fmt.Sprintf("%v.app", name))).Start()