Subito-it / PodBuilder

A tool to precompile CocoaPods pods
Other
284 stars 28 forks source link

Built dependencies are not added to generated Podfile #4

Closed iKleMiX closed 4 years ago

iKleMiX commented 4 years ago

Suppose I have some private pod with a subspec, which adds dependencies to other subspecs which add more dependencies. Itself private subspecs are prebuilt libraries, so they are not being built. In total one line of a pod adds 20 frameworks, which are built by PodBuilder but none of them are added to the generated Podfile, so original project still builds all those 20 frameworks.

Example Frameworks/Podfile:

platform :ios, '9.0'

source 'https://cdn.cocoapods.org/'
source 'https://github.com/SomeOrg/Some-Specs.git'

target :'MyTarget' do   
    pod 'SomePrivatePod/SomeSubspec', '5.2.6'
    pod 'GoogleMobileAdsMediationTestSuite'
end

pre_install do |installer|
    raise "\n🚨  Do not launch 'pod install' manually, use `pod_builder` instead!\n" if !File.exist?('pod_builder.lock')
end

Generated Podfile:

# Autogenerated by PodBuilder (https://github.com/Subito-it/PodBuilder)
# Any change to this file should be done on Frameworks/Podfile

platform :ios, '9.0'

source 'https://cdn.cocoapods.org/'
source 'https://github.com/SomeOrg/Some-Specs.git'

target :'MyTarget' do   
    pod 'SomePrivatePod/SomeSubspec', '5.2.6'
    pod 'GoogleMobileAdsMediationTestSuite'
end

post_install do |installer|
    require 'pod_builder/podfile/post_actions'
    PodBuilder::Podfile::remove_target_support_duplicate_entries
    PodBuilder::Podfile::check_target_support_resource_collisions
end

pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_duplicate_framework_and_library_names) {}

end

Build all output:

% pod_builder build_all
Updating local specs repositories
... private pod spec update
  HEAD is now at ....
Analyzing dependencies
Analyzing dependencies
Initialized empty Git repository in /private/tmp/pod_builder_1575563420108/.git/
Analyzing dependencies
Downloading dependencies
Installing AWSCore (2.6.28)
Installing AWSPinpoint (2.6.28)
Installing FBSDKCoreKit (5.12.0)
Installing GoogleUtilities (6.3.2)
Installing MDFInternationalization (2.0.0)
Installing MDFTextAccessibility (2.0.0)
Installing MaterialComponents (94.5.0)
Installing SSZipArchive (2.2.2)
Installing mopub-ios-sdk (5.7.1)
Installing nanopb (0.3.9011)
Generating Pods project
Skipping User Project Integration
Building frameworks
Built 20 frameworks
Copying 20 frameworks to `Rome`
Pod installation complete! There are 13 dependencies from the Podfile and 10 total pods installed.
Writing licenses
Generating PodBuilder's local podspec
Analyzing dependencies
Writing Restore Podfile
Analyzing dependencies
Updating Application Podfile
Running pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
[PodBuilder] Removing target support duplicated entries
[PodBuilder] Checking target support resource collisions
Integrating client project
Pod installation complete! There are 3 dependencies from the Podfile and 18 total pods installed.

[!] Unable to read the license file `LICENSE` for the spec `UnityAds (3.3.0)`

[!] Unable to read the license file `LICENSE` for the spec `UnityAds (3.3.0)`

🎉 done!

In Pods folder I still can see all dependencies with source code.

tcamin commented 4 years ago

What if you add "SomePrivatePod/SomeSubspec" to the force_prebuild_pods array in PodBuilder.plist? Depending on the subspec you might even need to add "SomePrivatePod" to the array as well. A similar trick is used to prebuild Firebase as well (see the default values in the PodBuilder.plist).

iKleMiX commented 4 years ago

I just wanted to add this as another issue but since you are asking here, this is what happens. For this example I reduced my dependency tree, added only SomePrivatePod/SomeSubspec and SomePrivatePod/SomeOtherSubspec to the Frameworks/Podfile. I did add SomePrivatePod, SomePrivatePod/SomeSubspec and SomePrivatePod/SomeOtherSubspec to the force_prebuild_pods array.

Generated Podfile got added:

