2017-06-02 106 views
2

問題:動態創建科爾多瓦構建(Android和iOS)

爲了我的測試/生產的API之間進行切換,我已經註釋掉取決於我用的構造線。此外,我無法找到在兩個平臺的商店中爲我的應用程序簽名設置自定義項目的最佳方法(例如:如果我正在使用測試版本,我想在Xcode的軟件包標識符中包含「.dev」)。


我已經試過:關於使用build.json宣佈簽署您的應用程序所需的信息

科爾多瓦文檔會談。 Here for iOShere for Android。我嘗試過使用它(甚至試圖只使用沒有文件的標誌),但是當我構建應用程序時,這些標誌似乎不被用於每個平臺的構建文件夾。這是我使用的build.json

{ 
    "android": { 
     "debug": { 
      "keystore": "../android.keystore", 
      "storePassword": "android", 
      "alias": "mykey1", 
      "password" : "password", 
      "keystoreType": "" 
     , 
     "release": { 
      "keystore": "../android.keystore", 
      "storePassword": "", 
      "alias": "mykey2", 
      "password" : "password", 
      "keystoreType": "" 
     } 
    }, 

    "ios": { 
     "debug": { 
      "codeSignIdentity": "iPhone Developer", 
      "developmentTeam": "IDENTIFIER", 
      "packageType": "debug", 
      "buildFlag": [ 
       "PRODUCT_BUNDLE_IDENTIFIER=org.name.dev.product_name", 
       "EMBEDDED_CONTENT_CONTAINS_SWIFT=YES", 
       "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO", 
       "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\"" 
      ] 
     }, 
     "release": { 
      "codeSignIdentity": "iPhone Developer", 
      "developmentTeam": "IDENTIFIER", 
      "packageType": "app-store", 
      "buildFlag": [ 
       "PRODUCT_BUNDLE_IDENTIFIER=org.name.product_name", 
       "EMBEDDED_CONTENT_CONTAINS_SWIFT=YES", 
       "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO", 
       "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\"" 
      ] 
     } 
    } 
} 

下面是來自CLI一些輸出,當我運行cordova run ios --target="iPad-2" --debug

Reading build config file: 
    Building for iPad 2 Simulator 
    Building project: /path/product_name/platforms/ios/product_name.xcworkspace 
    Configuration: Debug 
    Platform: emulator 
Adding xcodebuildArg: PRODUCT_BUNDLE_IDENTIFIER=org.name.dev.product_name 
Build settings from command line: 
    CONFIGURATION_BUILD_DIR = /path/product_name/platforms/ios/build/emulator 
    PRODUCT_BUNDLE_IDENTIFIER = org.name.dev.product_name 
    SDKROOT = iphonesimulator10.3 
    SHARED_PRECOMPS_DIR = /path/product_name/platforms/ios/build/sharedpch 

Build settings from configuration file '/path/product_name/platforms/ios/cordova/build-debug.xcconfig': 
    CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES 
    CODE_SIGN_ENTITLEMENTS = $(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-$(CONFIGURATION).plist 
    CODE_SIGN_IDENTITY = iPhone Developer 
    ENABLE_BITCODE = NO 
    GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 
    HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)" 
    OTHER_LDFLAGS = -ObjC 
    SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h 

=== BUILD TARGET CordovaLib OF PROJECT CordovaLib WITH CONFIGURATION Debug === 

所以......它看起來像build.json工作,但我不能看到我的Xcode建立論點正在放!

我對此有何看法?我應該潛入鉤子還是cordova-custom-config?我很茫然。


我想要什麼,以避免...

如果它真是一絕,我可以嘗試處理不同的構建與Gulpfile,但我覺得自己有一個正確的方式來與Cordova一起做這件事。

回答