2016-11-11 157 views
0

將Fastlane與PhoneGap應用程序構建集成的最簡單方法是什麼?過去兩年來,我們一直使用phonegap手動構建我們的應用程序,這可能是一個乏味的過程。現在我們正在不斷增長,並且需要開始重新發布應用程序,因此我們正在尋找一種可以簡化整個流程的快速/簡單解決方案。我在網絡和fastlane資源庫中搜索過,我沒有看到太多與phonegap集成的東西。任何信息或資源將不勝感激。用Fastlane和Phonegap構建應用程序

回答

2

我們一直在使用fastlane(從shezhen等遷移)與科爾多瓦(不像Phonegap相同,但足夠接近),並發現它是非常省時。我相信主要區別在於使用phonegap構建服務,儘管我建議在本地構建,但使用shell命令雖然理論上可以使用phonelane快速調用。

我也推薦使用他們的brew包安裝Fastlane。 (假設你是一個Mac上)在你的項目的根

brew cask install fastlane

運行:

fastlane init

這將設置一個主FASTLANE目錄,在那裏你會管理Android和iOS從。

我們的目錄結構如下:

── fastlane │   ├── Appfile │   ├── Deliverfile │   ├── Fastfile │   ├── Gymfile │   ├── Matchfile │   ├── Supplyfile │   └── metadata

和我們中fastfile看起來是這樣的:

fastlane_version "2.1.1" 

default_platform :ios 

app_name = "REDACTED" 
app_identifier = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) 

platform :ios do 

    lane :development_profiles do 
    match(type: 'development', app_identifier: "#{app_identifier}") 
    match(type: 'development', app_identifier: "#{app_identifier}.MessagesExtension") 
    end 

    lane :appstore_profiles do 
    match(type: 'appstore', app_identifier: "#{app_identifier}") 
    match(type: 'appstore', app_identifier: "#{app_identifier}.MessagesExtension") 
    end 

    lane :profiles do 
    development_profiles 
    appstore_profiles 
    end 

    lane :build_development do 
    development_profiles 
    gym(
     configuration: "Debug", 
     output_name: "#{app_name}-development.ipa" 
    ) 
    end 

    lane :build_release do 
    appstore_profiles 
    gym(
     configuration: "Release", 
     output_name: "#{app_name}-release.ipa" 
    ) 
    end 

    lane :hockeyapp do |options| 
    hockey(
     ipa: "REDACTED", 
     dsym: "REDACTED", 
     api_token: "REDACTED", 
     notes: "Build " + (ENV["BUILD_NUMBER"] ? ENV["BUILD_NUMBER"] + " " : "") + "From " + git_branch + " branch on " + Time.now.strftime('%F') + " at " + Time.now.strftime('%T'), 
     notify: "0" 
    ) 
    end 

    lane :ci do 
    build_development 
    hockeyapp 
    end 

    lane :beta do 
    build_release 
    pilot 
    end 

    lane :release do 
    deliver(
     ipa: "REDACTED", 
     force: true, 
     skip_metadata: true, 
     skip_screenshots: true 
    ) 
    end 

    lane :screenshots do 
    deliver(
     skip_binary_upload: true 
    ) 
    end 

    after_all do |lane| 
    end 

    error do |lane, exception| 
    end 
end 

platform :android do 

    lane :build_development do 
    Dir.chdir ".." do 
     sh("platforms/android/cordova/clean") 
    end 
    gradle(
     task: "cdvBuildDebug", 
     project_dir: "platforms/android/", 
     properties: { 
     'android.useDeprecatedNdk' => true 
     } 
    ) 
    Dir.chdir ".." do 
     sh("mkdir -p REDACTED/") 
     sh("cp -f platforms/android/build/outputs/apk/android-armv7-debug.apk REDACTED/") 
     sh("cp -f platforms/android/build/outputs/apk/android-x86-debug.apk REDACTED/") 
    end 
    end 

    lane :build_release do 
    Dir.chdir ".." do 
     sh("platforms/android/cordova/clean") 
    end 
    gradle(
     task: "cdvBuildRelease", 
     project_dir: "platforms/android/", 
     properties: { 
     'android.useDeprecatedNdk' => true 
     } 
    ) 
    Dir.chdir ".." do 
     sh("mkdir -p REDACTED/") 
     sh("cp -f platforms/android/build/outputs/apk/android-armv7-release.apk REDACTED/") 
     sh("cp -f platforms/android/build/outputs/apk/android-x86-release.apk REDACTED/") 
    end 
    end 

    lane :hockeyapp do |options| 
    hockey(
     apk: "REDACTED", 
     notes: "Build " + (ENV["BUILD_NUMBER"] ? ENV["BUILD_NUMBER"] + " " : "") + "From " + git_branch + " branch on " + Time.now.strftime('%F') + " at " + Time.now.strftime('%T'), 
     notify: "0" 
    ) 
    end 

    lane :release do |options| 
    supply(
     track: options[:track], 
     apk_paths: ["REDACTED", "REDACTED"], 
     skip_upload_metadata: true, 
     skip_upload_images: true, 
     skip_upload_screenshots: true 
    ) 
    end 

    lane :ci do 
    build_development 
    hockeyapp 
    end 

    after_all do |lane| 
    end 

    error do |lane, exception| 
    end 
end 

它的關鍵是,你把你的項目,如果它是一個正常的本地項目,並以此方式構建。工作得很好。

相關問題