pod 'PodBuilder/SomePrivatePod', :path => 'Frameworks' # pb<SomePrivatePod/SomeSubspec>
pod 'PodBuilder/SomePrivatePod', :path => 'Frameworks' # pb<SomePrivatePod/SomeOtherSubspec>

Then I get an error after frameworks are built:

[!] CocoaPods could not find compatible versions for pod "PodBuilder/SomePrivatePod":
  In Podfile:
    PodBuilder/SomePrivatePod (from `Frameworks`)

None of your spec sources contain a spec satisfying the dependency: `PodBuilder/SomePrivatePod (from `Frameworks`)`.

And indeed, there is no subspec for my pods. If I look in Frameworks/Rome directory, I see a folder named SomePrivatePod without a framework extension. Inside there is a Libraries directory where I see my libSomeSubspec.a and libSomeOtherSubspec.a files, not even headers.

Unfortunately since it's a private pod, I can't share it, but you can repro it by making similar podspec's subspec to this:

    s.subspec 'SomeSubspec' do |core|
        core.ios.vendored_libraries   = 'Libraries/libSomeSubspec.a'
        core.source_files               = 'Libraries/headers/SomeSubspec/*.h'
        core.header_dir                 = 'SomeSubspec'
        core.resource                   = 'Libraries/SomeSubspecResources.bundle'

        core.libraries = 'z', 'c++'
        core.ios.frameworks = 'UIKit', 'WebKit', 'QuartzCore', 'SystemConfiguration', 'CoreTelephony'
        core.ios.weak_frameworks = 'UserNotifications', 'StoreKit'

        core.ios.dependency 'AWSPinpoint', '2.6.28'
    end
iKleMiX commented 4 years ago

Since you mentioned Firebase. I tried to add most of my dependencies to the Frameworks/Podfile as well, but ran into issue with the Firebase as well. When I add

pod 'Firebase/Core'
pod 'Firebase/RemoteConfig'

It fails that there is no spec for PodBuilder/Firebase.

I tried to add both pods and plain Firebase to the force_prebuild_pods, this is what i got in generated Podfile:

pod 'PodBuilder/Firebase', :path => 'Frameworks' # pb<Firebase/Core>
pod 'PodBuilder/Firebase', :path => 'Frameworks' # pb<Firebase/RemoteConfig>

And this is what I get in the build all log:

After building all pods....

Analyzing dependencies
Skipping `Firebase/Core`, not prebuilt
Skipping `Firebase/CoreOnly`, not prebuilt
Skipping `Firebase/RemoteConfig`, not prebuilt
Writing Restore Podfile
Analyzing dependencies
Updating Application Podfile
Running pod install
Analyzing dependencies
[!] CocoaPods could not find compatible versions for pod "PodBuilder/Firebase":
  In Podfile:
    PodBuilder/Firebase (from `Frameworks`)

Though there is FirebaseCore.framework in Frameworks/Rome folder. (Same if I try to add Firebase/CoreOnly to theforce_prebuild_pods)

I see there are FirebaseCore and FirebaseRemoteConfig podspecs generated but they don't match those in generated Podfile.

Is there an actual example of prebuilding Firebase? Maybe that would help with some of these questions.

P.S. I discovered this gem from a tweet about prebuilding Firebase 😃

tcamin commented 4 years ago

I released version 0.9.4 today which ships a significant number of improvements, could you try with this version again? I tried prebuilding Firebase again on a sample project and it is working properly.

The problem you reported with SomePrivatePod should be fixed as well. Keep in mind that you'll need to add SomePrivatePod to force_prebuild_pods if the pod itself does not contain any source code to compile (e.g. it only defines dependencies and/or adds vendored frameworks).

The PodBuilder.json defaults have changed when you run pod_builder init. Defaults should look like this

  "skip_pods": [
    "GoogleMaps"
  ],
  "force_prebuild_pods": [
    "Firebase"
  ],
iKleMiX commented 4 years ago

