mirror of
https://github.com/bluszcz/cutego.git
synced 2024-09-28 13:15:17 +03:00
change android signing + fix android-emulator docker support + update default assets
This commit is contained in:
parent
e929d5dd53
commit
e94fc48f4a
3 changed files with 41 additions and 93 deletions
|
@ -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(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>%[1]v</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>%[1]v.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.yourcompany.%[1]v</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>%[1]v</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>%[1]v</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.ident.%[1]v</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.11</string>
|
||||
<key>NOTE</key>
|
||||
<string>This file was generated by Qt/QMake.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
`, name)
|
||||
|
@ -177,32 +171,32 @@ func ios_plist(name string) string {
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>%[1]v</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>main</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>Created by Qt/QMake</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.identifier.%[1]v</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<string>com.yourcompany.%[1]v</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>%[1]v</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<string>1.0.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<string>1.0.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>${IPHONEOS_DEPLOYMENT_TARGET}</string>
|
||||
<key>NOTE</key>
|
||||
<string>This file was generated by Qt/QMake.</string>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
|
@ -210,20 +204,8 @@ func ios_plist(name string) string {
|
|||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>QtRunLoopIntegrationDisableSeparateStack</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
`, name)
|
||||
|
@ -231,10 +213,9 @@ func ios_plist(name string) string {
|
|||
|
||||
func ios_launchscreen(name string) string {
|
||||
return fmt.Sprintf(`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A343f" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
|
@ -247,7 +228,7 @@ func ios_launchscreen(name string) string {
|
|||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="%v" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
|
||||
<rect key="frame" x="20" y="140" width="441" height="43"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
|
@ -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
|
||||
`
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue