googlesamples / unity-jar-resolver

Unity plugin which resolves Android & iOS dependencies and performs version management
Other
1.29k stars 350 forks source link

[Question] EDM resolution based on define symbols #659

Closed SamTyurenkov closed 2 months ago

SamTyurenkov commented 11 months ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the question here:

I am building two separate builds using define symbols, e.g. GOOGLE_PLAY_BUILD & RUSTORE_BUILD In C# I have code blocks specific to those builds and want to use different SDKs in different builds.

However, I noticed that all dependencies are resolved and added to mainTemplate.gradle in both GP build and RUSTORE build. Is there a way to resolve libraries based on current define symbols only and not include all libraries that are available in Android folder?

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
    implementation 'androidx.activity:activity-ktx:1.5.1' // Assets/RuStoreSDK/Review/Editor/ReviewDependencies.xml:12
    implementation 'androidx.appcompat:appcompat:1.4.2' // Assets/RuStoreSDK/Review/Editor/ReviewDependencies.xml:11
    implementation 'androidx.core:core-ktx:1.8.0' // Assets/RuStoreSDK/Review/Editor/ReviewDependencies.xml:16
    implementation 'androidx.lifecycle:lifecycle-process:2.4.1' // Assets/YandexMobileAds/Editor/YandexMobileadsDependencies.xml:20
    implementation 'androidx.lifecycle:lifecycle-viewmodel:2.5.1' // Assets/RuStoreSDK/BillingClient/Editor/BillingClientDependencies.xml:8
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1' // Assets/RuStoreSDK/BillingClient/Editor/BillingClientDependencies.xml:9
    implementation 'com.google.ads.mediation:unity:4.8.0.0' // Assets/GoogleMobileAds/Mediation/UnityAds/Editor/UnityMediationDependencies.xml:25
    // implementation 'com.google.android.gms:play-services-ads:22.2.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
    implementation 'com.google.android.gms:play-services-ads:22.3.0' // Assets/YandexMobileAds/Editor/MobileadsGoogleMediationDependencies.xml:10
    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' // Assets/AdIdPlugin/Editor/AdIdDependencies.xml:30
    implementation 'com.google.android.material:material:1.6.1' // Assets/RuStoreSDK/Review/Editor/ReviewDependencies.xml:17
    implementation 'com.google.android.ump:user-messaging-platform:2.0.0' // Assets/GoogleMobileAds/Editor/GoogleUmpDependencies.xml:7
    implementation 'com.unity3d.ads:unity-ads:4.8.0' // Assets/GoogleMobileAds/Mediation/UnityAds/Editor/UnityMediationDependencies.xml:33
    implementation 'com.yandex.ads.mediation:mobileads-google:22.2.0.0' // Assets/YandexMobileAds/Editor/MobileadsGoogleMediationDependencies.xml:16
    implementation 'com.yandex.ads.mediation:mobileads-unityads:4.9.0.0' // Assets/YandexMobileAds/Editor/MobileadsUnityAdsMediationDependencies.xml:14
    implementation 'com.yandex.android:mobileads:6.1.0' // Assets/YandexMobileAds/Editor/YandexMobileadsDependencies.xml:15
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10' // Assets/RuStoreSDK/Review/Editor/ReviewDependencies.xml:15
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4' // Assets/RuStoreSDK/Review/Editor/ReviewDependencies.xml:9
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' // Assets/RuStoreSDK/Review/Editor/ReviewDependencies.xml:14
    implementation 'ru.rustore.sdk:appupdate:0.2.0' // Assets/RuStoreSDK/AppUpdate/Editor/AppUpdateDependencies.xml:7
    implementation 'ru.rustore.sdk:billingclient:2.2.0' // Assets/RuStoreSDK/BillingClient/Editor/BillingClientDependencies.xml:7
    implementation 'ru.rustore.sdk:review:0.1.4' // Assets/RuStoreSDK/Review/Editor/ReviewDependencies.xml:7
// Android Resolver Dependencies End
**DEPS**}
google-oss-bot commented 11 months ago

This issue does not seem to follow the issue template. Make sure you provide all the required information.

a-maurice commented 2 months ago

There isn't a built in way to do this in EDM4U, and unfortunately don't think we could reasonably add it.

One potential option that could do is add an editor script that based on the define symbols modifies the *Dependencies.xml file, though you might need to trigger ForceResolves when it changes.