Now I can see a lot of dependencies being added to the generated Podfile. These Pods I can see in generated Podfile:

    pod 'PodBuilder/AWSCore', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/AWSPinpoint', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/AdColony', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FBAudienceNetwork', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FBSDKCoreKit', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FirebaseABTesting', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FirebaseAnalytics', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FirebaseCore', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FirebaseCoreDiagnostics', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FirebaseDatabase', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FirebaseInstanceID', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FirebaseMessaging', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/FirebaseRemoteConfig', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/GoogleAppMeasurement', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/GoogleDataTransport', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/GoogleDataTransportCCTSupport', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/GoogleUtilities', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/Protobuf', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/SSZipArchive', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/UnityAds', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/leveldb-library', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/mopub-ios-sdk', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/nanopb', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
    pod 'PodBuilder/GoogleAppMeasurement', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
    pod 'PodBuilder/GoogleUtilities', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
    pod 'PodBuilder/MDFInternationalization', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
    pod 'PodBuilder/MDFTextAccessibility', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
    pod 'PodBuilder/MaterialComponents', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
    pod 'PodBuilder/nanopb', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>

This was installation log:

Pod installation complete! There are 52 dependencies from the Podfile and 33 total pods installed.
Cleaning framework folder
Writing licenses
Generating PodBuilder's local podspec
Skipping `SomePrivatePod/Standard`, not prebuilt
Skipping `GoogleMobileAdsMediationTestSuite`, not prebuilt
Skipping `Firebase/Core`, not prebuilt
Skipping `Firebase/CoreOnly`, not prebuilt
Skipping `Firebase/Database`, not prebuilt
Skipping `Firebase/Messaging`, not prebuilt
Skipping `Firebase/RemoteConfig`, not prebuilt
Skipping `FirebaseAnalyticsInterop`, not prebuilt
Skipping `FirebaseAuthInterop`, not prebuilt
Skipping `FirebaseCoreDiagnosticsInterop`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec1`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec2`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec3`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec4`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec5`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec6`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec7`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec8`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec9`, not prebuilt
Skipping `SomePrivatePod/Core`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec2/Subspec10`, not prebuilt
Skipping `Google-Mobile-Ads-SDK`, not prebuilt
Skipping `VungleSDK-iOS`, not prebuilt
Writing Restore Podfile
Analyzing dependencies
Updating Application Podfile
Running pod install
Analyzing dependencies
Downloading dependencies
Installing FirebaseAnalyticsInterop (1.4.0)
Installing FirebaseAuthInterop (1.0.0)
Installing FirebaseCoreDiagnosticsInterop (1.1.0)
Installing PodBuilder (0.0.1)
Removing AWSCore
Removing AWSPinpoint
Removing AdColony
Removing FBAudienceNetwork
Removing FBSDKCoreKit
Removing SomePrivatePod
Removing Google-Mobile-Ads-SDK
Removing GoogleAppMeasurement
Removing GoogleMobileAdsMediationTestSuite
Removing GoogleUtilities
Removing MDFInternationalization
Removing MDFTextAccessibility
Removing MaterialComponents
Removing SSZipArchive
Removing UnityAds
Removing VungleSDK-iOS
Removing mopub-ios-sdk
Removing nanopb
Generating Pods project

And I see SomePrivatePod being removed while not being prebuilt, though it was added to the force_prebuild_pods. In the Frameworks/Rome directory I see directory named SomePrivatePod (without an extension), which has all the static libraries I am providing. But there is nothing in generated Podfile, and nothing in generated podspec files about these libraries which are just lost.

Otherwise it looks fine, though I can't build my project to be sure because my private pod is missing still. I have linked example of my podspec in the first answer. Still it is much better now!

Should I open another issue? Since adding pod dependencies is now resolved.

tcamin commented 4 years ago

You have multiple subspecs of SomePrivatePod that ends up in different targets?

iKleMiX commented 4 years ago

It's all in the single target.

tcamin commented 4 years ago

Can you share your Podfile (excluding the private pods)?

iKleMiX commented 4 years ago

I've seen GoogleMobileAdsMediationTestSuite not being prebuilt and added as well, so I added it to the force_prebuild_pods as well. This lead to more problems, while the framework was built and added to the target, it looks like this in generated podspec:

  s.subspec 'GoogleMobileAdsMediationTestSuite' do |p|
    p.vendored_frameworks = 'Rome/GoogleMobileAdsMediationTestSuite.framework','Rome/GoogleAppMeasurement.framework','Rome/GoogleUtilities.framework','Rome/MDFInternationalization.framework','Rome/MDFTextAccessibility.framework','Rome/MaterialComponents.framework','Rome/nanopb.framework','Rome/GoogleMobileAds.framework'
    p.frameworks = 'AVFoundation', 'AudioToolbox', 'CFNetwork', 'CoreGraphics', 'CoreMedia', 'CoreTelephony', 'CoreVideo', 'MediaPlayer', 'MessageUI', 'MobileCoreServices', 'QuartzCore', 'Security', 'StoreKit', 'SystemConfiguration'
    p.libraries = 'c++', 'sqlite3', 'z'
    p.dependency 'Google-Mobile-Ads-SDK'
  end

which adds Google-Mobile-Ads-SDK dependency without prebuilding it, while private pod has the same dependency and it was prebuilt. Which added more dependencies that were prebuilt before, overall log added:

Writing Restore Podfile
Analyzing dependencies
Updating Application Podfile
Running pod install
Analyzing dependencies
Downloading dependencies
Installing Google-Mobile-Ads-SDK (7.53.0)
Installing GoogleAppMeasurement (6.1.6)
Installing GoogleUtilities (6.3.2)
Installing PodBuilder 0.0.1
Installing nanopb (0.3.9011)
Generating Pods project
[PodBuilder] Removing target support duplicated entries
[PodBuilder] Checking target support resource collisions
Integrating client project
Pod installation complete! There are 24 dependencies from the Podfile and 8 total pods installed.

All of these Installing were prebuilt before by the private pod installation.

tcamin commented 4 years ago

I may be wrong but multiple subspecs in the same target shouldn't be something that CocoaPods supports. Except, but by accident, if they are static.

tcamin commented 4 years ago

which adds Google-Mobile-Ads-SDK dependency without prebuilding it

This is right, Google-Mobile-Ads-SDK is already prebuilt (https://github.com/CocoaPods/Specs/blob/master/Specs/5/9/a/Google-Mobile-Ads-SDK/7.53.0/Google-Mobile-Ads-SDK.podspec.json)

iKleMiX commented 4 years ago

This is how my Podfile looks like:

platform :ios, '9.0'

source 'https://cdn.cocoapods.org/'
source 'https://github.com/Private/Private-Specs.git'

target :'SomeExample' do    
    pod 'SomePrivatePod/Standard', '5.3.2'
    pod 'GoogleMobileAdsMediationTestSuite'
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)']
            cflags << '-fembed-bitcode'

            if target.name == "SSZipArchive"
                cflags << '-fvisibility=hidden'
            end

            cflags << '-Wno-everything' # we don't want warnings from external sources ¯\_(ツ)_/¯
            config.build_settings['OTHER_CFLAGS'] = cflags
            config.build_settings['ENABLE_BITCODE'] = 'YES'
            config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
            config.build_settings['TARGETED_DEVICE_FAMILY'] = '1,2'
        end
    end
end

pre_install do |installer|
    raise "\n🚨  Do not launch 'pod install' manually, use `pod_builder` instead!\n" if !File.exist?('pod_builder.lock')
end

PodBuilder.json:

{
  "project_name": "SomeExample",
  "spec_overrides": {
    "spec_overrides": {
  }
  },
  "skip_licenses": [

  ],
  "skip_pods": [

  ],
  "force_prebuild_pods": [
    "SomePrivatePod", "GoogleMobileAdsMediationTestSuite"
  ],
  "build_settings": {
  },
  "build_settings_overrides": {
  },
  "build_system": "Legacy",
  "license_filename": "Pods-acknowledgements",
  "subspecs_to_split": [

  ],
  "lfs_update_gitattributes": false,
  "lfs_include_pods_folder": false
}
tcamin commented 4 years ago

From a previous post I see Firebase got installed, but I don't see the entry in the podfile. force_prebuild_pods should definitely contain "Firebase" (this is added automatically by PodBuilder if you run pod_builder init with one of the latest versions).

iKleMiX commented 4 years ago

which adds Google-Mobile-Ads-SDK dependency without prebuilding it

This is right, Google-Mobile-Ads-SDK is already prebuilt (https://github.com/CocoaPods/Specs/blob/master/Specs/5/9/a/Google-Mobile-Ads-SDK/7.53.0/Google-Mobile-Ads-SDK.podspec.json)

But it was prebuilt by forcing my private pod to prebuild - I see GoogleMobileAds.framework in Frameworks/Rome directory, as well as nanopb, GoogleAppMeasurement and GoogleUtilities. Maybe there was some version collision?

iKleMiX commented 4 years ago

From a previous post I see Firebase got installed, but I don't see the entry in the podfile. force_prebuild_pods should definitely contain "Firebase" (this is added automatically by PodBuilder if you run pod_builder init with one of the latest versions).

There are some Firebase frameworks prebuilt, some have dependancies, I didn't try to rebuild PodBuilder.json from scratch, and didn't try to add Firebase there yet.

tcamin commented 4 years ago

But it was prebuilt by forcing my private pod to prebuild - I see GoogleMobileAds.framework in Frameworks/Rome directory, as well as nanopb, GoogleAppMeasurement and GoogleUtilities. Maybe there was some version collision?

It was created (just extracted from the tar.gz) by CocoaPods under the hood. You should have another entry under Pods folder in your app's folder

tcamin commented 4 years ago

Now I can see a lot of dependencies being added to the generated Podfile. These Pods I can see in generated Podfile:

  pod 'PodBuilder/AWSCore', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/AWSPinpoint', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/AdColony', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FBAudienceNetwork', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FBSDKCoreKit', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FirebaseABTesting', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FirebaseAnalytics', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FirebaseCore', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FirebaseCoreDiagnostics', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FirebaseDatabase', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FirebaseInstanceID', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FirebaseMessaging', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/FirebaseRemoteConfig', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/GoogleAppMeasurement', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/GoogleDataTransport', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/GoogleDataTransportCCTSupport', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/GoogleUtilities', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/Protobuf', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/SSZipArchive', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/UnityAds', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/leveldb-library', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/mopub-ios-sdk', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/nanopb', :path => 'Frameworks' # pb<SomePrivatePod/Standard>
  pod 'PodBuilder/GoogleAppMeasurement', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
  pod 'PodBuilder/GoogleUtilities', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
  pod 'PodBuilder/MDFInternationalization', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
  pod 'PodBuilder/MDFTextAccessibility', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
  pod 'PodBuilder/MaterialComponents', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
  pod 'PodBuilder/nanopb', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>

This was installation log:

Pod installation complete! There are 52 dependencies from the Podfile and 33 total pods installed.
Cleaning framework folder
Writing licenses
Generating PodBuilder's local podspec
Skipping `SomePrivatePod/Standard`, not prebuilt
Skipping `GoogleMobileAdsMediationTestSuite`, not prebuilt
Skipping `Firebase/Core`, not prebuilt
Skipping `Firebase/CoreOnly`, not prebuilt
Skipping `Firebase/Database`, not prebuilt
Skipping `Firebase/Messaging`, not prebuilt
Skipping `Firebase/RemoteConfig`, not prebuilt
Skipping `FirebaseAnalyticsInterop`, not prebuilt
Skipping `FirebaseAuthInterop`, not prebuilt
Skipping `FirebaseCoreDiagnosticsInterop`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec1`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec2`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec3`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec4`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec5`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec6`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec7`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec8`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec/Subspec9`, not prebuilt
Skipping `SomePrivatePod/Core`, not prebuilt
Skipping `SomePrivatePod/SomeSubspec2/Subspec10`, not prebuilt
Skipping `Google-Mobile-Ads-SDK`, not prebuilt
Skipping `VungleSDK-iOS`, not prebuilt
Writing Restore Podfile
Analyzing dependencies
Updating Application Podfile
Running pod install
Analyzing dependencies
Downloading dependencies
Installing FirebaseAnalyticsInterop (1.4.0)
Installing FirebaseAuthInterop (1.0.0)
Installing FirebaseCoreDiagnosticsInterop (1.1.0)
Installing PodBuilder (0.0.1)
Removing AWSCore
Removing AWSPinpoint
Removing AdColony
Removing FBAudienceNetwork
Removing FBSDKCoreKit
Removing SomePrivatePod
Removing Google-Mobile-Ads-SDK
Removing GoogleAppMeasurement
Removing GoogleMobileAdsMediationTestSuite
Removing GoogleUtilities
Removing MDFInternationalization
Removing MDFTextAccessibility
Removing MaterialComponents
Removing SSZipArchive
Removing UnityAds
Removing VungleSDK-iOS
Removing mopub-ios-sdk
Removing nanopb
Generating Pods project

And I see SomePrivatePod being removed while not being prebuilt, though it was added to the force_prebuild_pods. In the Frameworks/Rome directory I see directory named SomePrivatePod (without an extension), which has all the static libraries I am providing. But there is nothing in generated Podfile, and nothing in generated podspec files about these libraries which are just lost.

Otherwise it looks fine, though I can't build my project to be sure because my private pod is missing still. I have linked example of my podspec in the first answer. Still it is much better now!

Should I open another issue? Since adding pod dependencies is now resolved.

I was asking about this previous post where I see Firebase in the output logs

tcamin commented 4 years ago

I just tried in a sample project with just GoogleMobileAdsMediationTestSuite.

The output looks ok, this is the Podfile of the app:

use_frameworks!

target 'SandboxPodBuilder' do
  pod 'PodBuilder/GoogleMobileAdsMediationTestSuite', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
end

pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_duplicate_framework_and_library_names) {}
end

post_install do |installer|
  require 'pod_builder/podfile/post_actions'
  PodBuilder::Podfile::remove_target_support_duplicate_entries
  PodBuilder::Podfile::check_target_support_resource_collisions
end

The subspec that PodBuilder created looks fine as well

  s.subspec 'GoogleMobileAdsMediationTestSuite' do |p|
    p.vendored_frameworks = 'Rome/GoogleMobileAdsMediationTestSuite.framework','Rome/GoogleMobileAds.framework','Rome/GoogleAppMeasurement.framework','Rome/GoogleUtilities.framework','Rome/MDFInternationalization.framework','Rome/MDFTextAccessibility.framework','Rome/MaterialComponents.framework','Rome/nanopb.framework'
    p.frameworks = 'AVFoundation', 'AudioToolbox', 'CFNetwork', 'CoreGraphics', 'CoreMedia', 'CoreTelephony', 'CoreVideo', 'MediaPlayer', 'MessageUI', 'MobileCoreServices', 'QuartzCore', 'Security', 'StoreKit', 'SystemConfiguration'
    p.libraries = 'c++', 'sqlite3', 'z'
  end

I had to add GoogleMobileAdsMediationTestSuite to the force_prebuild_pods.

iKleMiX commented 4 years ago

Alright, I've created minimal testbed, so you can test it. Now it doesn't handle resource bundles and Firebase at all, just so we can focus on something first. My Podfile:

platform :ios, '9.0'

source 'https://cdn.cocoapods.org/'

target :'SomeExample' do    
    pod 'SomePrivatePod/More', :git => 'git@github.com:iKleMiX/SomePrivatePod.git', :tag => '5.3.3'
    pod 'GoogleMobileAdsMediationTestSuite'
end

pre_install do |installer|
    raise "\n🚨  Do not launch 'pod install' manually, use `pod_builder` instead!\n" if !File.exist?('pod_builder.lock')
end

PodBuilder.json:

{
  "project_name": "SomeExample",
  "spec_overrides": {
    "spec_overrides": {
    }
  },
  "skip_licenses": [

  ],
  "skip_pods": [

  ],
  "force_prebuild_pods": [
    "SomePrivatePod", "GoogleMobileAdsMediationTestSuite", "Google-Mobile-Ads-SDK"
  ],
  "build_settings": {
  },
  "build_settings_overrides": {
  },
  "build_system": "Legacy",
  "license_filename": "Pods-acknowledgements",
  "subspecs_to_split": [

  ],
  "lfs_update_gitattributes": false,
  "lfs_include_pods_folder": false
}

Generated Podfile:

# Autogenerated by PodBuilder (https://github.com/Subito-it/PodBuilder)
# Any change to this file should be done on Frameworks/Podfile

platform :ios, '9.0'

source 'https://cdn.cocoapods.org/'

target :'SomeExample' do    
    pod 'PodBuilder/AWSCore', :path => 'Frameworks' # pb<SomePrivatePod/More>
    pod 'PodBuilder/AWSPinpoint', :path => 'Frameworks' # pb<SomePrivatePod/More>
    pod 'PodBuilder/GoogleAppMeasurement', :path => 'Frameworks' # pb<SomePrivatePod/More>
    pod 'PodBuilder/GoogleUtilities', :path => 'Frameworks' # pb<SomePrivatePod/More>
    pod 'PodBuilder/nanopb', :path => 'Frameworks' # pb<SomePrivatePod/More>
    pod 'PodBuilder/GoogleMobileAdsMediationTestSuite', :path => 'Frameworks' # pb<GoogleMobileAdsMediationTestSuite>
end

pre_install do |installer|
    Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_duplicate_framework_and_library_names) {}

end

post_install do |installer|
    require 'pod_builder/podfile/post_actions'
    PodBuilder::Podfile::remove_target_support_duplicate_entries
    PodBuilder::Podfile::check_target_support_resource_collisions

end

⚠️ Doesn't include SomePrivatePod

Generated PodBuilder.Podspec:

Pod::Spec.new do |s|
  s.name             = "PodBuilder"
  s.version          = "0.0.1"
  s.summary          = "Prebuilt frameworks"

  s.description      = <<-DESC
  A set of prebuilt frameworks to make compilation faster
  DESC

  s.homepage         = "https://www.subito.it"
  s.license          = 'Apache License, Version 2.0'
  s.author           = { "Tomas Camin" => "tomas.camin@schibsted.com" }
  s.source           = { :git => "https://www.subito.it", :tag => s.version.to_s }

  s.platform     = :ios, '9.0'
  s.requires_arc = true

  s.subspec 'GoogleMobileAdsMediationTestSuite' do |p|
    p.vendored_frameworks = 'Rome/GoogleMobileAdsMediationTestSuite.framework','Rome/GoogleAppMeasurement.framework','Rome/GoogleUtilities.framework','Rome/MDFInternationalization.framework','Rome/MDFTextAccessibility.framework','Rome/MaterialComponents.framework','Rome/nanopb.framework','Rome/GoogleMobileAds.framework'
    p.frameworks = 'AVFoundation', 'AudioToolbox', 'CFNetwork', 'CoreGraphics', 'CoreMedia', 'CoreTelephony', 'CoreVideo', 'MediaPlayer', 'MessageUI', 'MobileCoreServices', 'QuartzCore', 'Security', 'StoreKit', 'SystemConfiguration'
    p.libraries = 'c++', 'sqlite3', 'z'
    p.dependency 'Google-Mobile-Ads-SDK'
  end

  s.subspec 'AWSCore' do |p|
    p.vendored_frameworks = 'Rome/AWSCore.framework'
    p.frameworks = 'CoreGraphics', 'Foundation', 'Security', 'SystemConfiguration', 'UIKit'
    p.libraries = 'sqlite3', 'z'
  end

  s.subspec 'AWSPinpoint' do |p|
    p.vendored_frameworks = 'Rome/AWSPinpoint.framework','Rome/AWSCore.framework'
    p.frameworks = 'CoreGraphics', 'Foundation', 'Security', 'SystemConfiguration', 'UIKit'
    p.libraries = 'sqlite3', 'z'
  end

  s.subspec 'GoogleAppMeasurement' do |p|
    p.vendored_frameworks = 'Rome/GoogleAppMeasurement.framework','Rome/GoogleUtilities.framework','Rome/nanopb.framework'
    p.frameworks = 'Security', 'StoreKit', 'SystemConfiguration'
    p.libraries = 'c++', 'sqlite3', 'z'
  end

  s.subspec 'GoogleUtilities' do |p|
    p.vendored_frameworks = 'Rome/GoogleUtilities.framework'
    p.frameworks = 'Security', 'SystemConfiguration'
    p.libraries = 'z'
  end

  s.subspec 'MDFInternationalization' do |p|
    p.vendored_frameworks = 'Rome/MDFInternationalization.framework'
  end

  s.subspec 'MDFTextAccessibility' do |p|
    p.vendored_frameworks = 'Rome/MDFTextAccessibility.framework'
  end

  s.subspec 'MaterialComponents' do |p|
    p.vendored_frameworks = 'Rome/MaterialComponents.framework','Rome/MDFInternationalization.framework','Rome/MDFTextAccessibility.framework'
  end

  s.subspec 'nanopb' do |p|
    p.vendored_frameworks = 'Rome/nanopb.framework'
  end
end

full log of build_all:

% pod_builder build_all
Updating local specs repositories
Analyzing dependencies
Pre-downloading: `SomePrivatePod` from `git@github.com:iKleMiX/SomePrivatePod.git`, tag `5.3.3`
Analyzing dependencies
Initialized empty Git repository in /private/tmp/pod_builder_1576173758019/.git/
Analyzing dependencies
Pre-downloading: `SomePrivatePod` from `git@github.com:iKleMiX/SomePrivatePod.git`, tag `5.3.3`
Downloading dependencies
Installing AWSCore (2.6.28)
Installing AWSPinpoint (2.6.28)
Installing Google-Mobile-Ads-SDK (7.51.0)
Installing GoogleAppMeasurement (6.1.6)
Installing GoogleMobileAdsMediationTestSuite (1.1.1)
Installing GoogleUtilities (6.3.2)
Installing MDFInternationalization (2.0.0)
Installing MDFTextAccessibility (2.0.0)
Installing MaterialComponents (94.5.0)
Installing SomePrivatePod (5.3.2)
Installing nanopb (0.3.9011)
Generating Pods project
Skipping User Project Integration
Building frameworks
Built 14 frameworks
Copying 18 frameworks to `Rome`
Pod installation complete! There are 51 dependencies from the Podfile and 11 total pods installed.
Cleaning framework folder
Writing licenses
Generating PodBuilder's local podspec
Skipping `SomePrivatePod/More`, not prebuilt
Skipping `Google-Mobile-Ads-SDK`, not prebuilt
Skipping `SomePrivatePod/Core`, not prebuilt
Writing Restore Podfile
Analyzing dependencies
Updating Application Podfile
Running pod install
Analyzing dependencies
Downloading dependencies
Installing Google-Mobile-Ads-SDK (7.53.0)
Installing GoogleAppMeasurement (6.1.6)
Installing GoogleUtilities (6.3.2)
Installing PodBuilder (0.0.1)
Installing nanopb (0.3.9011)
Generating Pods project
[PodBuilder] Removing target support duplicated entries
[PodBuilder] Checking target support resource collisions
Integrating client project
Pod installation complete! There are 6 dependencies from the Podfile and 5 total pods installed.

🎉 done!

In the result you are losing SomePrivatePod, and getting Google-Mobile-Ads-SDK (7.51.0) prebuilt + Google-Mobile-Ads-SDK (7.53.0) as a dependency + some nanopb with same version prebuilt and as a dependency. I've made https://github.com/iKleMiX/SomePrivatePod sample public so you can test it.

iKleMiX commented 4 years ago

Oh, I just noticed in this sample it did download Google-Mobile-Ads-SDK (7.51.0) but it's not in the generated Podfile nor generated podspec, though it resides in Frameworks/Rome

tcamin commented 4 years ago

One limitation of PodBuilder is that it won't generate an output framework for umbrella frameworks or in general pods that do not directly contain buildable source code. It will however generate framework of the dependencies (again if they contain source code).

Take for example the Firebase podspec (https://github.com/firebase/firebase-ios-sdk/blob/master/Firebase.podspec)

The podspec itself and the default subspec do not reference any source code to build.

However adding "Firebase" to "force_prebuild_pods" will prebuild it's dependencies.

Since PodBuilder does not produce the Firebase umbrella framework you'll have to change some imports in your source code (depending on the case for example import Firebase with import FirebaseCore), but it's a minor drawback compared to the amount of code that it will prebuild (in case of Firebase+FirebasPerformance it was in the range of 120kLoC removed from the project).

I hope this explains the similar behaviour that happens with your SomePrivatePod.

iKleMiX commented 4 years ago

So as I understand you correctly, missing SomePrivatePod with its libraries case won't be fixed?

tcamin commented 4 years ago

The latest version of PodBuilder should work with SomePrivatePod the same way it does with Firebase you should just add it to force_prebuild_pods.

braysonjohn148 commented 3 years ago

I have an internet problem. Downloading Google-Mobile-Ads-SDK take long time and brings an error before complete. I downloaded it with my browser i have the folder. Where do i add it so as it shouldnt download from internet rather, install from the local location.

tcamin commented 3 years ago

It depends what you downloaded, https://guides.cocoapods.org/using/the-podfile.html#using-the-files-from-a-folder-local-to-the-machine might help. I would suggest however to address the question on the CocoaPods repo since it isn't a specific PodBuilder issue.