diff --git a/.allstar/binary_artifacts.yaml b/.allstar/binary_artifacts.yaml new file mode 100644 index 00000000..77feaba6 --- /dev/null +++ b/.allstar/binary_artifacts.yaml @@ -0,0 +1,4 @@ +# Exemption reason: Binary files are either for testing or part of the release artifacts. +# Exemption timeframe: permanent +optConfig: + optOut: true diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..27399da4 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,90 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Workflow to build EDM4U packages and compute their hash +name: Build + +on: + schedule: + - cron: "0 10 * * *" # 10am UTC = 2am PST + + workflow_dispatch: + inputs: + unity_version: + description: 'Unity version' + default: '2019' + type: string + required: true + +env: + # Use SHA256 for hashing files. + hashCommand: "sha256sum" + +jobs: + check_and_prepare: + runs-on: ubuntu-latest + outputs: + unity_version: ${{ steps.set_outputs.outputs.unity_version }} + steps: + - id: set_outputs + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "unity_version=${{ github.event.inputs.unity_version }}" >> $GITHUB_OUTPUT + else + # inputs are not available for non "workflow_dispatch" events. Therefore, set default value here. + echo "unity_version=2019" >> $GITHUB_OUTPUT + fi + + - name: Print output + run: | + echo outputs.unity_version : ${{ steps.set_outputs.outputs.unity_version }} + + build_macos: + name: build-macos-unity${{ needs.check_and_prepare.outputs.unity_version }} + needs: [check_and_prepare] + uses: ./.github/workflows/build_macos.yaml + with: + unity_version: ${{ needs.check_and_prepare.outputs.unity_version }} + + finalizing: + # Only compute SHA hash for macOS build + name: finalizing-macOS-unity${{ needs.check_and_prepare.outputs.unity_version }} + needs: [check_and_prepare, build_macos] + runs-on: ubuntu-latest + steps: + - name: Fetch All builds + uses: actions/download-artifact@v3 + with: + path: built_artifact + + - name: Compute Plugin Hash + shell: bash + run: | + # Compute hash for .tgz package + pushd built_artifact/TarballPackage_macOS + tgz_files_list=$(find -type f -name '*.tgz') + for tgz_file in "${tgz_files_list[@]}"; do + echo tgz_file + ${{ env.hashCommand }} --tag ${tgz_file} >> edm4u_hash.txt + done + echo "::warning ::$(cat edm4u_hash.txt)" + popd + + # Compute hash for .unitypackage package + pushd built_artifact/AssetPackage_macOS + ${{ env.hashCommand }} --tag external-dependency-manager.unitypackage >> edm4u_hash.txt + echo "::warning ::$(cat edm4u_hash.txt)" + popd + + diff --git a/.github/workflows/build_macos.yaml b/.github/workflows/build_macos.yaml new file mode 100644 index 00000000..48a8b97f --- /dev/null +++ b/.github/workflows/build_macos.yaml @@ -0,0 +1,105 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Workflow to build EDM4U packages on macOS +name: Build macOS (SubWorkflow) + +on: + workflow_call: + inputs: + unity_version: + description: 'Unity version' + default: '2019' + type: string + required: true + +env: + pythonVersion: '3.7' + artifactRetentionDays: 2 + assetPackageArtifactName: "AssetPackage_macOS" + tarballPackageArtifactName: "TarballPackage_macOS" + +jobs: + build_desktop: + name: build-macOS-unity${{ inputs.unity_version}} + runs-on: macos-13 + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v3 + + - id: build_setup + uses: ./gha/build_setup + timeout-minutes: 30 + with: + unity_version: ${{ inputs.unity_version }} + platform: macOS + python_version: ${{ env.pythonVersion }} + unity_username: ${{ secrets.UNITY_USERNAME }} + unity_password: ${{ secrets.UNITY_PASSWORD }} + unity_serial_id: ${{ secrets.SERIAL_ID }} + + - name: Set Unity Env for EDM4U build script + shell: bash + run: echo "UNITY_EXE=${{ env.UNITY_ROOT_DIR }}/Unity.app/Contents/MacOS/Unity" >> $GITHUB_ENV + + - name: Force Java 8 + shell: bash + run: echo "JAVA_HOME=${JAVA_HOME_8_X64}" >> $GITHUB_ENV + + # Build .unitypackage + - run: ./gradlew buildPlugin --info + + # Build .tgz + - run: ./gradlew buildUpmPlugin --info + + - name: Return Unity license + if: always() + uses: firebase/firebase-unity-sdk/gha/unity@main + with: + version: ${{ inputs.unity_version }} + release_license: "true" + + - name: Check build files + shell: bash + run: | + if [ -f build/external-dependency-manager.unitypackage ]; then + echo "external-dependency-manager.unitypackage zip created." + else + echo "Fail to create external-dependency-manager.unitypackage." + exit 1 + fi + if ls build/com.google.external-dependency-manager*.tgz 1> /dev/null 2>&1; then + echo "com.google.external-dependency-manager.tgz created." + else + echo "Fail to create com.google.external-dependency-manager.tgz ." + exit 1 + fi + + - name: Upload build results artifact + uses: actions/upload-artifact@v3 + if: ${{ !cancelled() }} + with: + name: ${{ env.assetPackageArtifactName }} + path: build/external-dependency-manager.unitypackage + retention-days: ${{ env.artifactRetentionDays }} + + - name: Upload build results artifact + uses: actions/upload-artifact@v3 + if: ${{ !cancelled() }} + with: + name: ${{ env.tarballPackageArtifactName }} + path: build/com.google.external-dependency-manager-*.tgz + retention-days: ${{ env.artifactRetentionDays }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..a2bff30f --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,176 @@ +name: Test + +on: + schedule: + - cron: "0 11 * * *" # 11am UTC = 3`am PST + + pull_request: + types: [ labeled, closed ] + + workflow_dispatch: + inputs: + unity_version: + description: 'Unity version (value: 2018, 2019, 2020)' + default: '2019' + required: true + include_test_types: + description: 'Specify the only types of tests to run, separated by comma. See TestTypesEnum in build.gradle for options.' + default: '' + required: false + exclude_test_types: + description: 'Specify the types of tests to exclude, separated by comma. See TestTypesEnum in build.gradle for options.' + default: '' + required: false + include_test_modules: + description: 'Specify the only modules to test against, separated by comma. See TestModulesEnum in build.gradle for options.' + default: '' + required: false + exclude_test_modules: + description: 'Specify the modules to exclude from testing against, separated by comma. See TestModulesEnum in build.gradle for options.' + default: '' + required: false + exclude_tests: + description: 'Specify the tests to exclude, separated by comma. See the tasks in build.gradle for options.' + default: '' + required: false + +env: + pythonVersion: '3.7' + artifactRetentionDays: 2 + +jobs: + check_and_prepare: + runs-on: ubuntu-latest + outputs: + unity_version: ${{ steps.set_outputs.outputs.unity_version }} + include_test_types: ${{ steps.set_outputs.outputs.include_test_types }} + exclude_test_types: ${{ steps.set_outputs.outputs.exclude_test_types }} + include_test_modules: ${{ steps.set_outputs.outputs.include_test_modules }} + exclude_test_modules: ${{ steps.set_outputs.outputs.exclude_test_modules }} + exclude_tests: ${{ steps.set_outputs.outputs.exclude_tests }} + steps: + - id: set_outputs + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "unity_version=${{ github.event.inputs.unity_version }}" >> $GITHUB_OUTPUT + echo "include_test_types=${{ github.event.inputs.include_test_types }}" >> $GITHUB_OUTPUT + echo "exclude_test_types=${{ github.event.inputs.exclude_test_types }}" >> $GITHUB_OUTPUT + echo "include_test_modules=${{ github.event.inputs.include_test_modules }}" >> $GITHUB_OUTPUT + echo "exclude_test_modules=${{ github.event.inputs.exclude_test_modules }}" >> $GITHUB_OUTPUT + echo "exclude_tests=${{ github.event.inputs.exclude_tests }}" >> $GITHUB_OUTPUT + else + # inputs are not available for non "workflow_dispatch" events. Therefore, set default value here. + echo "unity_version=2019" >> $GITHUB_OUTPUT + echo "include_test_types=" >> $GITHUB_OUTPUT + echo "exclude_test_types=" >> $GITHUB_OUTPUT + echo "include_test_modules=" >> $GITHUB_OUTPUT + echo "exclude_test_modules=" >> $GITHUB_OUTPUT + echo "exclude_tests=" >> $GITHUB_OUTPUT + + # This is currently checking for invalid trigger only. + if [[ "${{ github.event_name }}" == "schedule" ]]; then + # Do nothing for now + : + elif [[ "${{ github.event_name }}" == "pull_request" ]]; then + if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "tests-requested" ]]; then + # Do nothing for now + : + elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged == true}}" == "true" ]]; then + # Do nothing for now + : + else + echo "invalid_trigger=1" >> $GITHUB_OUTPUT + fi + else + echo "invalid_trigger=1" >> $GITHUB_OUTPUT + fi + fi + + - name: Cancel workflow + if: ${{ steps.set_outputs.outputs.invalid_trigger }} + uses: andymckay/cancel-action@0.2 + + - name: Wait for workflow cancellation + if: ${{ steps.set_outputs.outputs.invalid_trigger }} + run: | + sleep 300 + exit 1 # fail out if the cancellation above somehow failed. + + - name: Print output + run: | + echo outputs.unity_version : ${{ steps.set_outputs.outputs.unity_version }} + echo outputs.include_test_types : ${{ steps.set_outputs.outputs.include_test_types }} + echo outputs.exclude_test_types : ${{ steps.set_outputs.outputs.exclude_test_types }} + echo outputs.include_test_modules : ${{ steps.set_outputs.outputs.include_test_modules }} + echo outputs.exclude_test_modules : ${{ steps.set_outputs.outputs.exclude_test_modules }} + echo outputs.exclude_tests : ${{ steps.set_outputs.outputs.exclude_tests }} + + test_on_macos: + name: test-macOS-unity${{ needs.check_and_prepare.outputs.unity_version }} + runs-on: macos-13 + needs: [check_and_prepare] + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - id: build_setup + uses: ./gha/build_setup + timeout-minutes: 30 + with: + unity_version: ${{ needs.check_and_prepare.outputs.unity_version }} + platform: macOS + python_version: ${{ env.pythonVersion }} + unity_username: ${{ secrets.UNITY_USERNAME }} + unity_password: ${{ secrets.UNITY_PASSWORD }} + unity_serial_id: ${{ secrets.SERIAL_ID }} + + - name: Set Unity Env for EDM4U build script + shell: bash + run: echo "UNITY_EXE=${{ env.UNITY_ROOT_DIR }}/Unity.app/Contents/MacOS/Unity" >> $GITHUB_ENV + + - name: Force Java 8 + shell: bash + run: echo "JAVA_HOME=${JAVA_HOME_8_X64}" >> $GITHUB_ENV + + - name: Run tests + shell: bash + timeout-minutes: 60 + run: | + ./gradlew test -q \ + -PINTERACTIVE_MODE_TESTS_ENABLED=0 \ + -PINCLUDE_TEST_TYPES="${{ needs.check_and_prepare.outputs.include_test_types }}" \ + -PEXCLUDE_TEST_TYPES="${{ needs.check_and_prepare.outputs.exclude_test_types }}" \ + -PINCLUDE_TEST_MODULES="${{ needs.check_and_prepare.outputs.include_test_modules }}" \ + -PEXCLUDE_TEST_MODULES="${{ needs.check_and_prepare.outputs.exclude_test_modules }}" \ + -PEXCLUDE_TESTS="${{ needs.check_and_prepare.outputs.exclude_tests }}" + + - name: Print test log + if: always() + shell: bash + continue-on-error: true + run: cat test_output/test*IntegrationTestsBatchMode/*.log + + - name: Obtain Failed tests from Integration tests and NUnit tests + if: always() + shell: bash + continue-on-error: true + run: | + # Quick and dirty way to get all failed tests in granular level. + # TODO: better parser for more information, ex. error message. + { cat test_output/test*/*_test.log || true; } | { grep "^Test .* FAILED$" || true; } + { cat test_output/test*/test*/results.xml || true; } | { grep '^ * @@ -244,20 +138,22 @@ the set of a plugin's Android dependencies: The version specification (last component) supports: - * Specific versions e.g `9.8.0` - * Partial matches e.g `9.8.+` would match 9.8.0, 9.8.1 etc. choosing the most - recent version. - * Latest version using `LATEST` or `+`. We do *not* recommend using this - unless you're 100% sure the library you depend upon will not break your - Unity plugin in future. +* Specific versions e.g `9.8.0` + +* Partial matches e.g `9.8.+` would match 9.8.0, 9.8.1 etc. choosing the most + recent version + +* Latest version using `LATEST` or `+`. We do *not* recommend using this + unless you're 100% sure the library you depend upon will not break your + Unity plugin in future The above example specifies the dependency as a component of the Android SDK manager such that the Android SDK manager will be executed to install the -package if it's not found. If your Android dependency is located on Maven +package if it's not found. If your Android dependency is located on Maven central it's possible to specify the package simply using the `androidPackage` element: -``` +```xml @@ -265,170 +161,157 @@ element: ``` -## Auto-resolution +#### Auto-resolution By default the Android Resolver automatically monitors the dependencies you have -specified and the `Plugins/Android` folder of your Unity project. The -resolution process runs when the specified dependencies are not present in your -project. +specified and the `Plugins/Android` folder of your Unity project. The resolution +process runs when the specified dependencies are not present in your project. -The *auto-resolution* process can be disabled via the -`Assets > External Dependency Manager > Android Resolver > Settings` menu. +The *auto-resolution* process can be disabled via the `Assets > External +Dependency Manager > Android Resolver > Settings` menu. Manual resolution can be performed using the following menu options: - * `Assets > External Dependency Manager > Android Resolver > Resolve` - * `Assets > External Dependency Manager > Android Resolver > Force Resolve` +* `Assets > External Dependency Manager > Android Resolver > Resolve` + +* `Assets > External Dependency Manager > Android Resolver > Force Resolve` -## Deleting libraries +#### Deleting libraries -Resolved packages are tracked via asset labels by the Android Resolver. -They can easily be deleted using the -`Assets > External Dependency Manager > Android Resolver > Delete Resolved Libraries` -menu item. +Resolved packages are tracked via asset labels by the Android Resolver. They can +easily be deleted using the `Assets > External Dependency Manager > Android +Resolver > Delete Resolved Libraries` menu item. -## Android Manifest Variable Processing +#### Android Manifest Variable Processing Some AAR files (for example play-services-measurement) contain variables that -are processed by the Android Gradle plugin. Unfortunately, Unity does not +are processed by the Android Gradle plugin. Unfortunately, Unity does not perform the same processing when using Unity's Internal Build System, so the -Android Resolver plugin handles known cases of this variable substitution -by exploding the AAR into a folder and replacing `${applicationId}` with the +Android Resolver plugin handles known cases of this variable substitution by +exploding the AAR into a folder and replacing `${applicationId}` with the `bundleID`. Disabling AAR explosion and therefore Android manifest processing can be done via the `Assets > External Dependency Manager > Android Resolver > Settings` -menu. You may want to disable explosion of AARs if you're exporting a project -to be built with Gradle / Android Studio. +menu. You may want to disable explosion of AARs if you're exporting a project to +be built with Gradle/Android Studio. -## ABI Stripping +#### ABI Stripping -Some AAR files contain native libraries (.so files) for each ABI supported -by Android. Unfortunately, when targeting a single ABI (e.g x86), Unity does -not strip native libraries for unused ABIs. To strip unused ABIs, the Android -Resolver plugin explodes an AAR into a folder and removes unused ABIs to -reduce the built APK size. Furthermore, if native libraries are not stripped -from an APK (e.g you have a mix of Unity's x86 library and some armeabi-v7a -libraries) Android may attempt to load the wrong library for the current -runtime ABI completely breaking your plugin when targeting some architectures. +Some AAR files contain native libraries (.so files) for each ABI supported by +Android. Unfortunately, when targeting a single ABI (e.g x86), Unity does not +strip native libraries for unused ABIs. To strip unused ABIs, the Android +Resolver plugin explodes an AAR into a folder and removes unused ABIs to reduce +the built APK size. Furthermore, if native libraries are not stripped from an +APK (e.g you have a mix of Unity's x86 library and some armeabi-v7a libraries) +Android may attempt to load the wrong library for the current runtime ABI +completely breaking your plugin when targeting some architectures. -AAR explosion and therefore ABI stripping can be disabled via the -`Assets > External Dependency Manager > Android Resolver > Settings` menu. -You may want to disable explosion of AARs if you're exporting a project to be -built with Gradle / Android Studio. +AAR explosion and therefore ABI stripping can be disabled via the `Assets > +External Dependency Manager > Android Resolver > Settings` menu. You may want to +disable explosion of AARs if you're exporting a project to be built with +Gradle/Android Studio. -## Resolution Strategies +#### Resolution Strategies By default the Android Resolver will use Gradle to download dependencies prior -to integrating them into a Unity project. This works with Unity's internal -build system and Gradle / Android Studio project export. +to integrating them into a Unity project. This works with Unity's internal build +system and Gradle/Android Studio project export. -It's possible to change the resolution strategy via the -`Assets > External Dependency Manager > Android Resolver > Settings` menu. +It's possible to change the resolution strategy via the `Assets > External +Dependency Manager > Android Resolver > Settings` menu. -### Download Artifacts with Gradle +##### Download Artifacts with Gradle Using the default resolution strategy, the Android resolver executes the following operations: - - Remove the result of previous Android resolutions. - e.g Delete all files and directories labeled with "gpsr" under - `Plugins/Android` from the project. - - Collect the set of Android dependencies (libraries) specified by a - project's `*Dependencies.xml` files. - - Run `download_artifacts.gradle` with Gradle to resolve conflicts and, - if successful, download the set of resolved Android libraries (AARs, JARs). - - Process each AAR / JAR so that it can be used with the currently selected - Unity build system (e.g Internal vs. Gradle, Export vs. No Export). - This involves patching each reference to `applicationId` in the - AndroidManifest.xml with the project's bundle ID. This means resolution - must be run if the bundle ID is changed again. - - Move the processed AARs to `Plugins/Android` so they will be included when - Unity invokes the Android build. - -### Integrate into mainTemplate.gradle +- Remove the result of previous Android resolutions. E.g Delete all files and + directories labeled with "gpsr" under `Plugins/Android` from the project. + +- Collect the set of Android dependencies (libraries) specified by a project's + `*Dependencies.xml` files. + +- Run `download_artifacts.gradle` with Gradle to resolve conflicts and, if + successful, download the set of resolved Android libraries (AARs, JARs). + +- Process each AAR/JAR so that it can be used with the currently selected + Unity build system (e.g Internal vs. Gradle, Export vs. No Export). This + involves patching each reference to `applicationId` in the + `AndroidManifest.xml` with the project's bundle ID. This means resolution + must be run again if the bundle ID has changed. + +- Move the processed AARs to `Plugins/Android` so they will be included when + Unity invokes the Android build. + +##### Integrate into mainTemplate.gradle Unity 5.6 introduced support for customizing the `build.gradle` used to build Unity projects with Gradle. When the *Patch mainTemplate.gradle* setting is enabled, rather than downloading artifacts before the build, Android resolution results in the execution of the following operations: - - Remove the result of previous Android resolutions. - e.g Delete all files and directories labeled with "gpsr" under - `Plugins/Android` from the project and remove sections delimited with - `// Android Resolver * Start` and `// Android Resolver * End` lines. - - Collect the set of Android dependencies (libraries) specified by a - project's `*Dependencies.xml` files. - - Rename any `.srcaar` files in the build to `.aar` and exclude them from - being included directly by Unity in the Android build as - `mainTemplate.gradle` will be patched to include them instead from their - local maven repositories. - - Inject the required Gradle repositories into `mainTemplate.gradle` at the - line matching the pattern - `.*apply plugin: 'com\.android\.(application|library)'.*` or the section - starting at the line `// Android Resolver Repos Start`. - If you want to control the injection point in the file, the section - delimited by the lines `// Android Resolver Repos Start` and - `// Android Resolver Repos End` should be placed in the global scope - before the `dependencies` section. - - Inject the required Android dependencies (libraries) into - `mainTemplate.gradle` at the line matching the pattern `***DEPS***` or - the section starting at the line `// Android Resolver Dependencies Start`. - If you want to control the injection point in the file, the section - delimited by the lines `// Android Resolver Dependencies Start` and - `// Android Resolver Dependencies End` should be placed in the - `dependencies` section. - - Inject the packaging options logic, which excludes architecture specific - libraries based upon the selected build target, into `mainTemplate.gradle` - at the line matching the pattern `android +{` or the section starting at - the line `// Android Resolver Exclusions Start`. - If you want to control the injection point in the file, the section - delimited by the lines `// Android Resolver Exclusions Start` and - `// Android Resolver Exclusions End` should be placed in the global - scope before the `android` section. - -## Dependency Tracking +- Remove the result of previous Android resolutions. E.g Delete all files and + directories labeled with "gpsr" under `Plugins/Android` from the project and + remove sections delimited with `// Android Resolver * Start` and `// Android + Resolver * End` lines. + +- Collect the set of Android dependencies (libraries) specified by a project's + `*Dependencies.xml` files. + +- Rename any `.srcaar` files in the build to `.aar` and exclude them from + being included directly by Unity in the Android build as + `mainTemplate.gradle` will be patched to include them instead from their + local maven repositories. + +- Inject the required Gradle repositories into `mainTemplate.gradle` at the + line matching the pattern `.*apply plugin: + 'com\.android\.(application|library)'.*` or the section starting at the line + `// Android Resolver Repos Start`. If you want to control the injection + point in the file, the section delimited by the lines `// Android Resolver + Repos Start` and `// Android Resolver Repos End` should be placed in the + global scope before the `dependencies` section. + +- Inject the required Android dependencies (libraries) into + `mainTemplate.gradle` at the line matching the pattern `***DEPS***` or the + section starting at the line `// Android Resolver Dependencies Start`. If + you want to control the injection point in the file, the section delimited + by the lines `// Android Resolver Dependencies Start` and `// Android + Resolver Dependencies End` should be placed in the `dependencies` section. + +- Inject the packaging options logic, which excludes architecture specific + libraries based upon the selected build target, into `mainTemplate.gradle` + at the line matching the pattern `android +{` or the section starting at the + line `// Android Resolver Exclusions Start`. If you want to control the + injection point in the file, the section delimited by the lines `// Android + Resolver Exclusions Start` and `// Android Resolver Exclusions End` should + be placed in the global scope before the `android` section. + +#### Dependency Tracking The Android Resolver creates the `ProjectSettings/AndroidResolverDependencies.xml` to quickly determine the set -of resolved dependencies in a project. This is used by the auto-resolution +of resolved dependencies in a project. This is used by the auto-resolution process to only run the expensive resolution process when necessary. -## Displaying Dependencies +#### Displaying Dependencies -It's possible to display the set of dependencies the Android Resolver -would download and process in your project via the -`Assets > External Dependency Manager > Android Resolver > Display Libraries` -menu item. +It's possible to display the set of dependencies the Android Resolver would +download and process in your project via the `Assets > External Dependency +Manager > Android Resolver > Display Libraries` menu item. -# iOS Resolver Usage +### iOS Resolver The iOS resolver component of this plugin manages -[CocoaPods](https://cocoapods.org/). A CocoaPods `Podfile` is generated and -the `pod` tool is executed as a post build process step to add dependencies -to the Xcode project exported by Unity. +[CocoaPods](https://cocoapods.org/). A CocoaPods `Podfile` is generated and the +`pod` tool is executed as a post build process step to add dependencies to the +Xcode project exported by Unity. Dependencies for iOS are added by referring to CocoaPods. - 1. Add the `external-dependency-manager-*.unitypackage` to your plugin - project (assuming you are developing a plugin). If you are redistributing - EDM4U with your plugin, you **must** follow the - import steps in the [Getting Started](#getting-started) section! - - 2. Copy and rename the - [SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) - file into your plugin and add the dependencies your plugin requires. - - The XML file just needs to be under an `Editor` directory and match the - name `*Dependencies.xml`. For example, - `MyPlugin/Editor/MyPluginDependencies.xml`. - - 3. Follow the steps in the [Getting Started](#getting-started) - section when you are exporting your plugin package. - For example, to add the AdMob pod, version 7.0 or greater with bitcode enabled: -``` +```xml ``` -## Integration Strategies +#### Integration Strategies The `CocoaPods` are either: - * Downloaded and injected into the Xcode project file directly, rather than - creating a separate xcworkspace. We call this `Xcode project` integration. - * If the Unity version supports opening a xcworkspace file, the `pod` tool - is used as intended to generate a xcworkspace which references the - CocoaPods. We call this `Xcode workspace` integration. -The resolution strategy can be changed via the -`Assets > External Dependency Manager > iOS Resolver > Settings` menu. +* Downloaded and injected into the Xcode project file directly, rather than + creating a separate xcworkspace. We call this `Xcode project` integration. + +* If the Unity version supports opening a xcworkspace file, the `pod` tool is + used as intended to generate a xcworkspace which references the CocoaPods. + We call this `Xcode workspace` integration. + +The resolution strategy can be changed via the `Assets > External Dependency +Manager > iOS Resolver > Settings` menu. + +##### Appending text to generated Podfile -### Appending text to generated Podfile In order to modify the generated Podfile you can create a script like this: -``` + +```csharp using System.IO; -public class PostProcessIOS : MonoBehaviour { -[PostProcessBuildAttribute(45)]//must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's added before "pod install" (50) -private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) + +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEngine; + +public class PostProcessIOS : MonoBehaviour { - if (target == BuildTarget.iOS) + // Must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and + // that it's added before "pod install" (50). + [PostProcessBuildAttribute(45)] + private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) { - - using (StreamWriter sw = File.AppendText(buildPath + "/Podfile")) + if (target == BuildTarget.iOS) { - //in this example I'm adding an app extension - sw.WriteLine("\ntarget 'NSExtension' do\n pod 'Firebase/Messaging', '6.6.0'\nend"); + using (StreamWriter sw = File.AppendText(buildPath + "/Podfile")) + { + // E.g. add an app extension + sw.WriteLine("\ntarget 'NSExtension' do\n pod 'Firebase/Messaging', '6.6.0'\nend"); + } } } } ``` -# Package Manager Resolver Usage +### Package Manager Resolver Adding registries to the -[Package Manager](https://docs.unity3d.com/Manual/Packages.html) -(PM) is a manual process. The Package Manager Resolver (PMR) component -of this plugin makes it easy for plugin maintainers to distribute new PM -registry servers and easy for plugin users to manage PM registry servers. - -## Adding Registries - - 1. Add the `external-dependency-manager-*.unitypackage` to your plugin - project (assuming you are developing a plugin). If you are redistributing - EDM4U with your plugin, you **must** follow the - import steps in the [Getting Started](#getting-started) section! +[Package Manager](https://docs.unity3d.com/Manual/Packages.html) (PM) is a +manual process. The Package Manager Resolver (PMR) component of this plugin +makes it easy for plugin maintainers to distribute new PM registry servers and +easy for plugin users to manage PM registry servers. - 2. Copy and rename the - [SampleRegistries.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/sample/Assets/ExternalDependencyManager/Editor/SampleRegistries.xml) - file into your plugin and add the registries your plugin requires. - - The XML file just needs to be under an `Editor` directory and match the - name `*Registries.xml` or labeled with `gumpr_registries`. For example, - `MyPlugin/Editor/MyPluginRegistries.xml`. - - 3. Follow the steps in the [Getting Started](#getting-started) - section when you are exporting your plugin package. +#### Adding Registries For example, to add a registry for plugins in the scope `com.coolstuff`: -``` +```xml External Dependency Manager > Package Manager Resolver > - Add Registries` will prompt the user with a window which allows them to - add registries discovered in the project to the Package Manager. -* `Assets > External Dependency Manager > Package Manager Resolver > - Remove Registries` will prompt the user with a window which allows them to - remove registries discovered in the project from the Package Manager. -* `Assets > External Dependency Manager > Package Manager Resolver > - Modify Registries` will prompt the user with a window which allows them to - add or remove registries discovered in the project. - -## Migration - -PMR can migrate Version Handler packages installed in the `Assets` folder -to PM packages. This requires the plugins to implement the following: - -* `.unitypackage` must include a Version Handler manifests that describes - the components of the plugin. If the plugin has no dependencies - the manifest would just include the files in the plugin. -* The PM package JSON provided by the registry must include a keyword - (in the `versions.VERSION.keyword` list) that maps the PM package - to a Version Handler package using the format - `vh-name:VERSION_HANDLER_MANIFEST_NAME` where `VERSION_HANDLER_MANIFEST_NAME` - is the name of the manifest defined in the `.unitypackage`. For - more information see the description of the `gvhp_manifestname` asset label - in the *Version Handler Usage* section. - -When using the `Assets > External Dependency Manager > -Package Manager Resolver > Migrate Packages` menu option, PMR then -will: - -* List all Version Handler manager packages in the project. -* Search all available packages in the PM registries and fetch keywords - associated with each package parsing the Version Handler manifest names - for each package. -* Map each installed Version Handler package to a PM package. -* Prompt the user to migrate the discovered packages. -* Perform package migration for all selected packages if the user clicks - the `Apply` button. - -## Configuration - -PMR can be configured via the `Assets > External Dependency Manager > -Package Manager Resolver > Settings` menu option: - -* `Add package registries` when enabled, when the plugin loads or registry - configuration files change, this will prompt the user to add registries - that are not present in the Package Manager. -* `Prompt to add package registries` will cause a developer to be prompted - with a window that will ask for confirmation before adding registries. - When this is disabled registries are added silently to the project. -* `Prompt to migrate packages` will cause a developer to be prompted - with a window that will ask for confirmation before migrating packages - installed in the `Assets` directory to PM packages. -* `Enable Analytics Reporting` when enabled, reports the use of the plugin - to the developers so they can make imrpovements. -* `Verbose logging` when enabled prints debug information to the console - which can be useful when filing bug reports. - -# Version Handler Usage +#### Managing Registries + +It's possible to add and remove registries that are specified via PMR XML +configuration files via the following menu options: + +* `Assets > External Dependency Manager > Package Manager Resolver > Add + Registries` will prompt the user with a window which allows them to add + registries discovered in the project to the Package Manager. + +* `Assets > External Dependency Manager > Package Manager Resolver > Remove + Registries` will prompt the user with a window which allows them to remove + registries discovered in the project from the Package Manager. + +* `Assets > External Dependency Manager > Package Manager Resolver > Modify + Registries` will prompt the user with a window which allows them to add or + remove registries discovered in the project. + +#### Migration + +PMR can migrate Version Handler packages installed in the `Assets` folder to PM +packages. This requires the plugins to implement the following: + +* `.unitypackage` must include a Version Handler manifests that describes the + components of the plugin. If the plugin has no dependencies the manifest + would just include the files in the plugin. + +* The PM package JSON provided by the registry must include a keyword (in the + `versions.VERSION.keyword` list) that maps the PM package to a Version + Handler package using the format `vh-name:VERSION_HANDLER_MANIFEST_NAME` + where `VERSION_HANDLER_MANIFEST_NAME` is the name of the manifest defined in + the `.unitypackage`. For more information see the description of the + `gvhp_manifestname` asset label in the [Version Handler](#version-handler) + section. + +When using the `Assets > External Dependency Manager > Package Manager +Resolver > Migrate Packages` menu option, PMR then will: + +* List all Version Handler manager packages in the project. + +* Search all available packages in the PM registries and fetch keywords + associated with each package parsing the Version Handler manifest names for + each package. + +* Map each installed Version Handler package to a PM package. + +* Prompt the user to migrate the discovered packages. + +* Perform package migration for all selected packages if the user clicks the + `Apply` button. + +#### Configuration + +PMR can be configured via the `Assets > External Dependency Manager > Package +Manager Resolver > Settings` menu option: + +* `Add package registries` when enabled, when the plugin loads or registry + configuration files change, this will prompt the user to add registries that + are not present in the Package Manager. + +* `Prompt to add package registries` will cause a developer to be prompted + with a window that will ask for confirmation before adding registries. When + this is disabled registries are added silently to the project. + +* `Prompt to migrate packages` will cause a developer to be prompted with a + window that will ask for confirmation before migrating packages installed in + the `Assets` directory to PM packages. + +* `Enable Analytics Reporting` when enabled, reports the use of the plugin to + the developers so they can make imrpovements. + +* `Verbose logging` when enabled prints debug information to the console which + can be useful when filing bug reports. + +### Version Handler The Version Handler component of this plugin manages: -* Shared Unity plugin dependencies. -* Upgrading Unity plugins by cleaning up old files from previous versions. -* Uninstallation of plugins that are distributed with manifest files. -* Restoration of plugin assets to their original install locations if assets - are tagged with the `exportpath` label. +* Shared Unity plugin dependencies. + +* Upgrading Unity plugins by cleaning up old files from previous versions. + +* Uninstallation of plugins that are distributed with manifest files. + +* Restoration of plugin assets to their original install locations if assets + are tagged with the `exportpath` label. Since the Version Handler needs to modify Unity asset metadata (`.meta` files), -to enable / disable components, rename and delete asset files it does not -work with Package Manager installed packages. It's still possible to -include EDM4U in Package Manager packages, the Version Handler component -simply won't do anything to PM plugins in this case. +to enable/disable components, rename and delete asset files it does not work +with Package Manager installed packages. It's still possible to include EDM4U in +Package Manager packages, the Version Handler component simply won't do anything +to PM plugins in this case. -## Using Version Handler Managed Plugins +#### Using Version Handler Managed Plugins -If a plugin is imported at multiple different versions into a project, if -the Version Handler is enabled, it will automatically check all managed -assets to determine the set of assets that are out of date and assets that -should be removed. To disable automatic checking managed assets disable -the `Enable version management` option in the -`Assets > External Dependency Manager > Version Handler > Settings` menu. +If a plugin is imported at multiple different versions into a project, if the +Version Handler is enabled, it will automatically check all managed assets to +determine the set of assets that are out of date and assets that should be +removed. To disable automatic checking managed assets disable the `Enable +version management` option in the `Assets > External Dependency Manager > +Version Handler > Settings` menu. If version management is disabled, it's possible to check managed assets -manually using the -`Assets > External Dependency Manager > Version Handler > Update` menu option. +manually using the `Assets > External Dependency Manager > Version Handler > +Update` menu option. -### Listing Managed Plugins +##### Listing Managed Plugins -Plugins managed by the Version Handler, those that ship with manifest files, -can displayed using the `Assets > External Dependency Manager > -Version Handler > Display Managed Packages` menu option. The list of plugins -are written to the console window along with the set of files used by each -plugin. +Plugins managed by the Version Handler, those that ship with manifest files, can +displayed using the `Assets > External Dependency Manager > Version Handler > +Display Managed Packages` menu option. The list of plugins are written to the +console window along with the set of files used by each plugin. -### Uninstalling Managed Plugins +##### Uninstalling Managed Plugins -Plugins managed by the Version Handler, those that ship with manifest files, -can be removed using the `Assets > External Dependency Manager > -Version Handler > Uninstall Managed Packages` menu option. This operation -will display a window that allows a developer to select a set of plugins to -remove which will remove all files owned by each plugin excluding those that -are in use by other installed plugins. +Plugins managed by the Version Handler, those that ship with manifest files, can +be removed using the `Assets > External Dependency Manager > Version Handler > +Uninstall Managed Packages` menu option. This operation will display a window +that allows a developer to select a set of plugins to remove which will remove +all files owned by each plugin excluding those that are in use by other +installed plugins. Files managed by the Version Handler, those labeled with the `gvh` asset label, -can be checked to see whether anything needs to be upgraded, disabled or -removed using the `Assets > External Dependency Manager > -Version Handler > Update` menu option. +can be checked to see whether anything needs to be upgraded, disabled or removed +using the `Assets > External Dependency Manager > Version Handler > Update` menu +option. -### Restore Install Paths +##### Restore Install Paths -Some developers move assets around in their project which can make it -harder for plugin maintainers to debug issues if this breaks Unity's -[special folders](https://docs.unity3d.com/Manual/SpecialFolders.html) rules. -If assets are labeled with their original install / export path -(see `gvhp_exportpath` below), Version Handler can restore assets to their -original locations when using the `Assets > External Dependency Manager > -Version Handler > Move Files To Install Locations` menu option. +Some developers move assets around in their project which can make it harder for +plugin maintainers to debug issues if this breaks Unity's +[special folders](https://docs.unity3d.com/Manual/SpecialFolders.html) rules. If +assets are labeled with their original install/export path (see +`gvhp_exportpath` below), Version Handler can restore assets to their original +locations when using the `Assets > External Dependency Manager > Version +Handler > Move Files To Install Locations` menu option. -### Settings +##### Settings -Some behavior of the Version Handler can be configured via the -`Assets > External Dependency Manager > Version Handler > Settings` menu -option. +Some behavior of the Version Handler can be configured via the `Assets > +External Dependency Manager > Version Handler > Settings` menu option. + +* `Enable version management` controls whether the plugin should automatically + check asset versions and apply changes. If this is disabled the process + should be run manually when installing or upgrading managed plugins using + `Assets > External Dependency Manager > Version Handler > Update`. + +* `Rename to canonical filenames` is a legacy option that will rename files to + remove version numbers and other labels from filenames. + +* `Prompt for obsolete file deletion` enables the display of a window when + obsolete files are deleted allowing the developer to select which files to + delete and those to keep. + +* `Allow disabling files via renaming` controls whether obsolete or disabled + files should be disabled by renaming them to `myfilename_DISABLED`. Renaming + to disable files is required in some scenarios where Unity doesn't support + removing files from the build via the PluginImporter. + +* `Enable Analytics Reporting` enables/disables usage reporting to plugin + developers to improve the product. -* `Enable version management` controls whether the plugin should automatically - check asset versions and apply changes. If this is disabled the process - should be run manually when installing or upgrading managed plugins using - `Assets > External Dependency Manager > Version Handler > Update`. -* `Rename to canonical filenames` is a legacy option that will rename files to - remove version numbers and other labels from filenames. -* `Prompt for obsolete file deletion` enables the display of a window when - obsolete files are deleted allowing the developer to select which files to - delete and those to keep. -* `Allow disabling files via renaming` controls whether obsolete or disabled - files should be disabled by renaming them to `myfilename_DISABLED`. - Renaming to disable files is required in some scenarios where Unity doesn't - support removing files from the build via the PluginImporter. -* `Enable Analytics Reporting` enables / disables usage reporting to plugin - developers to improve the product. -* `Verbose logging` enables _very_ noisy log output that is useful for - debugging while filing a bug report or building a new managed plugin. -* `Use project settings` saves settings for the plugin in the project rather - than system-wide. - -## Redistributing a Managed Plugin - -The Version Handler employs a couple of methods for managing version -selection, upgrade and removal of plugins. - -* Each plugin can ship with a manifest file that lists the files it includes. - This makes it possible for Version Handler to calculate the difference - in assets between the most recent release of a plugin and the previous - release installed in a project. If a files are removed the Version Handler - will prompt the user to clean up obsolete files. -* Plugins can ship using assets with unique names, unique GUIDs and version - number labels. Version numbers can be attached to assets using labels or - added to the filename (e.g `myfile.txt` would be `myfile_version-x.y.z.txt). - This allows the Version Handler to determine which set of files are the - same file at different versions, select the most recent version and prompt - the developer to clean up old versions. +* `Verbose logging` enables *very* noisy log output that is useful for + debugging while filing a bug report or building a new managed plugin. + +* `Use project settings` saves settings for the plugin in the project rather + than system-wide. + +#### Redistributing a Managed Plugin + +The Version Handler employs a couple of methods for managing version selection, +upgrade and removal of plugins. + +* Each plugin can ship with a manifest file that lists the files it includes. + This makes it possible for Version Handler to calculate the difference in + assets between the most recent release of a plugin and the previous release + installed in a project. If a files are removed the Version Handler will + prompt the user to clean up obsolete files. + +* Plugins can ship using assets with unique names, unique GUIDs and version + number labels. Version numbers can be attached to assets using labels or + added to the filename (e.g `myfile.txt` would be `myfile_version-x.y.z.txt). + This allows the Version Handler to determine which set of files are the same + file at different versions, select the most recent version and prompt the + developer to clean up old versions. Unity plugins can be managed by the Version Handler using the following steps: - 1. Add the `gvh` asset label to each asset (file) you want Version Handler - to manage. - 1. Add the `gvh_version-VERSION` label to each asset where `VERSION` is the - version of the plugin you're releasing (e.g 1.2.3). - 1. Add the `gvhp_exportpath-PATH` label to each asset where `PATH` is the - export path of the file when the `.unitypackage` is created. This is - used to track files if they're moved around in a project by developers. - 1. Optional: Add `gvh_targets-editor` label to each editor DLL in your - plugin and disable `editor` as a target platform for the DLL. - The Version Handler will enable the most recent version of this DLL when - the plugin is imported. - 1. Optional: If your plugin is included in other Unity plugins, you should - add the version number to each filename and change the GUID of each asset. - This allows multiple versions of your plugin to be imported into a Unity - project, with the Version Handler component activating only the most - recent version. - 1. Create a manifest text file named `MY_UNIQUE_PLUGIN_NAME_VERSION.txt` - that lists all the files in your plugin relative to the project root. - Then add the `gvh_manifest` label to the asset to indicate this file is - a plugin manifest. - 1. Optional: Add a `gvhp_manifestname-NAME` label to your manifest file - to provide a human readable name for your package. If this isn't provided - the name of the manifest file will be used as the package name. - NAME can match the pattern `[0-9]+[a-zA-Z -]' where a leading integer - will set the priority of the name where `0` is the highest priority - and preferably used as the display name. The lowest value (i.e highest - priority name) will be used as the display name and all other specified - names will be aliases of the display name. Aliases can refer to previous - names of the package allowing renaming across published versions. - 1. Redistribute EDM4U Unity plugin with your plugin. - See the [Plugin Redistribution](#plugin-redistribution) for the details. +1. Add the `gvh` asset label to each asset (file) you want Version Handler to + manage. + +1. Add the `gvh_version-VERSION` label to each asset where `VERSION` is the + version of the plugin you're releasing (e.g 1.2.3). + +1. Add the `gvhp_exportpath-PATH` label to each asset where `PATH` is the + export path of the file when the `.unitypackage` is created. This is used to + track files if they're moved around in a project by developers. + +1. Optional: Add `gvh_targets-editor` label to each editor DLL in your plugin + and disable `editor` as a target platform for the DLL. The Version Handler + will enable the most recent version of this DLL when the plugin is imported. + +1. Optional: If your plugin is included in other Unity plugins, you should add + the version number to each filename and change the GUID of each asset. This + allows multiple versions of your plugin to be imported into a Unity project, + with the Version Handler component activating only the most recent version. + +1. Create a manifest text file named `MY_UNIQUE_PLUGIN_NAME_VERSION.txt` that + lists all the files in your plugin relative to the project root. Then add + the `gvh_manifest` label to the asset to indicate this file is a plugin + manifest. + +1. Optional: Add a `gvhp_manifestname-NAME` label to your manifest file to + provide a human readable name for your package. If this isn't provided the + name of the manifest file will be used as the package name. NAME can match + the pattern `[0-9]+[a-zA-Z -]` where a leading integer will set the priority + of the name where `0` is the highest priority and preferably used as the + display name. The lowest value (i.e highest priority name) will be used as + the display name and all other specified names will be aliases of the + display name. Aliases can refer to previous names of the package allowing + renaming across published versions. + +1. Redistribute EDM4U Unity plugin with your plugin. See the + [Plugin Redistribution](#plugin-redistribution) section for details. If you follow these steps: - * When users import a newer version of your plugin, files referenced by the - older version's manifest are cleaned up. - * The latest version of the plugin will be selected when users import - multiple packages that include your plugin, assuming the steps in - [Plugin Redistribution](#plugin-redistribution) are followed. +* When users import a newer version of your plugin, files referenced by the + older version's manifest are cleaned up. + +* The latest version of the plugin will be selected when users import multiple + packages that include your plugin, assuming the steps in + [Plugin Redistribution](#plugin-redistribution) are followed. + +## Background + +Many Unity plugins have dependencies upon Android specific libraries, iOS +CocoaPods, and sometimes have transitive dependencies upon other Unity plugins. +This causes the following problems: + +* Integrating platform specific (e.g Android and iOS) libraries within a Unity + project can be complex and a burden on a Unity plugin maintainer. +* The process of resolving conflicting dependencies on platform specific + libraries is pushed to the developer attempting to use a Unity plugin. The + developer trying to use your plugin is very likely to give up when faced + with Android or iOS specific build errors. +* The process of resolving conflicting Unity plugins (due to shared Unity + plugin components) is pushed to the developer attempting to use your Unity + plugin. In an effort to resolve conflicts, the developer will very likely + attempt to resolve problems by deleting random files in your plugin, report + bugs when that doesn't work and finally give up. + +EDM4U provides solutions for each of these problems. + +### Android Dependency Management + +The *Android Resolver* component of this plugin will download and integrate +Android library dependencies and handle any conflicts between plugins that share +the same dependencies. + +Without the Android Resolver, typically Unity plugins bundle their AAR and JAR +dependencies, e.g. a Unity plugin `SomePlugin` that requires the Google Play +Games Android library would redistribute the library and its transitive +dependencies in the folder `SomePlugin/Android/`. When a user imports +`SomeOtherPlugin` that includes the same libraries (potentially at different +versions) in `SomeOtherPlugin/Android/`, the developer using `SomePlugin` and +`SomeOtherPlugin` will see an error when building for Android that can be hard +to interpret. + +Using the Android Resolver to manage Android library dependencies: + +* Solves Android library conflicts between plugins. +* Handles all of the various processing steps required to use Android + libraries (AARs, JARs) in Unity 4.x and above projects. Almost all versions + of Unity have - at best - partial support for AARs. +* (Experimental) Supports minification of included Java components without + exporting a project. + +### iOS Dependency Management + +The *iOS Resolver* component of this plugin integrates with +[CocoaPods](https://cocoapods.org/) to download and integrate iOS libraries and +frameworks into the Xcode project Unity generates when building for iOS. Using +CocoaPods allows multiple plugins to utilize shared components without forcing +developers to fix either duplicate or incompatible versions of libraries +included through multiple Unity plugins in their project. + +### Package Manager Registry Setup + +The [Package Manager](https://docs.unity3d.com/Manual/Packages.html) (PM) makes +use of [NPM](https://www.npmjs.com/) registry servers for package hosting and +provides ways to discover, install, upgrade and uninstall packages. This makes +it easier for developers to manage plugins within their projects. + +However, installing additional package registries requires a few manual steps +that can potentially be error prone. The *Package Manager Resolver* component of +this plugin integrates with [PM](https://docs.unity3d.com/Manual/Packages.html) +to provide a way to auto-install PM package registries when a `.unitypackage` is +installed which allows plugin maintainers to ship a `.unitypackage` that can +provide access to their own PM registry server to make it easier for developers +to manage their plugins. + +### Unity Plugin Version Management + +Finally, the *Version Handler* component of this plugin simplifies the process +of managing transitive dependencies of Unity plugins and each plugin's upgrade +process. + +For example, without the Version Handler plugin, if: + +* Unity plugin `SomePlugin` includes `EDM4U` plugin at version 1.1. +* Unity plugin `SomeOtherPlugin` includes `EDM4U` plugin at version 1.2. + +The version of `EDM4U` included in the developer's project depends upon the +order the developer imports `SomePlugin` or `SomeOtherPlugin`. + +This results in: + +* `EDM4U` at version 1.2, if `SomePlugin` is imported then `SomeOtherPlugin` + is imported. +* `EDM4U` at version 1.1, if `SomeOtherPlugin` is imported then `SomePlugin` + is imported. + +The Version Handler solves the problem of managing transitive dependencies by: + +* Specifying a set of packaging requirements that enable a plugin at different + versions to be imported into a Unity project. +* Providing activation logic that selects the latest version of a plugin + within a project. + +When using the Version Handler to manage `EDM4U` included in `SomePlugin` and +`SomeOtherPlugin`, from the prior example, version 1.2 will always be the +version activated in a developer's Unity project. + +Plugin creators are encouraged to adopt this library to ease integration for +their customers. For more information about integrating EDM4U into your own +plugin, see the [Plugin Redistribution](#plugin-redistribution) section of this +document. + +## Analytics + +The External Dependency Manager for Unity plugin by default logs usage to Google +Analytics. The purpose of the logging is to quantitatively measure the usage of +functionality, to gather reports on integration failures and to inform future +improvements to the developer experience of the External Dependency Manager +plugin. Note that the analytics collected are limited to the scope of the EDM4U +plugin’s usage. + +For details of what is logged, please refer to the usage of +`EditorMeasurement.Report()` in the source code. -# Building from Source +## Plugin Redistribution -To build this plugin from source you need the following tools installed: - * Unity (with iOS and Android modules installed) +If you are a package maintainer and your package depends on EDM4U, it is highly +recommended to use the UPM format and add EDM4U as a dependency. If you must +include it in your `.unitypackage`, redistributing `EDM4U` inside your own +plugin might ease the integration process for your users. + +If you wish to redistribute `EDM4U` inside your plugin, you **must** follow +these steps when importing the `external-dependency-manager-*.unitypackage`, and +when exporting your own plugin package: + +1. Import the `external-dependency-manager-*.unitypackage` into your plugin + project by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), + ensuring that you add the `-gvh_disable` option. +1. Export your plugin by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), + ensuring that you: + - Include the contents of the `Assets/PlayServicesResolver` and + `Assets/ExternalDependencyManager` directory. + - Add the `-gvh_disable` option. -You can build the plugin by running the following from your shell -(Linux / OSX): +You **must** specify the `-gvh_disable` option in order for the Version Handler +to work correctly! +For example, the following command will import the +`external-dependency-manager-1.2.46.0.unitypackage` into the project +`MyPluginProject` and export the entire Assets folder to +`MyPlugin.unitypackage`: + +```shell +Unity -gvh_disable \ + -batchmode \ + -importPackage external-dependency-manager-1.2.46.0.unitypackage \ + -projectPath MyPluginProject \ + -exportPackage Assets MyPlugin.unitypackage \ + -quit ``` + +### Background + +The *Version Handler* component relies upon deferring the load of editor DLLs so +that it can run first and determine the latest version of a plugin component to +activate. The build of `EDM4U` plugin has Unity asset metadata that is +configured so that the editor components are not initially enabled when it's +imported into a Unity project. To maintain this configuration when importing the +`external-dependency-manager.unitypackage` into a Unity plugin project, you +*must* specify the command line option `-gvh_disable` which will prevent the +Version Handler component from running and changing the Unity asset metadata. + +## Building from Source + +To build this plugin from source you need the following tools installed: * Unity +2021 and below (with iOS and Android modules installed) * Java 11 + +You can build the plugin by running the following from your shell (Linux / OSX): + +```shell ./gradlew build + ``` or Windows: -``` +```shell ./gradlew.bat build ``` -# Releasing - -Each time a new build of this plugin is checked into the source tree you -need to do the following: - - * Bump the plugin version variable `pluginVersion` in `build.gradle` - * Update `CHANGELOG.md` with the new version number and changes included in - the release. - * Build the release using `./gradlew release` which performs the following: - * Updates `external-dependency-manager-*.unitypackage` - * Copies the unpacked plugin to the `exploded` directory. - * Updates template metadata files in the `plugin` directory. - The GUIDs of all asset metadata is modified due to the version number - change. Each file within the plugin is versioned to allow multiple - versions of the plugin to be imported into a Unity project which allows - the most recent version to be activated by the Version Handler - component. - * Create release commit using `./gradlew gitCreateReleaseCommit` which - performs `git commit -a -m "description from CHANGELOG.md"` - * Once the release commit is merge, tag the release using - `./gradlew gitTagRelease` which performs the following: - * `git tag -a pluginVersion -m "version RELEASE"` to tag the release. - * Update tags on remote branch using `git push --tag REMOTE HEAD:master` +If Java 11 is not your default Java command, add +`-Dorg.gradle.java.home=` to the command above. + +## Testing + +You can run the tests by running the following from your shell (Linux / OSX): + +```shell +./gradlew test +``` + +or Windows: + +```shell +./gradlew.bat test +``` + +The following properties can be set to narrow down the tests to run or change +the test run behavior. + +* `INTERACTIVE_MODE_TESTS_ENABLED` - Default to `1`. Set to `1` to enable + interactive mode tests, which requires GPU on the machine. Otherwise, only + run tests in the batch mode. +* `INCLUDE_TEST_TYPES` - Default to empty string, which means to include every + type of the test. To narrow down the types of test to run, set this + properties with a list of case-insensitive type strings separated by comma. + For instance, `-PINCLUDE_TEST_TYPES="Python,NUnit"` means to include only + Python tests and NUnit tests. See `TestTypeEnum` in `build.gradle` for + available options. +* `EXCLUDE_TEST_TYPES` - Default to empty string, which means to exclude none. + To add types of tests to exclude, set this properties with a list of + case-insensitive type strings separated by comma. For instance, + `-PEXCLUDE_TEST_TYPES="Python,NUnit"` means to exclude Python tests and + NUnit tests. See `TestTypeEnum` in `build.gradle` for available options. +* `INCLUDE_TEST_MODULES` - Default to empty string, which means to include the + tests for every modules. To narrow down modules to test, set this properties + with a list of case-insensitive module strings separated by comma. For + instance, `-PINCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests + for tools and Android Resolver only. See `TestModuleEnum` in `build.gradle` + for available options. +* `EXCLUDE_TEST_MODULES` - Default to empty string, which means to exclude + none. To add modules to exclude, set this properties with a list of + case-insensitive module strings separated by comma. For instance, + `-PEXCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests for any + modules other than tools and Android Resolver. See `TestModuleEnum` in + `build.gradle` for available options. +* `EXCLUDE_TESTS` - Default to empty string, which means to exclude none. To + add tests to exclude, set this properties with a list of case-insensitive + test names separated by comma. For instance, + `-PEXCLUDE_TESTS="testGenGuids,testDownloadArtifacts"` means to run tests + except the tests with name of `testGenGuids` and `testDownloadArtifacts`. +* `CONTINUE_ON_FAIL_FOR_TESTS_ENABLED` - Default to `1`. Set to `1` to + continue running the next test when the current one fails. Otherwise, the + build script stops whenever any test fails. + +For instance, by running the following command, it only runs the Unity +integration tests that does not requires GPU, but exclude tests for Android +Resolver module and iOS Resolver module. + +```shell +./gradlew test \ + -PINTERACTIVE_MODE_TESTS_ENABLED=0 \ + -PINCLUDE_TEST_TYPES="Integration" \ + -PEXCLUDE_TEST_MODULES="AndroidResolver,iOSResolver" +``` + +## Releasing + +Each time a new build of this plugin is checked into the source tree you need to +do the following: + +* Bump the plugin version variable `pluginVersion` in `build.gradle` +* Update `CHANGELOG.md` with the new version number and changes included in + the release. +* Build the release using `./gradlew release` which performs the following: + * Updates `external-dependency-manager-*.unitypackage` + * Copies the unpacked plugin to the `exploded` directory. + * Updates template metadata files in the `plugin` directory. The GUIDs of + all asset metadata is modified due to the version number change. Each + file within the plugin is versioned to allow multiple versions of the + plugin to be imported into a Unity project which allows the most recent + version to be activated by the Version Handler component. +* Create release commit using `./gradlew gitCreateReleaseCommit` which + performs `git commit -a -m "description from CHANGELOG.md"` +* Once the release commit is merge, tag the release using `./gradlew + gitTagRelease` which performs the following: + * `git tag -a pluginVersion -m "version RELEASE"` to tag the release. +* Update tags on remote branch using `git push --tag REMOTE HEAD:master` diff --git a/build.gradle b/build.gradle index ff115c43..cb824eac 100644 --- a/build.gradle +++ b/build.gradle @@ -166,35 +166,6 @@ project.ext { monoVersion)) } - // Find the NUnit framework dll. - unityNUnitDll = getFileFromPropertyOrFileTree( - "UNITY_NUNIT_PATH", true, { - unityRootDirTree.matching { - include "**/nunit.framework.dll" - exclude unitySearchDirExcludes - } - }) - if (unityNUnitDll == null) { - logger.warn("Unity NUnit DLL not found, tests will not build.") - } - saveProperty("UNITY_NUNIT_PATH", unityNUnitDll, cacheProperties) - - // nunit-console is used to run tests. - nunitConsoleExe = getFileFromPropertyOrFileTree( - "NUNIT_CONSOLE_EXE", false, { - unityRootDirTree.matching { - include (operatingSystem == OperatingSystem.WINDOWS ? - "**/bin/nunit-console2.bat" : - "**/nunit-console2") - exclude unitySearchDirExcludes - } - }) - if (nunitConsoleExe == null) { - logger.warn("nunit_console not found (NUNIT_CONSOLE_EXE) C# unit test " + - "execution will fail.") - } - saveProperty("NUNIT_CONSOLE_EXE", nunitConsoleExe, cacheProperties) - // Get the directory that contains this script. scriptDirectory = buildscript.sourceFile.getParentFile() @@ -221,12 +192,70 @@ project.ext { interactiveModeTestsEnabled = findProperty("INTERACTIVE_MODE_TESTS_ENABLED", "1") == "1" + // Whether to continue to the next test if one fails. + continueOnFailForTestsEnabled = + findProperty("CONTINUE_ON_FAIL_FOR_TESTS_ENABLED", "1") == "1" + + // List of test sessions + testSessions = [] + + // List of test types that should be included. Controlled by + // "INCLUDE_TEST_TYPES" property. Includes every tests if the property is + // empty. + // DO NOT USE THIS FOR FILTER, Use `actualIncludeTestTypes` instead. + includeTestTypesParam = + TestTypeEnum.toSet( + findProperty("INCLUDE_TEST_TYPES", "").split('\\s+|\\s*,\\s*').toList(), + true) + + // List of test types that should be excluded. Controlled by + // "EXCLUDE_TEST_TYPES" property. Excludes none if the property is + // empty. + // DO NOT USE THIS FOR FILTER, Use `actualIncludeTestTypes` instead. + excludeTestTypesParam = + TestTypeEnum.toSet( + findProperty("EXCLUDE_TEST_TYPES", "").split('\\s+|\\s*,\\s*').toList(), + false) + + // The actual list of test types to run. + actualIncludeTestTypes = includeTestTypesParam.clone() + actualIncludeTestTypes.removeAll(excludeTestTypesParam) + + // List of test modules that should be included. Controlled by + // "INCLUDE_TEST_MODULES" property. Includes every tests if the property is + // empty. + // DO NOT USE THIS FOR FILTER, Use `actualIncludeTestModules` instead. + includeTestModulesParam = + TestModuleEnum.toSet( + findProperty("INCLUDE_TEST_MODULES", "").split('\\s+|\\s*,\\s*').toList(), + true) + + // List of test modules that should be excluded. Controlled by + // "EXCLUDE_TEST_MODULES" property. Excludes none if the property is + // empty. + // DO NOT USE THIS FOR FILTER, Use `actualIncludeTestModules` instead. + excludeTestModulesParam = + TestModuleEnum.toSet( + findProperty("EXCLUDE_TEST_MODULES", "").split('\\s+|\\s*,\\s*').toList(), + false) + + // The actual list of test module to run. + actualIncludeTestModules = includeTestModulesParam.clone() + actualIncludeTestModules.removeAll(excludeTestModulesParam) + + // List of tests to exclude. Controlled by "EXCLUDE_TESTS" property. Excludes + // none if the property is empty. + excludeTestsParam = + new HashSet(findProperty("EXCLUDE_TESTS", "").toLowerCase().split('\\s+|\\s*,\\s*').toList()) + // Directory for intermediate and final build outputs. buildDir = new File(scriptDirectory, "build") + // Directory for external tools. + externalToolsDir = new File(scriptDirectory, "external_tools") // Directory for testing. testDir = new File(scriptDirectory, "test_output") // Version of the plugin (update this with CHANGELOG.md on each release). - pluginVersion = "1.2.174" + pluginVersion = "1.2.186" // Directory that contains the template plugin. // Files under this directory are copied into the staging area for the // plugin. @@ -235,14 +264,18 @@ project.ext { pluginStagingAreaDir = new File(buildDir, "staging") // Directory where the build plugin is unpacked to. pluginExplodedDir = new File(scriptDirectory, "exploded") + // Directory where the UPM package is unpacked to. + pluginUpmDir = new File(scriptDirectory, "upm") // Base filename of the released plugin. currentPluginBasename = "external-dependency-manager" + // Base UPM package name of the released plugin. + currentPluginUpmPackageName = "com.google.external-dependency-manager" // Where the exported plugin file is built before it's copied to the release // location. pluginExportFile = new File(buildDir, currentPluginBasename + ".unitypackage") // Where the exported UPM plugin file is built. pluginUpmExportFile = new File(buildDir, - currentPluginBasename + pluginVersion + ".tgz") + currentPluginUpmPackageName + "-" + pluginVersion + ".tgz") // Directory within the plugin staging area that just contains the plugin. pluginAssetsDir = new File("Assets", "ExternalDependencyManager") // Directories within the staging area to export. @@ -282,14 +315,14 @@ project.ext { symbolDatabaseExtension = pdbSupported ? ".pdb" : ".dll.mdb" // Changelog file. changelog = new File(scriptDirectory, "CHANGELOG.md") - pythonBootstrapDir = new File(buildDir, "python_bootstrap") + pythonBootstrapDir = new File(externalToolsDir, "python_bootstrap") pythonBinDir = new File(new File(pythonBootstrapDir, "python"), "bin") // Python binary after it has been bootstrapped. pythonExe = new File(pythonBinDir, "python3") // Pip binary after it has been bootstrapped. pipExe = new File(pythonBinDir, "pip3") // Python packages required by export_unity_package.py - exportUnityPackageRequirements = ["absl-py", "PyYAML"] + exportUnityPackageRequirements = ["absl-py", "PyYAML", "packaging"] // Python packages required by gen_guids.py genGuidRequirements = ["absl-py"] } @@ -325,6 +358,254 @@ public enum OperatingSystem { } } +/* + * Test Types + */ +public enum TestTypeEnum { + INTEGRATION, // Unity Integration Tests using IntegrationTester framework. + NUNIT, // Tests using NUnit framework + PYTHON, // Tests implemented in Python + GRADLE // Tests implemented in Gradle scripts + + // A complete set of all enums + private static HashSet completeSet; + + /* + * Get a complete set of all enums + * + * @returns A complete set of all enums + */ + private static HashSet getCompleteSet() { + if (completeSet == null) { + completeSet = new HashSet() + for (TestTypeEnum type : TestTypeEnum.values()) { + completeSet.add(type); + } + } + return completeSet.clone() + } + + /* + * Convert a list of strings to a set of enums + * + * @param values A list of case-insensitive strings to convert to enum. + * @param completeSetWhenEmpty Whether to return a complete set if the list + * is empty. + * + * @returns A set of enums + */ + public static HashSet toSet( + Collection values, Boolean completeSetWhenEmpty) { + def result = new HashSet() + if ( values == null) { + return completeSetWhenEmpty ? getCompleteSet() : result; + } + for (String value : values) { + def trimmed = value.trim().toUpperCase() + if (!trimmed.isEmpty()) { + result.add(TestTypeEnum.valueOf(trimmed)) + } + } + if (result.size() == 0) { + result = completeSetWhenEmpty ? getCompleteSet() : result; + } + return result + } +} + +/* + * Test Modules + */ +public enum TestModuleEnum { + ANDROIDRESOLVER, // Tests for Android Resolver + VERSIONHANDLER, // Tests for Version Handler + IOSRESOLVER, // Tests for iOS Resolver + PACKAGEMANAGER, // Tests for Package Manager + CORE, // Tests for reusable C# libraries + TOOL // Tests for build/packaging/release tools + + // A complete set of all enums + private static HashSet completeSet; + + /* + * Get a complete set of all enums + * + * @returns A complete set of all enums + */ + private static HashSet getCompleteSet() { + if (completeSet == null) { + completeSet = new HashSet() + for (TestModuleEnum type : TestModuleEnum.values()) { + completeSet.add(type); + } + } + return completeSet.clone() + } + + /* + * Convert a list of strings to a set of enums + * + * @param values A list of case-insensitive strings to convert to enum. + * @param completeSetWhenEmpty Whether to return a complete set if the list + * is empty. + * + * @returns A set of enums + */ + public static HashSet toSet( + Collection values, Boolean completeSetWhenEmpty) { + def result = new HashSet() + if ( values == null) { + return completeSetWhenEmpty ? getCompleteSet() : result; + } + for (String value : values) { + def trimmed = value.trim().toUpperCase() + if (!trimmed.isEmpty()) { + result.add(TestModuleEnum.valueOf(trimmed)) + } + } + if (result.size() == 0) { + result = completeSetWhenEmpty ? getCompleteSet() : result; + } + return result + } +} + +/* + * Determine whether the test should be run given the filter parameters, + * the current test type and the current test module + * + * @param type Type of the test. + * @param module Module of the test. + * + * @returns True if the test should be run by the given the filters. + */ +boolean shouldTestRunWithFilters(TestTypeEnum type, TestModuleEnum module) { + project.ext.actualIncludeTestTypes.contains(type) && + project.ext.actualIncludeTestModules.contains(module) +} + +/* + * Set the test type and module to the given task. + * + * @param task The task to set the properties to. + * @param type Type of the test. + * @param module Module of the test. + */ +void setTestProperties(Task task, TestTypeEnum type, TestModuleEnum module) { + task.ext.testType = type + task.ext.testModule = module +} + +/* + * Unit test for TestTypeEnum + */ +task(testTestTypeEnum) { task -> + setTestProperties(task, TestTypeEnum.GRADLE, TestModuleEnum.TOOL) + doFirst { + ReportTestStarted(task) + } + doLast { + def expectedTestTypeEnumCompleteSet = + new HashSet([ + TestTypeEnum.INTEGRATION, + TestTypeEnum.NUNIT, + TestTypeEnum.PYTHON, + TestTypeEnum.GRADLE]) + def expectedEmptySet = new HashSet() + def expectedPythonOnlySet = new HashSet([TestTypeEnum.PYTHON]) + def expectedPythonAndIntegrationSet = new HashSet([ + TestTypeEnum.PYTHON, + TestTypeEnum.INTEGRATION]) + + assert TestTypeEnum.getCompleteSet().equals( + expectedTestTypeEnumCompleteSet) + assert TestTypeEnum.toSet([], false).equals( + expectedEmptySet) + assert TestTypeEnum.toSet([], true).equals( + expectedTestTypeEnumCompleteSet) + assert TestTypeEnum.toSet(["python"], false).equals( + expectedPythonOnlySet) + assert TestTypeEnum.toSet(["python"], true).equals( + expectedPythonOnlySet) + assert TestTypeEnum.toSet(["PYTHON"], false).equals( + expectedPythonOnlySet) + assert TestTypeEnum.toSet(["PyThOn"], false).equals( + expectedPythonOnlySet) + assert TestTypeEnum.toSet(["Python", "Integration"], false).equals( + expectedPythonAndIntegrationSet) + assert TestTypeEnum.toSet(["Integration", "Python"], false).equals( + expectedPythonAndIntegrationSet) + assert TestTypeEnum.toSet( + ["Integration", "Python", "Gradle", "NUnit"], false).equals( + expectedTestTypeEnumCompleteSet) + + EvaluateTestResult(task) + } +} + +/* + * Unit test for TestModuleEnum + */ +task(testTestModuleEnum) { task -> + setTestProperties(task, TestTypeEnum.GRADLE, TestModuleEnum.TOOL) + doFirst { + ReportTestStarted(task) + } + doLast { + def expectedTestModuleEnumCompleteSet = + new HashSet([ + TestModuleEnum.ANDROIDRESOLVER, + TestModuleEnum.VERSIONHANDLER, + TestModuleEnum.IOSRESOLVER, + TestModuleEnum.PACKAGEMANAGER, + TestModuleEnum.CORE, + TestModuleEnum.TOOL]) + def expectedEmptySet = new HashSet() + def expectedToolOnlySet = new HashSet([TestModuleEnum.TOOL]) + def expectedToolAndAndroidResolverSet = new HashSet([ + TestModuleEnum.TOOL, + TestModuleEnum.ANDROIDRESOLVER]) + + assert TestModuleEnum.getCompleteSet().equals( + expectedTestModuleEnumCompleteSet) + assert TestModuleEnum.toSet([], false).equals( + expectedEmptySet) + assert TestModuleEnum.toSet([], true).equals( + expectedTestModuleEnumCompleteSet) + assert TestModuleEnum.toSet(["tool"], false).equals( + expectedToolOnlySet) + assert TestModuleEnum.toSet(["tool"], true).equals( + expectedToolOnlySet) + assert TestModuleEnum.toSet(["TOOL"], false).equals( + expectedToolOnlySet) + assert TestModuleEnum.toSet(["TooL"], false).equals( + expectedToolOnlySet) + assert TestModuleEnum.toSet(["Tool", "AndroidResolver"], false).equals( + expectedToolAndAndroidResolverSet) + assert TestModuleEnum.toSet(["AndroidResolver", "Tool"], false).equals( + expectedToolAndAndroidResolverSet) + assert TestModuleEnum.toSet([ + "AndroidResolver", + "VersionHandler", + "iOSResolver", + "PackageManager", + "Core", + "Tool"], false).equals( + expectedTestModuleEnumCompleteSet) + EvaluateTestResult(task) + } +} + +/* + * Test session + */ +public class TestSession { + public String name; + public TestTypeEnum type; + public TestModuleEnum module; + public Boolean isPassed; +} + /* * Search the path variable for an executable file. * @@ -434,24 +715,6 @@ void saveProperty(String name, value, Properties properties) { logger.info(sprintf("%s: %s", name, value)) } -/* - * Make sure the NUnit DLL property is set. - */ -void checkNUnitDllPath() { - if (project.ext.unityNUnitDll == null) { - throw new StopActionException("NUnit DLL not found.") - } -} - -/* - * Make sure the NUnit console property is set. - */ -void checkNUnitConsolePath() { - if (project.ext.nunitConsoleExe == null) { - throw new StopActionException("NUnit Console not found.") - } -} - /* * Removes the extension from a filename. * @@ -776,9 +1039,6 @@ Task createXbuildTask(String taskName, String taskDescription, project.ext.unityDllPath.absolutePath), sprintf("/property:UnityIosPath=%s", project.ext.unityIosPath.absolutePath), - sprintf("/property:NUnityHintPath=%s", - project.ext.unityNUnitDll ? - project.ext.unityNUnitDll.absolutePath: ""), sprintf("/property:BaseIntermediateOutputPath=%s%s", intermediatesDir.absolutePath, File.separator), @@ -891,38 +1151,43 @@ Task createBuildPluginDllTask(String componentName, } /* - * Create a Nunit test task. + * Creates a task which compiles and run an NUnit test. * - * @param name Name of the task. + * @param taskName Name of the test. * @param description Description of the task. - * @param testDll Test DLL to execute. The log file will be placed in the - * parent directory of this DLL path. * @param dependsOn Dependencies of the new task. - * - * @returns Task which executes nunit-console. + * @param unityProjectDir Directory containing a assets to copy into the + * integration test project. + * @param arguments Additional arguments for Unity when running the integration + * test. + * @param testType Type of the test + * @param testModule Module of the test */ -Task createNUnitTask(String name, String description, File testDll, - Iterable dependsOn) { - File logFileDir = testDll.parentFile.parentFile - File logFile = new File(logFileDir, name + ".log") - File xmlLogFile = new File(logFileDir, name + ".xml") - return tasks.create(name: name, - description: description, - type: Task, - dependsOn: dependsOn).with { - inputs.files testDll - outputs.files logFile - doFirst { checkNUnitConsolePath() } - doLast { - exec { - workingDir project.ext.pluginSourceDir - executable project.ext.nunitConsoleExe - args ([sprintf("-output:%s", logFile.absolutePath), - sprintf("-xml:%s", xmlLogFile.absolutePath), - testDll.absolutePath]) - } - } - } +Task createUnityNUnitTest(String taskName, + String description, + Iterable dependsOn, + File unityProjectDir, + Iterable arguments, + TestTypeEnum testType, + TestModuleEnum testModule) { + createUnityTestBatchAndNonBatch( + taskName, + description, + ["buildPlugin"], + unityProjectDir, + [], + arguments + [ + "-runTests", + "-batchmode", + "-testResults", "results.xml", + "-testPlatform", "EditMode" + ], null, testType, testModule, + true, + new File(new File(new File( + project.ext.scriptDirectory, + "test_resources"), + "nunit_upm"), + "manifest.json")) } /* @@ -933,12 +1198,13 @@ Task createNUnitTask(String name, String description, File testDll, * @param dependsOn Tasks this depends upon. * @param executable Executable to run. * @param arguments Arguments for the executable. + * @param continueOnFail Whether to ignore non-zero return code and continue. * * @returns Task which runs the specified executable. */ Task createExecTask(String name, String description, Iterable dependsOn, File executableToRun, - Iterable arguments) { + Iterable arguments, Boolean continueOnFail = false) { Task execTask = tasks.create(name: name, description: description, type: Exec, @@ -946,6 +1212,7 @@ Task createExecTask(String name, String description, execTask.with { executable executableToRun args arguments + ignoreExitValue continueOnFail } return execTask } @@ -987,6 +1254,7 @@ Task createEmptyTask(String taskName, String summary, * @param batchMode Whether to run Unity in batch mode. * @param createTaskClosure Optional task used to start Unity, this must * conform to createExecTask() + * @param continueOnFail Whether to ignore non-zero return code and continue. * * @returns Task which executes Unity. * The following extended properties are set on the task: @@ -998,7 +1266,8 @@ Task createEmptyTask(String taskName, String summary, Task createUnityTask(String taskName, String summary, Iterable dependsOn, String projectName, File projectContainerDir, Iterable arguments, - Boolean batchMode, createTaskClosure) { + Boolean batchMode, createTaskClosure, + Boolean continueOnFail = false) { Boolean createProject = summary == "create" File logFile = new File(projectContainerDir, sprintf("%s_%s.log", projectName, summary)) @@ -1019,8 +1288,13 @@ Task createUnityTask(String taskName, String summary, if (!createTaskClosure) { createTaskClosure = { String name, String description, Iterable depends, - File executable, Iterable args -> - return createExecTask(name, description, depends, executable, args) + File executable, Iterable args, Boolean contOnFail-> + return createExecTask(name, + description, + depends, + executable, + args, + contOnFail) } } @@ -1034,7 +1308,8 @@ Task createUnityTask(String taskName, String summary, summary, projectName), dependsOn, project.ext.unityExe, - executeArguments) + executeArguments, + continueOnFail) } unityTask.with { outputs.files files(logFile) @@ -1072,35 +1347,6 @@ Task createUnityProjectTask(String taskName, Iterable dependsOn, } } -/* - * Setup a Unity project for a testing task and import the plugin in - * preparation for testing. - * - * @param taskName Name of the test task. - * @param dependsOn Dependencies of the new task. - * @param projectName Name of the Unity project to create. - * @param batchMode Whether to run Unity in batch mode. - * - * @returns Task which sets up a Unity project. - * The following extended properties are set on the task: - * - ext.projectDir: Directory of the created Unity project. - * - ext.containerDir: Directory which contains the Unity project and the logs. - * - ext.logFile: Unity log file for the import operation. - */ -Task createSetupUnityProjectTask(String taskName, Iterable dependsOn, - String projectName, Boolean batchMode) { - File outputDir = new File(project.ext.testDir, projectName) - Task createProject = createUnityProjectTask( - sprintf("create%s", taskName), dependsOn, projectName, outputDir) - createProject.with { - inputs.files files(project.ext.pluginExportFile) - } - return createUnityTask( - taskName, "import_plugin", [createProject], projectName, outputDir, - ["-importPackage", project.ext.pluginExportFile.absolutePath, - "-quit"], batchMode, null) -} - /* * Creates a task which runs a test with the Unity plugin. * @@ -1116,6 +1362,10 @@ Task createSetupUnityProjectTask(String taskName, Iterable dependsOn, * project. * @param createTaskClosure Optional task used to start Unity, this must * conform to tasks.create(name, description, type, dependsOn). + * @param testType Type of the test + * @param testModule Module of the test + * @param enableDlls Whether to enable dlls through Version Handlers before tests. + * @param upm_package_manifest Specify UPM package manifest (manifest.json) * * @returns Test task. */ @@ -1123,7 +1373,10 @@ Task createUnityTestTask(String taskName, String description, Iterable dependsOn, File testScriptsDir, Iterable editorAssets, Iterable additionalArguments, - Boolean batchMode, createTaskClosure) { + Boolean batchMode, createTaskClosure, + TestTypeEnum testType, TestModuleEnum testModule, + Boolean enableDlls = false, + File upm_package_manifest = null) { List testScripts = [] if (testScriptsDir) { testScripts = fileTree(testScriptsDir).collect { @@ -1133,10 +1386,53 @@ Task createUnityTestTask(String taskName, String description, } // Setup the Unity project. - Task setupTestProject = createSetupUnityProjectTask( - sprintf("setup%s", taskName), dependsOn, taskName, batchMode) - setupTestProject.with { + List setupTasks = [] + File testOutputDir = new File(project.ext.testDir, taskName) + Task createProject = createUnityProjectTask( + sprintf("createsetup%s", taskName), dependsOn, taskName, testOutputDir) + createProject.with { task -> + inputs.files files(project.ext.pluginExportFile) + setTestProperties(task, testType, testModule) + } + setupTasks += [createProject] + + Task setupTestProject = createUnityTask( + sprintf("setup%s", taskName), "import_plugin", [createProject], taskName, + testOutputDir, ["-importPackage", project.ext.pluginExportFile.absolutePath, + "-quit"], batchMode, null) + setupTestProject.with { task -> inputs.files (testScripts + editorAssets) + setTestProperties(task, testType, testModule) + } + setupTasks += [setupTestProject] + + Task versionHandlerUpdate; + if (enableDlls) { + File updaterScriptDir = new File(new File(new File( + setupTestProject.ext.projectDir, + "Assets"), + "Editor"), + "VersionHandlerUpdater") + versionHandlerUpdate = createUnityTask( + sprintf("enableDlls%s", taskName), "enable_dlls", [setupTestProject], taskName, + testOutputDir, [], batchMode, null) + versionHandlerUpdate.with { task -> + setTestProperties(task, testType, testModule) + doFirst { + copy { + from new File(new File(new File( + project.ext.scriptDirectory, + "test_resources"), + "version_handler_update"), + "VersionHandlerUpdater.cs") + into updaterScriptDir + } + } + doLast { + delete updaterScriptDir + } + } + setupTasks += [versionHandlerUpdate] } List copyTasks = [] @@ -1147,21 +1443,40 @@ Task createUnityTestTask(String taskName, String description, sprintf("copyScriptsFor%s", taskName), sprintf("Copy the test scripts into the %s Unity project.", taskName), testScripts, testScriptsDir, setupTestProject.ext.projectDir, - [setupTestProject], null) + setupTasks, null) + copyTestScripts.with { task -> + setTestProperties(task, testType, testModule) + } copyTasks += [copyTestScripts] } + if (upm_package_manifest != null) { + Task copyPackageManifest = tasks.create( + name: sprintf("copyPackageManifestFor%s", taskName), + description: sprintf("Copy the package manifest into the %s Unity project.", + taskName), + type: Copy, + dependsOn: setupTasks) + copyPackageManifest.with { task -> + from upm_package_manifest + into new File(setupTestProject.ext.projectDir, "Packages") + setTestProperties(task, testType, testModule) + } + copyTasks += [copyPackageManifest] + } + // Task which copies editor scripts into the project. Task copyEditorAssets = tasks.create( name: sprintf("copyEditorAssetsFor%s", taskName), description: sprintf("Copy the editor assets into the %s Unity project.", taskName), type: Copy, - dependsOn: [setupTestProject]) - copyEditorAssets.with { + dependsOn: setupTasks) + copyEditorAssets.with { task -> from editorAssets into new File(new File(setupTestProject.ext.projectDir, "Assets"), "Editor") + setTestProperties(task, testType, testModule) } copyTasks += [copyEditorAssets] @@ -1171,8 +1486,19 @@ Task createUnityTestTask(String taskName, String description, setupTestProject.ext.projectDir.name, setupTestProject.ext.containerDir, additionalArguments, batchMode, - createTaskClosure) + createTaskClosure, + true) testTask.description = description + testTask.with { task -> + finalizedBy "reportAllTestsResult" + doLast { + EvaluateTestResult(task) + } + doFirst { + ReportTestStarted(task) + } + setTestProperties(task, testType, testModule) + } // Create a clean task Task cleanTestTask = tasks.create(name: sprintf("clean%s", taskName), @@ -1198,6 +1524,10 @@ Task createUnityTestTask(String taskName, String description, * @param additionalArguments Additional arguments to pass to Unity. * @param createTaskClosure Optional task used to start Unity, this must * conform to tasks.create(name, description, type, dependsOn). + * @param testType Type of the test + * @param testModule Module of the test + * @param enableDlls Whether to enable dlls through Version Handlers before tests. + * @param upm_package_manifest Specify UPM package manifest (manifest.json) * * @returns Test task. */ @@ -1206,7 +1536,11 @@ Task createUnityTestBatchAndNonBatch(String taskName, String description, File testScriptsDir, Iterable editorAssets, Iterable additionalArguments, - createTaskClosure) { + createTaskClosure, + TestTypeEnum testType, + TestModuleEnum testModule, + Boolean enableDlls = false, + File upm_package_manifest = null) { return tasks.create(name: taskName, description: description, dependsOn: [ @@ -1214,23 +1548,16 @@ Task createUnityTestBatchAndNonBatch(String taskName, String description, sprintf("%sBatchMode", taskName), sprintf("%s (Batch Mode)", description), dependsOn, testScriptsDir, editorAssets, - additionalArguments, true, createTaskClosure), + additionalArguments, true, createTaskClosure, + testType, testModule, + enableDlls, upm_package_manifest), createUnityTestTask( sprintf("%sInteractiveMode", taskName), sprintf("%s (Interactive Mode)", description), dependsOn, testScriptsDir, editorAssets, - additionalArguments, false, createTaskClosure)]) -} - -Task compileResolverLibTests = createXbuildTask( - "compileResolverLibTests", - "Compile tests for the deprecated Jar Resolver library.", - project.ext.pluginSolutionFile, "JarResolverTests", - fileTree(new File(new File(project.ext.pluginSourceDir, - "JarResolverLib"), "src")), - new File(project.ext.testDir, "ResolverLibTests"), - [new File("JarResolverTests.dll")], []).with { - doFirst { checkNUnitDllPath() } + additionalArguments, false, createTaskClosure, + testType, testModule, + enableDlls, upm_package_manifest)]) } /* @@ -1265,13 +1592,15 @@ Task createInstallPythonPackageTask(String taskName, String description, * @param script Python script to run. * @param arguments Command line arguments to pass to the Python script. * @param packages Optional Python packages to install. + * @param continueOnFail Whether to ignore non-zero return code and continue. * * @returns Task which executes Python. */ Task createPythonTask(String taskName, String description, Iterable dependsOn, File script, Iterable arguments, - Iterable packages) { + Iterable packages, + Boolean continueOnFail = false) { List installPackagesTask = [] if (packages) { installPackagesTask = [ @@ -1287,6 +1616,7 @@ Task createPythonTask(String taskName, String description, description: sprintf("Run Python to %s", description), type: Exec, dependsOn: (dependsOn + installPackagesTask + ["build_envs"])).with { + ignoreExitValue continueOnFail executable project.ext.pythonExe args ([script.absolutePath] + arguments) } @@ -1370,30 +1700,137 @@ Task createGenGuidTask(String taskName, } -Task testResolverLibTests = createNUnitTask( - "testResolverLibTests", - "Runs the tests for the deprecated Jar Resolver library", - compileResolverLibTests.outputs.files[0], - [compileResolverLibTests]) - -task cleanResolverLibTests() { - description "Clean test output for the deprecated Jar Resolver library" - doLast { delete files(compileResolverLibTests.ext.buildDir, - testResolverLibTests.outputs.files) } -} +createUnityNUnitTest( + "testAndroidResolverNUnitTests", + "Runs NUnit tests for the Android Resolver module.", + [], + new File(project.ext.scriptDirectory, + "source/AndroidResolver/unit_tests"), [], + TestTypeEnum.NUNIT, TestModuleEnum.ANDROIDRESOLVER +) -task testDownloadArtifacts(type: GradleBuild) { +task testDownloadArtifacts(type: GradleBuild) { task -> description "Run tests for the download_artifacts.gradle script." dir "source/AndroidResolver/scripts" + setTestProperties(task, TestTypeEnum.GRADLE, TestModuleEnum.ANDROIDRESOLVER) + doLast { + EvaluateTestResult(task) + } + doFirst { + ReportTestStarted(task) + } + finalizedBy "reportAllTestsResult" } -createPythonTask( + +/* + * Report when a test starts to run + * + * @param testTask Task for test to start. + */ +void ReportTestStarted(Task testTask) { + println sprintf("Test %s STARTED", testTask.name) +} + +/* + * Evaluate previously-ran test result + * + * @param testTask Task for previously-ran test + */ +void EvaluateTestResult(Task testTask) { + Boolean succeeded = false + if (testTask.class.simpleName.startsWith("Exec")) { + if (testTask.execResult.exitValue == 0) { + succeeded = true + } + } else if (testTask.class.simpleName.startsWith("DefaultTask") || + testTask.class.simpleName.startsWith("GradleBuild")) { + if (testTask.state.didWork && testTask.state.failure == null) { + succeeded = true + } + } else { + throw new GradleException( + sprintf("Unsupported test class %s", testTask.class.simpleName)) + } + + if (succeeded) { + println sprintf("Test %s PASSED", testTask.name) + project.ext.testSessions.add(new TestSession( + name: testTask.name, + type: testTask.ext.testType, + module: testTask.ext.testModule, + isPassed: true)) + } else { + String errorMsg = sprintf("Test %s FAILED", testTask.name) + println sprintf("::error::%s", errorMsg) + project.ext.testSessions.add(new TestSession( + name: testTask.name, + type: testTask.ext.testType, + module: testTask.ext.testModule, + isPassed: false)) + if (!project.ext.continueOnFailForTestsEnabled) { + throw new GradleException(errorMsg) + } + } +} + +Task reportAllTestsResult = tasks.create ( + name: "reportAllTestsResult", + description: "Report the result all every test that has been run", + type: Task +).with { + doLast { + if (project.ext.testSessions.isEmpty()) { + return + } + + println "\n\n[Test Summary]" + int failedCount = 0 + int totalCount = 0 + project.ext.testSessions.each { session -> + String resultStr + ++totalCount + String logType = "" + if (session.isPassed) { + resultStr = "PASSED" + } else { + resultStr = "FAILED" + logType = "::error::" + ++failedCount + } + println sprintf("%sTest %s %s [%s/%s]", + logType, + session.name, + resultStr, + session.type, + session.module) + } + println "--------------------------------------" + println sprintf("::notice::%s out of %d test(s) passed", totalCount - failedCount, totalCount) + if (failedCount > 0) { + throw new GradleException( + sprintf("%d out of %d test(s) failed", failedCount, totalCount)) + } + } +} + +Task testPackageUploader = createPythonTask( "testPackageUploader", "Test the unity_asset_uploader.py application.", [], new File(project.ext.unityAssetUploaderDir, "unity_asset_uploader_test.py"), [], - []) + [], + true).with { task -> + finalizedBy reportAllTestsResult + doLast { + EvaluateTestResult(task) + } + doFirst { + ReportTestStarted(task) + } + setTestProperties(task, TestTypeEnum.PYTHON, TestModuleEnum.TOOL) + } createPythonTask( "testExportUnityPackage", @@ -1401,7 +1838,17 @@ createPythonTask( [], new File(project.ext.exportUnityPackageDir, "export_unity_package_test.py"), [], - exportUnityPackageRequirements) + exportUnityPackageRequirements, + true).with { task -> + setTestProperties(task, TestTypeEnum.PYTHON, TestModuleEnum.TOOL) + finalizedBy reportAllTestsResult + doLast { + EvaluateTestResult(task) + } + doFirst { + ReportTestStarted(task) + } +} createPythonTask( "testGenGuids", @@ -1409,7 +1856,17 @@ createPythonTask( [], new File(project.ext.exportUnityPackageDir, "gen_guids_test.py"), [], - ["absl-py"]) + ["absl-py"], + true).with { task -> + setTestProperties(task, TestTypeEnum.PYTHON, TestModuleEnum.TOOL) + finalizedBy reportAllTestsResult + doLast { + EvaluateTestResult(task) + } + doFirst { + ReportTestStarted(task) + } + } createPythonTask( "testImportUnityPackage", @@ -1417,7 +1874,17 @@ createPythonTask( [], new File(project.ext.importUnityPackageDir, "import_unity_package_test.py"), [], - ["absl-py"]) + ["absl-py"], + true).with { task -> + setTestProperties(task, TestTypeEnum.PYTHON, TestModuleEnum.TOOL) + finalizedBy reportAllTestsResult + doLast { + EvaluateTestResult(task) + } + doFirst { + ReportTestStarted(task) + } + } task updateEmbeddedGradleWrapper(type: Zip) { description "Update the gradle wrapper in gradle-template.zip" @@ -1606,8 +2073,7 @@ buildPlugin.with { } // Guid paths for UPM package. -File upmPluginPackageDir = new File("com.google.external-dependency-manager", - "ExternalDependencyManager") +File upmPluginPackageDir = new File(currentPluginUpmPackageName, "ExternalDependencyManager") File upmPluginEditorDir = new File(upmPluginPackageDir, "Editor") File upmPluginDllDir = new File(upmPluginEditorDir, project.ext.pluginVersion) @@ -1658,6 +2124,7 @@ task releasePlugin(dependsOn: [buildPlugin, buildUpmPlugin]) { fileTree(dir: project.ext.pluginExplodedDir), pluginTemplateFilesMap.values()) doLast { + // Delete and regenerate built .unitypackage in the repo. delete fileTree( dir: project.ext.pluginReleaseFile.parentFile, includes: [project.ext.currentPluginBasename + "-*.unitypackage"]) @@ -1671,6 +2138,7 @@ task releasePlugin(dependsOn: [buildPlugin, buildUpmPlugin]) { into project.ext.pluginReleaseFileUnversioned.parentFile rename { src_filename -> project.ext.pluginReleaseFileUnversioned.name } } + // Delete and regenerate the exploded plugin folder in the repo. delete fileTree(dir: project.ext.pluginExplodedDir) copy { from project.ext.pluginStagingAreaDir @@ -1679,6 +2147,16 @@ task releasePlugin(dependsOn: [buildPlugin, buildUpmPlugin]) { it.path + "/**/*" } } + // Delete and regenerate the UPM package in the repo. + delete fileTree(dir: project.ext.pluginUpmDir) + copy { + // Rename the top-level package folder to upm. + eachFile { + path = path.replaceFirst(/^.+?\//, "upm/") + } + from tarTree(project.ext.pluginUpmExportFile) + into project.ext.scriptDirectory + } pluginTemplateFilesMap.each { sourceFile, targetFile -> copyFile(sourceFile, targetFile) } @@ -1753,7 +2231,7 @@ task gitTagRelease(type: Exec) { project.ext.pluginVersion)) } -// TODO: Version Handler tests to implement in both batch and interactive modes +// TODO: Version Handler tests // - Per platform targeting (iOS, Android, Editor, desktop) // - Version enablement, import newer plugin on top of older plugin and validate // new plugin is enabled, old plugin is removed. @@ -1763,7 +2241,7 @@ task gitTagRelease(type: Exec) { // - Import plugin into a project and wait for asset processor to enable it. // - Switch .NET version, validate DLLs are enabled / disabled as expected. -// TODO: Android Resolver tests to implement in both batch and interactive modes +// TODO: Android Resolver tests // - Resolve with: // - Conflicting dependencies // - FAT ABI vs. single ABI selection @@ -1776,49 +2254,23 @@ task gitTagRelease(type: Exec) { // - Project export // - Add a pod which changes the target SDK -Task compileVersionHandlerImplTests = createXbuildTask( - "compileVersionHandlerImplTests", - "Compile tests for VersionHandlerImpl.", - project.ext.pluginSolutionFile, "VersionHandlerImplTests", - fileTree(new File( - new File( - new File(project.ext.pluginSourceDir, - "VersionHandlerImpl"), - "unit_tests"), - "src")), - new File(project.ext.testDir, "VersionHandlerImplTests"), - [new File("Google.VersionHandlerImplTests.dll")], []).with { - doFirst { checkNUnitDllPath() } -} - -createNUnitTask( - "testVersionHandlerImpl", - "Runs tests for the VersionHandlerImpl module", - compileVersionHandlerImplTests.outputs.files[0], - [compileVersionHandlerImplTests]) - -Task compilePackageManagerResolverTests = createXbuildTask( - "compilePackageManagerResolverTests", - "Compile tests for PackageManagerResolver.", - project.ext.pluginSolutionFile, - "PackageManagerResolverTests", - fileTree(new File( - new File( - new File(project.ext.pluginSourceDir, - "PackageManagerResolver"), - "unit_tests"), - "src")), - new File(project.ext.testDir, "PackageManagerResolverTests"), - [new File("Google.PackageManagerResolverTests.dll")], - [buildPackageManagerResolver]).with { - doFirst { checkNUnitDllPath() } -} +createUnityNUnitTest( + "testVersionHandlerImplNUnitTests", + "Runs NUnit tests for the VersionHandlerImpl module.", + [], + new File(project.ext.scriptDirectory, + "source/VersionHandlerImpl/unit_tests"), [], + TestTypeEnum.NUNIT, TestModuleEnum.VERSIONHANDLER +) -createNUnitTask( - "testPackageManagerResolver", - "Runs tests for the PackageManagerResolver module", - compilePackageManagerResolverTests.outputs.files[0], - [compilePackageManagerResolverTests]) +createUnityNUnitTest( + "testPackageManagerResolverNUnitTests", + "Runs NUnit tests for the PackageManagerResolver module.", + [], + new File(project.ext.scriptDirectory, + "source/PackageManagerResolver/unit_tests"), [], + TestTypeEnum.NUNIT, TestModuleEnum.PACKAGEMANAGER +) createUnityTestBatchAndNonBatch( "testVersionHandlerActivation", @@ -1827,7 +2279,7 @@ createUnityTestBatchAndNonBatch( [buildPlugin], new File(project.ext.scriptDirectory, "source/VersionHandlerImpl/test/activation"), - [], [], null) + [], [], null, TestTypeEnum.INTEGRATION, TestModuleEnum.VERSIONHANDLER) // Launch the test via a script that runs a local web server. createUnityTestBatchAndNonBatch( @@ -1839,7 +2291,7 @@ createUnityTestBatchAndNonBatch( "source/VersionHandlerImpl/test/webrequest"), [], [], { String name, String description, Iterable depends, - File executable, Iterable args -> + File executable, Iterable args, Boolean continueOnFail -> Iterable runnerArgs = [executable.absolutePath] + args return createPythonTask( name, description, depends, @@ -1850,8 +2302,8 @@ createUnityTestBatchAndNonBatch( "test"), "webrequest_launcher.py"), runnerArgs, - []) - }) + [], continueOnFail) + }, TestTypeEnum.INTEGRATION, TestModuleEnum.CORE) createUnityTestBatchAndNonBatch( "testVersionHandlerReflection", @@ -1862,7 +2314,8 @@ createUnityTestBatchAndNonBatch( "source/VersionHandler/test/reflection"), [], [], - null) + null, + TestTypeEnum.INTEGRATION, TestModuleEnum.CORE) Task compileIntegrationTester = createXbuildTask( "compileIntegrationTester", @@ -1891,6 +2344,8 @@ Task compileIntegrationTester = createXbuildTask( * integration test project. * @param arguments Additional arguments for Unity when running the integration * test. + * @param testType Type of the test + * @param testModule Module of the test */ Task createUnityIntegrationTest(String taskName, String description, @@ -1899,7 +2354,9 @@ Task createUnityIntegrationTest(String taskName, Iterable integrationTestProjectSources, Iterable integrationTestProjectOutputs, File unityProjectDir, - Iterable arguments) { + Iterable arguments, + TestTypeEnum testType, + TestModuleEnum testModule) { Task compileIntegrationTest = createXbuildTask( sprintf("compile%s", integrationTestProject), sprintf("Compile %s for %s", integrationTestProject, taskName), @@ -1909,6 +2366,9 @@ Task createUnityIntegrationTest(String taskName, new File(project.ext.buildDir, integrationTestProject), integrationTestProjectOutputs, [compileIntegrationTester] + dependsOn) + compileIntegrationTest.with { task -> + setTestProperties(task, testType, testModule) + } createUnityTestBatchAndNonBatch( taskName, @@ -1917,7 +2377,7 @@ Task createUnityIntegrationTest(String taskName, unityProjectDir, compileIntegrationTest.outputs.files + compileIntegrationTester.outputs.files, - arguments, null) + arguments, null, testType, testModule) } createUnityIntegrationTest( @@ -1933,7 +2393,9 @@ createUnityIntegrationTest( new File( project.ext.scriptDirectory, "source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject"), - ["-buildTarget", "android"]) + ["-buildTarget", "android"], + TestTypeEnum.INTEGRATION, + TestModuleEnum.ANDROIDRESOLVER) createUnityIntegrationTest( "testPackageManagerClientIntegrationTests", @@ -1946,24 +2408,9 @@ createUnityIntegrationTest( "PackageManagerClientIntegrationTests")), [new File("Google.PackageManagerClientIntegrationTests.dll"), new File("Google.PackageManagerClientIntegrationTests.dll.mdb")], - null, []) - -createUnityIntegrationTest( - "testPackageMigratorIntegrationTests", - ("Imports the plugin into a Unity project and uses the Package Migrator " + - "list packages that can be migrated and self migrate EDM to UPM. "), - [compilePackageManagerResolver], - "PackageMigratorIntegrationTests", - fileTree(new File(new File(new File(project.ext.pluginSourceDir, - "PackageManagerResolver"), "test"), - "PackageMigratorIntegrationTests")), - [new File("Google.PackageMigratorIntegrationTests.dll"), - new File("Google.PackageMigratorIntegrationTests.dll.mdb")], - new File( - project.ext.scriptDirectory, - "source/PackageManagerResolver/test/" + - "PackageMigratorIntegrationTestsUnityProject"), - []) + null, [], + TestTypeEnum.INTEGRATION, + TestModuleEnum.PACKAGEMANAGER) task cleanTests(type: Delete) { description "Clean test directories." @@ -1985,3 +2432,18 @@ project.defaultTasks = ["build", "test", "release", "clean"].collect { task -> task.name.startsWith(topLevelTaskName) }) } + +// Disable tests by filters. +project.tasks.findAll { task -> + if (task.hasProperty("testType") && task.testType != null && + task.hasProperty("testModule") && task.testModule != null) { + if (!shouldTestRunWithFilters(task.testType, task.testModule)) { + println sprintf("DISABLED :%s", task.name) + task.enabled = false + } + if (project.ext.excludeTestsParam.contains(task.name.toLowerCase())) { + println sprintf("DISABLED :%s", task.name) + task.enabled = false + } + } +} diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll deleted file mode 100644 index 2ee5d27e..00000000 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll and /dev/null differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.mdb b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.mdb deleted file mode 100644 index d23f911e..00000000 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.mdb and /dev/null differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll deleted file mode 100644 index 889de414..00000000 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll and /dev/null differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.mdb b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.mdb deleted file mode 100644 index 4af26e77..00000000 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.mdb and /dev/null differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll deleted file mode 100644 index 5293ab60..00000000 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll and /dev/null differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.mdb b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.mdb deleted file mode 100644 index 7b1fdd4e..00000000 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.mdb and /dev/null differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.mdb.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.mdb.meta deleted file mode 100644 index 454a2a23..00000000 --- a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.mdb.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 61d62a8f613c4719952dca51701294da -labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.mdb -- gvh -timeCreated: 1538009133 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll deleted file mode 100644 index 5fe6e009..00000000 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll and /dev/null differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.mdb b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.mdb deleted file mode 100644 index 7e84abc9..00000000 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.mdb and /dev/null differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.mdb.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.mdb.meta deleted file mode 100644 index 339c1fbc..00000000 --- a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.mdb.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4ed4b38fe3c141f09fbc666169c1546f -labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.mdb -- gvh -timeCreated: 1538009133 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll new file mode 100644 index 00000000..30030559 Binary files /dev/null and b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll.meta similarity index 79% rename from exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.meta rename to exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll.meta index 310c4f3a..707c589b 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 83ff4764cfaa404ab9546c5a00b1b54f +guid: e2d7ea0845de4cf984265d2a444b7aa4 labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll - gvh - gvhp_targets-editor PluginImporter: @@ -12,6 +12,7 @@ PluginImporter: executionOrder: {} isPreloaded: 0 isOverridable: 0 + validateReferences: 0 platformData: - first: Any: diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb new file mode 100644 index 00000000..493d3b28 Binary files /dev/null and b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.mdb.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb.meta similarity index 50% rename from exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.mdb.meta rename to exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb.meta index 9d23d8b3..e6b1e059 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.mdb.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: b7c7315093524d328a0896f4e2a2d5e1 +guid: baf24db2bf904e729e7796721c09e8ad labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.mdb +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll new file mode 100644 index 00000000..645d5cd3 Binary files /dev/null and b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll.meta similarity index 82% rename from exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.meta rename to exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll.meta index b89074dd..a1398e9f 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: d9cf2414188e40c9a9f7a254a5436601 +guid: fa49a85d4ba140a0ae21528ed12d174c labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll - gvh - gvhp_targets-editor PluginImporter: diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb new file mode 100644 index 00000000..c6eaef49 Binary files /dev/null and b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.mdb.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb.meta similarity index 50% rename from exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.mdb.meta rename to exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb.meta index c2dd5c00..12826037 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.mdb.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 5b6bc09459a04d01b86b61aa2479fcd8 +guid: d13c8602d5e14e43b0e92459754c4315 labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.mdb +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll new file mode 100644 index 00000000..a4a6590c Binary files /dev/null and b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll.meta similarity index 82% rename from exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.meta rename to exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll.meta index a18922a7..3b4fa84b 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 789ffd788f924bd0bdb33e26b367ad70 +guid: d8bb10c56a0147bc855a6296778e025e labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll - gvh - gvhp_targets-editor PluginImporter: diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb new file mode 100644 index 00000000..884ce212 Binary files /dev/null and b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb.meta new file mode 100644 index 00000000..ac071adc --- /dev/null +++ b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a695eb9f64fe49569a2db0c4246c877d +labels: +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb +- gvh +timeCreated: 1538009133 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll new file mode 100644 index 00000000..8562ef33 Binary files /dev/null and b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll.meta similarity index 82% rename from exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.meta rename to exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll.meta index d44296c0..7456068f 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 149319a041c7420b94473745b1919576 +guid: 5980a684c61d42fbb6b74e2eb3477016 labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll - gvh - gvhp_targets-editor PluginImporter: diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb new file mode 100644 index 00000000..ed8cc976 Binary files /dev/null and b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb.meta b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb.meta new file mode 100644 index 00000000..da5b09b2 --- /dev/null +++ b/exploded/Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9f56badf3ca84753b00163c3b632d4e5 +labels: +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb +- gvh +timeCreated: 1538009133 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/exploded/Assets/ExternalDependencyManager/Editor/CHANGELOG.md b/exploded/Assets/ExternalDependencyManager/Editor/CHANGELOG.md index 5dce1c73..e1294a3a 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/CHANGELOG.md +++ b/exploded/Assets/ExternalDependencyManager/Editor/CHANGELOG.md @@ -1,3 +1,62 @@ +# Version 1.2.186 - May 19, 2025 +* iOS Resolver - Set `validateReferences` to off by default, + to prevent errors when running without iOS Support installed. + Fixes #412 and #622 + +# Version 1.2.185 - Feb 3, 2025 +* Android Resolver - Reverse conditional checker for `packaging` keyword in maintemplate based on android gradle plugin version. Fixes #715 + +# Version 1.2.184 - Jan 28, 2025 +* Android Resolver - Update and resolve `packaging` keyword in maintemplate + based on android gradle plugin version. + Fixes #715 + +# Version 1.2.183 - Sep 18, 2024 +* Android Resolver - Handle package paths that don't include a version hash, + which is no longer present with Unity 6. Fixes #697 +* Android Resolver - Handle packages referenced using local file paths. + Fixes #701 + +# Version 1.2.182 - Aug 2, 2024 +* General - Check for gradle version instead of Unity version when determining + the template files to modify. + +# Version 1.2.181 - Jun 26, 2024 +* General - Disable `EditorMeasurement` reporting that relied on the + Measurement Protocol for Universal Analytics. + +# Version 1.2.180 - Jun 4, 2024 +* General - Fix project settings resetting on domain reload. + Fixes #524 + +# Version 1.2.179 - Feb 12, 2024 +* Android Resolver - Added logic to automatically turn on `mainTemplate.gradle` + for new projects, and prompt users to enable it on projects that have previously + had the resolver run. + +# Version 1.2.178 - Dec 20, 2023 +* Added [OpenUPM support](https://openupm.com/packages/com.google.external-dependency-manager/). + +# Version 1.2.177 - Aug 14, 2023 +* iOS Resolver - Added `/opt/homebrew/bin` to Cocoapod executable search path. + Fixes #627 + +# Version 1.2.176 - Apr 27, 2023 +* Android Resolver - Added two Android Resolver settings to determine whether + EDM4U injects custom local Maven repo path as a relative path or full path. + Fixes #537 +* Android Resolver - Inject Maven Repo to `settingTemplate.gradle` from + Unity 2022.2+ + Fixes #594 +* Android Resolver - Jetifier option is enabled by default now. +* Android Resolver - `Explode Aar` option applies to all cases, whether the + project will be exported or not. + Fixes #584 + Fixes #287 + +# Version 1.2.175 - Nov 16, 2022 +* General - Added tvOS podfile support to the iOS resolver. + # Version 1.2.174 - Oct 06, 2022 * General - Added tvOS support to the iOS resolver. * General - Fixed #484 - Changed `EditorMeasurement` to use secure connection. diff --git a/exploded/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta b/exploded/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta index 438b6570..e5662a98 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 3d9f779dd5e74fcc9e05e0c450716999 +guid: aba4ee01c6d145f7bf2d944d892f709a labels: -- gvh_version-1.2.174 +- gvh_version-1.2.186 - gvhp_exportpath-ExternalDependencyManager/Editor/CHANGELOG.md - gvh timeCreated: 1584567712 diff --git a/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll b/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll index 349b1de6..12c150e2 100644 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll and b/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb b/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb deleted file mode 100644 index 7f4b0d57..00000000 Binary files a/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb and /dev/null differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta b/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta index ceceb765..3babd47f 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 2010dfbbc3ff4f499e6892f6681a37df +guid: f7632a50b10045458c53a5ddf7b6d238 labels: -- gvh_version-1.2.174 +- gvh_version-1.2.186 - gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll - gvh - gvhp_targets-editor diff --git a/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb b/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb new file mode 100644 index 00000000..7dd02af5 Binary files /dev/null and b/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb differ diff --git a/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb.meta b/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta similarity index 73% rename from exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb.meta rename to exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta index fd5316ac..0b461abd 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: c3f725ddd3494ddf9818ee51153c40da +guid: 57f5a82a79ab4b098f09326c8f3c73a6 labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.pdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/exploded/Assets/ExternalDependencyManager/Editor/LICENSE.meta b/exploded/Assets/ExternalDependencyManager/Editor/LICENSE.meta index d4bb51b3..30482451 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/LICENSE.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/LICENSE.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: b5a2636858c0483bab69644a94d03b42 +guid: ae8b2bc8d1ac4ad48f0ab2b2e7ac75fb labels: -- gvh_version-1.2.174 +- gvh_version-1.2.186 - gvhp_exportpath-ExternalDependencyManager/Editor/LICENSE - gvh timeCreated: 1584567712 diff --git a/exploded/Assets/ExternalDependencyManager/Editor/README.md b/exploded/Assets/ExternalDependencyManager/Editor/README.md index b49cf1e2..a9aafe9f 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/README.md +++ b/exploded/Assets/ExternalDependencyManager/Editor/README.md @@ -1,236 +1,130 @@ -External Dependency Manager for Unity -======== +# External Dependency Manager for Unity -# Overview +[![openupm](https://img.shields.io/npm/v/com.google.external-dependency-manager?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.google.external-dependency-manager/) +[![openupm](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=downloads&query=%24.downloads&suffix=%2Fmonth&url=https%3A%2F%2Fpackage.openupm.com%2Fdownloads%2Fpoint%2Flast-month%2Fcom.google.external-dependency-manager)](https://openupm.com/packages/com.google.external-dependency-manager/) -The External Dependency Manager for Unity (EDM4U) -(formerly Play Services Resolver / Jar Resolver) is intended to be used by any -Unity plugin that requires: +## Overview - * Android specific libraries (e.g - [AARs](https://developer.android.com/studio/projects/android-library.html)). - * iOS [CocoaPods](https://cocoapods.org/). - * Version management of transitive dependencies. - * Management of Package Manager (PM) Registries. +The External Dependency Manager for Unity (EDM4U) (formerly Play Services +Resolver/Jar Resolver) is intended to be used by any Unity package or user that +requires: -Updated releases are available on -[GitHub](https://github.com/googlesamples/unity-jar-resolver) - -# Background - -Many Unity plugins have dependencies upon Android specific libraries, iOS -CocoaPods, and sometimes have transitive dependencies upon other Unity plugins. -This causes the following problems: - - * Integrating platform specific (e.g Android and iOS) libraries within a - Unity project can be complex and a burden on a Unity plugin maintainer. - * The process of resolving conflicting dependencies on platform specific - libraries is pushed to the developer attempting to use a Unity plugin. - The developer trying to use your plugin is very likely to give up when - faced with Android or iOS specific build errors. - * The process of resolving conflicting Unity plugins (due to shared Unity - plugin components) is pushed to the developer attempting to use your Unity - plugin. In an effort to resolve conflicts, the developer will very likely - attempt to resolve problems by deleting random files in your plugin, - report bugs when that doesn't work and finally give up. - -EDM provides solutions for each of these problems. - -## Android Dependency Management - -The *Android Resolver* component of this plugin will download and integrate -Android library dependencies and handle any conflicts between plugins that share -the same dependencies. - -Without the Android Resolver, typically Unity plugins bundle their AAR and -JAR dependencies, e.g. a Unity plugin `SomePlugin` that requires the Google -Play Games Android library would redistribute the library and its transitive -dependencies in the folder `SomePlugin/Android/`. When a user imports -`SomeOtherPlugin` that includes the same libraries (potentially at different -versions) in `SomeOtherPlugin/Android/`, the developer using `SomePlugin` and -`SomeOtherPlugin` will see an error when building for Android that can be hard -to interpret. - -Using the Android Resolver to manage Android library dependencies: - - * Solves Android library conflicts between plugins. - * Handles all of the various processing steps required to use Android - libraries (AARs, JARs) in Unity 4.x and above projects. Almost all - versions of Unity have - at best - partial support for AARs. - * (Experimental) Supports minification of included Java components without - exporting a project. - -## iOS Dependency Management - -The *iOS Resolver* component of this plugin integrates with -[CocoaPods](https://cocoapods.org/) to download and integrate iOS libraries -and frameworks into the Xcode project Unity generates when building for iOS. -Using CocoaPods allows multiple plugins to utilize shared components without -forcing developers to fix either duplicate or incompatible versions of -libraries included through multiple Unity plugins in their project. +* Android specific libraries (e.g + [AARs](https://developer.android.com/studio/projects/android-library.html)) -## Package Manager Registry Setup +* iOS [CocoaPods](https://cocoapods.org/) -The [Package Manager](https://docs.unity3d.com/Manual/Packages.html) -(PM) makes use of [NPM](https://www.npmjs.com/) registry servers for package -hosting and provides ways to discover, install, upgrade and uninstall packages. -This makes it easier for developers to manage plugins within their projects. +* Version management of transitive dependencies -However, installing additional package registries requires a few manual steps -that can potentially be error prone. The *Package Manager Resolver* -component of this plugin integrates with -[PM](https://docs.unity3d.com/Manual/Packages.html) to provide a way to -auto-install PM package registries when a `.unitypackage` is installed which -allows plugin maintainers to ship a `.unitypackage` that can provide access -to their own PM registry server to make it easier for developers to -manage their plugins. +* Management of Package Manager (PM) Registries -## Unity Plugin Version Management +If you want to add and use iOS/Android dependencies directly in your project, +then you should to install EDM4U in your project. -Finally, the *Version Handler* component of this plugin simplifies the process -of managing transitive dependencies of Unity plugins and each plugin's upgrade -process. +If you are a package user and the plugin you are using depends on EDM4U, *and* +the package does not include EDM4U as a package dependency already, then you +should to install EDM4U in your project. -For example, without the Version Handler plugin, if: +If you are a UPM package maintainer and your package requires EDM4U, then you +should add EDM4U as a +[package dependency](https://docs.unity3d.com/2019.3/Documentation/Manual/upm-dependencies.html) +in your package manifest (`package.json`): - * Unity plugin `SomePlugin` includes `EDM4U` plugin at - version 1.1. - * Unity plugin `SomeOtherPlugin` includes `EDM4U` - plugin at version 1.2. +```json +{ + "dependencies": { + "com.google.external-dependency-manager": "1.2.178" + } +} +``` -The version of `EDM4U` included in the developer's project depends upon the -order the developer imports `SomePlugin` or `SomeOtherPlugin`. +You should still install EDM4U to test out the package during development. -This results in: +If you are a legacy `.unitypackage` package maintainer and your package requires +EDM4U, please ask the user to install EDM4U separately. You should install EDM4U +to test out the package during development. - * `EDM4U` at version 1.2, if `SomePlugin` is imported then `SomeOtherPlugin` - is imported. - * `EDM4U` at version 1.1, if `SomeOtherPlugin` is imported then - `SomePlugin` is imported. +Updated releases are available on +[GitHub](https://github.com/googlesamples/unity-jar-resolver) -The Version Handler solves the problem of managing transitive dependencies by: +## Requirements - * Specifying a set of packaging requirements that enable a plugin at - different versions to be imported into a Unity project. - * Providing activation logic that selects the latest version of a plugin - within a project. +The *Android Resolver* and *iOS Resolver* components of the plugin only work +with Unity version 4.6.8 or higher. -When using the Version Handler to manage `EDM4U` included in `SomePlugin` and -`SomeOtherPlugin`, from the prior example, version 1.2 will always be the -version activated in a developer's Unity project. +The *Version Handler* component only works with Unity 5.x or higher as it +depends upon the `PluginImporter` UnityEditor API. -Plugin creators are encouraged to adopt this library to ease integration for -their customers. For more information about integrating EDM4U -into your own plugin, see the [Plugin Redistribution](#plugin-redistribution) -section of this document. +The *Package Manager Resolver* component only works with Unity 2018.4 or above, +when [scoped registry](https://docs.unity3d.com/Manual/upm-scoped.html) support +was added to the Package Manager. -# Analytics +## Getting Started -The External Dependency Manager for Unity plugin by default logs usage to Google -Analytics. The purpose of the logging is to quantitatively measure the usage of -functionality, to gather reports on integration failures and to inform future -improvements to the developer experience of the External Dependency Manager -plugin. Note that the analytics collected are limited to the scope of the EDM4U -plugin’s usage. +Check out [troubleshooting](troubleshooting-faq.md) if you need help. -For details of what is logged, please refer to the usage of -`EditorMeasurement.Report()` in the source code. +### Install via OpenUPM -# Requirements +EDM4U is available on +[OpenUPM](https://openupm.com/packages/com.google.external-dependency-manager/): -The *Android Resolver* and *iOS Resolver* components of the plugin only work -with Unity version 4.6.8 or higher. +```shell +openupm add com.google.external-dependency-manager +``` -The *Version Handler* component only works with Unity 5.x or higher as it -depends upon the `PluginImporter` UnityEditor API. +### Install via git URL +1. Open Package Manager +2. Click on the + icon on the top left corner of the "Package Manager" screen +3. Click on "Install package from git url..." +4. Paste: https://github.com/googlesamples/unity-jar-resolver.git?path=upm -The *Package Manager Resolver* component only works with -Unity 2018.4 or above, when -[scoped registry](https://docs.unity3d.com/Manual/upm-scoped.html) -support was added to the Package Manager. +### Install via Google APIs for Unity -# Getting Started +EDM4U is available both in UPM and legacy `.unitypackage` formats on +[Google APIs for Unity](https://developers.google.com/unity/archive#external_dependency_manager_for_unity). -Before you import EDM4U into your plugin project, you first -need to consider whether you intend to *redistribute* `EDM4U` -along with your own plugin. +You may install the UPM version (.tgz) as a +[local UPM package](https://docs.unity3d.com/Manual/upm-ui-local.html). -## Plugin Redistribution +You can also install EDM4U in your project as a `.unitypackage`. This is not +recommended due to potential conflicts. -If you're a plugin maintainer, redistributing `EDM4U` inside your own plugin -will ease the integration process for your users, by resolving dependency -conflicts between your plugin and other plugins in a user's project. - -If you wish to redistribute `EDM4U` inside your plugin, -you **must** follow these steps when importing the -`external-dependency-manager-*.unitypackage`, and when exporting your own plugin -package: - - 1. Import the `external-dependency-manager-*.unitypackage` into your plugin - project by - [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), ensuring that - you add the `-gvh_disable` option. - 1. Export your plugin by [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), ensuring that - you: - - Include the contents of the `Assets/PlayServicesResolver` and - `Assets/ExternalDependencyManager` directory. - - Add the `-gvh_disable` option. +### Conflict Resolution -You **must** specify the `-gvh_disable` option in order for the Version -Handler to work correctly! +For historical reasons, a package maintainer may choose to embed EDM4U in their +package for ease of installation. This will create a conflict when you try to +install EDM4U with the steps above, or with another package with embedded EDM4U. +If your project imported a `.unitypackage` that has a copy of EDM4U embedded in +it, you may safely delete it from your Assets folder. If your project depends on +another UPM package with EDM4U, please reach out to the package maintainer and +ask them to replace it with a dependency to this package. In the meantime, you +can workaround the issue by copying the package to your Packages folder (to +create an +[embedded package](https://docs.unity3d.com/Manual/upm-concepts.html#Embedded)) +and perform the steps yourself to avoid a dependency conflict. -For example, the following command will import the -`external-dependency-manager-1.2.46.0.unitypackage` into the project -`MyPluginProject` and export the entire Assets folder to -`MyPlugin.unitypackage`: +### Config file -``` -Unity -gvh_disable \ - -batchmode \ - -importPackage external-dependency-manager-1.2.46.0.unitypackage \ - -projectPath MyPluginProject \ - -exportPackage Assets MyPlugin.unitypackage \ - -quit -``` +To start adding dependencies to your project, copy and rename the +[SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) +file into your plugin and add the dependencies your project requires. -### Background +The XML file needs to be under an `Editor` directory and match the name +`*Dependencies.xml`. For example, `MyPlugin/Editor/MyPluginDependencies.xml`. -The *Version Handler* component relies upon deferring the load of editor DLLs -so that it can run first and determine the latest version of a plugin component -to activate. The build of `EDM4U` plugin has Unity asset metadata that is -configured so that the editor components are not initially enabled when it's -imported into a Unity project. To maintain this configuration when importing -the `external-dependency-manager.unitypackage` into a Unity plugin project, you -*must* specify the command line option `-gvh_disable` which will prevent the -Version Handler component from running and changing the Unity asset metadata. +## Usages -# Android Resolver Usage +### Android Resolver The Android Resolver copies specified dependencies from local or remote Maven repositories into the Unity project when a user selects Android as the build target in the Unity editor. - 1. Add the `external-dependency-manager-*.unitypackage` to your plugin - project (assuming you are developing a plugin). If you are redistributing - EDM4U with your plugin, you **must** follow the - import steps in the [Getting Started](#getting-started) section! - - 2. Copy and rename the - [SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) - file into your plugin and add the dependencies your plugin requires. - - The XML file just needs to be under an `Editor` directory and match the - name `*Dependencies.xml`. For example, - `MyPlugin/Editor/MyPluginDependencies.xml`. - - 3. Follow the steps in the [Getting Started](#getting-started) - section when you are exporting your plugin package. - For example, to add the Google Play Games library -(`com.google.android.gms:play-services-games` package) at version `9.8.0` to -the set of a plugin's Android dependencies: +(`com.google.android.gms:play-services-games` package) at version `9.8.0` to the +set of a plugin's Android dependencies: -``` +```xml @@ -244,20 +138,22 @@ the set of a plugin's Android dependencies: The version specification (last component) supports: - * Specific versions e.g `9.8.0` - * Partial matches e.g `9.8.+` would match 9.8.0, 9.8.1 etc. choosing the most - recent version. - * Latest version using `LATEST` or `+`. We do *not* recommend using this - unless you're 100% sure the library you depend upon will not break your - Unity plugin in future. +* Specific versions e.g `9.8.0` + +* Partial matches e.g `9.8.+` would match 9.8.0, 9.8.1 etc. choosing the most + recent version + +* Latest version using `LATEST` or `+`. We do *not* recommend using this + unless you're 100% sure the library you depend upon will not break your + Unity plugin in future The above example specifies the dependency as a component of the Android SDK manager such that the Android SDK manager will be executed to install the -package if it's not found. If your Android dependency is located on Maven +package if it's not found. If your Android dependency is located on Maven central it's possible to specify the package simply using the `androidPackage` element: -``` +```xml @@ -265,170 +161,157 @@ element: ``` -## Auto-resolution +#### Auto-resolution By default the Android Resolver automatically monitors the dependencies you have -specified and the `Plugins/Android` folder of your Unity project. The -resolution process runs when the specified dependencies are not present in your -project. +specified and the `Plugins/Android` folder of your Unity project. The resolution +process runs when the specified dependencies are not present in your project. -The *auto-resolution* process can be disabled via the -`Assets > External Dependency Manager > Android Resolver > Settings` menu. +The *auto-resolution* process can be disabled via the `Assets > External +Dependency Manager > Android Resolver > Settings` menu. Manual resolution can be performed using the following menu options: - * `Assets > External Dependency Manager > Android Resolver > Resolve` - * `Assets > External Dependency Manager > Android Resolver > Force Resolve` +* `Assets > External Dependency Manager > Android Resolver > Resolve` + +* `Assets > External Dependency Manager > Android Resolver > Force Resolve` -## Deleting libraries +#### Deleting libraries -Resolved packages are tracked via asset labels by the Android Resolver. -They can easily be deleted using the -`Assets > External Dependency Manager > Android Resolver > Delete Resolved Libraries` -menu item. +Resolved packages are tracked via asset labels by the Android Resolver. They can +easily be deleted using the `Assets > External Dependency Manager > Android +Resolver > Delete Resolved Libraries` menu item. -## Android Manifest Variable Processing +#### Android Manifest Variable Processing Some AAR files (for example play-services-measurement) contain variables that -are processed by the Android Gradle plugin. Unfortunately, Unity does not +are processed by the Android Gradle plugin. Unfortunately, Unity does not perform the same processing when using Unity's Internal Build System, so the -Android Resolver plugin handles known cases of this variable substitution -by exploding the AAR into a folder and replacing `${applicationId}` with the +Android Resolver plugin handles known cases of this variable substitution by +exploding the AAR into a folder and replacing `${applicationId}` with the `bundleID`. Disabling AAR explosion and therefore Android manifest processing can be done via the `Assets > External Dependency Manager > Android Resolver > Settings` -menu. You may want to disable explosion of AARs if you're exporting a project -to be built with Gradle / Android Studio. +menu. You may want to disable explosion of AARs if you're exporting a project to +be built with Gradle/Android Studio. -## ABI Stripping +#### ABI Stripping -Some AAR files contain native libraries (.so files) for each ABI supported -by Android. Unfortunately, when targeting a single ABI (e.g x86), Unity does -not strip native libraries for unused ABIs. To strip unused ABIs, the Android -Resolver plugin explodes an AAR into a folder and removes unused ABIs to -reduce the built APK size. Furthermore, if native libraries are not stripped -from an APK (e.g you have a mix of Unity's x86 library and some armeabi-v7a -libraries) Android may attempt to load the wrong library for the current -runtime ABI completely breaking your plugin when targeting some architectures. +Some AAR files contain native libraries (.so files) for each ABI supported by +Android. Unfortunately, when targeting a single ABI (e.g x86), Unity does not +strip native libraries for unused ABIs. To strip unused ABIs, the Android +Resolver plugin explodes an AAR into a folder and removes unused ABIs to reduce +the built APK size. Furthermore, if native libraries are not stripped from an +APK (e.g you have a mix of Unity's x86 library and some armeabi-v7a libraries) +Android may attempt to load the wrong library for the current runtime ABI +completely breaking your plugin when targeting some architectures. -AAR explosion and therefore ABI stripping can be disabled via the -`Assets > External Dependency Manager > Android Resolver > Settings` menu. -You may want to disable explosion of AARs if you're exporting a project to be -built with Gradle / Android Studio. +AAR explosion and therefore ABI stripping can be disabled via the `Assets > +External Dependency Manager > Android Resolver > Settings` menu. You may want to +disable explosion of AARs if you're exporting a project to be built with +Gradle/Android Studio. -## Resolution Strategies +#### Resolution Strategies By default the Android Resolver will use Gradle to download dependencies prior -to integrating them into a Unity project. This works with Unity's internal -build system and Gradle / Android Studio project export. +to integrating them into a Unity project. This works with Unity's internal build +system and Gradle/Android Studio project export. -It's possible to change the resolution strategy via the -`Assets > External Dependency Manager > Android Resolver > Settings` menu. +It's possible to change the resolution strategy via the `Assets > External +Dependency Manager > Android Resolver > Settings` menu. -### Download Artifacts with Gradle +##### Download Artifacts with Gradle Using the default resolution strategy, the Android resolver executes the following operations: - - Remove the result of previous Android resolutions. - e.g Delete all files and directories labeled with "gpsr" under - `Plugins/Android` from the project. - - Collect the set of Android dependencies (libraries) specified by a - project's `*Dependencies.xml` files. - - Run `download_artifacts.gradle` with Gradle to resolve conflicts and, - if successful, download the set of resolved Android libraries (AARs, JARs). - - Process each AAR / JAR so that it can be used with the currently selected - Unity build system (e.g Internal vs. Gradle, Export vs. No Export). - This involves patching each reference to `applicationId` in the - AndroidManifest.xml with the project's bundle ID. This means resolution - must be run if the bundle ID is changed again. - - Move the processed AARs to `Plugins/Android` so they will be included when - Unity invokes the Android build. - -### Integrate into mainTemplate.gradle +- Remove the result of previous Android resolutions. E.g Delete all files and + directories labeled with "gpsr" under `Plugins/Android` from the project. + +- Collect the set of Android dependencies (libraries) specified by a project's + `*Dependencies.xml` files. + +- Run `download_artifacts.gradle` with Gradle to resolve conflicts and, if + successful, download the set of resolved Android libraries (AARs, JARs). + +- Process each AAR/JAR so that it can be used with the currently selected + Unity build system (e.g Internal vs. Gradle, Export vs. No Export). This + involves patching each reference to `applicationId` in the + `AndroidManifest.xml` with the project's bundle ID. This means resolution + must be run again if the bundle ID has changed. + +- Move the processed AARs to `Plugins/Android` so they will be included when + Unity invokes the Android build. + +##### Integrate into mainTemplate.gradle Unity 5.6 introduced support for customizing the `build.gradle` used to build Unity projects with Gradle. When the *Patch mainTemplate.gradle* setting is enabled, rather than downloading artifacts before the build, Android resolution results in the execution of the following operations: - - Remove the result of previous Android resolutions. - e.g Delete all files and directories labeled with "gpsr" under - `Plugins/Android` from the project and remove sections delimited with - `// Android Resolver * Start` and `// Android Resolver * End` lines. - - Collect the set of Android dependencies (libraries) specified by a - project's `*Dependencies.xml` files. - - Rename any `.srcaar` files in the build to `.aar` and exclude them from - being included directly by Unity in the Android build as - `mainTemplate.gradle` will be patched to include them instead from their - local maven repositories. - - Inject the required Gradle repositories into `mainTemplate.gradle` at the - line matching the pattern - `.*apply plugin: 'com\.android\.(application|library)'.*` or the section - starting at the line `// Android Resolver Repos Start`. - If you want to control the injection point in the file, the section - delimited by the lines `// Android Resolver Repos Start` and - `// Android Resolver Repos End` should be placed in the global scope - before the `dependencies` section. - - Inject the required Android dependencies (libraries) into - `mainTemplate.gradle` at the line matching the pattern `***DEPS***` or - the section starting at the line `// Android Resolver Dependencies Start`. - If you want to control the injection point in the file, the section - delimited by the lines `// Android Resolver Dependencies Start` and - `// Android Resolver Dependencies End` should be placed in the - `dependencies` section. - - Inject the packaging options logic, which excludes architecture specific - libraries based upon the selected build target, into `mainTemplate.gradle` - at the line matching the pattern `android +{` or the section starting at - the line `// Android Resolver Exclusions Start`. - If you want to control the injection point in the file, the section - delimited by the lines `// Android Resolver Exclusions Start` and - `// Android Resolver Exclusions End` should be placed in the global - scope before the `android` section. - -## Dependency Tracking +- Remove the result of previous Android resolutions. E.g Delete all files and + directories labeled with "gpsr" under `Plugins/Android` from the project and + remove sections delimited with `// Android Resolver * Start` and `// Android + Resolver * End` lines. + +- Collect the set of Android dependencies (libraries) specified by a project's + `*Dependencies.xml` files. + +- Rename any `.srcaar` files in the build to `.aar` and exclude them from + being included directly by Unity in the Android build as + `mainTemplate.gradle` will be patched to include them instead from their + local maven repositories. + +- Inject the required Gradle repositories into `mainTemplate.gradle` at the + line matching the pattern `.*apply plugin: + 'com\.android\.(application|library)'.*` or the section starting at the line + `// Android Resolver Repos Start`. If you want to control the injection + point in the file, the section delimited by the lines `// Android Resolver + Repos Start` and `// Android Resolver Repos End` should be placed in the + global scope before the `dependencies` section. + +- Inject the required Android dependencies (libraries) into + `mainTemplate.gradle` at the line matching the pattern `***DEPS***` or the + section starting at the line `// Android Resolver Dependencies Start`. If + you want to control the injection point in the file, the section delimited + by the lines `// Android Resolver Dependencies Start` and `// Android + Resolver Dependencies End` should be placed in the `dependencies` section. + +- Inject the packaging options logic, which excludes architecture specific + libraries based upon the selected build target, into `mainTemplate.gradle` + at the line matching the pattern `android +{` or the section starting at the + line `// Android Resolver Exclusions Start`. If you want to control the + injection point in the file, the section delimited by the lines `// Android + Resolver Exclusions Start` and `// Android Resolver Exclusions End` should + be placed in the global scope before the `android` section. + +#### Dependency Tracking The Android Resolver creates the `ProjectSettings/AndroidResolverDependencies.xml` to quickly determine the set -of resolved dependencies in a project. This is used by the auto-resolution +of resolved dependencies in a project. This is used by the auto-resolution process to only run the expensive resolution process when necessary. -## Displaying Dependencies +#### Displaying Dependencies -It's possible to display the set of dependencies the Android Resolver -would download and process in your project via the -`Assets > External Dependency Manager > Android Resolver > Display Libraries` -menu item. +It's possible to display the set of dependencies the Android Resolver would +download and process in your project via the `Assets > External Dependency +Manager > Android Resolver > Display Libraries` menu item. -# iOS Resolver Usage +### iOS Resolver The iOS resolver component of this plugin manages -[CocoaPods](https://cocoapods.org/). A CocoaPods `Podfile` is generated and -the `pod` tool is executed as a post build process step to add dependencies -to the Xcode project exported by Unity. +[CocoaPods](https://cocoapods.org/). A CocoaPods `Podfile` is generated and the +`pod` tool is executed as a post build process step to add dependencies to the +Xcode project exported by Unity. Dependencies for iOS are added by referring to CocoaPods. - 1. Add the `external-dependency-manager-*.unitypackage` to your plugin - project (assuming you are developing a plugin). If you are redistributing - EDM4U with your plugin, you **must** follow the - import steps in the [Getting Started](#getting-started) section! - - 2. Copy and rename the - [SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) - file into your plugin and add the dependencies your plugin requires. - - The XML file just needs to be under an `Editor` directory and match the - name `*Dependencies.xml`. For example, - `MyPlugin/Editor/MyPluginDependencies.xml`. - - 3. Follow the steps in the [Getting Started](#getting-started) - section when you are exporting your plugin package. - For example, to add the AdMob pod, version 7.0 or greater with bitcode enabled: -``` +```xml ``` -## Integration Strategies +#### Integration Strategies The `CocoaPods` are either: - * Downloaded and injected into the Xcode project file directly, rather than - creating a separate xcworkspace. We call this `Xcode project` integration. - * If the Unity version supports opening a xcworkspace file, the `pod` tool - is used as intended to generate a xcworkspace which references the - CocoaPods. We call this `Xcode workspace` integration. -The resolution strategy can be changed via the -`Assets > External Dependency Manager > iOS Resolver > Settings` menu. +* Downloaded and injected into the Xcode project file directly, rather than + creating a separate xcworkspace. We call this `Xcode project` integration. + +* If the Unity version supports opening a xcworkspace file, the `pod` tool is + used as intended to generate a xcworkspace which references the CocoaPods. + We call this `Xcode workspace` integration. + +The resolution strategy can be changed via the `Assets > External Dependency +Manager > iOS Resolver > Settings` menu. + +##### Appending text to generated Podfile -### Appending text to generated Podfile In order to modify the generated Podfile you can create a script like this: -``` + +```csharp using System.IO; -public class PostProcessIOS : MonoBehaviour { -[PostProcessBuildAttribute(45)]//must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's added before "pod install" (50) -private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) + +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEngine; + +public class PostProcessIOS : MonoBehaviour { - if (target == BuildTarget.iOS) + // Must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and + // that it's added before "pod install" (50). + [PostProcessBuildAttribute(45)] + private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) { - - using (StreamWriter sw = File.AppendText(buildPath + "/Podfile")) + if (target == BuildTarget.iOS) { - //in this example I'm adding an app extension - sw.WriteLine("\ntarget 'NSExtension' do\n pod 'Firebase/Messaging', '6.6.0'\nend"); + using (StreamWriter sw = File.AppendText(buildPath + "/Podfile")) + { + // E.g. add an app extension + sw.WriteLine("\ntarget 'NSExtension' do\n pod 'Firebase/Messaging', '6.6.0'\nend"); + } } } } ``` -# Package Manager Resolver Usage +### Package Manager Resolver Adding registries to the -[Package Manager](https://docs.unity3d.com/Manual/Packages.html) -(PM) is a manual process. The Package Manager Resolver (PMR) component -of this plugin makes it easy for plugin maintainers to distribute new PM -registry servers and easy for plugin users to manage PM registry servers. - -## Adding Registries - - 1. Add the `external-dependency-manager-*.unitypackage` to your plugin - project (assuming you are developing a plugin). If you are redistributing - EDM4U with your plugin, you **must** follow the - import steps in the [Getting Started](#getting-started) section! +[Package Manager](https://docs.unity3d.com/Manual/Packages.html) (PM) is a +manual process. The Package Manager Resolver (PMR) component of this plugin +makes it easy for plugin maintainers to distribute new PM registry servers and +easy for plugin users to manage PM registry servers. - 2. Copy and rename the - [SampleRegistries.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/sample/Assets/ExternalDependencyManager/Editor/SampleRegistries.xml) - file into your plugin and add the registries your plugin requires. - - The XML file just needs to be under an `Editor` directory and match the - name `*Registries.xml` or labeled with `gumpr_registries`. For example, - `MyPlugin/Editor/MyPluginRegistries.xml`. - - 3. Follow the steps in the [Getting Started](#getting-started) - section when you are exporting your plugin package. +#### Adding Registries For example, to add a registry for plugins in the scope `com.coolstuff`: -``` +```xml External Dependency Manager > Package Manager Resolver > - Add Registries` will prompt the user with a window which allows them to - add registries discovered in the project to the Package Manager. -* `Assets > External Dependency Manager > Package Manager Resolver > - Remove Registries` will prompt the user with a window which allows them to - remove registries discovered in the project from the Package Manager. -* `Assets > External Dependency Manager > Package Manager Resolver > - Modify Registries` will prompt the user with a window which allows them to - add or remove registries discovered in the project. - -## Migration - -PMR can migrate Version Handler packages installed in the `Assets` folder -to PM packages. This requires the plugins to implement the following: - -* `.unitypackage` must include a Version Handler manifests that describes - the components of the plugin. If the plugin has no dependencies - the manifest would just include the files in the plugin. -* The PM package JSON provided by the registry must include a keyword - (in the `versions.VERSION.keyword` list) that maps the PM package - to a Version Handler package using the format - `vh-name:VERSION_HANDLER_MANIFEST_NAME` where `VERSION_HANDLER_MANIFEST_NAME` - is the name of the manifest defined in the `.unitypackage`. For - more information see the description of the `gvhp_manifestname` asset label - in the *Version Handler Usage* section. - -When using the `Assets > External Dependency Manager > -Package Manager Resolver > Migrate Packages` menu option, PMR then -will: - -* List all Version Handler manager packages in the project. -* Search all available packages in the PM registries and fetch keywords - associated with each package parsing the Version Handler manifest names - for each package. -* Map each installed Version Handler package to a PM package. -* Prompt the user to migrate the discovered packages. -* Perform package migration for all selected packages if the user clicks - the `Apply` button. - -## Configuration - -PMR can be configured via the `Assets > External Dependency Manager > -Package Manager Resolver > Settings` menu option: - -* `Add package registries` when enabled, when the plugin loads or registry - configuration files change, this will prompt the user to add registries - that are not present in the Package Manager. -* `Prompt to add package registries` will cause a developer to be prompted - with a window that will ask for confirmation before adding registries. - When this is disabled registries are added silently to the project. -* `Prompt to migrate packages` will cause a developer to be prompted - with a window that will ask for confirmation before migrating packages - installed in the `Assets` directory to PM packages. -* `Enable Analytics Reporting` when enabled, reports the use of the plugin - to the developers so they can make imrpovements. -* `Verbose logging` when enabled prints debug information to the console - which can be useful when filing bug reports. - -# Version Handler Usage +#### Managing Registries + +It's possible to add and remove registries that are specified via PMR XML +configuration files via the following menu options: + +* `Assets > External Dependency Manager > Package Manager Resolver > Add + Registries` will prompt the user with a window which allows them to add + registries discovered in the project to the Package Manager. + +* `Assets > External Dependency Manager > Package Manager Resolver > Remove + Registries` will prompt the user with a window which allows them to remove + registries discovered in the project from the Package Manager. + +* `Assets > External Dependency Manager > Package Manager Resolver > Modify + Registries` will prompt the user with a window which allows them to add or + remove registries discovered in the project. + +#### Migration + +PMR can migrate Version Handler packages installed in the `Assets` folder to PM +packages. This requires the plugins to implement the following: + +* `.unitypackage` must include a Version Handler manifests that describes the + components of the plugin. If the plugin has no dependencies the manifest + would just include the files in the plugin. + +* The PM package JSON provided by the registry must include a keyword (in the + `versions.VERSION.keyword` list) that maps the PM package to a Version + Handler package using the format `vh-name:VERSION_HANDLER_MANIFEST_NAME` + where `VERSION_HANDLER_MANIFEST_NAME` is the name of the manifest defined in + the `.unitypackage`. For more information see the description of the + `gvhp_manifestname` asset label in the [Version Handler](#version-handler) + section. + +When using the `Assets > External Dependency Manager > Package Manager +Resolver > Migrate Packages` menu option, PMR then will: + +* List all Version Handler manager packages in the project. + +* Search all available packages in the PM registries and fetch keywords + associated with each package parsing the Version Handler manifest names for + each package. + +* Map each installed Version Handler package to a PM package. + +* Prompt the user to migrate the discovered packages. + +* Perform package migration for all selected packages if the user clicks the + `Apply` button. + +#### Configuration + +PMR can be configured via the `Assets > External Dependency Manager > Package +Manager Resolver > Settings` menu option: + +* `Add package registries` when enabled, when the plugin loads or registry + configuration files change, this will prompt the user to add registries that + are not present in the Package Manager. + +* `Prompt to add package registries` will cause a developer to be prompted + with a window that will ask for confirmation before adding registries. When + this is disabled registries are added silently to the project. + +* `Prompt to migrate packages` will cause a developer to be prompted with a + window that will ask for confirmation before migrating packages installed in + the `Assets` directory to PM packages. + +* `Enable Analytics Reporting` when enabled, reports the use of the plugin to + the developers so they can make imrpovements. + +* `Verbose logging` when enabled prints debug information to the console which + can be useful when filing bug reports. + +### Version Handler The Version Handler component of this plugin manages: -* Shared Unity plugin dependencies. -* Upgrading Unity plugins by cleaning up old files from previous versions. -* Uninstallation of plugins that are distributed with manifest files. -* Restoration of plugin assets to their original install locations if assets - are tagged with the `exportpath` label. +* Shared Unity plugin dependencies. + +* Upgrading Unity plugins by cleaning up old files from previous versions. + +* Uninstallation of plugins that are distributed with manifest files. + +* Restoration of plugin assets to their original install locations if assets + are tagged with the `exportpath` label. Since the Version Handler needs to modify Unity asset metadata (`.meta` files), -to enable / disable components, rename and delete asset files it does not -work with Package Manager installed packages. It's still possible to -include EDM4U in Package Manager packages, the Version Handler component -simply won't do anything to PM plugins in this case. +to enable/disable components, rename and delete asset files it does not work +with Package Manager installed packages. It's still possible to include EDM4U in +Package Manager packages, the Version Handler component simply won't do anything +to PM plugins in this case. -## Using Version Handler Managed Plugins +#### Using Version Handler Managed Plugins -If a plugin is imported at multiple different versions into a project, if -the Version Handler is enabled, it will automatically check all managed -assets to determine the set of assets that are out of date and assets that -should be removed. To disable automatic checking managed assets disable -the `Enable version management` option in the -`Assets > External Dependency Manager > Version Handler > Settings` menu. +If a plugin is imported at multiple different versions into a project, if the +Version Handler is enabled, it will automatically check all managed assets to +determine the set of assets that are out of date and assets that should be +removed. To disable automatic checking managed assets disable the `Enable +version management` option in the `Assets > External Dependency Manager > +Version Handler > Settings` menu. If version management is disabled, it's possible to check managed assets -manually using the -`Assets > External Dependency Manager > Version Handler > Update` menu option. +manually using the `Assets > External Dependency Manager > Version Handler > +Update` menu option. -### Listing Managed Plugins +##### Listing Managed Plugins -Plugins managed by the Version Handler, those that ship with manifest files, -can displayed using the `Assets > External Dependency Manager > -Version Handler > Display Managed Packages` menu option. The list of plugins -are written to the console window along with the set of files used by each -plugin. +Plugins managed by the Version Handler, those that ship with manifest files, can +displayed using the `Assets > External Dependency Manager > Version Handler > +Display Managed Packages` menu option. The list of plugins are written to the +console window along with the set of files used by each plugin. -### Uninstalling Managed Plugins +##### Uninstalling Managed Plugins -Plugins managed by the Version Handler, those that ship with manifest files, -can be removed using the `Assets > External Dependency Manager > -Version Handler > Uninstall Managed Packages` menu option. This operation -will display a window that allows a developer to select a set of plugins to -remove which will remove all files owned by each plugin excluding those that -are in use by other installed plugins. +Plugins managed by the Version Handler, those that ship with manifest files, can +be removed using the `Assets > External Dependency Manager > Version Handler > +Uninstall Managed Packages` menu option. This operation will display a window +that allows a developer to select a set of plugins to remove which will remove +all files owned by each plugin excluding those that are in use by other +installed plugins. Files managed by the Version Handler, those labeled with the `gvh` asset label, -can be checked to see whether anything needs to be upgraded, disabled or -removed using the `Assets > External Dependency Manager > -Version Handler > Update` menu option. +can be checked to see whether anything needs to be upgraded, disabled or removed +using the `Assets > External Dependency Manager > Version Handler > Update` menu +option. -### Restore Install Paths +##### Restore Install Paths -Some developers move assets around in their project which can make it -harder for plugin maintainers to debug issues if this breaks Unity's -[special folders](https://docs.unity3d.com/Manual/SpecialFolders.html) rules. -If assets are labeled with their original install / export path -(see `gvhp_exportpath` below), Version Handler can restore assets to their -original locations when using the `Assets > External Dependency Manager > -Version Handler > Move Files To Install Locations` menu option. +Some developers move assets around in their project which can make it harder for +plugin maintainers to debug issues if this breaks Unity's +[special folders](https://docs.unity3d.com/Manual/SpecialFolders.html) rules. If +assets are labeled with their original install/export path (see +`gvhp_exportpath` below), Version Handler can restore assets to their original +locations when using the `Assets > External Dependency Manager > Version +Handler > Move Files To Install Locations` menu option. -### Settings +##### Settings -Some behavior of the Version Handler can be configured via the -`Assets > External Dependency Manager > Version Handler > Settings` menu -option. +Some behavior of the Version Handler can be configured via the `Assets > +External Dependency Manager > Version Handler > Settings` menu option. + +* `Enable version management` controls whether the plugin should automatically + check asset versions and apply changes. If this is disabled the process + should be run manually when installing or upgrading managed plugins using + `Assets > External Dependency Manager > Version Handler > Update`. + +* `Rename to canonical filenames` is a legacy option that will rename files to + remove version numbers and other labels from filenames. + +* `Prompt for obsolete file deletion` enables the display of a window when + obsolete files are deleted allowing the developer to select which files to + delete and those to keep. + +* `Allow disabling files via renaming` controls whether obsolete or disabled + files should be disabled by renaming them to `myfilename_DISABLED`. Renaming + to disable files is required in some scenarios where Unity doesn't support + removing files from the build via the PluginImporter. + +* `Enable Analytics Reporting` enables/disables usage reporting to plugin + developers to improve the product. -* `Enable version management` controls whether the plugin should automatically - check asset versions and apply changes. If this is disabled the process - should be run manually when installing or upgrading managed plugins using - `Assets > External Dependency Manager > Version Handler > Update`. -* `Rename to canonical filenames` is a legacy option that will rename files to - remove version numbers and other labels from filenames. -* `Prompt for obsolete file deletion` enables the display of a window when - obsolete files are deleted allowing the developer to select which files to - delete and those to keep. -* `Allow disabling files via renaming` controls whether obsolete or disabled - files should be disabled by renaming them to `myfilename_DISABLED`. - Renaming to disable files is required in some scenarios where Unity doesn't - support removing files from the build via the PluginImporter. -* `Enable Analytics Reporting` enables / disables usage reporting to plugin - developers to improve the product. -* `Verbose logging` enables _very_ noisy log output that is useful for - debugging while filing a bug report or building a new managed plugin. -* `Use project settings` saves settings for the plugin in the project rather - than system-wide. - -## Redistributing a Managed Plugin - -The Version Handler employs a couple of methods for managing version -selection, upgrade and removal of plugins. - -* Each plugin can ship with a manifest file that lists the files it includes. - This makes it possible for Version Handler to calculate the difference - in assets between the most recent release of a plugin and the previous - release installed in a project. If a files are removed the Version Handler - will prompt the user to clean up obsolete files. -* Plugins can ship using assets with unique names, unique GUIDs and version - number labels. Version numbers can be attached to assets using labels or - added to the filename (e.g `myfile.txt` would be `myfile_version-x.y.z.txt). - This allows the Version Handler to determine which set of files are the - same file at different versions, select the most recent version and prompt - the developer to clean up old versions. +* `Verbose logging` enables *very* noisy log output that is useful for + debugging while filing a bug report or building a new managed plugin. + +* `Use project settings` saves settings for the plugin in the project rather + than system-wide. + +#### Redistributing a Managed Plugin + +The Version Handler employs a couple of methods for managing version selection, +upgrade and removal of plugins. + +* Each plugin can ship with a manifest file that lists the files it includes. + This makes it possible for Version Handler to calculate the difference in + assets between the most recent release of a plugin and the previous release + installed in a project. If a files are removed the Version Handler will + prompt the user to clean up obsolete files. + +* Plugins can ship using assets with unique names, unique GUIDs and version + number labels. Version numbers can be attached to assets using labels or + added to the filename (e.g `myfile.txt` would be `myfile_version-x.y.z.txt). + This allows the Version Handler to determine which set of files are the same + file at different versions, select the most recent version and prompt the + developer to clean up old versions. Unity plugins can be managed by the Version Handler using the following steps: - 1. Add the `gvh` asset label to each asset (file) you want Version Handler - to manage. - 1. Add the `gvh_version-VERSION` label to each asset where `VERSION` is the - version of the plugin you're releasing (e.g 1.2.3). - 1. Add the `gvhp_exportpath-PATH` label to each asset where `PATH` is the - export path of the file when the `.unitypackage` is created. This is - used to track files if they're moved around in a project by developers. - 1. Optional: Add `gvh_targets-editor` label to each editor DLL in your - plugin and disable `editor` as a target platform for the DLL. - The Version Handler will enable the most recent version of this DLL when - the plugin is imported. - 1. Optional: If your plugin is included in other Unity plugins, you should - add the version number to each filename and change the GUID of each asset. - This allows multiple versions of your plugin to be imported into a Unity - project, with the Version Handler component activating only the most - recent version. - 1. Create a manifest text file named `MY_UNIQUE_PLUGIN_NAME_VERSION.txt` - that lists all the files in your plugin relative to the project root. - Then add the `gvh_manifest` label to the asset to indicate this file is - a plugin manifest. - 1. Optional: Add a `gvhp_manifestname-NAME` label to your manifest file - to provide a human readable name for your package. If this isn't provided - the name of the manifest file will be used as the package name. - NAME can match the pattern `[0-9]+[a-zA-Z -]' where a leading integer - will set the priority of the name where `0` is the highest priority - and preferably used as the display name. The lowest value (i.e highest - priority name) will be used as the display name and all other specified - names will be aliases of the display name. Aliases can refer to previous - names of the package allowing renaming across published versions. - 1. Redistribute EDM4U Unity plugin with your plugin. - See the [Plugin Redistribution](#plugin-redistribution) for the details. +1. Add the `gvh` asset label to each asset (file) you want Version Handler to + manage. + +1. Add the `gvh_version-VERSION` label to each asset where `VERSION` is the + version of the plugin you're releasing (e.g 1.2.3). + +1. Add the `gvhp_exportpath-PATH` label to each asset where `PATH` is the + export path of the file when the `.unitypackage` is created. This is used to + track files if they're moved around in a project by developers. + +1. Optional: Add `gvh_targets-editor` label to each editor DLL in your plugin + and disable `editor` as a target platform for the DLL. The Version Handler + will enable the most recent version of this DLL when the plugin is imported. + +1. Optional: If your plugin is included in other Unity plugins, you should add + the version number to each filename and change the GUID of each asset. This + allows multiple versions of your plugin to be imported into a Unity project, + with the Version Handler component activating only the most recent version. + +1. Create a manifest text file named `MY_UNIQUE_PLUGIN_NAME_VERSION.txt` that + lists all the files in your plugin relative to the project root. Then add + the `gvh_manifest` label to the asset to indicate this file is a plugin + manifest. + +1. Optional: Add a `gvhp_manifestname-NAME` label to your manifest file to + provide a human readable name for your package. If this isn't provided the + name of the manifest file will be used as the package name. NAME can match + the pattern `[0-9]+[a-zA-Z -]` where a leading integer will set the priority + of the name where `0` is the highest priority and preferably used as the + display name. The lowest value (i.e highest priority name) will be used as + the display name and all other specified names will be aliases of the + display name. Aliases can refer to previous names of the package allowing + renaming across published versions. + +1. Redistribute EDM4U Unity plugin with your plugin. See the + [Plugin Redistribution](#plugin-redistribution) section for details. If you follow these steps: - * When users import a newer version of your plugin, files referenced by the - older version's manifest are cleaned up. - * The latest version of the plugin will be selected when users import - multiple packages that include your plugin, assuming the steps in - [Plugin Redistribution](#plugin-redistribution) are followed. +* When users import a newer version of your plugin, files referenced by the + older version's manifest are cleaned up. + +* The latest version of the plugin will be selected when users import multiple + packages that include your plugin, assuming the steps in + [Plugin Redistribution](#plugin-redistribution) are followed. + +## Background + +Many Unity plugins have dependencies upon Android specific libraries, iOS +CocoaPods, and sometimes have transitive dependencies upon other Unity plugins. +This causes the following problems: + +* Integrating platform specific (e.g Android and iOS) libraries within a Unity + project can be complex and a burden on a Unity plugin maintainer. +* The process of resolving conflicting dependencies on platform specific + libraries is pushed to the developer attempting to use a Unity plugin. The + developer trying to use your plugin is very likely to give up when faced + with Android or iOS specific build errors. +* The process of resolving conflicting Unity plugins (due to shared Unity + plugin components) is pushed to the developer attempting to use your Unity + plugin. In an effort to resolve conflicts, the developer will very likely + attempt to resolve problems by deleting random files in your plugin, report + bugs when that doesn't work and finally give up. + +EDM4U provides solutions for each of these problems. + +### Android Dependency Management + +The *Android Resolver* component of this plugin will download and integrate +Android library dependencies and handle any conflicts between plugins that share +the same dependencies. + +Without the Android Resolver, typically Unity plugins bundle their AAR and JAR +dependencies, e.g. a Unity plugin `SomePlugin` that requires the Google Play +Games Android library would redistribute the library and its transitive +dependencies in the folder `SomePlugin/Android/`. When a user imports +`SomeOtherPlugin` that includes the same libraries (potentially at different +versions) in `SomeOtherPlugin/Android/`, the developer using `SomePlugin` and +`SomeOtherPlugin` will see an error when building for Android that can be hard +to interpret. + +Using the Android Resolver to manage Android library dependencies: + +* Solves Android library conflicts between plugins. +* Handles all of the various processing steps required to use Android + libraries (AARs, JARs) in Unity 4.x and above projects. Almost all versions + of Unity have - at best - partial support for AARs. +* (Experimental) Supports minification of included Java components without + exporting a project. + +### iOS Dependency Management + +The *iOS Resolver* component of this plugin integrates with +[CocoaPods](https://cocoapods.org/) to download and integrate iOS libraries and +frameworks into the Xcode project Unity generates when building for iOS. Using +CocoaPods allows multiple plugins to utilize shared components without forcing +developers to fix either duplicate or incompatible versions of libraries +included through multiple Unity plugins in their project. + +### Package Manager Registry Setup + +The [Package Manager](https://docs.unity3d.com/Manual/Packages.html) (PM) makes +use of [NPM](https://www.npmjs.com/) registry servers for package hosting and +provides ways to discover, install, upgrade and uninstall packages. This makes +it easier for developers to manage plugins within their projects. + +However, installing additional package registries requires a few manual steps +that can potentially be error prone. The *Package Manager Resolver* component of +this plugin integrates with [PM](https://docs.unity3d.com/Manual/Packages.html) +to provide a way to auto-install PM package registries when a `.unitypackage` is +installed which allows plugin maintainers to ship a `.unitypackage` that can +provide access to their own PM registry server to make it easier for developers +to manage their plugins. + +### Unity Plugin Version Management + +Finally, the *Version Handler* component of this plugin simplifies the process +of managing transitive dependencies of Unity plugins and each plugin's upgrade +process. + +For example, without the Version Handler plugin, if: + +* Unity plugin `SomePlugin` includes `EDM4U` plugin at version 1.1. +* Unity plugin `SomeOtherPlugin` includes `EDM4U` plugin at version 1.2. + +The version of `EDM4U` included in the developer's project depends upon the +order the developer imports `SomePlugin` or `SomeOtherPlugin`. + +This results in: + +* `EDM4U` at version 1.2, if `SomePlugin` is imported then `SomeOtherPlugin` + is imported. +* `EDM4U` at version 1.1, if `SomeOtherPlugin` is imported then `SomePlugin` + is imported. + +The Version Handler solves the problem of managing transitive dependencies by: + +* Specifying a set of packaging requirements that enable a plugin at different + versions to be imported into a Unity project. +* Providing activation logic that selects the latest version of a plugin + within a project. + +When using the Version Handler to manage `EDM4U` included in `SomePlugin` and +`SomeOtherPlugin`, from the prior example, version 1.2 will always be the +version activated in a developer's Unity project. + +Plugin creators are encouraged to adopt this library to ease integration for +their customers. For more information about integrating EDM4U into your own +plugin, see the [Plugin Redistribution](#plugin-redistribution) section of this +document. + +## Analytics + +The External Dependency Manager for Unity plugin by default logs usage to Google +Analytics. The purpose of the logging is to quantitatively measure the usage of +functionality, to gather reports on integration failures and to inform future +improvements to the developer experience of the External Dependency Manager +plugin. Note that the analytics collected are limited to the scope of the EDM4U +plugin’s usage. + +For details of what is logged, please refer to the usage of +`EditorMeasurement.Report()` in the source code. -# Building from Source +## Plugin Redistribution -To build this plugin from source you need the following tools installed: - * Unity (with iOS and Android modules installed) +If you are a package maintainer and your package depends on EDM4U, it is highly +recommended to use the UPM format and add EDM4U as a dependency. If you must +include it in your `.unitypackage`, redistributing `EDM4U` inside your own +plugin might ease the integration process for your users. + +If you wish to redistribute `EDM4U` inside your plugin, you **must** follow +these steps when importing the `external-dependency-manager-*.unitypackage`, and +when exporting your own plugin package: + +1. Import the `external-dependency-manager-*.unitypackage` into your plugin + project by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), + ensuring that you add the `-gvh_disable` option. +1. Export your plugin by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), + ensuring that you: + - Include the contents of the `Assets/PlayServicesResolver` and + `Assets/ExternalDependencyManager` directory. + - Add the `-gvh_disable` option. -You can build the plugin by running the following from your shell -(Linux / OSX): +You **must** specify the `-gvh_disable` option in order for the Version Handler +to work correctly! +For example, the following command will import the +`external-dependency-manager-1.2.46.0.unitypackage` into the project +`MyPluginProject` and export the entire Assets folder to +`MyPlugin.unitypackage`: + +```shell +Unity -gvh_disable \ + -batchmode \ + -importPackage external-dependency-manager-1.2.46.0.unitypackage \ + -projectPath MyPluginProject \ + -exportPackage Assets MyPlugin.unitypackage \ + -quit ``` + +### Background + +The *Version Handler* component relies upon deferring the load of editor DLLs so +that it can run first and determine the latest version of a plugin component to +activate. The build of `EDM4U` plugin has Unity asset metadata that is +configured so that the editor components are not initially enabled when it's +imported into a Unity project. To maintain this configuration when importing the +`external-dependency-manager.unitypackage` into a Unity plugin project, you +*must* specify the command line option `-gvh_disable` which will prevent the +Version Handler component from running and changing the Unity asset metadata. + +## Building from Source + +To build this plugin from source you need the following tools installed: * Unity +2021 and below (with iOS and Android modules installed) * Java 11 + +You can build the plugin by running the following from your shell (Linux / OSX): + +```shell ./gradlew build + ``` or Windows: -``` +```shell ./gradlew.bat build ``` -# Releasing - -Each time a new build of this plugin is checked into the source tree you -need to do the following: - - * Bump the plugin version variable `pluginVersion` in `build.gradle` - * Update `CHANGELOG.md` with the new version number and changes included in - the release. - * Build the release using `./gradlew release` which performs the following: - * Updates `external-dependency-manager-*.unitypackage` - * Copies the unpacked plugin to the `exploded` directory. - * Updates template metadata files in the `plugin` directory. - The GUIDs of all asset metadata is modified due to the version number - change. Each file within the plugin is versioned to allow multiple - versions of the plugin to be imported into a Unity project which allows - the most recent version to be activated by the Version Handler - component. - * Create release commit using `./gradlew gitCreateReleaseCommit` which - performs `git commit -a -m "description from CHANGELOG.md"` - * Once the release commit is merge, tag the release using - `./gradlew gitTagRelease` which performs the following: - * `git tag -a pluginVersion -m "version RELEASE"` to tag the release. - * Update tags on remote branch using `git push --tag REMOTE HEAD:master` +If Java 11 is not your default Java command, add +`-Dorg.gradle.java.home=` to the command above. + +## Testing + +You can run the tests by running the following from your shell (Linux / OSX): + +```shell +./gradlew test +``` + +or Windows: + +```shell +./gradlew.bat test +``` + +The following properties can be set to narrow down the tests to run or change +the test run behavior. + +* `INTERACTIVE_MODE_TESTS_ENABLED` - Default to `1`. Set to `1` to enable + interactive mode tests, which requires GPU on the machine. Otherwise, only + run tests in the batch mode. +* `INCLUDE_TEST_TYPES` - Default to empty string, which means to include every + type of the test. To narrow down the types of test to run, set this + properties with a list of case-insensitive type strings separated by comma. + For instance, `-PINCLUDE_TEST_TYPES="Python,NUnit"` means to include only + Python tests and NUnit tests. See `TestTypeEnum` in `build.gradle` for + available options. +* `EXCLUDE_TEST_TYPES` - Default to empty string, which means to exclude none. + To add types of tests to exclude, set this properties with a list of + case-insensitive type strings separated by comma. For instance, + `-PEXCLUDE_TEST_TYPES="Python,NUnit"` means to exclude Python tests and + NUnit tests. See `TestTypeEnum` in `build.gradle` for available options. +* `INCLUDE_TEST_MODULES` - Default to empty string, which means to include the + tests for every modules. To narrow down modules to test, set this properties + with a list of case-insensitive module strings separated by comma. For + instance, `-PINCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests + for tools and Android Resolver only. See `TestModuleEnum` in `build.gradle` + for available options. +* `EXCLUDE_TEST_MODULES` - Default to empty string, which means to exclude + none. To add modules to exclude, set this properties with a list of + case-insensitive module strings separated by comma. For instance, + `-PEXCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests for any + modules other than tools and Android Resolver. See `TestModuleEnum` in + `build.gradle` for available options. +* `EXCLUDE_TESTS` - Default to empty string, which means to exclude none. To + add tests to exclude, set this properties with a list of case-insensitive + test names separated by comma. For instance, + `-PEXCLUDE_TESTS="testGenGuids,testDownloadArtifacts"` means to run tests + except the tests with name of `testGenGuids` and `testDownloadArtifacts`. +* `CONTINUE_ON_FAIL_FOR_TESTS_ENABLED` - Default to `1`. Set to `1` to + continue running the next test when the current one fails. Otherwise, the + build script stops whenever any test fails. + +For instance, by running the following command, it only runs the Unity +integration tests that does not requires GPU, but exclude tests for Android +Resolver module and iOS Resolver module. + +```shell +./gradlew test \ + -PINTERACTIVE_MODE_TESTS_ENABLED=0 \ + -PINCLUDE_TEST_TYPES="Integration" \ + -PEXCLUDE_TEST_MODULES="AndroidResolver,iOSResolver" +``` + +## Releasing + +Each time a new build of this plugin is checked into the source tree you need to +do the following: + +* Bump the plugin version variable `pluginVersion` in `build.gradle` +* Update `CHANGELOG.md` with the new version number and changes included in + the release. +* Build the release using `./gradlew release` which performs the following: + * Updates `external-dependency-manager-*.unitypackage` + * Copies the unpacked plugin to the `exploded` directory. + * Updates template metadata files in the `plugin` directory. The GUIDs of + all asset metadata is modified due to the version number change. Each + file within the plugin is versioned to allow multiple versions of the + plugin to be imported into a Unity project which allows the most recent + version to be activated by the Version Handler component. +* Create release commit using `./gradlew gitCreateReleaseCommit` which + performs `git commit -a -m "description from CHANGELOG.md"` +* Once the release commit is merge, tag the release using `./gradlew + gitTagRelease` which performs the following: + * `git tag -a pluginVersion -m "version RELEASE"` to tag the release. +* Update tags on remote branch using `git push --tag REMOTE HEAD:master` diff --git a/exploded/Assets/ExternalDependencyManager/Editor/README.md.meta b/exploded/Assets/ExternalDependencyManager/Editor/README.md.meta index eee07ef8..6bcc2245 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/README.md.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/README.md.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 8899dd41fdfd4ebc88ca6ef5951c6eb1 +guid: 77919e84cef8419ab4b725fc16e83d52 labels: -- gvh_version-1.2.174 +- gvh_version-1.2.186 - gvhp_exportpath-ExternalDependencyManager/Editor/README.md - gvh timeCreated: 1584567712 diff --git a/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.174_manifest.txt b/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.174_manifest.txt deleted file mode 100644 index 5539d779..00000000 --- a/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.174_manifest.txt +++ /dev/null @@ -1,13 +0,0 @@ -Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll -Assets/ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.mdb -Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll -Assets/ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.mdb -Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll -Assets/ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.mdb -Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll -Assets/ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.mdb -Assets/ExternalDependencyManager/Editor/CHANGELOG.md -Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll -Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb -Assets/ExternalDependencyManager/Editor/LICENSE -Assets/ExternalDependencyManager/Editor/README.md diff --git a/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt b/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt new file mode 100644 index 00000000..81c97ed6 --- /dev/null +++ b/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt @@ -0,0 +1,13 @@ +Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll +Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb +Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll +Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb +Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll +Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb +Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll +Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb +Assets/ExternalDependencyManager/Editor/CHANGELOG.md +Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll +Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb +Assets/ExternalDependencyManager/Editor/LICENSE +Assets/ExternalDependencyManager/Editor/README.md diff --git a/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.174_manifest.txt.meta b/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt.meta similarity index 75% rename from exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.174_manifest.txt.meta rename to exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt.meta index 7f8fa1af..a36e708a 100644 --- a/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.174_manifest.txt.meta +++ b/exploded/Assets/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: ad74f355b1754d20addf318841f3f9d1 +guid: c9a3138961c74d99b7046b783112fceb labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.174_manifest.txt +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt - gvh - gvh_manifest - gvhp_manifestname-0External Dependency Manager diff --git a/export_unity_package_config.json b/export_unity_package_config.json index 3fcccfe8..78b83ecb 100644 --- a/export_unity_package_config.json +++ b/export_unity_package_config.json @@ -88,7 +88,7 @@ "export_upm" : 1, "upm_package_config" : { "manifest" : { - "unity": "2017.1" + "unity": "2019.1" } } } diff --git a/export_unity_package_guids.json b/export_unity_package_guids.json index b404bcfa..59c045f4 100644 --- a/export_unity_package_guids.json +++ b/export_unity_package_guids.json @@ -33,5 +33,41 @@ }, "1.2.174": { "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.174": "2a82085e2b06441b96c360b7fe97f98c" + }, + "1.2.175": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.175": "ba0c697ad191428fac6b53f4ca8f8d4a" + }, + "1.2.176": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.176": "864a72f7c7cf4153a532cc1277dbfbdb" + }, + "1.2.177": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.177": "a768f4126d3b41ac900586e5a3b2d4a1" + }, + "1.2.178": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.178": "3d894de101f34a4b9a7f42e13c7aa3a3" + }, + "1.2.179": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.179": "e4b2f028f2e949cfac3ba5bbb128d139" + }, + "1.2.180": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.180": "e8f303eb74064b86b1308e81afd52ce1" + }, + "1.2.181": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.181": "d27fe564f10147d1bfded8244b25b494" + }, + "1.2.182": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.182": "60e9ce1be3474de5bdded37d1462e09b" + }, + "1.2.183": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.183": "5c127f68af44472d8099a80364a25718" + }, + "1.2.184": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.184": "297013161bc34ce4ac7b8ffba2384862" + }, + "1.2.185": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.185": "eb66eed64a99451d81abd63ff417f837" + }, + "1.2.186": { + "com.google.external-dependency-manager/ExternalDependencyManager/Editor/1.2.186": "8a6a9bd2649d4370b43be75e1689748c" } } diff --git a/external-dependency-manager-1.2.174.unitypackage b/external-dependency-manager-1.2.174.unitypackage deleted file mode 100644 index 9a2b92b8..00000000 Binary files a/external-dependency-manager-1.2.174.unitypackage and /dev/null differ diff --git a/external-dependency-manager-1.2.186.unitypackage b/external-dependency-manager-1.2.186.unitypackage new file mode 100644 index 00000000..37e58cd2 Binary files /dev/null and b/external-dependency-manager-1.2.186.unitypackage differ diff --git a/external-dependency-manager-latest.unitypackage b/external-dependency-manager-latest.unitypackage index 9a2b92b8..37e58cd2 100644 Binary files a/external-dependency-manager-latest.unitypackage and b/external-dependency-manager-latest.unitypackage differ diff --git a/gha/build_setup/action.yml b/gha/build_setup/action.yml new file mode 100644 index 00000000..aaacd456 --- /dev/null +++ b/gha/build_setup/action.yml @@ -0,0 +1,72 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Reusable cross-platform workflow to setup for the build environment. +# * Install Python and required Python packages +# * Install Unity, platform build support, and register license if +# username, password and serial id are provided +name: 'Build Setup' + +inputs: + unity_version: + required: true + platform: + description: 'Platform to install Unity on (Windows,macOS,Linux)' + type: choice + options: + - Windows + - macOS + - Linux + required: true + unity_username: + required: false + unity_password: + required: false + unity_serial_id: + required: false + python_version: + required: true + +runs: + using: 'composite' + steps: + # Download GHA tools and requirements from Firebase Unity SDK repo + - uses: actions/checkout@v3 + with: + repository: firebase/firebase-unity-sdk + path: external/firebase-unity-sdk + sparse-checkout: | + scripts/gha/requirements.txt + sparse-checkout-cone-mode: false + + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python_version }} + + - name: Install python deps + shell: bash + run: | + pip install -r ./external/firebase-unity-sdk/scripts/gha/requirements.txt + + - name: Install Unity and get a license + uses: firebase/firebase-unity-sdk/gha/unity@main + with: + version: ${{ inputs.unity_version }} + # iOS build support is always required to build EDM4U + platforms: "${{ inputs.platform }},iOS,Android" + username: ${{ inputs.unity_username }} + password: ${{ inputs.unity_password }} + serial_ids: ${{ inputs.unity_serial_id }} + diff --git a/plugin/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta b/plugin/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta index 438b6570..e5662a98 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/CHANGELOG.md.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 3d9f779dd5e74fcc9e05e0c450716999 +guid: aba4ee01c6d145f7bf2d944d892f709a labels: -- gvh_version-1.2.174 +- gvh_version-1.2.186 - gvhp_exportpath-ExternalDependencyManager/Editor/CHANGELOG.md - gvh timeCreated: 1584567712 diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.mdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.mdb.meta index c2dd5c00..3e39629c 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.mdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.mdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 5b6bc09459a04d01b86b61aa2479fcd8 +guid: adacdf2f31cf474c99788c9454063fed labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll.mdb +- gvh_version-1.2.177 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.177/Google.IOSResolver.dll.mdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.meta index 310c4f3a..707c589b 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.dll.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 83ff4764cfaa404ab9546c5a00b1b54f +guid: e2d7ea0845de4cf984265d2a444b7aa4 labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.IOSResolver.dll +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll - gvh - gvhp_targets-editor PluginImporter: @@ -12,6 +12,7 @@ PluginImporter: executionOrder: {} isPreloaded: 0 isOverridable: 0 + validateReferences: 0 platformData: - first: Any: diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.pdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.pdb.meta index 9ffc04a5..e6b1e059 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.pdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.IOSResolver.pdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 23a96cf443af4817b9681df7e40a0a48 +guid: baf24db2bf904e729e7796721c09e8ad labels: -- gvh_version-1.2.144 -- gvhp_exportpath-ExternalDependencyManager/Editor/Google.IOSResolver_v1.2.144.pdb +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.mdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.mdb.meta index 9d23d8b3..e5cd206a 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.mdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.mdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: b7c7315093524d328a0896f4e2a2d5e1 +guid: c613343662334614b65918fa6cf9c17e labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll.mdb +- gvh_version-1.2.177 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.177/Google.JarResolver.dll.mdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.meta index b89074dd..a1398e9f 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.dll.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: d9cf2414188e40c9a9f7a254a5436601 +guid: fa49a85d4ba140a0ae21528ed12d174c labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.JarResolver.dll +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll - gvh - gvhp_targets-editor PluginImporter: diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.pdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.pdb.meta index cf8a9bca..12826037 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.pdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.JarResolver.pdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: c8b529e6db8d411fb1bc26464a9f761e +guid: d13c8602d5e14e43b0e92459754c4315 labels: -- gvh_version-1.2.144 -- gvhp_exportpath-ExternalDependencyManager/Editor/Google.JarResolver_v1.2.144.pdb +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll.mdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll.mdb.meta index 454a2a23..9c80a012 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll.mdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll.mdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 61d62a8f613c4719952dca51701294da +guid: b60e304f823d423da748809d088d67b1 labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll.mdb +- gvh_version-1.2.177 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.177/Google.PackageManagerResolver.dll.mdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll.meta index a18922a7..3b4fa84b 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.dll.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 789ffd788f924bd0bdb33e26b367ad70 +guid: d8bb10c56a0147bc855a6296778e025e labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.PackageManagerResolver.dll +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll - gvh - gvhp_targets-editor PluginImporter: diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.pdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.pdb.meta index c8776e55..ac071adc 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.pdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.PackageManagerResolver.pdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: c3a4db753c154822b84671ce6df74c09 +guid: a695eb9f64fe49569a2db0c4246c877d labels: -- gvh_version-1.2.144 -- gvhp_exportpath-ExternalDependencyManager/Editor/Google.UnityPackageManagerResolver_v1.2.144.pdb +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb.meta index fd5316ac..442c422b 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: c3f725ddd3494ddf9818ee51153c40da +guid: 5855ffeab65945dc8f9cb3dc063f9eba labels: -- gvh_version-1.2.174 +- gvh_version-1.2.177 - gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll.mdb - gvh timeCreated: 1538009133 diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta index ceceb765..3babd47f 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 2010dfbbc3ff4f499e6892f6681a37df +guid: f7632a50b10045458c53a5ddf7b6d238 labels: -- gvh_version-1.2.174 +- gvh_version-1.2.186 - gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll - gvh - gvhp_targets-editor diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta index 3f49c29f..0b461abd 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 3aa17cd5f43042a1a7381759dc1258a7 +guid: 57f5a82a79ab4b098f09326c8f3c73a6 labels: -- gvh_version-1.2.144 +- gvh_version-1.2.186 - gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.pdb - gvh timeCreated: 1538009133 diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll.mdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll.mdb.meta index 339c1fbc..6569dce4 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll.mdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll.mdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 4ed4b38fe3c141f09fbc666169c1546f +guid: bd203ff120ed4c69bfdeffa466beec72 labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll.mdb +- gvh_version-1.2.177 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.177/Google.VersionHandlerImpl.dll.mdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll.meta index d44296c0..7456068f 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.dll.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 149319a041c7420b94473745b1919576 +guid: 5980a684c61d42fbb6b74e2eb3477016 labels: -- gvh_version-1.2.174 -- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.174/Google.VersionHandlerImpl.dll +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll - gvh - gvhp_targets-editor PluginImporter: diff --git a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.pdb.meta b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.pdb.meta index 9a317c29..da5b09b2 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.pdb.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/Google.VersionHandlerImpl.pdb.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: f75f9b60ac3c4499899472453dd9336c +guid: 9f56badf3ca84753b00163c3b632d4e5 labels: -- gvh_version-1.2.144 -- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandlerImpl_v1.2.144.pdb +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb - gvh timeCreated: 1538009133 licenseType: Pro diff --git a/plugin/Assets/ExternalDependencyManager/Editor/LICENSE.meta b/plugin/Assets/ExternalDependencyManager/Editor/LICENSE.meta index d4bb51b3..30482451 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/LICENSE.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/LICENSE.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: b5a2636858c0483bab69644a94d03b42 +guid: ae8b2bc8d1ac4ad48f0ab2b2e7ac75fb labels: -- gvh_version-1.2.174 +- gvh_version-1.2.186 - gvhp_exportpath-ExternalDependencyManager/Editor/LICENSE - gvh timeCreated: 1584567712 diff --git a/plugin/Assets/ExternalDependencyManager/Editor/README.md.meta b/plugin/Assets/ExternalDependencyManager/Editor/README.md.meta index eee07ef8..6bcc2245 100644 --- a/plugin/Assets/ExternalDependencyManager/Editor/README.md.meta +++ b/plugin/Assets/ExternalDependencyManager/Editor/README.md.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 8899dd41fdfd4ebc88ca6ef5951c6eb1 +guid: 77919e84cef8419ab4b725fc16e83d52 labels: -- gvh_version-1.2.174 +- gvh_version-1.2.186 - gvhp_exportpath-ExternalDependencyManager/Editor/README.md - gvh timeCreated: 1584567712 diff --git a/source/AndroidResolver/Properties/AssemblyInfo.cs b/source/AndroidResolver/Properties/AssemblyInfo.cs index a4691a3c..2d9fbd82 100644 --- a/source/AndroidResolver/Properties/AssemblyInfo.cs +++ b/source/AndroidResolver/Properties/AssemblyInfo.cs @@ -57,3 +57,4 @@ [assembly: InternalsVisibleTo("Google.IOSResolver")] // Uses all classes for testing. [assembly: InternalsVisibleTo("Google.AndroidResolverIntegrationTests")] +[assembly: InternalsVisibleTo("Google.AndroidResolverTests")] diff --git a/source/AndroidResolver/scripts/gradle-template.zip b/source/AndroidResolver/scripts/gradle-template.zip index 3799fdff..db181f66 100644 Binary files a/source/AndroidResolver/scripts/gradle-template.zip and b/source/AndroidResolver/scripts/gradle-template.zip differ diff --git a/source/AndroidResolver/src/GradleResolver.cs b/source/AndroidResolver/src/GradleResolver.cs index 965eed16..c9f4eac1 100644 --- a/source/AndroidResolver/src/GradleResolver.cs +++ b/source/AndroidResolver/src/GradleResolver.cs @@ -1161,7 +1161,7 @@ internal static bool ShouldProcess(string aarDirectory) { // To work around this when Gradle builds are enabled, explosion is enabled for all // AARs that require variable expansion unless this behavior is explicitly disabled // in the settings dialog. - if (PlayServicesResolver.GradleProjectExportEnabled && !SettingsDialog.ExplodeAars) { + if (!SettingsDialog.ExplodeAars) { return false; } // If this version of Unity doesn't support AAR files, always explode. diff --git a/source/AndroidResolver/src/GradleTemplateResolver.cs b/source/AndroidResolver/src/GradleTemplateResolver.cs index 6013c1a0..ff9f75e5 100644 --- a/source/AndroidResolver/src/GradleTemplateResolver.cs +++ b/source/AndroidResolver/src/GradleTemplateResolver.cs @@ -31,11 +31,49 @@ namespace GooglePlayServices { internal class GradleTemplateResolver { /// - /// Path of the Gradle properties file. + /// Filename of the Custom Gradle Properties Template file. + /// + public static string GradlePropertiesTemplateFilename = "gradleTemplate.properties"; + + /// + /// Path of the Custom Gradle Properties Template file in the Unity project. /// Available only from Unity version 2019.3 onwards /// public static string GradlePropertiesTemplatePath = - Path.Combine(SettingsDialog.AndroidPluginsDir, "gradleTemplate.properties"); + Path.Combine(SettingsDialog.AndroidPluginsDir, GradlePropertiesTemplateFilename); + + /// + /// Filename of the Custom Gradle Settings Template file. + /// + public static string GradleSettingsTemplatePathFilename = "settingsTemplate.gradle"; + + /// + /// Path of the Custom Gradle Settings Template file. + /// + public static string GradleSettingsTemplatePath = + Path.Combine(SettingsDialog.AndroidPluginsDir, GradleSettingsTemplatePathFilename); + + public static string UnityGradleTemplatesDir { + get { + if (unityGradleTemplatesDir == null) { + var engineDir = PlayServicesResolver.AndroidPlaybackEngineDirectory; + if (String.IsNullOrEmpty(engineDir)) return null; + var gradleTemplateDir = + Path.Combine(Path.Combine(engineDir, "Tools"), "GradleTemplates"); + unityGradleTemplatesDir = gradleTemplateDir; + } + return unityGradleTemplatesDir; + } + } + private static string unityGradleTemplatesDir = null; + + public static string UnityGradleSettingsTemplatePath { + get { + return Path.Combine( + UnityGradleTemplatesDir, + GradleSettingsTemplatePathFilename); + } + } /// /// Line that indicates the start of the injected properties block in properties template. @@ -47,11 +85,16 @@ internal class GradleTemplateResolver { /// private const string PropertiesEndLine = "# Android Resolver Properties End"; + /// + /// Filename of the Custom Main Gradle Template file. + /// + public static string GradleTemplateFilename = "mainTemplate.gradle"; + /// /// Path of the Gradle template file. /// public static string GradleTemplatePath = - Path.Combine(SettingsDialog.AndroidPluginsDir, "mainTemplate.gradle"); + Path.Combine(SettingsDialog.AndroidPluginsDir, GradleTemplateFilename); /// /// Line that indicates the start of the injected repos block in the template. @@ -69,6 +112,12 @@ internal class GradleTemplateResolver { private const string ReposInjectionLine = @".*apply plugin: 'com\.android\.(application|library)'.*"; + /// + /// Line that indicates where to initially inject repos in the settings template. + /// + private const string ReposInjectionLineInGradleSettings = + @".*flatDir {"; + /// /// Token that indicates where gradle properties should initially be injected. /// If this isn't present in the properties template, properties will not be @@ -108,6 +157,35 @@ internal class GradleTemplateResolver { /// private const string PackagingOptionsToken = @"android +{"; + /// + /// Whether current of Unity has changed the place to specify Maven repos from + /// `mainTemplate.gradle` to `settingsTemplate.gradle`. + /// + public static bool UnityChangeMavenRepoInSettingsTemplate { + get { + // Check against the Android Gradle plugin version being used, since that can + // change between Unity minor versions. + return (new Dependency.VersionComparer()).Compare( + "7.0", PlayServicesResolver.AndroidGradlePluginVersion) >= 0; + } + } + + /// + /// Modifies the given path such that the m2repository is placed into the + /// LocalMavenRepoDir/PrefixDirectory/m2repository/... + /// + /// The original path to modify. + /// A modified path if m2repository is found, the same path otherwise. + private static string ReplaceLocalFolderBasedOnM2repo(string path) { + string regexPattern = @"^(.*[/\\])([^/\\]+[/\\]m2repository.*)$"; + Match match = Regex.Match(path, regexPattern); + if (match.Success) { + path = Path.Combine(GooglePlayServices.SettingsDialog.LocalMavenRepoDir, + match.Groups[2].Value); + } + return path; + } + /// /// Copy srcaar files to aar files that are excluded from Unity's build process. /// @@ -136,6 +214,15 @@ private static bool CopySrcAars(ICollection dependencies) { var dir = FileUtils.ReplaceBaseAssetsOrPackagesFolder( Path.GetDirectoryName(aar), GooglePlayServices.SettingsDialog.LocalMavenRepoDir); + + if (!dir.StartsWith(GooglePlayServices.SettingsDialog.LocalMavenRepoDir)) { + // The directory replace logic failed, likely because the original aar + // is not located under the Assets or Packages folders. + // Try to come up with a sensible destination folder by searching for + // an m2repository within the path, and using that. + dir = ReplaceLocalFolderBasedOnM2repo(Path.GetDirectoryName(aar)); + } + var filename = Path.GetFileNameWithoutExtension(aarPath); var targetFilename = Path.Combine(dir, filename + ".aar"); @@ -429,7 +516,8 @@ public static bool InjectProperties(){ } /// - /// Inject / update dependencies in the gradle template file. + /// Inject / update additional Maven repository urls specified from `Dependencies.xml` in + /// the Gradle settings template file. /// /// Dependencies to inject. /// true if successful, false otherwise. @@ -508,7 +596,9 @@ public static bool InjectDependencies(ICollection dependencies) { }); } } - repoLines.AddRange(PlayServicesResolver.GradleMavenReposLines(dependencies)); + if (!UnityChangeMavenRepoInSettingsTemplate) { + repoLines.AddRange(PlayServicesResolver.GradleMavenReposLines(dependencies)); + } TextFileLineInjector[] injectors = new [] { new TextFileLineInjector(ReposInjectionLine, ReposStartLine, ReposEndLine, @@ -527,5 +617,184 @@ public static bool InjectDependencies(ICollection dependencies) { "Gradle Template", "gradletemplate", injectors, resolutionMeasurementParameters); } + + /// + /// Inject / update dependencies in the gradle template file. + /// + /// true if successful, false otherwise. + public static bool InjectSettings(ICollection dependencies, out string lastError) { + if (!UnityChangeMavenRepoInSettingsTemplate || + !PlayServicesResolver.GradleTemplateEnabled) { + // Early out since there is no need to patch settings template. + lastError = ""; + return true; + } + + if (!EnsureGradleTemplateEnabled(GradleSettingsTemplatePathFilename)) { + lastError = String.Format( + "Failed to auto-generate '{0}'. This is required to specify " + + "additional Maven repos from Unity 2022.2. " + + "Please manually generate '{2}' through one " + + "of the following methods:\n" + + "* For Unity 2022.2.10+, enable 'Custom Gradle Settings Template' " + + "found under 'Player Settings > Settings for Android -> Publishing " + + "Settings' menu. \n" + + "* Manually copy '{1}' to '{2}'\n" + + "If you like to patch this yourself, simply disable 'Copy and patch " + + "settingsTemplate.gradle' in Android Resolver settings.", + GradleSettingsTemplatePathFilename, + UnityGradleSettingsTemplatePath, + GradleSettingsTemplatePath); + return false; + } + + // ReposInjectionLineInGradleSettings + + var resolutionMeasurementParameters = + PlayServicesResolver.GetResolutionMeasurementParameters(null); + PlayServicesResolver.analytics.Report( + "/resolve/gradlesettings", resolutionMeasurementParameters, + "Gradle Settings Template Resolve"); + + var settingsFileDescription = String.Format( + "gradle settings template " + GradleSettingsTemplatePath); + + TextFileLineInjector[] settingsInjectors = new [] { + new TextFileLineInjector(ReposInjectionLineInGradleSettings, + ReposStartLine, ReposEndLine, + GradleMavenReposLinesFromDependencies( + dependencies: dependencies, + addMavenGoogle: false, + addMavenCentral: false, + addMavenLocal: true), + "Repo", + settingsFileDescription) + }; + if (!PatchFile(GradleSettingsTemplatePath, settingsFileDescription, + "Gradle Settings", "gradlesettings", + settingsInjectors, + resolutionMeasurementParameters)) { + lastError = String.Format("Unable to patch " + settingsFileDescription); + return false; + } + + lastError = ""; + return true; + } + + /// + /// Get the included dependency repos as lines that can be included in a Gradle file. + /// + /// Lines that can be included in a gradle file. + internal static IList GradleMavenReposLinesFromDependencies( + ICollection dependencies, + bool addMavenGoogle, + bool addMavenCentral, + bool addMavenLocal) { + var lines = new List(); + if (dependencies.Count > 0) { + var exportEnabled = PlayServicesResolver.GradleProjectExportEnabled; + var useFullPath = ( + exportEnabled && + SettingsDialog.UseFullCustomMavenRepoPathWhenExport ) || ( + !exportEnabled && + SettingsDialog.UseFullCustomMavenRepoPathWhenNotExport); + + var projectPath = FileUtils.PosixPathSeparators(Path.GetFullPath(".")); + var projectFileUri = GradleResolver.RepoPathToUri(projectPath); + // projectPath will point to the Unity project root directory as Unity will + // generate the root Gradle project in "Temp/gradleOut" when *not* exporting a + // gradle project. + if (!useFullPath) { + lines.Add(String.Format( + " def unityProjectPath = $/{0}**DIR_UNITYPROJECT**/$" + + ".replace(\"\\\\\", \"/\")", GradleWrapper.FILE_SCHEME)); + } + if(addMavenGoogle) { + lines.Add(" maven {"); + lines.Add(" url \"https://maven.google.com/""); + lines.Add(" }"); + } + // Consolidate repos url from Packages folders like + // "Packages/com.company.pkg1/Path/To/m2repository" and + // "Packages/com.company.pkg2/Path/To/m2repository" + Dictionary< string, List > repoUriToSources = + new Dictionary>(); + foreach (var repoAndSources in PlayServicesResolver.GetRepos(dependencies: dependencies)) { + string repoUri; + if (repoAndSources.Key.StartsWith(projectFileUri)) { + var relativePath = repoAndSources.Key.Substring(projectFileUri.Length + 1); + // Convert "Assets", "Packages/packageid", or + // "Library/PackageCache/packageid@version" prefix (@version optional) to local + // maven repo path. Note that local maven repo path only exists if the original + // repo path contains .srcaar. + var repoPath = FileUtils.ReplaceBaseAssetsOrPackagesFolder( + relativePath, GooglePlayServices.SettingsDialog.LocalMavenRepoDir); + // We also want to just convert any prefixes before a directory/m2repository, since + // they are copied to the LocalMavenRepoDir as well. + repoPath = ReplaceLocalFolderBasedOnM2repo(repoPath); + if (!Directory.Exists(repoPath)) { + repoPath = relativePath; + } + repoPath = FileUtils.PosixPathSeparators(repoPath); + + if (useFullPath) { + // build.gradle expects file:/// URI so file separator will be "/" in anycase + // and we must NOT use Path.Combine here because it will use "\" for win platforms + repoUri = String.Format("\"{0}/{1}\"", projectFileUri, repoPath); + } else { + repoUri = String.Format("(unityProjectPath + \"/{0}\")", repoPath); + } + } else { + repoUri = String.Format("\"{0}\"", repoAndSources.Key); + } + List sources; + if (!repoUriToSources.TryGetValue(repoUri, out sources)) { + sources = new List(); + repoUriToSources[repoUri] = sources; + } + sources.Add(repoAndSources.Value); + } + foreach(var kv in repoUriToSources) { + lines.Add(" maven {"); + lines.Add(String.Format(" url {0} // {1}", kv.Key, + String.Join(", ", kv.Value.ToArray()))); + lines.Add(" }"); + } + if (addMavenLocal) { + lines.Add(" mavenLocal()"); + } + if (addMavenCentral) { + lines.Add(" mavenCentral()"); + } + } + return lines; + } + + public static bool EnsureGradleTemplateEnabled(string templateName) { + string templatePath = Path.Combine(SettingsDialog.AndroidPluginsDir, templateName); + if (File.Exists(templatePath)) { + return true; + } + + string templateSourcePath = Path.Combine(UnityGradleTemplatesDir, templateName); + + try { + File.Copy(templateSourcePath, templatePath); + } catch (Exception e) { + PlayServicesResolver.Log(String.Format( + "Unable to copy '{0}' from Unity engine folder '{1}' to this project " + + "folder '{2}'. \n {3}", + templateName, + UnityGradleTemplatesDir, + SettingsDialog.AndroidPluginsDir, + e.ToString()), LogLevel.Error); + return false; + } + PlayServicesResolver.Log(String.Format( + "Copied '{0}' from Unity engine folder to this project '{1}'", + templateName, SettingsDialog.AndroidPluginsDir)); + return true; + } } } diff --git a/source/AndroidResolver/src/PlayServicesResolver.cs b/source/AndroidResolver/src/PlayServicesResolver.cs index 63310762..e4f7d40e 100644 --- a/source/AndroidResolver/src/PlayServicesResolver.cs +++ b/source/AndroidResolver/src/PlayServicesResolver.cs @@ -18,6 +18,7 @@ namespace GooglePlayServices { using System; using System.Collections.Generic; using System.IO; + using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Xml; @@ -522,6 +523,16 @@ public static bool GradlePropertiesTemplateEnabled { } } + /// + /// Whether the Gradle Settings template is enabled. + /// + public static bool GradleSettingsTemplateEnabled { + get { + return GradleBuildEnabled && + File.Exists(GradleTemplateResolver.GradleSettingsTemplatePath); + } + } + // Backing store for GradleVersion property. private static string gradleVersion = null; // Extracts a version number from a gradle distribution jar file. @@ -605,10 +616,7 @@ public static string AndroidGradlePluginVersion { return androidGradlePluginVersion; } // Search the gradle templates for the plugin version. - var engineDir = AndroidPlaybackEngineDirectory; - if (String.IsNullOrEmpty(engineDir)) return null; - var gradleTemplateDir = - Path.Combine(Path.Combine(engineDir, "Tools"), "GradleTemplates"); + var gradleTemplateDir = GradleTemplateResolver.UnityGradleTemplatesDir; if (Directory.Exists(gradleTemplateDir)) { var gradleTemplates = new List(); if (File.Exists(mainTemplateGradlePath)) { @@ -1663,12 +1671,21 @@ public static bool ResolveSync(bool forceResolution) { /// Remove libraries references from Gradle template files and patch POM files to work /// with the Gradle template. /// - private static void DeleteResolvedLibrariesFromGradleTemplate() { + /// Whether to update mainTemplate.gradle. + /// Whether to update settingsTemplate.gradle. + /// have changed. This is useful if a dependency specifies a wildcard in the version + /// expression. + private static void DeleteResolvedLibrariesFromGradleTemplate( + bool updateMainTemplate, bool updateSettingsTemplate) { LocalMavenRepository.PatchPomFilesInLocalRepos( PlayServicesSupport.GetAllDependencies().Values); - if (GradleTemplateEnabled) { + if (updateMainTemplate && GradleTemplateEnabled) { GradleTemplateResolver.InjectDependencies(new List()); } + if (updateSettingsTemplate && GradleSettingsTemplateEnabled) { + string lastError; + GradleTemplateResolver.InjectSettings(new List(), out lastError); + } } /// @@ -1685,7 +1702,8 @@ public static void DeleteResolvedLibraries(System.Action complete = null) { PlayServicesResolver.analytics.Report("/deleteresolved", "Delete Resolved Packages"); DeleteLabeledAssets(); - DeleteResolvedLibrariesFromGradleTemplate(); + DeleteResolvedLibrariesFromGradleTemplate(updateMainTemplate: true, + updateSettingsTemplate: true); if (complete != null) complete(); }, 0); } @@ -1730,7 +1748,7 @@ private static void ScheduleResolve(bool forceResolution, bool closeWindowOnComp new ResolutionJob( isAutoResolveJob, () => { - ResolveUnsafeAfterJetifierCheck( + ResolveUnsafeAfterMainTemplateCheck( (success) => { SignalResolveJobComplete(() => { if (resolutionCompleteWithResult != null) { @@ -1746,6 +1764,72 @@ private static void ScheduleResolve(bool forceResolution, bool closeWindowOnComp if (firstJob) ExecuteNextResolveJob(); } + /// + /// Ensures that the mainTemplate.gradle and gradle.properties files are present in the project, + /// creating them via the Unity Editor's template files if needed. + /// + /// True if both files are present. + private static bool EnableGradleTemplates() { + return GradleTemplateResolver.EnsureGradleTemplateEnabled(GradleTemplateResolver.GradleTemplateFilename) && + GradleTemplateResolver.EnsureGradleTemplateEnabled(GradleTemplateResolver.GradlePropertiesTemplateFilename); + } + + /// + /// Resolve dependencies after checking if mainTemplate.gradle is enabled (or previously disabled). + /// + /// Delegate called when resolution is complete + /// with a parameter that indicates whether it succeeded or failed. + /// Whether resolution should be executed when no dependencies + /// have changed. This is useful if a dependency specifies a wildcard in the version + /// expression. + /// Whether this is an auto-resolution job. + /// Whether to unconditionally close the resolution + /// window when complete. + private static void ResolveUnsafeAfterMainTemplateCheck(Action resolutionComplete, + bool forceResolution, + bool isAutoResolveJob, + bool closeWindowOnCompletion) { + // If mainTemplate.gradle is already enabled, or if the user has rejected the switch, + // move to the next step. + if (GradleTemplateEnabled || + SettingsDialogObj.UserRejectedGradleUpgrade) { + ResolveUnsafeAfterJetifierCheck(resolutionComplete, forceResolution, isAutoResolveJob, closeWindowOnCompletion); + return; + } + + // Else, if there are no resolved files tracked by this (aka, it hasn't been run before), + // turn on mainTemplate, and log a message to the user. + // Or, if using Batch mode, we want to enable the templates as well, since that is now the + // desired default behavior. If Users want to preserve the old method, they can save their + // SettingsObject with the UserRejectedGradleUpgrade option enabled. + if (ExecutionEnvironment.InBatchMode || !PlayServicesResolver.FindLabeledAssets().Any()) { + EnableGradleTemplates(); + ResolveUnsafeAfterJetifierCheck(resolutionComplete, forceResolution, isAutoResolveJob, closeWindowOnCompletion); + return; + } + + // Else, prompt the user to turn it on for them. + DialogWindow.Display( + "Enable Android Gradle templates?", + "Android Resolver recommends using Gradle templates " + + "for managing Android dependencies. The old method of downloading " + + "the dependencies into Plugins/Android is no longer recommended.", + DialogWindow.Option.Selected0, "Enable", "Disable", + complete: (selectedOption) => { + switch (selectedOption) { + case DialogWindow.Option.Selected0: // Enable + EnableGradleTemplates(); + break; + case DialogWindow.Option.Selected1: // Disable + SettingsDialogObj.UserRejectedGradleUpgrade = true; + break; + } + + // Either way, proceed with the resolution. + ResolveUnsafeAfterJetifierCheck(resolutionComplete, forceResolution, isAutoResolveJob, closeWindowOnCompletion); + }); + } + /// /// Resolve dependencies after checking the configuration is compatible with the Jetifier /// settings. @@ -1806,7 +1890,9 @@ private static void ResolveUnsafeAfterPromptCheck(Action resolutionComplet Log("Stale dependencies exist. Deleting assets...", level: LogLevel.Verbose); DeleteLabeledAssets(); } - DeleteResolvedLibrariesFromGradleTemplate(); + DeleteResolvedLibrariesFromGradleTemplate(updateMainTemplate: true, + updateSettingsTemplate: true); + if (resolutionComplete != null) { resolutionComplete(true); } @@ -1934,10 +2020,11 @@ private static void ResolveUnsafe(Action resolutionComplete, // If a gradle template is present but patching is disabled, remove managed libraries // from the template. - if (GradleTemplateEnabled && - !SettingsDialogObj.PatchMainTemplateGradle) { - DeleteResolvedLibrariesFromGradleTemplate(); - } + DeleteResolvedLibrariesFromGradleTemplate( + updateMainTemplate: GradleTemplateEnabled && + !SettingsDialogObj.PatchMainTemplateGradle, + updateSettingsTemplate: GradleSettingsTemplateEnabled && + !SettingsDialogObj.PatchSettingsTemplateGradle); Func patchGradleProperties = () => { // For Unity 2019.3 and above, warn the user if jetifier is enabled @@ -1975,13 +2062,23 @@ private static void ResolveUnsafe(Action resolutionComplete, return true; }; + Func, bool> patchSettingsTemplateGradle = (dependencies) => { + if (GradleBuildEnabled && GradleTemplateEnabled && + SettingsDialogObj.PatchSettingsTemplateGradle) { + return GradleTemplateResolver.InjectSettings(dependencies, out lastError); + } + return true; + }; + if (GradleTemplateEnabled && SettingsDialogObj.PatchMainTemplateGradle) { lastError = ""; RunOnMainThread.Run(() => { - finishResolution(GradleTemplateResolver.InjectDependencies( - PlayServicesSupport.GetAllDependencies().Values) && - patchGradleProperties(), lastError); + var dependencies = PlayServicesSupport.GetAllDependencies().Values; + finishResolution( + GradleTemplateResolver.InjectDependencies(dependencies) && + patchGradleProperties() && + patchSettingsTemplateGradle(dependencies), lastError); }); } else { lastError = ""; @@ -2119,69 +2216,15 @@ public static IList> GetRepos( internal static IList GradleMavenReposLines(ICollection dependencies) { var lines = new List(); if (dependencies.Count > 0) { - var exportEnabled = GradleProjectExportEnabled; var projectPath = FileUtils.PosixPathSeparators(Path.GetFullPath(".")); var projectFileUri = GradleResolver.RepoPathToUri(projectPath); lines.Add("([rootProject] + (rootProject.subprojects as List)).each { project ->"); lines.Add(" project.repositories {"); - // projectPath will point to the Unity project root directory as Unity will - // generate the root Gradle project in "Temp/gradleOut" when *not* exporting a - // gradle project. - lines.Add(String.Format( - " def unityProjectPath = $/{0}**DIR_UNITYPROJECT**/$" + - ".replace(\"\\\\\", \"/\")", GradleWrapper.FILE_SCHEME)); - lines.Add(" maven {"); - lines.Add(" url \"https://maven.google.com/""); - lines.Add(" }"); - - // Consolidate repos url from Packages folders like - // "Packages/com.company.pkg1/Path/To/m2repository" and - // "Packages/com.company.pkg2/Path/To/m2repository" - Dictionary< string, List > repoUriToSources = - new Dictionary>(); - foreach (var repoAndSources in GetRepos(dependencies: dependencies)) { - string repoUri; - if (repoAndSources.Key.StartsWith(projectFileUri)) { - var relativePath = repoAndSources.Key.Substring(projectFileUri.Length + 1); - // Convert "Assets", "Packages/packageid", or - // "Library/PackageCache/packageid@version" prefix to local maven repo - // path. Note that local maven repo path only exists if the original repo - // path contains .srcaar. - var repoPath = FileUtils.PosixPathSeparators( - FileUtils.ReplaceBaseAssetsOrPackagesFolder( - relativePath, GooglePlayServices.SettingsDialog.LocalMavenRepoDir)); - if (!Directory.Exists(repoPath)) { - repoPath = relativePath; - } - - // If "Export Gradle Project" setting is enabled, gradle project expects - // absolute path. - if (exportEnabled) { - // build.gradle expects file:/// URI so file separator will be "/" in anycase - // and we must NOT use Path.Combine here because it will use "\" for win platforms - repoUri = String.Format("\"{0}/{1}\"", projectFileUri, repoPath); - } else { - repoUri = String.Format("(unityProjectPath + \"/{0}\")", repoPath); - } - } else { - repoUri = String.Format("\"{0}\"", repoAndSources.Key); - } - List sources; - if (!repoUriToSources.TryGetValue(repoUri, out sources)) { - sources = new List(); - repoUriToSources[repoUri] = sources; - } - sources.Add(repoAndSources.Value); - } - foreach(var kv in repoUriToSources) { - lines.Add(" maven {"); - lines.Add(String.Format(" url {0} // {1}", kv.Key, - String.Join(", ", kv.Value.ToArray()))); - lines.Add(" }"); - } - - lines.Add(" mavenLocal()"); - lines.Add(" mavenCentral()"); + lines.AddRange(GradleTemplateResolver.GradleMavenReposLinesFromDependencies( + dependencies: dependencies, + addMavenGoogle: true, + addMavenCentral: true, + addMavenLocal: true)); lines.Add(" }"); lines.Add("}"); } @@ -2309,7 +2352,13 @@ internal static IList PackagingOptionsLines(ICollection depe var sortedExcludeFiles = new List(excludeFiles); sortedExcludeFiles.Sort(); lines.Add("android {"); - lines.Add(" packagingOptions {"); + + // `packagingOptions` is replaced by `packaging` keyword in Android Gradle plugin 8.0+ + if ((new Dependency.VersionComparer()).Compare("8.0", AndroidGradlePluginVersion) >= 0) { + lines.Add(" packaging {"); + } else { + lines.Add(" packagingOptions {"); + } foreach (var filename in sortedExcludeFiles) { // Unity's Android extension replaces ** in the template with an empty // string presumably due to the token expansion it performs. It's not @@ -2541,6 +2590,8 @@ internal static Dictionary GetResolutionSettings() { {"explodeAars", SettingsDialogObj.ExplodeAars.ToString()}, {"patchAndroidManifest", SettingsDialogObj.PatchAndroidManifest.ToString()}, {"patchMainTemplateGradle", SettingsDialogObj.PatchMainTemplateGradle.ToString()}, + {"useFullCustomMavenRepoPathWhenExport", SettingsDialogObj.UseFullCustomMavenRepoPathWhenExport.ToString()}, + {"useFullCustomMavenRepoPathWhenNotExport", SettingsDialogObj.UseFullCustomMavenRepoPathWhenNotExport.ToString()}, {"localMavenRepoDir", SettingsDialogObj.LocalMavenRepoDir.ToString()}, {"useJetifier", SettingsDialogObj.UseJetifier.ToString()}, {"bundleId", GetAndroidApplicationId()}, @@ -2558,6 +2609,8 @@ internal static Dictionary GetResolutionSettings() { "explodeAars", "patchAndroidManifest", "patchMainTemplateGradle", + "useFullCustomMavenRepoPathWhenExport", + "useFullCustomMavenRepoPathWhenNotExport", "localMavenRepoDir", "useJetifier", "gradleBuildEnabled", diff --git a/source/AndroidResolver/src/SettingsDialog.cs b/source/AndroidResolver/src/SettingsDialog.cs index 1b731c47..33bea57d 100644 --- a/source/AndroidResolver/src/SettingsDialog.cs +++ b/source/AndroidResolver/src/SettingsDialog.cs @@ -39,12 +39,16 @@ private class Settings { internal bool patchAndroidManifest; internal bool patchMainTemplateGradle; internal bool patchPropertiesTemplateGradle; + internal bool patchSettingsTemplateGradle; + internal bool useFullCustomMavenRepoPathWhenExport; + internal bool useFullCustomMavenRepoPathWhenNotExport; internal string localMavenRepoDir; internal bool useJetifier; internal bool verboseLogging; internal bool autoResolutionDisabledWarning; internal bool promptBeforeAutoResolution; internal bool useProjectSettings; + internal bool userRejectedGradleUpgrade; internal EditorMeasurement.Settings analyticsSettings; /// @@ -60,12 +64,16 @@ internal Settings() { patchAndroidManifest = SettingsDialog.PatchAndroidManifest; patchMainTemplateGradle = SettingsDialog.PatchMainTemplateGradle; patchPropertiesTemplateGradle = SettingsDialog.PatchPropertiesTemplateGradle; + patchSettingsTemplateGradle = SettingsDialog.PatchSettingsTemplateGradle; + useFullCustomMavenRepoPathWhenExport = SettingsDialog.UseFullCustomMavenRepoPathWhenExport; + useFullCustomMavenRepoPathWhenNotExport = SettingsDialog.UseFullCustomMavenRepoPathWhenNotExport; localMavenRepoDir = SettingsDialog.LocalMavenRepoDir; useJetifier = SettingsDialog.UseJetifier; verboseLogging = SettingsDialog.VerboseLogging; autoResolutionDisabledWarning = SettingsDialog.AutoResolutionDisabledWarning; promptBeforeAutoResolution = SettingsDialog.PromptBeforeAutoResolution; useProjectSettings = SettingsDialog.UseProjectSettings; + userRejectedGradleUpgrade = SettingsDialog.UserRejectedGradleUpgrade; analyticsSettings = new EditorMeasurement.Settings(PlayServicesResolver.analytics); } @@ -82,12 +90,16 @@ internal void Save() { SettingsDialog.PatchAndroidManifest = patchAndroidManifest; SettingsDialog.PatchMainTemplateGradle = patchMainTemplateGradle; SettingsDialog.PatchPropertiesTemplateGradle = patchPropertiesTemplateGradle; + SettingsDialog.PatchSettingsTemplateGradle = patchSettingsTemplateGradle; + SettingsDialog.UseFullCustomMavenRepoPathWhenExport = useFullCustomMavenRepoPathWhenExport; + SettingsDialog.UseFullCustomMavenRepoPathWhenNotExport = useFullCustomMavenRepoPathWhenNotExport; SettingsDialog.LocalMavenRepoDir = localMavenRepoDir; SettingsDialog.UseJetifier = useJetifier; SettingsDialog.VerboseLogging = verboseLogging; SettingsDialog.AutoResolutionDisabledWarning = autoResolutionDisabledWarning; SettingsDialog.PromptBeforeAutoResolution = promptBeforeAutoResolution; SettingsDialog.UseProjectSettings = useProjectSettings; + SettingsDialog.UserRejectedGradleUpgrade = userRejectedGradleUpgrade; analyticsSettings.Save(); } } @@ -101,6 +113,9 @@ internal void Save() { private const string PatchAndroidManifestKey = Namespace + "PatchAndroidManifest"; private const string PatchMainTemplateGradleKey = Namespace + "PatchMainTemplateGradle"; private const string PatchPropertiesTemplateGradleKey = Namespace + "PatchPropertiesTemplateGradle"; + private const string PatchSettingsTemplateGradleKey = Namespace + "PatchSettingsTemplateGradle"; + private const string UseFullCustomMavenRepoPathWhenExportKey = Namespace + "UseFullCustomMavenRepoPathWhenExport"; + private const string UseFullCustomMavenRepoPathWhenNotExportKey = Namespace + "UseFullCustomMavenRepoPathWhenNotExport"; private const string LocalMavenRepoDirKey = Namespace + "LocalMavenRepoDir"; private const string UseJetifierKey = Namespace + "UseJetifier"; private const string VerboseLoggingKey = Namespace + "VerboseLogging"; @@ -109,6 +124,7 @@ internal void Save() { private const string PromptBeforeAutoResolutionKey = Namespace + "PromptBeforeAutoResolution"; private const string UseGradleDaemonKey = Namespace + "UseGradleDaemon"; + private const string UserRejectedGradleUpgradeKey = Namespace + "UserRejectedGradleUpgrade"; // List of preference keys, used to restore default settings. private static string[] PreferenceKeys = new[] { @@ -120,12 +136,16 @@ internal void Save() { PatchAndroidManifestKey, PatchMainTemplateGradleKey, PatchPropertiesTemplateGradleKey, + PatchSettingsTemplateGradleKey, + UseFullCustomMavenRepoPathWhenExportKey, + UseFullCustomMavenRepoPathWhenNotExportKey, LocalMavenRepoDirKey, UseJetifierKey, VerboseLoggingKey, AutoResolutionDisabledWarningKey, PromptBeforeAutoResolutionKey, - UseGradleDaemonKey + UseGradleDaemonKey, + UserRejectedGradleUpgradeKey }; internal const string AndroidPluginsDir = "Assets/Plugins/Android"; @@ -245,6 +265,21 @@ internal static bool PatchPropertiesTemplateGradle { get { return projectSettings.GetBool(PatchPropertiesTemplateGradleKey, true); } } + internal static bool PatchSettingsTemplateGradle { + set { projectSettings.SetBool(PatchSettingsTemplateGradleKey, value); } + get { return projectSettings.GetBool(PatchSettingsTemplateGradleKey, true); } + } + + internal static bool UseFullCustomMavenRepoPathWhenExport { + set { projectSettings.SetBool(UseFullCustomMavenRepoPathWhenExportKey, value); } + get { return projectSettings.GetBool(UseFullCustomMavenRepoPathWhenExportKey, true); } + } + + internal static bool UseFullCustomMavenRepoPathWhenNotExport { + set { projectSettings.SetBool(UseFullCustomMavenRepoPathWhenNotExportKey, value); } + get { return projectSettings.GetBool(UseFullCustomMavenRepoPathWhenNotExportKey, false); } + } + internal static string LocalMavenRepoDir { private set { projectSettings.SetString(LocalMavenRepoDirKey, value); } get { @@ -255,7 +290,7 @@ internal static string LocalMavenRepoDir { internal static bool UseJetifier { set { projectSettings.SetBool(UseJetifierKey, value); } - get { return projectSettings.GetBool(UseJetifierKey, false); } + get { return projectSettings.GetBool(UseJetifierKey, true); } } internal static bool VerboseLogging { @@ -263,6 +298,11 @@ internal static bool VerboseLogging { get { return projectSettings.GetBool(VerboseLoggingKey, false); } } + internal static bool UserRejectedGradleUpgrade { + set { projectSettings.SetBool(UserRejectedGradleUpgradeKey, value); } + get { return projectSettings.GetBool(UserRejectedGradleUpgradeKey, false); } + } + internal static string ValidatePackageDir(string directory) { // Make sure the package directory starts with the same name. // This is case insensitive to handle cases where developers rename Unity @@ -337,6 +377,8 @@ public void OnEnable() { /// Called when the GUI should be rendered. /// public void OnGUI() { + GUI.skin.label.wordWrap = true; + GUILayout.BeginVertical(); GUILayout.Label(String.Format("Android Resolver (version {0}.{1}.{2})", AndroidResolverVersionNumber.Value.Major, @@ -410,8 +452,8 @@ public void OnGUI() { "AndroidManifest.xml or a single target ABI is selected " + "without a compatible build system."); } else { - GUILayout.Label("AAR explosion will be disabled in exported Gradle builds " + - "(Unity 5.5 and above). You will need to set " + + GUILayout.Label("AAR explosion will be disabled." + + "You may need to set " + "android.defaultConfig.applicationId to your bundle ID in your " + "build.gradle to generate a functional APK."); } @@ -458,6 +500,29 @@ public void OnGUI() { AndroidManifestPath)); } + GUILayout.BeginHorizontal(); + GUILayout.Label("Use Jetifier.", EditorStyles.boldLabel); + settings.useJetifier = EditorGUILayout.Toggle(settings.useJetifier); + GUILayout.EndHorizontal(); + if (settings.useJetifier) { + GUILayout.Label( + "Legacy Android support libraries and references to them from other " + + "libraries will be rewritten to use Jetpack using the Jetifier tool. " + + "Enabling option allows an application to use Android Jetpack " + + "when other libraries in the project use the Android support libraries."); + } else { + GUILayout.Label( + "Class References to legacy Android support libraries (pre-Jetpack) will be " + + "left unmodified in the project. This will possibly result in broken Android " + + "builds when mixing legacy Android support libraries and Jetpack libraries."); + } + + GUILayout.BeginHorizontal(); + GUILayout.Label("Disable MainTemplate Gradle prompt", EditorStyles.boldLabel); + settings.userRejectedGradleUpgrade = + EditorGUILayout.Toggle(settings.userRejectedGradleUpgrade); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); GUILayout.Label("Patch mainTemplate.gradle", EditorStyles.boldLabel); settings.patchMainTemplateGradle = @@ -477,6 +542,44 @@ public void OnGUI() { } if (settings.patchMainTemplateGradle) { + GUILayout.Label("Use Full Custom Local Maven Repo Path", EditorStyles.boldLabel); + GUILayout.BeginHorizontal(); + GUILayout.Label(" When building Android app through Unity", EditorStyles.boldLabel); + settings.useFullCustomMavenRepoPathWhenNotExport = + EditorGUILayout.Toggle(settings.useFullCustomMavenRepoPathWhenNotExport); + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + GUILayout.Label(" When exporting Android project", EditorStyles.boldLabel); + settings.useFullCustomMavenRepoPathWhenExport = + EditorGUILayout.Toggle(settings.useFullCustomMavenRepoPathWhenExport); + GUILayout.EndHorizontal(); + + GUILayout.Label( + "EDM4U can inject custom local Maven repo to Gradle template files " + + "differnetly depending on whether 'Export Project' in Build Settings is " + + "enabled or not.\n" + + "If checked, custom local Maven repo path will look like the following. " + + "This is best if the Unity project is always under the same path, or when " + + "Unity editor has bugs which fail to resolve template variables like " + + "'**DIR_UNITYPROJECT**'"); + GUILayout.Box( + " maven {\n" + + " url \"file:////path/to/myUnityProject/path/to/m2repository\"\n" + + " }", EditorStyles.wordWrappedMiniLabel); + GUILayout.Label( + "If unchecked, custom local Maven repo path will look like the following. " + + "This is best if the Unity projects locates in different folders on " + + "different workstations. 'unityProjectPath' will be resolved at build time " + + "using template variables like '**DIR_UNITYPROJECT**'"); + GUILayout.Box( + " def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace(\"\\\", \"/\")\n" + + " maven {\n" + + " url (unityProjectPath + \"/path/to/m2repository\")\n" + + " }", EditorStyles.wordWrappedMiniLabel); + GUILayout.Label( + "Note that EDM4U always uses full path if the custom local Maven repo is NOT " + + "under Unity project folder."); + GUILayout.BeginHorizontal(); string previousDir = settings.localMavenRepoDir; GUILayout.Label("Local Maven Repo Directory", EditorStyles.boldLabel); @@ -502,23 +605,6 @@ public void OnGUI() { settings.localMavenRepoDir))); } - GUILayout.BeginHorizontal(); - GUILayout.Label("Use Jetifier.", EditorStyles.boldLabel); - settings.useJetifier = EditorGUILayout.Toggle(settings.useJetifier); - GUILayout.EndHorizontal(); - if (settings.useJetifier) { - GUILayout.Label( - "Legacy Android support libraries and references to them from other " + - "libraries will be rewritten to use Jetpack using the Jetifier tool. " + - "Enabling option allows an application to use Android Jetpack " + - "when other libraries in the project use the Android support libraries."); - } else { - GUILayout.Label( - "Class References to legacy Android support libraries (pre-Jetpack) will be " + - "left unmodified in the project. This will possibly result in broken Android " + - "builds when mixing legacy Android support libraries and Jetpack libraries."); - } - if (settings.useJetifier) { GUILayout.BeginHorizontal(); GUILayout.Label("Patch gradleTemplate.properties", EditorStyles.boldLabel); @@ -531,6 +617,18 @@ public void OnGUI() { "Settings for Android > Publishing Settings' menu item. " + "This has no effect in older versions of Unity."); } + + if (settings.patchMainTemplateGradle) { + GUILayout.BeginHorizontal(); + GUILayout.Label("Copy and patch settingsTemplate.gradle from 2022.2", EditorStyles.boldLabel); + settings.patchSettingsTemplateGradle = EditorGUILayout.Toggle(settings.patchSettingsTemplateGradle); + GUILayout.EndHorizontal(); + GUILayout.Label( + "For Unity 2022.2 and above, any additional Maven repositories should be " + + "specified in settingsTemplate.gradle. If checked, EDM4U will also copy " + + "settingsTemplate.gradle from Unity engine folder."); + } + settings.analyticsSettings.RenderGui(); GUILayout.BeginHorizontal(); @@ -543,6 +641,10 @@ public void OnGUI() { settings.useProjectSettings = EditorGUILayout.Toggle(settings.useProjectSettings); GUILayout.EndHorizontal(); + GUILayout.EndVertical(); + EditorGUILayout.EndScrollView(); + + GUILayout.BeginVertical(); GUILayout.Space(10); if (GUILayout.Button("Reset to Defaults")) { @@ -581,6 +683,12 @@ public void OnGUI() { new KeyValuePair( "patchAndroidManifest", SettingsDialog.PatchAndroidManifest.ToString()), + new KeyValuePair( + "UseFullCustomMavenRepoPathWhenNotExport", + SettingsDialog.UseFullCustomMavenRepoPathWhenNotExport.ToString()), + new KeyValuePair( + "UseFullCustomMavenRepoPathWhenExport", + SettingsDialog.UseFullCustomMavenRepoPathWhenExport.ToString()), new KeyValuePair( "localMavenRepoDir", SettingsDialog.LocalMavenRepoDir.ToString()), @@ -596,6 +704,18 @@ public void OnGUI() { new KeyValuePair( "promptBeforeAutoResolution", SettingsDialog.PromptBeforeAutoResolution.ToString()), + new KeyValuePair( + "patchMainTemplateGradle", + SettingsDialog.PatchMainTemplateGradle.ToString()), + new KeyValuePair( + "patchPropertiesTemplateGradle", + SettingsDialog.PatchPropertiesTemplateGradle.ToString()), + new KeyValuePair( + "patchSettingsTemplateGradle", + SettingsDialog.PatchSettingsTemplateGradle.ToString()), + new KeyValuePair( + "userRejectedGradleUpgrade", + SettingsDialog.UserRejectedGradleUpgrade.ToString()), }, "Settings Save"); @@ -604,9 +724,8 @@ public void OnGUI() { } if (closeWindow) Close(); GUILayout.EndHorizontal(); - GUILayout.EndVertical(); - EditorGUILayout.EndScrollView(); + GUILayout.EndVertical(); } } diff --git a/source/AndroidResolver/src/VersionNumber.cs b/source/AndroidResolver/src/VersionNumber.cs index f65567b9..5309b99f 100644 --- a/source/AndroidResolver/src/VersionNumber.cs +++ b/source/AndroidResolver/src/VersionNumber.cs @@ -27,7 +27,7 @@ public class AndroidResolverVersionNumber { /// /// Version number, patched by the build process. /// - private const string VERSION_STRING = "1.2.174"; + private const string VERSION_STRING = "1.2.186"; /// /// Cached version structure. diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/Assets/Plugins/Android/gradleTemplateDISABLED.properties b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/Assets/Plugins/Android/gradleTemplateDISABLED.properties index ad7b0b07..de2dd054 100644 --- a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/Assets/Plugins/Android/gradleTemplateDISABLED.properties +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/Assets/Plugins/Android/gradleTemplateDISABLED.properties @@ -1,3 +1,4 @@ org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M org.gradle.parallel=true +unityStreamingAssets=**STREAMING_ASSETS** **ADDITIONAL_PROPERTIES** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/Assets/Plugins/Android/settingsTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/Assets/Plugins/Android/settingsTemplateDISABLED.gradle new file mode 100644 index 00000000..939fa3d5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/Assets/Plugins/Android/settingsTemplateDISABLED.gradle @@ -0,0 +1,23 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/mainTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/mainTemplate.gradle new file mode 100644 index 00000000..71d3fdee --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/mainTemplate.gradle @@ -0,0 +1,81 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +// Android Resolver Dependencies Start + compile 'com.android.support:support-annotations:26.1.0' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:4 + // compile 'com.google.android.gms:play-services-base:12.0.1' // Assets/ExternalDependencyManager/Editor/TestAdditionalDuplicateDependencies.xml:6 + // compile 'com.google.android.gms:play-services-base:15.0.1' // Assets/ExternalDependencyManager/Editor/TestAdditionalDependencies.xml:3 + compile 'com.google.android.gms:play-services-base:18.0.1' // Assets/ExternalDependencyManager/Editor/TestAdditionalDuplicateDependencies.xml:4 + // compile 'com.google.firebase:firebase-app-unity:5.+' // Assets/ExternalDependencyManager/Editor/TestAdditionalDuplicateDependencies.xml:8 + compile 'com.google.firebase:firebase-app-unity:5.1.1' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:10 + compile 'com.google.firebase:firebase-common:16.0.0' // Google.AndroidResolverIntegrationTests.SetupDependencies + compile 'org.test.psr:classifier:1.0.1:foo@aar' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:12 +// Android Resolver Dependencies End +**DEPS**} + +// Android Resolver Exclusions Start +android { + packagingOptions { + exclude ('lib/unsupported/libFirebaseCppApp-5.1.1.so') + } +} +// Android Resolver Exclusions End +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplatePropertiesJetifier/mainTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/mainTemplateDISABLED.gradle similarity index 100% rename from source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplatePropertiesJetifier/mainTemplateDISABLED.gradle rename to source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/mainTemplateDISABLED.gradle diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/settingsTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/settingsTemplate.gradle new file mode 100644 index 00000000..d23796f5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/settingsTemplate.gradle @@ -0,0 +1,36 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() +// Android Resolver Repos Start + def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/") + maven { + url "file:///my/nonexistant/test/repo" // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:17 + } + maven { + url (unityProjectPath + "/project_relative_path/repo") // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:17 + } + maven { + url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:10 + } + mavenLocal() +// Android Resolver Repos End + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/settingsTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/settingsTemplateDISABLED.gradle new file mode 100644 index 00000000..939fa3d5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2/settingsTemplateDISABLED.gradle @@ -0,0 +1,23 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/mainTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/mainTemplate.gradle new file mode 100644 index 00000000..5b7bb06a --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/mainTemplate.gradle @@ -0,0 +1,64 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +**DEPS**} + +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/mainTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/mainTemplateDISABLED.gradle new file mode 100644 index 00000000..5b7bb06a --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/mainTemplateDISABLED.gradle @@ -0,0 +1,64 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +**DEPS**} + +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/settingsTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/settingsTemplate.gradle new file mode 100644 index 00000000..939fa3d5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/settingsTemplate.gradle @@ -0,0 +1,23 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/settingsTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/settingsTemplateDISABLED.gradle new file mode 100644 index 00000000..939fa3d5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2/settingsTemplateDISABLED.gradle @@ -0,0 +1,23 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplatePropertiesJetifier/gradleTemplate.properties b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/gradleTemplate.properties similarity index 83% rename from source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplatePropertiesJetifier/gradleTemplate.properties rename to source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/gradleTemplate.properties index bdea4ef0..87046809 100644 --- a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplatePropertiesJetifier/gradleTemplate.properties +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/gradleTemplate.properties @@ -1,5 +1,6 @@ org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M org.gradle.parallel=true +unityStreamingAssets=**STREAMING_ASSETS** # Android Resolver Properties Start android.useAndroidX=true android.enableJetifier=true diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/gradleTemplateDISABLED.properties b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/gradleTemplateDISABLED.properties new file mode 100644 index 00000000..de2dd054 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/gradleTemplateDISABLED.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M +org.gradle.parallel=true +unityStreamingAssets=**STREAMING_ASSETS** +**ADDITIONAL_PROPERTIES** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplatePropertiesJetifier/mainTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/mainTemplate.gradle similarity index 100% rename from source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplatePropertiesJetifier/mainTemplate.gradle rename to source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/mainTemplate.gradle diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/mainTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/mainTemplateDISABLED.gradle new file mode 100644 index 00000000..5b7bb06a --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3/mainTemplateDISABLED.gradle @@ -0,0 +1,64 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +**DEPS**} + +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/gradleTemplate.properties b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/gradleTemplate.properties new file mode 100644 index 00000000..87046809 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/gradleTemplate.properties @@ -0,0 +1,8 @@ +org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M +org.gradle.parallel=true +unityStreamingAssets=**STREAMING_ASSETS** +# Android Resolver Properties Start +android.useAndroidX=true +android.enableJetifier=true +# Android Resolver Properties End +**ADDITIONAL_PROPERTIES** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/gradleTemplateDISABLED.properties b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/gradleTemplateDISABLED.properties new file mode 100644 index 00000000..de2dd054 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/gradleTemplateDISABLED.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M +org.gradle.parallel=true +unityStreamingAssets=**STREAMING_ASSETS** +**ADDITIONAL_PROPERTIES** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/mainTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/mainTemplate.gradle new file mode 100644 index 00000000..ddfc07b3 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/mainTemplate.gradle @@ -0,0 +1,77 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +// Android Resolver Dependencies Start + compile 'com.android.support:support-annotations:26.1.0' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:4 + compile 'com.google.firebase:firebase-app-unity:5.1.1' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:10 + compile 'com.google.firebase:firebase-common:16.0.0' // Google.AndroidResolverIntegrationTests.SetupDependencies + compile 'org.test.psr:classifier:1.0.1:foo@aar' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:12 +// Android Resolver Dependencies End +**DEPS**} + +// Android Resolver Exclusions Start +android { + packagingOptions { + exclude ('lib/unsupported/libFirebaseCppApp-5.1.1.so') + } +} +// Android Resolver Exclusions End +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/mainTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/mainTemplateDISABLED.gradle new file mode 100644 index 00000000..5b7bb06a --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/mainTemplateDISABLED.gradle @@ -0,0 +1,64 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +**DEPS**} + +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/settingsTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/settingsTemplate.gradle new file mode 100644 index 00000000..d23796f5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/settingsTemplate.gradle @@ -0,0 +1,36 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() +// Android Resolver Repos Start + def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/") + maven { + url "file:///my/nonexistant/test/repo" // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:17 + } + maven { + url (unityProjectPath + "/project_relative_path/repo") // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:17 + } + maven { + url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:10 + } + mavenLocal() +// Android Resolver Repos End + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/settingsTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/settingsTemplateDISABLED.gradle new file mode 100644 index 00000000..939fa3d5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2/settingsTemplateDISABLED.gradle @@ -0,0 +1,23 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/mainTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/mainTemplate.gradle new file mode 100644 index 00000000..b93a44f8 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/mainTemplate.gradle @@ -0,0 +1,77 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.library' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +// Android Resolver Dependencies Start + compile 'com.android.support:support-annotations:26.1.0' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:4 + compile 'com.google.firebase:firebase-app-unity:5.1.1' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:10 + compile 'com.google.firebase:firebase-common:16.0.0' // Google.AndroidResolverIntegrationTests.SetupDependencies + compile 'org.test.psr:classifier:1.0.1:foo@aar' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:12 +// Android Resolver Dependencies End +**DEPS**} + +// Android Resolver Exclusions Start +android { + packagingOptions { + exclude ('lib/unsupported/libFirebaseCppApp-5.1.1.so') + } +} +// Android Resolver Exclusions End +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/mainTemplateLibraryDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/mainTemplateLibraryDISABLED.gradle new file mode 100644 index 00000000..4dce823e --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/mainTemplateLibraryDISABLED.gradle @@ -0,0 +1,64 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.library' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +**DEPS**} + +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/settingsTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/settingsTemplate.gradle new file mode 100644 index 00000000..d23796f5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/settingsTemplate.gradle @@ -0,0 +1,36 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() +// Android Resolver Repos Start + def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/") + maven { + url "file:///my/nonexistant/test/repo" // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:17 + } + maven { + url (unityProjectPath + "/project_relative_path/repo") // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:17 + } + maven { + url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:10 + } + mavenLocal() +// Android Resolver Repos End + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/settingsTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/settingsTemplateDISABLED.gradle new file mode 100644 index 00000000..939fa3d5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2/settingsTemplateDISABLED.gradle @@ -0,0 +1,23 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/mainTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/mainTemplate.gradle new file mode 100644 index 00000000..ddfc07b3 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/mainTemplate.gradle @@ -0,0 +1,77 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +// Android Resolver Dependencies Start + compile 'com.android.support:support-annotations:26.1.0' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:4 + compile 'com.google.firebase:firebase-app-unity:5.1.1' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:10 + compile 'com.google.firebase:firebase-common:16.0.0' // Google.AndroidResolverIntegrationTests.SetupDependencies + compile 'org.test.psr:classifier:1.0.1:foo@aar' // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:12 +// Android Resolver Dependencies End +**DEPS**} + +// Android Resolver Exclusions Start +android { + packagingOptions { + exclude ('lib/unsupported/libFirebaseCppApp-5.1.1.so') + } +} +// Android Resolver Exclusions End +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/mainTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/mainTemplateDISABLED.gradle new file mode 100644 index 00000000..5b7bb06a --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/mainTemplateDISABLED.gradle @@ -0,0 +1,64 @@ +// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN + +buildscript { + repositories { + google() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.0.1' + } +} + +allprojects { + repositories { + flatDir { + dirs 'libs' + } + } +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +**DEPS**} + +android { + compileSdkVersion **APIVERSION** + buildToolsVersion '**BUILDTOOLS**' + + defaultConfig { + minSdkVersion **MINSDKVERSION** + targetSdkVersion **TARGETSDKVERSION** + applicationId '**APPLICATIONID**' + ndk { + abiFilters **ABIFILTERS** + } + versionCode **VERSIONCODE** + versionName '**VERSIONNAME**' + } + + lintOptions { + abortOnError false + } + + aaptOptions { + noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS** + }**SIGN** + + buildTypes { + debug { + minifyEnabled **MINIFY_DEBUG** + useProguard **PROGUARD_DEBUG** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD** + jniDebuggable true + } + release { + minifyEnabled **MINIFY_RELEASE** + useProguard **PROGUARD_RELEASE** + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG** + } + }**PACKAGING_OPTIONS****SPLITS** +**BUILT_APK_LOCATION** +}**SPLITS_VERSION_CODE****SOURCE_BUILD_SETUP** diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/settingsTemplate.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/settingsTemplate.gradle new file mode 100644 index 00000000..d23796f5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/settingsTemplate.gradle @@ -0,0 +1,36 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() +// Android Resolver Repos Start + def unityProjectPath = $/file:///**DIR_UNITYPROJECT**/$.replace("\\", "/") + maven { + url "file:///my/nonexistant/test/repo" // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:17 + } + maven { + url (unityProjectPath + "/project_relative_path/repo") // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:17 + } + maven { + url (unityProjectPath + "/Assets/GeneratedLocalRepo/Firebase/m2repository") // Assets/ExternalDependencyManager/Editor/TestDependencies.xml:10 + } + mavenLocal() +// Android Resolver Repos End + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/settingsTemplateDISABLED.gradle b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/settingsTemplateDISABLED.gradle new file mode 100644 index 00000000..939fa3d5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ExpectedArtifacts/NoExport/GradleTemplate_2022_2/settingsTemplateDISABLED.gradle @@ -0,0 +1,23 @@ +pluginManagement { + repositories { + **ARTIFACTORYREPOSITORY** + gradlePluginPortal() + google() + mavenCentral() + } +} + +include ':launcher', ':unityLibrary' +**INCLUDES** + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + **ARTIFACTORYREPOSITORY** + google() + mavenCentral() + flatDir { + dirs "${project(':unityLibrary').projectDir}/libs" + } + } +} diff --git a/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ProjectSettings/GvhProjectSettings.xml b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ProjectSettings/GvhProjectSettings.xml new file mode 100644 index 00000000..20f2d7b5 --- /dev/null +++ b/source/AndroidResolver/test/AndroidResolverIntegrationTestsUnityProject/ProjectSettings/GvhProjectSettings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/source/AndroidResolver/test/src/AndroidResolverIntegrationTests.cs b/source/AndroidResolver/test/src/AndroidResolverIntegrationTests.cs index 32d807ae..cc7a6e66 100644 --- a/source/AndroidResolver/test/src/AndroidResolverIntegrationTests.cs +++ b/source/AndroidResolver/test/src/AndroidResolverIntegrationTests.cs @@ -68,6 +68,12 @@ public class AndroidResolverIntegrationTests { private const string GRADLE_TEMPLATE_PROPERTIES_DISABLED = "Assets/Plugins/Android/gradleTemplateDISABLED.properties"; + /// + /// Disabled Gradle settings template file. + /// + private const string GRADLE_TEMPLATE_SETTINGS_DISABLED = + "Assets/Plugins/Android/settingsTemplateDISABLED.gradle"; + /// /// /// Enabled Gradle template file. @@ -80,6 +86,12 @@ public class AndroidResolverIntegrationTests { /// private const string GRADLE_TEMPLATE_PROPERTIES_ENABLED = "Assets/Plugins/Android/gradleTemplate.properties"; + /// + /// + /// Enabled Gradle settings properties file. + /// + private const string GRADLE_TEMPLATE_SETTINGS_ENABLED = "Assets/Plugins/Android/settingsTemplate.gradle"; + /// /// Configure tests to run. /// @@ -95,8 +107,22 @@ public static void ConfigureTestCases() { var nonGradleTemplateFilesToIgnore = new HashSet() { Path.GetFileName(GRADLE_TEMPLATE_DISABLED), Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), - Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED) + Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_SETTINGS_DISABLED) + }; + + // Set of files to ignore (relative to the Assets/Plugins/Android directory) in all tests + // that do not use the Gradle template. + var unity2022WithoutJetifierGradleTemplateFilesToIgnore = new HashSet { + Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED), }; + var defaultGradleTemplateFilesToIgnore = new HashSet { + Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_SETTINGS_DISABLED), + }; + UnityEngine.Debug.Log("Setting up test cases for execution."); IntegrationTester.Runner.ScheduleTestCases(new [] { @@ -122,17 +148,30 @@ public static void ConfigureTestCases() { ClearAllDependencies(); SetupDependencies(); + string expectedAssetsDir = null; + string gradleTemplateSettings = null; + HashSet filesToIgnore = null; + if (UnityChangeMavenInSettings_2022_2) { + // For Unity >= 2022.2, Maven repo need to be injected to + // Gradle Settings Template, instead of Gradle Main Template. + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplate_2022_2"; + gradleTemplateSettings = GRADLE_TEMPLATE_SETTINGS_DISABLED; + filesToIgnore = unity2022WithoutJetifierGradleTemplateFilesToIgnore; + } else { + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplate"; + filesToIgnore = defaultGradleTemplateFilesToIgnore; + } + ResolveWithGradleTemplate( GRADLE_TEMPLATE_DISABLED, - "ExpectedArtifacts/NoExport/GradleTemplate", + expectedAssetsDir, testCase, testCaseComplete, otherExpectedFiles: new [] { "Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/" + "firebase/firebase-app-unity/5.1.1/firebase-app-unity-5.1.1.aar" }, - filesToIgnore: new HashSet { - Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), - Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED) - }); + filesToIgnore: filesToIgnore, + deleteGradleTemplateSettings: true, + gradleTemplateSettings: gradleTemplateSettings); } }, new IntegrationTester.TestCase { @@ -145,17 +184,30 @@ public static void ConfigureTestCases() { UpdateAdditionalDependenciesFile(true, ADDITIONAL_DEPENDENCIES_FILENAME); UpdateAdditionalDependenciesFile(true, ADDITIONAL_DUPLICATE_DEPENDENCIES_FILENAME); + string expectedAssetsDir = null; + string gradleTemplateSettings = null; + HashSet filesToIgnore = null; + if (UnityChangeMavenInSettings_2022_2) { + // For Unity >= 2022.2, Maven repo need to be injected to + // Gradle Settings Template, instead of Gradle Main Template. + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages_2022_2"; + gradleTemplateSettings = GRADLE_TEMPLATE_SETTINGS_DISABLED; + filesToIgnore = unity2022WithoutJetifierGradleTemplateFilesToIgnore; + } else { + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages"; + filesToIgnore = defaultGradleTemplateFilesToIgnore; + } + ResolveWithGradleTemplate( GRADLE_TEMPLATE_DISABLED, - "ExpectedArtifacts/NoExport/GradleTemplateDuplicatePackages", + expectedAssetsDir, testCase, testCaseComplete, otherExpectedFiles: new [] { "Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/" + "firebase/firebase-app-unity/5.1.1/firebase-app-unity-5.1.1.aar" }, - filesToIgnore: new HashSet { - Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), - Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED) - }); + filesToIgnore: filesToIgnore, + deleteGradleTemplateSettings: true, + gradleTemplateSettings: gradleTemplateSettings); } }, new IntegrationTester.TestCase { @@ -164,13 +216,36 @@ public static void ConfigureTestCases() { ClearAllDependencies(); SetupDependencies(); GooglePlayServices.SettingsDialog.UseJetifier = true; - var expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplateJetifier"; + + string expectedAssetsDir = null; string gradleTemplateProperties = null; - // For Unity >= 2019.3f, Jetifier is enabled for the build - // via gradle properties. - if (GradleTemplatePropertiesSupported) { - expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplatePropertiesJetifier"; + string gradleTemplateSettings = null; + HashSet filesToIgnore = null; + if (UnityChangeMavenInSettings_2022_2) { + // For Unity >= 2022.2, Maven repo need to be injected to + // Gradle Settings Template, instead of Gradle Main Template. + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplateJetifier_2022_2"; gradleTemplateProperties = GRADLE_TEMPLATE_PROPERTIES_DISABLED; + gradleTemplateSettings = GRADLE_TEMPLATE_SETTINGS_DISABLED; + filesToIgnore = new HashSet { + Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), + }; + } else if (UnityChangeJetifierInProperties_2019_3) { + // For Unity >= 2019.3f, Jetifier is enabled for the build + // via gradle properties. + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplateJetifier_2019_3"; + gradleTemplateProperties = GRADLE_TEMPLATE_PROPERTIES_DISABLED; + filesToIgnore = new HashSet { + Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_SETTINGS_DISABLED), + }; + } else { + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplateJetifier"; + filesToIgnore = new HashSet { + Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_SETTINGS_DISABLED), + }; } ResolveWithGradleTemplate( @@ -180,12 +255,11 @@ public static void ConfigureTestCases() { otherExpectedFiles: new [] { "Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/" + "firebase/firebase-app-unity/5.1.1/firebase-app-unity-5.1.1.aar" }, - filesToIgnore: new HashSet { - Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), - Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED)}, + filesToIgnore: filesToIgnore, deleteGradleTemplateProperties: true, - gradleTemplateProperties: gradleTemplateProperties - ); + gradleTemplateProperties: gradleTemplateProperties, + deleteGradleTemplateSettings: true, + gradleTemplateSettings: gradleTemplateSettings); } }, new IntegrationTester.TestCase { @@ -194,17 +268,37 @@ public static void ConfigureTestCases() { ClearAllDependencies(); SetupDependencies(); + string expectedAssetsDir = null; + string gradleTemplateSettings = null; + HashSet filesToIgnore = null; + if (UnityChangeMavenInSettings_2022_2) { + // For Unity >= 2022.2, Maven repo need to be injected to + // Gradle Settings Template, instead of Gradle Main Template. + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplateLibrary_2022_2"; + gradleTemplateSettings = GRADLE_TEMPLATE_SETTINGS_DISABLED; + filesToIgnore = new HashSet { + Path.GetFileName(GRADLE_TEMPLATE_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED), + }; + } else { + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplateLibrary"; + filesToIgnore = new HashSet { + Path.GetFileName(GRADLE_TEMPLATE_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_SETTINGS_DISABLED), + }; + } + ResolveWithGradleTemplate( GRADLE_TEMPLATE_LIBRARY_DISABLED, - "ExpectedArtifacts/NoExport/GradleTemplateLibrary", + expectedAssetsDir, testCase, testCaseComplete, otherExpectedFiles: new [] { "Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/" + "firebase/firebase-app-unity/5.1.1/firebase-app-unity-5.1.1.aar" }, - filesToIgnore: new HashSet { - Path.GetFileName(GRADLE_TEMPLATE_DISABLED), - Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED) - }); + filesToIgnore: filesToIgnore, + deleteGradleTemplateSettings: true, + gradleTemplateSettings: gradleTemplateSettings); } }, new IntegrationTester.TestCase { @@ -238,6 +332,7 @@ public static void ConfigureTestCases() { filesToIgnore: new HashSet { Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED), + Path.GetFileName(GRADLE_TEMPLATE_SETTINGS_DISABLED) }); } finally { enableDependencies(); @@ -323,26 +418,49 @@ public static void ConfigureTestCases() { Method = (testCase, testCaseComplete) => { ClearAllDependencies(); SetupDependencies(); - var filesToIgnore = new HashSet { - Path.GetFileName(GRADLE_TEMPLATE_LIBRARY_DISABLED), - Path.GetFileName(GRADLE_TEMPLATE_PROPERTIES_DISABLED) - }; + + string expectedAssetsDir = null; + string gradleTemplateSettings = null; + HashSet filesToIgnore = null; + if (UnityChangeMavenInSettings_2022_2) { + // For Unity >= 2022.2, Maven repo need to be injected to + // Gradle Settings Template, instead of Gradle Main Template. + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplate_2022_2"; + gradleTemplateSettings = GRADLE_TEMPLATE_SETTINGS_DISABLED; + filesToIgnore = unity2022WithoutJetifierGradleTemplateFilesToIgnore; + } else { + expectedAssetsDir = "ExpectedArtifacts/NoExport/GradleTemplate"; + filesToIgnore = defaultGradleTemplateFilesToIgnore; + } ResolveWithGradleTemplate( GRADLE_TEMPLATE_DISABLED, - "ExpectedArtifacts/NoExport/GradleTemplate", + expectedAssetsDir, testCase, (testCaseResult) => { PlayServicesResolver.DeleteResolvedLibrariesSync(); + string expectedAssetsDirEmpty = null; + if (UnityChangeMavenInSettings_2022_2) { + // For Unity >= 2022.2, Maven repo need to be injected to + // Gradle Settings Template, instead of Gradle Main Template. + expectedAssetsDirEmpty = "ExpectedArtifacts/NoExport/GradleTemplateEmpty_2022_2"; + } else { + expectedAssetsDirEmpty = "ExpectedArtifacts/NoExport/GradleTemplateEmpty"; + } testCaseResult.ErrorMessages.AddRange(CompareDirectoryContents( - "ExpectedArtifacts/NoExport/GradleTemplateEmpty", + expectedAssetsDirEmpty, "Assets/Plugins/Android", filesToIgnore)); if (File.Exists(GRADLE_TEMPLATE_ENABLED)) { File.Delete(GRADLE_TEMPLATE_ENABLED); } + if (File.Exists(GRADLE_TEMPLATE_SETTINGS_ENABLED)) { + File.Delete(GRADLE_TEMPLATE_SETTINGS_ENABLED); + } testCaseComplete(testCaseResult); }, deleteGradleTemplate: false, - filesToIgnore: filesToIgnore); + filesToIgnore: filesToIgnore, + deleteGradleTemplateSettings: false, + gradleTemplateSettings: gradleTemplateSettings); } }, }); @@ -408,9 +526,16 @@ public static void ConfigureTestCases() { } /// - /// Whether Gradle Template properties are supported by the current version of Unity. + /// Whether Current Unity Version requires Maven Repo in Gradle Settings Template. /// - private static bool GradleTemplatePropertiesSupported { + private static bool UnityChangeMavenInSettings_2022_2 { + get { return IntegrationTester.Runner.UnityVersion >= 2022.2f; } + } + + /// + /// Whether Current Unity Version requires Jetifier enabling in Gradle Properties Template. + /// + private static bool UnityChangeJetifierInProperties_2019_3 { get { return IntegrationTester.Runner.UnityVersion >= 2019.3f; } } @@ -515,6 +640,9 @@ private static void ClearAllDependencies() { UnityEngine.Debug.Log("Clear all loaded dependencies"); GooglePlayServices.SettingsDialog.UseJetifier = false; GooglePlayServices.SettingsDialog.PatchPropertiesTemplateGradle = false; + GooglePlayServices.SettingsDialog.PatchSettingsTemplateGradle = false; + + GooglePlayServices.SettingsDialog.UserRejectedGradleUpgrade = true; PlayServicesSupport.ResetDependencies(); UpdateAdditionalDependenciesFile(false, ADDITIONAL_DEPENDENCIES_FILENAME); @@ -729,23 +857,27 @@ private static void Resolve(string androidBuildSystem, bool exportProject, /// Gradle template properties to use. /// Whether to delete the gradle template /// properties before testCaseComplete is called. + /// Gradle settings template to use. + /// Whether to delete the gradle settings template + /// before testCaseComplete is called. private static void ResolveWithGradleTemplate( string gradleTemplate, string expectedAssetsDir, IntegrationTester.TestCase testCase, Action testCaseComplete, IEnumerable otherExpectedFiles = null, - bool deleteGradleTemplateProperties = false, + bool deleteGradleTemplateProperties = true, ICollection filesToIgnore = null, bool deleteGradleTemplate = true, - string gradleTemplateProperties = null) { + string gradleTemplateProperties = null, + bool deleteGradleTemplateSettings = true, + string gradleTemplateSettings = null) { var cleanUpFiles = new List(); if (deleteGradleTemplate) cleanUpFiles.Add(GRADLE_TEMPLATE_ENABLED); if (deleteGradleTemplateProperties) cleanUpFiles.Add(GRADLE_TEMPLATE_PROPERTIES_ENABLED); + if (deleteGradleTemplateSettings) cleanUpFiles.Add(GRADLE_TEMPLATE_SETTINGS_ENABLED); if (otherExpectedFiles != null) cleanUpFiles.AddRange(otherExpectedFiles); Action cleanUpTestCase = () => { - GooglePlayServices.SettingsDialog.PatchMainTemplateGradle = false; - GooglePlayServices.SettingsDialog.PatchPropertiesTemplateGradle = false; foreach (var filename in cleanUpFiles) { if (File.Exists(filename)) File.Delete(filename); } @@ -757,6 +889,10 @@ private static void ResolveWithGradleTemplate( GooglePlayServices.SettingsDialog.PatchPropertiesTemplateGradle = true; File.Copy(gradleTemplateProperties, GRADLE_TEMPLATE_PROPERTIES_ENABLED); } + if (gradleTemplateSettings != null) { + GooglePlayServices.SettingsDialog.PatchSettingsTemplateGradle = true; + File.Copy(gradleTemplateSettings, GRADLE_TEMPLATE_SETTINGS_ENABLED); + } Resolve("Gradle", false, expectedAssetsDir, null, filesToIgnore, testCase, (IntegrationTester.TestCaseResult testCaseResult) => { if (otherExpectedFiles != null) { diff --git a/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/AndroidResolverTests.asmdef b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/AndroidResolverTests.asmdef new file mode 100644 index 00000000..1df88e66 --- /dev/null +++ b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/AndroidResolverTests.asmdef @@ -0,0 +1,25 @@ +{ + "name": "Google.AndroidResolverTests", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll", + "Google.VersionHandler.dll", + "Google.VersionHandlerImpl.dll", + "Google.JarResolver.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} diff --git a/source/JarResolverTests/src/Google.JarResolver.Tests/DependencyTests.cs b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/src/Google.JarResolver.Tests/DependencyTests.cs similarity index 100% rename from source/JarResolverTests/src/Google.JarResolver.Tests/DependencyTests.cs rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/src/Google.JarResolver.Tests/DependencyTests.cs diff --git a/source/JarResolverTests/src/Google.JarResolver.Tests/PlayServicesSupportTests.cs b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/src/Google.JarResolver.Tests/PlayServicesSupportTests.cs similarity index 100% rename from source/JarResolverTests/src/Google.JarResolver.Tests/PlayServicesSupportTests.cs rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/src/Google.JarResolver.Tests/PlayServicesSupportTests.cs diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/artifact/7.0.0/artifact-7.0.0.aar b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/7.0.0/artifact-7.0.0.aar similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/artifact/7.0.0/artifact-7.0.0.aar rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/7.0.0/artifact-7.0.0.aar diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/artifact/7.0.0/artifact-7.0.0.pom b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/7.0.0/artifact-7.0.0.pom similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/artifact/7.0.0/artifact-7.0.0.pom rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/7.0.0/artifact-7.0.0.pom diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/artifact/8.1.0/artifact-8.1.0.aar b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/8.1.0/artifact-8.1.0.aar similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/artifact/8.1.0/artifact-8.1.0.aar rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/8.1.0/artifact-8.1.0.aar diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/artifact/8.1.0/artifact-8.1.0.pom b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/8.1.0/artifact-8.1.0.pom similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/artifact/8.1.0/artifact-8.1.0.pom rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/8.1.0/artifact-8.1.0.pom diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/artifact/8.2.0-alpha/artifact-8.2.0-alpha.aar b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/8.2.0-alpha/artifact-8.2.0-alpha.aar similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/artifact/8.2.0-alpha/artifact-8.2.0-alpha.aar rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/8.2.0-alpha/artifact-8.2.0-alpha.aar diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/artifact/8.2.0-alpha/artifact-8.2.0-alpha.pom b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/8.2.0-alpha/artifact-8.2.0-alpha.pom similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/artifact/8.2.0-alpha/artifact-8.2.0-alpha.pom rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/8.2.0-alpha/artifact-8.2.0-alpha.pom diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/artifact/maven-metadata.xml b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/maven-metadata.xml similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/artifact/maven-metadata.xml rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/artifact/maven-metadata.xml diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/subdep/0.9/subdep-0.9.aar b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/0.9/subdep-0.9.aar similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/subdep/0.9/subdep-0.9.aar rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/0.9/subdep-0.9.aar diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/subdep/0.9/subdep-0.9.pom b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/0.9/subdep-0.9.pom similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/subdep/0.9/subdep-0.9.pom rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/0.9/subdep-0.9.pom diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/subdep/1.1.0/subdep-1.1.0.aar b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/1.1.0/subdep-1.1.0.aar similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/subdep/1.1.0/subdep-1.1.0.aar rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/1.1.0/subdep-1.1.0.aar diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/subdep/1.1.0/subdep-1.1.0.pom b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/1.1.0/subdep-1.1.0.pom similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/subdep/1.1.0/subdep-1.1.0.pom rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/1.1.0/subdep-1.1.0.pom diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/subdep/maven-metadata.xml b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/maven-metadata.xml similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/subdep/maven-metadata.xml rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/subdep/maven-metadata.xml diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/transdep/1.0.0/transdep-1.0.0.aar b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/transdep/1.0.0/transdep-1.0.0.aar similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/transdep/1.0.0/transdep-1.0.0.aar rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/transdep/1.0.0/transdep-1.0.0.aar diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/transdep/1.0.0/transdep-1.0.0.pom b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/transdep/1.0.0/transdep-1.0.0.pom similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/transdep/1.0.0/transdep-1.0.0.pom rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/transdep/1.0.0/transdep-1.0.0.pom diff --git a/source/JarResolverTests/testData/extras/google/m2repository/test/transdep/maven-metadata.xml b/source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/transdep/maven-metadata.xml similarity index 100% rename from source/JarResolverTests/testData/extras/google/m2repository/test/transdep/maven-metadata.xml rename to source/AndroidResolver/unit_tests/Assets/AndroidResolverTests/testData/extras/google/m2repository/test/transdep/maven-metadata.xml diff --git a/source/ExportUnityPackage/export_unity_package.py b/source/ExportUnityPackage/export_unity_package.py index 09b0be4f..b8f16b5a 100755 --- a/source/ExportUnityPackage/export_unity_package.py +++ b/source/ExportUnityPackage/export_unity_package.py @@ -293,7 +293,7 @@ from absl import app from absl import flags from absl import logging -import distutils.version +import packaging.version import yaml FLAGS = flags.FLAGS @@ -983,11 +983,11 @@ def __init__(self, duplicate_guids_checker, guids_json, if plugin_version: # Aggregate guids for older versions of files. - current_version = distutils.version.LooseVersion(plugin_version) - for version in sorted(guids_json, key=distutils.version.LooseVersion, + current_version = packaging.version.Version(plugin_version) + for version in sorted(guids_json, key=packaging.version.Version, reverse=True): # Skip all versions after and including the current version. - if distutils.version.LooseVersion(version) >= current_version: + if packaging.version.Version(version) >= current_version: continue # Add all guids for files to the current version. guids_by_filename = guids_json[version] @@ -1374,6 +1374,55 @@ def set_cpu_for_desktop_platforms(importer_metadata): second["settings"] = settings return importer_metadata + @staticmethod + def set_cpu_for_android(importer_metadata, cpu_string): + """Sets the CPU for Android in the metadata if enabled. + + Args: + importer_metadata: Metadata to modify. + cpu_string: The desired CPU string value. + + Returns: + Modified importer_metadata. + """ + plugin_importer = safe_dict_get_value( + importer_metadata, "PluginImporter", default_value={}) + serialized_version = safe_dict_get_value( + plugin_importer, "serializedVersion", default_value=1) + + if serialized_version == 1: + platform_data = safe_dict_get_value(plugin_importer, "platformData", + default_value={}) + for platform_name, options in platform_data.items(): + if not safe_dict_get_value(options, "enabled", default_value=0): + continue + if not cpu_string: + continue + if platform_name == "Android": + settings = options.get("settings", collections.OrderedDict()) + settings["CPU"] = cpu_string + options["settings"] = settings + else: + platform_data = safe_dict_get_value(plugin_importer, "platformData", + default_value=[]) + for entry in platform_data: + # Parse the platform name tuple from the "first" dictionary. + first, second = Asset.platform_data_get_entry(entry) + platform_tuple = list(first.items())[0] + if len(platform_tuple) < 2: + continue + unused_platform_target, platform_name = platform_tuple + if not second.get("enabled", 0): + continue + if not cpu_string: + continue + settings = safe_dict_get_value(second, "settings", + default_value=collections.OrderedDict()) + if platform_name == "Android": + settings["CPU"] = cpu_string + second["settings"] = settings + return importer_metadata + @staticmethod def apply_any_platform_selection(importer_metadata): """Enable / disable all platforms if the "Any" platform is enabled. @@ -1799,6 +1848,13 @@ def importer_metadata(self): platform_data_options["enabled"] = 1 importer_metadata = Asset.set_cpu_for_desktop_platforms( importer_metadata) + if "Android" in platforms and cpu_string != "AnyCPU": + importer_metadata = Asset.set_cpu_for_android( + importer_metadata, cpu_string) + # Set validateReferences, if requested, which should be either 0 or 1 + validateRef = safe_dict_get_value(self._json, "validateReferences", default_value=2) + if validateRef == 0 or validateRef == 1: + importer_metadata["PluginImporter"]["validateReferences"] = validateRef else: raise ProjectConfigurationError( "Unknown importer type %s for package %s, paths %s" % ( @@ -2543,6 +2599,9 @@ def create_archive(archive_filename, input_directory, timestamp): os.utime(filename, (FLAGS.timestamp, FLAGS.timestamp)) # Don't recurse directories. tar_args.append("-n") + # Avoid creating mac metadata files with name started with "." + if platform.system() == "Darwin": + tar_args.append("--no-mac-metadata") tar_args.extend(["-T", list_filename]) # Disable timestamp in the gzip header. tar_env = os.environ.copy() diff --git a/source/ExportUnityPackage/export_unity_package_test.py b/source/ExportUnityPackage/export_unity_package_test.py index b6a1ca74..8e9eeb5e 100755 --- a/source/ExportUnityPackage/export_unity_package_test.py +++ b/source/ExportUnityPackage/export_unity_package_test.py @@ -1665,6 +1665,39 @@ def test_set_cpu_for_desktop_platforms_serializationv2(self): export_unity_package.Asset.set_cpu_for_desktop_platforms(linux_enabled)) self.assertEqual(expected_metadata, linux_enabled_with_cpu) + def test_set_cpu_for_android_serializationv1(self): + """Set CPU field for the enabled Android platform in v1 metadata format.""" + android_enabled = copy.deepcopy( + export_unity_package.PLUGIN_IMPORTER_METADATA_TEMPLATE) + android_enabled["PluginImporter"]["platformData"]["Android"]["enabled"] = 1 + expected_metadata = copy.deepcopy(android_enabled) + expected_metadata["PluginImporter"]["platformData"]["Android"]["settings"][ + "CPU"] = "ARMv7" + android_enabled_with_cpu = ( + export_unity_package.Asset.set_cpu_for_android(android_enabled, "ARMv7")) + self.assertEqual(expected_metadata, android_enabled_with_cpu) + + def test_set_cpu_for_android_serializationv2(self): + """Set CPU field for the enabled Android platform in v2 metadata format.""" + android_enabled = collections.OrderedDict([ + ("PluginImporter", collections.OrderedDict([ + ("serializedVersion", 2), + ("platformData", [ + collections.OrderedDict([ + ("first", collections.OrderedDict([ + ("Android", "Android")])), + ("second", collections.OrderedDict([ + ("enabled", 1)]))]) + ]) + ])) + ]) + expected_metadata = copy.deepcopy(android_enabled) + expected_metadata["PluginImporter"]["platformData"][0]["second"][ + "settings"] = collections.OrderedDict([("CPU", "ARMv7")]) + android_enabled_with_cpu = ( + export_unity_package.Asset.set_cpu_for_android(android_enabled, "ARMv7")) + self.assertEqual(expected_metadata, android_enabled_with_cpu) + def test_apply_any_platform_selection_serializationv1(self): """Modify v1 importer metadata to enable all platforms.""" # Enable all platforms. @@ -2044,6 +2077,19 @@ def test_importer_metadata_android_only(self): self.package, {"importer": "PluginImporter", "platforms": ["Android"]}).importer_metadata) + def test_importer_metadata_android_only_armv7(self): + """Create metadata with ARMv7 CPU set.""" + self.plugin_metadata["PluginImporter"]["platformData"]["Android"][ + "enabled"] = 1 + self.plugin_metadata["PluginImporter"]["platformData"]["Android"][ + "settings"]["CPU"] = "ARMv7" + self.assertEqual( + self.plugin_metadata, + export_unity_package.AssetConfiguration( + self.package, {"importer": "PluginImporter", + "platforms": ["Android"], + "cpu": "ARMv7"}).importer_metadata) + def test_importer_metadata_ios_only(self): """Create metadata that only targets iOS.""" self.plugin_metadata["PluginImporter"]["platformData"]["iOS"]["enabled"] = 1 diff --git a/source/IOSResolver/src/IOSResolver.cs b/source/IOSResolver/src/IOSResolver.cs index a82517ea..a272810e 100644 --- a/source/IOSResolver/src/IOSResolver.cs +++ b/source/IOSResolver/src/IOSResolver.cs @@ -423,6 +423,21 @@ protected override bool Read(string filename, Logger logger) { " > sudo gem install -n /usr/local/bin cocoapods\n" + " > pod setup"); + // Dialog box text when the podfile version exceeds the currently configured + // target iOS or tvOS sdk version. + private const string TARGET_SDK_NEEDS_UPDATE_STRING = ( + "Target SDK selected in the {0} Player Settings ({1}) is not supported by " + + "the Cocoapods included in this project. The build will very " + + "likely fail. The minimum supported version is \"{2}\" required " + + "by pods ({3})\n" + + "Would you like to update the target SDK version?"); + + // Dialog box text when the IOSResolver has updated the target sdk version on behalf + // of the user. + private const string UPDATED_TARGET_SDK_STRING = ( + "Target {0} SDK has been updated from {1} to {2}. " + + "You must restart the build for this change to take effect."); + // Pod executable filename. private static string POD_EXECUTABLE = "pod"; // Default paths to search for the "pod" command before falling back to @@ -430,6 +445,7 @@ protected override bool Read(string filename, Logger logger) { private static string[] POD_SEARCH_PATHS = new string[] { "/usr/local/bin", "/usr/bin", + "/opt/homebrew/bin", }; // Ruby Gem executable filename. private static string GEM_EXECUTABLE = "gem"; @@ -539,8 +555,12 @@ protected override bool Read(string filename, Logger logger) { private static string PODFILE_GENERATED_COMMENT = "# IOSResolver Generated Podfile"; // Default iOS target SDK if the selected version is invalid. - private const int DEFAULT_TARGET_SDK = 82; - // Valid iOS target SDK version. + private const int DEFAULT_IOS_TARGET_SDK = 82; + + // Default tvOS target SDK if the selected version is invalid. + private const string DEFAULT_TVOS_TARGET_SDK = "12.0"; + + // Valid iOS / tvOS target SDK version. private static Regex TARGET_SDK_REGEX = new Regex("^[0-9]+\\.[0-9]$"); // Current window being used for a long running shell command. @@ -589,11 +609,17 @@ protected override bool Read(string filename, Logger logger) { private static ProjectSettings settings = new ProjectSettings(PREFERENCE_NAMESPACE); /// - /// Polls for changes to TargetSdk. + /// Polls for changes to target iOS SDK version. /// - private static PlayServicesResolver.PropertyPoller targetSdkPoller = + private static PlayServicesResolver.PropertyPoller iosTargetSdkPoller = new PlayServicesResolver.PropertyPoller("iOS Target SDK"); + /// + /// Polls for changes to target tvOS SDK version. + /// + private static PlayServicesResolver.PropertyPoller tvosTargetSdkPoller = + new PlayServicesResolver.PropertyPoller("tvOS Target SDK"); + // Search for a file up to a maximum search depth stopping the // depth first search each time the specified file is found. private static List FindFile( @@ -698,7 +724,7 @@ private static Assembly ResolveUnityEditoriOSXcodeExtension( /// static IOSResolver() { // Load log preferences. - VerboseLoggingEnabled = VerboseLoggingEnabled; + UpdateLoggerLevel(VerboseLoggingEnabled); // NOTE: We can't reference the UnityEditor.iOS.Xcode module in this // method as the Mono runtime in Unity 4 and below requires all @@ -754,8 +780,8 @@ exception is TypeInitializationException || !ExecutionEnvironment.InBatchMode) { AutoInstallCocoapods(); } - // Install / remove target SDK property poller. - SetEnablePollTargetSdk(PodfileGenerationEnabled); + // Install / remove target SDK property pollers. + SetEnablePollTargetSdks(PodfileGenerationEnabled); // Load XML dependencies on the next editor update. if (PodfileGenerationEnabled) { RefreshXmlDependencies(); @@ -817,25 +843,41 @@ public static void SettingsDialog() { /// internal static bool MultipleXcodeTargetsSupported { get { - return typeof(UnityEditor.iOS.Xcode.PBXProject).GetMethod( - "GetUnityMainTargetGuid", Type.EmptyTypes) != null; + try { + return MultipleXcodeTargetsSupportedInternal(); + } catch (Exception e) { + return false; + } } } + private static bool MultipleXcodeTargetsSupportedInternal() { + return typeof(UnityEditor.iOS.Xcode.PBXProject).GetMethod( + "GetUnityMainTargetGuid", Type.EmptyTypes) != null; + } + /// /// Name of the Xcode main target generated by Unity. /// public static string XcodeMainTargetName { get { - // NOTE: Unity-iPhone is hard coded in UnityEditor.iOS.Xcode.PBXProject and will no - // longer be exposed via GetUnityTargetName(). It hasn't changed in many years though - // so we'll use this constant as a relatively safe default. - return MultipleXcodeTargetsSupported ? "Unity-iPhone" : - (string)VersionHandler.InvokeStaticMethod(typeof(UnityEditor.iOS.Xcode.PBXProject), - "GetUnityTargetName", null); + try { + return XcodeMainTargetNameInternal(); + } catch (Exception e) { + return "Unity-iPhone"; + } } } + private static string XcodeMainTargetNameInternal() { + // NOTE: Unity-iPhone is hard coded in UnityEditor.iOS.Xcode.PBXProject and will no + // longer be exposed via GetUnityTargetName(). It hasn't changed in many years though + // so we'll use this constant as a relatively safe default. + return MultipleXcodeTargetsSupported ? "Unity-iPhone" : + (string)VersionHandler.InvokeStaticMethod(typeof(UnityEditor.iOS.Xcode.PBXProject), + "GetUnityTargetName", null); + } + /// /// Name of the Xcode UnityFramework target generated by Unity 2019.3+ /// @@ -949,20 +991,24 @@ public static bool PodfileGenerationEnabled { defaultValue: true); } set { settings.SetBool(PREFERENCE_PODFILE_GENERATION_ENABLED, value); - SetEnablePollTargetSdk(value); + SetEnablePollTargetSdks(value); } } /// - /// Enable / disable target SDK polling. + /// Enable / disable polling of target iOS and tvOS SDK project setting values. /// - private static void SetEnablePollTargetSdk(bool enable) { - if (enable && - (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS || - EditorUserBuildSettings.activeBuildTarget == BuildTarget.tvOS)) { - RunOnMainThread.OnUpdate += PollTargetSdk; + private static void SetEnablePollTargetSdks(bool enable) { + if (enable && EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS) { + RunOnMainThread.OnUpdate += PollTargetIosSdk; } else { - RunOnMainThread.OnUpdate -= PollTargetSdk; + RunOnMainThread.OnUpdate -= PollTargetIosSdk; + } + + if (enable && EditorUserBuildSettings.activeBuildTarget == BuildTarget.tvOS) { + RunOnMainThread.OnUpdate += PollTargetTvosSdk; + } else { + RunOnMainThread.OnUpdate -= PollTargetTvosSdk; } } @@ -1009,10 +1055,14 @@ public static bool VerboseLoggingEnabled { get { return settings.GetBool(PREFERENCE_VERBOSE_LOGGING_ENABLED, defaultValue: false); } set { settings.SetBool(PREFERENCE_VERBOSE_LOGGING_ENABLED, value); - logger.Level = value ? LogLevel.Verbose : LogLevel.Info; + UpdateLoggerLevel(value); } } + private static void UpdateLoggerLevel(bool verboseLoggingEnabled) { + logger.Level = verboseLoggingEnabled ? LogLevel.Verbose : LogLevel.Info; + } + /// /// Skip pod install when using workspace integration, let user manually run it. /// @@ -1388,64 +1438,120 @@ private static void AddPodInternal(string podName, return; } pods[podName] = pod; - ScheduleCheckTargetSdk(); + ScheduleCheckTargetIosSdkVersion(); + ScheduleCheckTargetTvosSdkVersion(); } /// - /// Determine whether the target SDK has changed. + /// Determine whether the target iOS SDK has changed. /// - private static void PollTargetSdk() { - targetSdkPoller.Poll(() => TargetSdk, - (previousValue, currentValue) => { ScheduleCheckTargetSdk(); }); + private static void PollTargetIosSdk() { + iosTargetSdkPoller.Poll(() => TargetIosSdkVersionString, + (previousValue, currentValue) => { ScheduleCheckTargetIosSdkVersion(); }); } - // ID of the job which checks that the target SDK is correct for the currently selected set of - // Cocoapods. - private static int checkTargetSdkJobId = 0; + /// + /// Determine whether the target tvOS SDK has changed. + /// + private static void PollTargetTvosSdk() { + tvosTargetSdkPoller.Poll(() => TargetTvosSdkVersionString, + (previousValue, currentValue) => { ScheduleCheckTargetTvosSdkVersion(); }); + } + + // ID of the job which checks that the target iOS SDK is correct for the currently selected + // set of Cocoapods. + private static int checkIosTargetSdkVersionJobId = 0; /// - /// Schedule a check to ensure target SDK is configured correctly given the set of selected - /// Cocoapods. + /// Schedule a check to ensure target iOS SDK is configured correctly given the + /// set of selected Cocoapods. /// - private static void ScheduleCheckTargetSdk() { - RunOnMainThread.Cancel(checkTargetSdkJobId); - checkTargetSdkJobId = RunOnMainThread.Schedule(() => { - UpdateTargetSdk(false); + private static void ScheduleCheckTargetIosSdkVersion() { + if(EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS) { + RunOnMainThread.Cancel(checkIosTargetSdkVersionJobId); + checkIosTargetSdkVersionJobId = RunOnMainThread.Schedule(() => { + UpdateTargetIosSdkVersion(false); }, 500.0 /* delay in milliseconds before running the check */); + } } + // ID of the job which checks that the target tvOS SDK is correct for the + // currently selected set of Cocoapods. + private static int checkTvosTargetSdkJobId = 0; + /// - /// Update the target SDK if it's required. + /// Schedule a check to ensure target tvOS SDK is configured correctly given the + /// set of selected Cocoapods. + /// + private static void ScheduleCheckTargetTvosSdkVersion() { + if(EditorUserBuildSettings.activeBuildTarget == BuildTarget.tvOS) { + RunOnMainThread.Cancel(checkTvosTargetSdkJobId); + checkTvosTargetSdkJobId = RunOnMainThread.Schedule(() => { + UpdateTargetTvosSdkVersion(false); + }, 500.0 /* delay in milliseconds before running the check */); + } + } + + /// + /// Update the iOS target SDK if it's required. /// /// Whether the build is being processed. - public static void UpdateTargetSdk(bool runningBuild) { - var minVersionAndPodNames = TargetSdkNeedsUpdate(); + public static void UpdateTargetIosSdkVersion(bool runningBuild) { + var minVersionAndPodNames = TargetSdkNeedsUpdate(TargetIosSdkVersionNum); + if (minVersionAndPodNames.Value != null) { + var minVersionString = TargetSdkVersionToString(minVersionAndPodNames.Key); + DialogWindow.Display("Unsupported Target iOS SDK", + String.Format( + TARGET_SDK_NEEDS_UPDATE_STRING, /*platformName=*/"iOS", + TargetIosSdkVersionNum, minVersionString, + String.Join(", ", minVersionAndPodNames.Value.ToArray())), + DialogWindow.Option.Selected1 /* No */, "Yes", "No", + complete: (selectedOption) => { + analytics.Report( + "UpdateTargetIosSdkVersion/" + + (selectedOption == DialogWindow.Option.Selected0 ? "apply" : "cancel"), + "Update Target iOS SDK"); + if (selectedOption == DialogWindow.Option.Selected0) { + TargetIosSdkVersionNum = minVersionAndPodNames.Key; + if (runningBuild) { + string errorString = String.Format( + UPDATED_TARGET_SDK_STRING, /*platform=*/"iOS", + TargetIosSdkVersionString, minVersionString); + DialogWindow.Display("Target iOS SDK updated.", errorString, + DialogWindow.Option.Selected0, "OK"); + } + } + }); + } + } + + /// + /// Update the iOS target SDK if it's required. + /// + /// Whether the build is being processed. + public static void UpdateTargetTvosSdkVersion(bool runningBuild) { + var minVersionAndPodNames = TargetSdkNeedsUpdate(TargetTvosSdkVersionNum); if (minVersionAndPodNames.Value != null) { var minVersionString = TargetSdkVersionToString(minVersionAndPodNames.Key); - DialogWindow.Display( - "Unsupported Target SDK", + DialogWindow.Display("Unsupported Target tvOS SDK", String.Format( - "Target SDK selected in the iOS Player Settings ({0}) is not supported by " + - "the Cocoapods included in this project. The build will very likely fail. " + - "The minimum supported version is \"{1}\" required by pods ({2})\n" + - "Would you like to update the target SDK version?", - TargetSdk, minVersionString, + TARGET_SDK_NEEDS_UPDATE_STRING, /*platformName=*/"tvOS", + TargetTvosSdkVersionNum, minVersionString, String.Join(", ", minVersionAndPodNames.Value.ToArray())), DialogWindow.Option.Selected1 /* No */, "Yes", "No", complete: (selectedOption) => { analytics.Report( - "updatetargetsdk/" + + "UpdateTargetTvosSdkVersion/" + (selectedOption == DialogWindow.Option.Selected0 ? "apply" : "cancel"), - "Update Target SDK"); + "Update Target tvOS SDK"); if (selectedOption == DialogWindow.Option.Selected0) { - TargetSdkVersion = minVersionAndPodNames.Key; + TargetTvosSdkVersionNum = minVersionAndPodNames.Key; if (runningBuild) { string errorString = String.Format( - "Target SDK has been updated from {0} to {1}. " + - "You must restart the build for this change to take effect.", - TargetSdk, minVersionString); - DialogWindow.Display("Target SDK updated.", errorString, + UPDATED_TARGET_SDK_STRING, /*platform=*/"tvOS", + TargetTvosSdkVersionString, minVersionString); + DialogWindow.Display("Target tvOS SDK updated.", errorString, DialogWindow.Option.Selected0, "OK"); } } @@ -1461,7 +1567,8 @@ public static void UpdateTargetSdk(bool runningBuild) { /// a list of pod names that require it (value) if the currently /// selected target SDK version does not satisfy pod requirements, the list /// (value) is null otherwise. - private static KeyValuePair> TargetSdkNeedsUpdate() { + private static KeyValuePair> + TargetSdkNeedsUpdate(int targetSdkVersionNum) { var emptyVersionAndPodNames = new KeyValuePair>(0, null); var minVersionAndPodNames = emptyVersionAndPodNames; int maxOfMinRequiredVersions = 0; @@ -1473,7 +1580,7 @@ private static KeyValuePair> TargetSdkNeedsUpdate() { } // If the target SDK version exceeds the minimum required version return an empty tuple // otherwise return the minimum required SDK version and the set of pods that need it. - return TargetSdkVersion >= maxOfMinRequiredVersions ? emptyVersionAndPodNames : + return targetSdkVersionNum >= maxOfMinRequiredVersions ? emptyVersionAndPodNames : minVersionAndPodNames; } @@ -1496,42 +1603,19 @@ public static string GetProjectPath(string relativeTo) { /// /// Get or set the Unity iOS target SDK version string (e.g "7.1") - /// build setting. + /// build setting dependeding on the current active build target. /// - static string TargetSdk { + static string TargetIosSdkVersionString { get { string name = null; var iosSettingsType = typeof(UnityEditor.PlayerSettings.iOS); - // Read the version (Unity 5.5 and above). - var osVersionProperty = iosSettingsType.GetProperty( - "targetOSVersionString"); + var osVersionProperty = + iosSettingsType.GetProperty("targetOSVersionString"); if (osVersionProperty != null) { name = (string)osVersionProperty.GetValue(null, null); } - if (name == null) { - // Read the version (deprecated in Unity 5.5). - osVersionProperty = iosSettingsType.GetProperty( - "targetOSVersion"); - if (osVersionProperty != null) { - var osVersionValue = - osVersionProperty.GetValue(null, null); - if (osVersionValue != null) { - name = Enum.GetName(osVersionValue.GetType(), - osVersionValue); - } - } - } if (String.IsNullOrEmpty(name)) { - // Versions 8.2 and above do not have enum symbols - // The values in Unity 5.4.1f1: - // 8.2 == 32 - // 8.3 == 34 - // 8.4 == 36 - // 9.0 == 38 - // 9.1 == 40 - // Since these are undocumented just report - // 8.2 as selected for the moment. - return TargetSdkVersionToString(DEFAULT_TARGET_SDK); + return TargetSdkVersionToString(DEFAULT_IOS_TARGET_SDK); } return name.Trim().Replace("iOS_", "").Replace("_", "."); } @@ -1549,19 +1633,55 @@ static string TargetSdk { osVersionProperty.SetValue( null, Enum.Parse(osVersionProperty.PropertyType, - "iOS_" + value.Replace(".", "_")), + "iOS_" + value.Replace(".", "_")), null); } } } + /// + /// Get or set the Unity tvOS target SDK version string (e.g "7.1") + /// build setting dependeding on the current active build target. + /// + static string TargetTvosSdkVersionString { + get { + string name = null; + var tvosSettingsType = typeof(UnityEditor.PlayerSettings.tvOS); + var osVersionProperty = + tvosSettingsType.GetProperty("targetOSVersionString"); + if (osVersionProperty != null) { + name = (string)osVersionProperty.GetValue(null, null); + } + if (String.IsNullOrEmpty(name)) { + return DEFAULT_TVOS_TARGET_SDK; + } + return name.Trim().Replace("tvOS_", "").Replace("_", "."); + } + + set { + var tvosSettingsType = typeof(UnityEditor.PlayerSettings.tvOS); + var osVersionProperty = + tvosSettingsType.GetProperty("targetOSVersionString"); + osVersionProperty.SetValue(null, value, null); + } + } + /// /// Get or set the Unity iOS target SDK using a version number (e.g 71 /// is equivalent to "7.1"). /// - static int TargetSdkVersion { - get { return TargetSdkStringToVersion(TargetSdk); } - set { TargetSdk = TargetSdkVersionToString(value); } + static int TargetIosSdkVersionNum { + get { return TargetSdkStringToVersion(TargetIosSdkVersionString); } + set { TargetIosSdkVersionString = TargetSdkVersionToString(value); } + } + + /// + /// Get or set the Unity iOS target SDK using a version number (e.g 71 + /// is equivalent to "7.1"). + /// + static int TargetTvosSdkVersionNum { + get { return TargetSdkStringToVersion(TargetTvosSdkVersionString); } + set { TargetTvosSdkVersionString = TargetSdkVersionToString(value); } } /// @@ -1583,9 +1703,9 @@ internal static int TargetSdkStringToVersion(string targetSdk) { "Please change this to a valid SDK version (e.g {1}) in:\n" + " Player Settings -> Other Settings --> " + "Target Minimum iOS Version\n", - targetSdk, TargetSdkVersionToString(DEFAULT_TARGET_SDK)), + targetSdk, TargetSdkVersionToString(DEFAULT_IOS_TARGET_SDK)), level: LogLevel.Warning); - return DEFAULT_TARGET_SDK; + return DEFAULT_IOS_TARGET_SDK; } @@ -2202,8 +2322,22 @@ public static void GenPodfile(BuildTarget buildTarget, verbose: true); using (StreamWriter file = new StreamWriter(podfilePath)) { - file.WriteLine(GeneratePodfileSourcesSection() + - String.Format("platform :ios, '{0}'\n", TargetSdk)); + file.WriteLine(GeneratePodfileSourcesSection()); + switch (EditorUserBuildSettings.activeBuildTarget) { + case BuildTarget.iOS: + file.WriteLine(String.Format("platform :ios, '{0}'\n", + TargetIosSdkVersionString)); + break; + case BuildTarget.tvOS: + file.WriteLine(String.Format("platform :tvos, '{0}'\n", + TargetTvosSdkVersionString)); + break; + default: + throw new Exception("IOSResolver.GenPodfile() invoked for a " + + "build target other than iOS or tvOS."); + break; + } + foreach (var target in XcodeTargetNames) { file.WriteLine(String.Format("target '{0}' do", target)); foreach(var pod in pods.Values) { @@ -2601,7 +2735,15 @@ private static CommandLine.Result RunPodCommand( public static void OnPostProcessInstallPods(BuildTarget buildTarget, string pathToBuiltProject) { if (!InjectDependencies() || !PodfileGenerationEnabled) return; - UpdateTargetSdk(true); + + if(EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS) { + UpdateTargetIosSdkVersion(true); + } + + if(EditorUserBuildSettings.activeBuildTarget == BuildTarget.tvOS) { + UpdateTargetTvosSdkVersion(true); + } + if (!CocoapodsIntegrationEnabled || !cocoapodsToolsInstallPresent) { Log(String.Format( "Cocoapod installation is disabled.\n" + diff --git a/source/IOSResolver/src/VersionNumber.cs b/source/IOSResolver/src/VersionNumber.cs index 93cc613a..c9f3afa8 100644 --- a/source/IOSResolver/src/VersionNumber.cs +++ b/source/IOSResolver/src/VersionNumber.cs @@ -27,7 +27,7 @@ public class IOSResolverVersionNumber { /// /// Version number, patched by the build process. /// - private const string VERSION_STRING = "1.2.174"; + private const string VERSION_STRING = "1.2.186"; /// /// Cached version structure. diff --git a/source/ImportUnityPackage/__pycache__/import_unity_package.cpython-311.pyc b/source/ImportUnityPackage/__pycache__/import_unity_package.cpython-311.pyc new file mode 100644 index 00000000..f1c36f67 Binary files /dev/null and b/source/ImportUnityPackage/__pycache__/import_unity_package.cpython-311.pyc differ diff --git a/source/ImportUnityPackage/__pycache__/import_unity_package.cpython-39.pyc b/source/ImportUnityPackage/__pycache__/import_unity_package.cpython-39.pyc index 5c245c16..0d771aa0 100644 Binary files a/source/ImportUnityPackage/__pycache__/import_unity_package.cpython-39.pyc and b/source/ImportUnityPackage/__pycache__/import_unity_package.cpython-39.pyc differ diff --git a/source/JarResolverTests/JarResolverTests.csproj b/source/JarResolverTests/JarResolverTests.csproj deleted file mode 100644 index 4a9acd0d..00000000 --- a/source/JarResolverTests/JarResolverTests.csproj +++ /dev/null @@ -1,75 +0,0 @@ - - - - Debug - AnyCPU - {593254D7-6358-40A6-B0C8-F0616BBF499D} - Library - JarResolverTests - JarResolverTests - v2.0 - 1.2 - 12.0.0 - 2.0 - - - True - full - False - bin\Debug - DEBUG; - prompt - 4 - False - - - none - True - bin\Release - prompt - 4 - False - - - ..\packages\NUnit.2.6.3\lib\ - - - - - - $(NUnityHintPath)/nunit.framework.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - {CC4F239D-3C7F-4164-830F-9215AE15B32A} - JarResolverLib - - - - - - diff --git a/source/JarResolverTests/packages.config b/source/JarResolverTests/packages.config deleted file mode 100644 index d4e241a2..00000000 --- a/source/JarResolverTests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/source/PackageManagerResolver/src/PackageManagerResolver.cs b/source/PackageManagerResolver/src/PackageManagerResolver.cs index 03d18ddd..d041cc26 100644 --- a/source/PackageManagerResolver/src/PackageManagerResolver.cs +++ b/source/PackageManagerResolver/src/PackageManagerResolver.cs @@ -94,7 +94,7 @@ static PackageManagerResolver() { RunOnMainThread.Run(() => { // Load log preferences. - VerboseLoggingEnabled = VerboseLoggingEnabled; + UpdateLoggerLevel(VerboseLoggingEnabled); }, runNow: false); } @@ -645,9 +645,13 @@ public static bool VerboseLoggingEnabled { get { return settings.GetBool(PreferenceVerboseLoggingEnabled, defaultValue: false); } set { settings.SetBool(PreferenceVerboseLoggingEnabled, value); - logger.Level = value ? LogLevel.Verbose : LogLevel.Info; + UpdateLoggerLevel(value); } } + + private static void UpdateLoggerLevel(bool verboseLoggingEnabled) { + logger.Level = verboseLoggingEnabled ? LogLevel.Verbose : LogLevel.Info; + } /// /// Whether scoped registries are supported in current Unity editor. diff --git a/source/PackageManagerResolver/src/VersionNumber.cs b/source/PackageManagerResolver/src/VersionNumber.cs index a24f4fed..d112d2be 100644 --- a/source/PackageManagerResolver/src/VersionNumber.cs +++ b/source/PackageManagerResolver/src/VersionNumber.cs @@ -27,7 +27,7 @@ public class PackageManagerResolverVersionNumber { /// /// Version number, patched by the build process. /// - private const string VERSION_STRING = "1.2.174"; + private const string VERSION_STRING = "1.2.186"; /// /// Cached version structure. diff --git a/source/PackageManagerResolver/test/PackageManagerClientIntegrationTests/PackageManagerClientIntegrationTests.cs b/source/PackageManagerResolver/test/PackageManagerClientIntegrationTests/PackageManagerClientIntegrationTests.cs index 7ff4fe44..b4b81f05 100644 --- a/source/PackageManagerResolver/test/PackageManagerClientIntegrationTests/PackageManagerClientIntegrationTests.cs +++ b/source/PackageManagerResolver/test/PackageManagerClientIntegrationTests/PackageManagerClientIntegrationTests.cs @@ -165,7 +165,7 @@ public static void TestSearchAvailablePackagesAll( CheckPackageNamesInPackageInfos( new List() { "com.unity.2d.animation", - "com.unity.entities" + "com.unity.test-framework" }, result.Packages, testCaseResult, "SearchAvailablePackages returned an unexpected set of packages"); diff --git a/source/PackageManagerResolver/unit_tests/src/PackageManagerRegistryTest.cs b/source/PackageManagerResolver/unit_tests/Assets/PackageManagerResolverTests/PackageManagerRegistryTest.cs similarity index 100% rename from source/PackageManagerResolver/unit_tests/src/PackageManagerRegistryTest.cs rename to source/PackageManagerResolver/unit_tests/Assets/PackageManagerResolverTests/PackageManagerRegistryTest.cs diff --git a/source/PackageManagerResolver/unit_tests/Assets/PackageManagerResolverTests/PackageManagerResolverTests.asmdef b/source/PackageManagerResolver/unit_tests/Assets/PackageManagerResolverTests/PackageManagerResolverTests.asmdef new file mode 100644 index 00000000..1826febe --- /dev/null +++ b/source/PackageManagerResolver/unit_tests/Assets/PackageManagerResolverTests/PackageManagerResolverTests.asmdef @@ -0,0 +1,25 @@ +{ + "name": "Google.PackageManagerResolverTests", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll", + "Google.VersionHandler.dll", + "Google.VersionHandlerImpl.dll", + "Google.PackageManagerResolver.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} diff --git a/source/PackageManagerResolver/unit_tests/src/PackageManifestModifierTest.cs b/source/PackageManagerResolver/unit_tests/Assets/PackageManagerResolverTests/PackageManifestModifierTest.cs similarity index 100% rename from source/PackageManagerResolver/unit_tests/src/PackageManifestModifierTest.cs rename to source/PackageManagerResolver/unit_tests/Assets/PackageManagerResolverTests/PackageManifestModifierTest.cs diff --git a/source/PackageManagerResolver/unit_tests/src/XmlPackageManagerRegistriesTest.cs b/source/PackageManagerResolver/unit_tests/Assets/PackageManagerResolverTests/XmlPackageManagerRegistriesTest.cs similarity index 100% rename from source/PackageManagerResolver/unit_tests/src/XmlPackageManagerRegistriesTest.cs rename to source/PackageManagerResolver/unit_tests/Assets/PackageManagerResolverTests/XmlPackageManagerRegistriesTest.cs diff --git a/source/PackageManagerResolver/unit_tests/PackageManagerResolverTests.csproj b/source/PackageManagerResolver/unit_tests/PackageManagerResolverTests.csproj deleted file mode 100644 index fca6aba1..00000000 --- a/source/PackageManagerResolver/unit_tests/PackageManagerResolverTests.csproj +++ /dev/null @@ -1,55 +0,0 @@ - - - - Debug - AnyCPU - {FEECDCE1-F528-4931-A4CF-808DDBCE1A8D} - Library - Google.PackageManagerResolver.Tests - Google.PackageManagerResolverTests - v2.0 - 1.2 - 12.0.0 - 2.0 - - - True - full - False - bin\Debug - DEBUG; - prompt - 4 - False - - - none - True - bin\Release - prompt - 4 - False - - - ..\packages\NUnit.2.6.3\lib\ - - - - - - $(NUnityHintPath)/nunit.framework.dll - - - - - - - - - - - {77EBE819-CBE6-4CA8-A791-ED747EA29D30} - PackageManagerResolver - - - diff --git a/source/VersionHandler/src/VersionHandler.cs b/source/VersionHandler/src/VersionHandler.cs index f5614708..0b0f719e 100644 --- a/source/VersionHandler/src/VersionHandler.cs +++ b/source/VersionHandler/src/VersionHandler.cs @@ -118,6 +118,12 @@ static VersionHandler() { } else { EditorApplication.update -= BootStrap; EditorApplication.update += BootStrap; + // A workaround to make sure bootstrap continues if Unity reloads assemblies + // during bootstrapping. The issue only observed in Unity 2019 and 2020 + float unityVersion = GetUnityVersionMajorMinor(); + if (unityVersion < 2021.0f && unityVersion >= 2019.0f) { + var type = BootStrappedImpl; + } } } @@ -147,7 +153,7 @@ private static void BootStrap() { if (implAvailable) return; var assemblies = new List(); - foreach (string assetGuid in AssetDatabase.FindAssets("l:gvh")) { + foreach (var assetGuid in AssetDatabase.FindAssets("l:gvh")) { string filename = AssetDatabase.GUIDToAssetPath(assetGuid); var match = VERSION_HANDLER_FILENAME_RE.Match(filename); if (match.Success) assemblies.Add(match); diff --git a/source/VersionHandlerImpl/src/EditorMeasurement.cs b/source/VersionHandlerImpl/src/EditorMeasurement.cs index 254ce50c..a2500b0c 100644 --- a/source/VersionHandlerImpl/src/EditorMeasurement.cs +++ b/source/VersionHandlerImpl/src/EditorMeasurement.cs @@ -493,7 +493,14 @@ public void Report(string reportUrl, string reportName) { PromptToEnable(() => { if (!Enabled) return; - try { + + // TODO: This logic uses the Universal Analytics Measurement Protocol, which is stopping + // support on July 1st, 2024. It needs to be upgraded to the new Google Analytics 4 protocols. + // Old: https://developers.google.com/analytics/devguides/collection/protocol/v1/reference + // New: https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events?client_type=gtag + // Commenting it out now, to prevent any possible errors from appearing in the console until the + // upgrade is complete. + /*try { var uri = new Uri("http://ignore.host/" + reportUrl); bool reported = false; var path = String.Join("", uri.Segments); @@ -547,7 +554,7 @@ public void Report(string reportUrl, string reportName) { logger.Log(String.Format( "Failed to reporting analytics data due to exception: {0}", e), level: LogLevel.Verbose); - } + }*/ }); } } diff --git a/source/VersionHandlerImpl/src/FileUtils.cs b/source/VersionHandlerImpl/src/FileUtils.cs index 6f3b098f..75f6aae3 100644 --- a/source/VersionHandlerImpl/src/FileUtils.cs +++ b/source/VersionHandlerImpl/src/FileUtils.cs @@ -48,9 +48,10 @@ internal class FileUtils { /// /// Regex to match packages folder like "Library/PackageCache/com.company.pkg" + /// or "Library/PackageCache/com.company.pkg@version" /// private static Regex PACKAGES_PHYSICAL_PATH_REGEX = - new Regex(@"^(Library[/\\]PackageCache[/\\])([^/\\]+)(@[^/\\]+)[/\\](.*)?$"); + new Regex(@"^(Library[/\\]PackageCache[/\\])([^/\\]+)(@[^/\\]+)?[/\\](.*)?$"); /// /// Returns the project directory (e.g contains the Assets folder). @@ -448,7 +449,9 @@ public static string GetPackageDirectory( // work if the package is installed from a local tarball or from a registry // server. string absolutePath = Path.GetFullPath(packageDir); - packageDir = absolutePath.Substring(ProjectDirectory.Length + 1); + if (absolutePath.StartsWith(ProjectDirectory)) { + packageDir = absolutePath.Substring(ProjectDirectory.Length + 1); + } } } else { nameMatch = PACKAGES_PHYSICAL_PATH_REGEX.Match(path); @@ -640,42 +643,47 @@ internal static bool IsValidGuid(string guidStr) { /// Path to the file/directory that needs checking. /// True if all folders are created successfully. public static bool CreateFolder(string path, Google.Logger logger = null) { - if (AssetDatabase.IsValidFolder(path)) { - return true; - } - DirectoryInfo di = new DirectoryInfo(path); - var parentFolder = Path.GetDirectoryName(path); - if (!CreateFolder(parentFolder)) { - return false; - } + try { + if (AssetDatabase.IsValidFolder(path)) { + return true; + } + DirectoryInfo di = new DirectoryInfo(path); + var parentFolder = Path.GetDirectoryName(path); + if (!CreateFolder(parentFolder)) { + return false; + } - // Try to use Unity API to create folder. However, some versions of Unity has issue to - // create folders with version number in it like '9.0.0'. In this case, instead of - // returnig empty guid, it can return guids with all zeroes. - if (IsValidGuid(AssetDatabase.CreateFolder(parentFolder, di.Name))) { - return true; - } + // Try to use Unity API to create folder. However, some versions of Unity has issue to + // create folders with version number in it like '9.0.0'. In this case, instead of + // returning empty guid, it can return guids with all zeroes. + if (IsValidGuid(AssetDatabase.CreateFolder(parentFolder, di.Name))) { + return true; + } - if (logger != null) { - logger.Log( - String.Format( - "Please ignore Unity error messages similar to '{0}'.\n" + - "Unable to use Unity API `AssetDatabase.CreateFolder()` to " + - "create folder: '{1}'. Switch to use `Directory.CreateDirectory()` " + - "instead. \n\n" + - "See {2} for more information.", - "*** is not a valid directory name.", - path, - "https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-7046"), - LogLevel.Info); - } + if (logger != null) { + logger.Log( + String.Format( + "Please ignore Unity error messages similar to '{0}'.\n" + + "Unable to use Unity API `AssetDatabase.CreateFolder()` to " + + "create folder: '{1}'. Switch to use `Directory.CreateDirectory()` " + + "instead. \n\n" + + "See {2} for more information.", + "*** is not a valid directory name.", + path, + "https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-7046"), + LogLevel.Info); + } - return Directory.CreateDirectory(path) != null; + return Directory.CreateDirectory(path) != null; + } catch (Exception ex) { + logger.Log("Exception thrown trying to CreateFolder. " + ex, LogLevel.Error); + return false; + } } /// /// Replace "Assets/", "Packages/package-id", or "Library/PackageCache/package-id@version" - /// base in the path with the new base. + /// base (@version optional) in the path with the new base. /// /// Path to the file/directory to be modified. /// New base used to replace the given path. diff --git a/source/VersionHandlerImpl/src/VersionHandlerImpl.cs b/source/VersionHandlerImpl/src/VersionHandlerImpl.cs index 36e32fe2..f0022556 100644 --- a/source/VersionHandlerImpl/src/VersionHandlerImpl.cs +++ b/source/VersionHandlerImpl/src/VersionHandlerImpl.cs @@ -2290,7 +2290,7 @@ public static Logger Logger { /// Load log preferences. /// private static void LoadLogPreferences() { - VerboseLoggingEnabled = VerboseLoggingEnabled; + UpdateLoggerLevel(VerboseLoggingEnabled); } /// @@ -2512,9 +2512,13 @@ public static bool VerboseLoggingEnabled { defaultValue: false); } set { settings.SetBool(PREFERENCE_VERBOSE_LOGGING_ENABLED, value); - logger.Level = value ? LogLevel.Verbose : LogLevel.Info; + UpdateLoggerLevel(value); } } + + private static void UpdateLoggerLevel(bool verboseLoggingEnabled) { + logger.Level = verboseLoggingEnabled ? LogLevel.Verbose : LogLevel.Info; + } /// /// Enable / disable verbose logging. @@ -2722,7 +2726,7 @@ public static string[] SearchAssetDatabase(string assetsFilter = null, } var assetGuids = searchDirectories == null ? AssetDatabase.FindAssets(assetsFilter) : AssetDatabase.FindAssets(assetsFilter, searchDirectories); - foreach (string assetGuid in assetGuids) { + foreach (var assetGuid in assetGuids) { string filename = AssetDatabase.GUIDToAssetPath(assetGuid); // Ignore non-existent files as it's possible for the asset database to reference // missing files if it hasn't been refreshed or completed a refresh. diff --git a/source/VersionHandlerImpl/src/VersionNumber.cs b/source/VersionHandlerImpl/src/VersionNumber.cs index 322982a1..58c6f697 100644 --- a/source/VersionHandlerImpl/src/VersionNumber.cs +++ b/source/VersionHandlerImpl/src/VersionNumber.cs @@ -27,7 +27,7 @@ public class VersionHandlerVersionNumber { /// /// Version number, patched by the build process. /// - private const string VERSION_STRING = "1.2.174"; + private const string VERSION_STRING = "1.2.186"; /// /// Cached version structure. diff --git a/source/VersionHandlerImpl/test/activation/Assets/PlayServicesResolver/Editor/TestEnabledCallback.cs b/source/VersionHandlerImpl/test/activation/Assets/PlayServicesResolver/Editor/TestEnabledCallback.cs index 36560baf..bf4b3ece 100644 --- a/source/VersionHandlerImpl/test/activation/Assets/PlayServicesResolver/Editor/TestEnabledCallback.cs +++ b/source/VersionHandlerImpl/test/activation/Assets/PlayServicesResolver/Editor/TestEnabledCallback.cs @@ -42,7 +42,11 @@ private static Dictionary EntryPoints { { "IOS Resolver", Google.VersionHandler.FindClass("Google.IOSResolver", "Google.IOSResolver") - } + }, + { + "Package Manager Resolver", + Google.VersionHandler.FindClass("Google.PackageManagerResolver", "Google.PackageManagerResolver") + } }; } } diff --git a/source/VersionHandlerImpl/unit_tests/src/EditorMeasurementTest.cs b/source/VersionHandlerImpl/unit_tests/Assets/VersionHandlerImplTests/EditorMeasurementTest.cs similarity index 100% rename from source/VersionHandlerImpl/unit_tests/src/EditorMeasurementTest.cs rename to source/VersionHandlerImpl/unit_tests/Assets/VersionHandlerImplTests/EditorMeasurementTest.cs diff --git a/source/VersionHandlerImpl/unit_tests/src/FileUtilsTest.cs b/source/VersionHandlerImpl/unit_tests/Assets/VersionHandlerImplTests/FileUtilsTest.cs similarity index 100% rename from source/VersionHandlerImpl/unit_tests/src/FileUtilsTest.cs rename to source/VersionHandlerImpl/unit_tests/Assets/VersionHandlerImplTests/FileUtilsTest.cs diff --git a/source/VersionHandlerImpl/unit_tests/src/ProjectSettingsTest.cs b/source/VersionHandlerImpl/unit_tests/Assets/VersionHandlerImplTests/ProjectSettingsTest.cs similarity index 100% rename from source/VersionHandlerImpl/unit_tests/src/ProjectSettingsTest.cs rename to source/VersionHandlerImpl/unit_tests/Assets/VersionHandlerImplTests/ProjectSettingsTest.cs diff --git a/source/VersionHandlerImpl/unit_tests/Assets/VersionHandlerImplTests/VersionHandlerImplTests.asmdef b/source/VersionHandlerImpl/unit_tests/Assets/VersionHandlerImplTests/VersionHandlerImplTests.asmdef new file mode 100644 index 00000000..7061f59d --- /dev/null +++ b/source/VersionHandlerImpl/unit_tests/Assets/VersionHandlerImplTests/VersionHandlerImplTests.asmdef @@ -0,0 +1,24 @@ +{ + "name": "Google.VersionHandlerImplTests", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll", + "Google.VersionHandler.dll", + "Google.VersionHandlerImpl.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} diff --git a/source/VersionHandlerImpl/unit_tests/VersionHandlerImplTests.csproj b/source/VersionHandlerImpl/unit_tests/VersionHandlerImplTests.csproj deleted file mode 100644 index a9301e0d..00000000 --- a/source/VersionHandlerImpl/unit_tests/VersionHandlerImplTests.csproj +++ /dev/null @@ -1,55 +0,0 @@ - - - - Debug - AnyCPU - {9FD33878-5B6B-411D-A3C7-D2A5E7E63182} - Library - Google.VersionHandlerImpl.Tests - Google.VersionHandlerImplTests - v2.0 - 1.2 - 12.0.0 - 2.0 - - - True - full - False - bin\Debug - DEBUG; - prompt - 4 - False - - - none - True - bin\Release - prompt - 4 - False - - - ..\packages\NUnit.2.6.3\lib\ - - - - - - $(NUnityHintPath)/nunit.framework.dll - - - - - - - - - - - {1E162334-8EA2-440A-9B3A-13FD8FE5C22E} - VersionHandlerImpl - - - diff --git a/test_resources/nunit_upm/manifest.json b/test_resources/nunit_upm/manifest.json new file mode 100644 index 00000000..807a360d --- /dev/null +++ b/test_resources/nunit_upm/manifest.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "com.unity.test-framework": "1.1.33" + } +} diff --git a/test_resources/version_handler_update/VersionHandlerUpdater.cs b/test_resources/version_handler_update/VersionHandlerUpdater.cs new file mode 100644 index 00000000..b80b1884 --- /dev/null +++ b/test_resources/version_handler_update/VersionHandlerUpdater.cs @@ -0,0 +1,48 @@ +// +// Copyright (C) 2023 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +using System; +using System.Collections.Generic; +using System.Collections; +using System.IO; + +/// +/// Run Version Handler to ensure all the libraries are properly enabled. +/// +[UnityEditor.InitializeOnLoad] +public class VersionHandlerUpdater { + /// + /// Register a method to call when the Version Handler has enabled all plugins in the project. + /// + static VersionHandlerUpdater() { + // Disable stack traces for more condensed logs. + UnityEngine.Application.stackTraceLogType = UnityEngine.StackTraceLogType.None; + UnityEngine.Debug.Log("Set up callback on Version Handler completion."); + Google.VersionHandler.UpdateCompleteMethods = new [] { + ":VersionHandlerUpdater:VersionHandlerReady" + }; + UnityEngine.Debug.Log("Enable plugin using the Version Handler."); + Google.VersionHandler.UpdateNow(); + } + + /// + /// Called when the Version Handler has enabled all managed plugins in a project. + /// + public static void VersionHandlerReady() { + UnityEngine.Debug.Log("The plugin should now be enabled by the Version Handler."); + UnityEditor.EditorApplication.Exit(0); + } +} diff --git a/troubleshooting-faq.md b/troubleshooting-faq.md new file mode 100644 index 00000000..e542b810 --- /dev/null +++ b/troubleshooting-faq.md @@ -0,0 +1,143 @@ + +# EDM4U Usage Troubleshooting Guide + +--- +## Table of contents +1. [Resolver and Target Platform Build Debug Process](#introduction) +2. [General Tips](#general_tips) + 1. [Enable Verbose Logging](#verbose_loggin) + 2. [Turn off auto-resolution on Android](#android_auto_resolution) +3. [Android](#android) + 1. [Fixing "Resolution Failed" errors](#resolution_failed) + 2. [Use Force Resolve if having issues with resolution](#force_resolve) + 3. [JDK, SDK, NDK, Gradle Issues (including locating)](#jdk_sdk_ndk) + 4. [Enable Custom Main Gradle Template, a.k.a. mainTemplate.gradle](#custom_main_gradle_template) + 5. [Enable Jetifier if you can](#jetifier) +4. [iOS](#ios) + 1. [Investigate Cocoapods if iOS resolution fails](#cocoapods) + 2. [Prefer opening Xcode Workspace files in Xcode to opening Xcode Project Files](#xcode_workspace_files) + 3. [Win32 Errors when building Xcode Workspace/Project on Mac](#win32_errors) + 4. [Runtime Swift Issues](#swift) +--- + +# Resolver and Target Platform Build Debug Process + + +The following is a roughly chronological process for debugging and exploring the use of EDM4U when building your game/app for a particular platform. The first section ("General Tips'') applies regardless of your target, while the remaining two have to do with which target you are building for (Android or or iOS). + +Consider each step within a section in order: If you do not have an issue with the step, move on to the next; If you do have an issue, attempt the listed steps and proceed once the issue is cleared. + +Throughout the process, additionally address and explore both warnings and error messages displayed in the Unity Editor console and/or device logs. Oftentimes, seemingly unrelated errors can cause issues and, even when they don't, they can hide bigger issues. + +
+ +

Note: This guide assumes you have already tested and verified the expected functionality of your Unity game/app in the Editor when compiling for the target platform.

+

If you have not done so yet, perform your tests and resolve any issues you find before returning to this process.

+
+
+

+ + +# **General Tips** + +If at any point you want or need more resolver or build information, consider enabling verbose logging and reading the log after trying to build again + +### **Enable Verbose Logging** + +#### Android + +Enable **Verbose Logging** in **Assets > External Dependency Manager > Android Resolver > Settings** + +#### iOS + +Enable **Verbose Logging** in **Assets > External Dependency Manager > iOS Resolver > Settings** + +### **Turn off auto-resolution on Android** + +When the auto-resolution feature is enabled, the Android resolver can trigger when assets are changed or when AppDomain is reloaded, which happens every time you press the Play button in the editor. Dependency resolution can be slow when the Unity project is big or when the resolver needs to download and patch many Android libraries. You can improve iteration time by disabling most of the auto-resolution features and manually triggering resolution instead. + +* Manual resolution is available through **Assets > External Dependency Manager > Android Resolver > Resolve** and **Assets > External Dependency Manager > Android Resolver > Force Resolve** menu items. +* Turn off "Enable Auto-Resolution" in the settings menu to prevent resolution triggered by assets changes and AppDomain reloads. +* Turn off "Enable Resolution on Build" in the settings menu to speed up build time. + +# **Android** + +### **Fixing "Resolution Failed" errors** + +If EDM4U fails resolution, try the following sequentially, making sure to check whether resolution succeeded between each. If a section heading includes "if you can", perform the step unless you *know* you cannot or that there are issues with doing so in your project. + +### **Use Force Resolve if having issues with resolution** + +* When trying to build, if you receive errors, try to resolve dependencies by clicking **Assets > External Dependency Manager > Android Resolver > Resolve** +* If this fails, try **Assets > External Dependency Manager > Android Resolver > Force Resolve.** While this is slower, it is more dependendable as it clears old intermediate data. + +### **JDK, SDK, NDK, Gradle Issues (including locating)** + +* Reasons to do this: + * If **Force Resolve** is failing and you have not done this yet, try this. + * If you receive error logs about Unity being unable to locate the `JDK`, `Android SDK Tools` or `NDK` + * This issue is mostly observed in Unity 2019 and 2020. +* What it does: + * Toggling the external tool settings forces Unity to acknowledge them as it may not have loaded them properly. +* What to do: + * Enter **Unity > Preferences> External Tools** + * Toggle the `JDK`, `Android SDK`, `Android NDK` and `Gradle` **checkboxes** such that they have the opposite value of what they started with + * Toggle them back to their original values + * Try **Force Resolve** and/or building again + +### **Enable Custom Main Gradle Template, a.k.a. mainTemplate.gradle** + +* By default, EDM4U used [a custom Gradle script](https://github.com/googlesamples/unity-jar-resolver/blob/master/source/AndroidResolver/scripts/download_artifacts.gradle) to download Android libraries to the "Assets/Plugins/Android/" folder. This can be problematic in several cases: + * When Unity adds some common Android libraries with specific versions to the Gradle by default, play-core or game-activity. This would very likely cause duplicate class errors during build time. + * When multiple Unity plugins depend on the same Android libraries with a very different range of versions. The Gradle project generated by Unity can handle resolution far better than the custom script in EDM4U. + * Downloading large amounts of Android libraries can be slow. +* If you do this and are on Unity 2019.3+ you *must* enable [**Custom Gradle Properties Template**](https://docs.unity3d.com/Manual/class-PlayerSettingsAndroid.html#Publishing) to enable AndroidX and Jetifier, which are described in the next step. + +### **Enable Jetifier if you can** + +* Android 9 introduced a new set of support libraries (AndroidX) which use the same class name but under a different package name. If your project has dependencies (including transitive dependencies) on both AndroidX and the older Android Support Libraries, duplicated class errors in `com.google.android.support.*` and `com.google.androidx.*` will occur during build time. [Jetifier](https://developer.android.com/tools/jetifier) is a tool to resolve such cases. In general, you should *enable Jetifier if your target Android version is 9+, or API level 28+*. +* Android Resolver can configure Unity projects to enable Jetifier. This feature can be enabled by the **Use Jetifier** option in Android Resolver settings. When enabled, + * Android Resolver uses Jetifier to patch every Android library it downloaded to the "Assets/Plugins/Android" folder. + * When **Custom Main Gradle Template** is enabled, it injects scripts to enable AndroidX and Jetifier to this template, prior to Unity 2019.3. After Unity 2019.3, AndroidX and Jetifier can only be enabled in **Custom Gradle Properties Template**. +* When using Unity 2019.3 or above, it is recommended to enable **Custom Gradle Properties Template**, regardless if you are using **Custom Main Gradle Template** or not. + +# **iOS** + +If EDM4U fails resolution, try the following sequentially, making sure to check whether resolution succeeded between each. + +### **Investigate Cocoapods if iOS resolution fails** + +* First of all make sure it's [properly installed](https://guides.cocoapods.org/using/getting-started.html) + * Verify that [`pod install` and `pod update` run without errors](https://guides.cocoapods.org/using/pod-install-vs-update.html) in the folder where the Podfile is (usually the root folder of the Xcode project). +* Cocoapods text encoding issues when building from Mac + * Do this if you are building on a Mac and see the following in the cocoapods log + `WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.` + * When building for iOS, Cocoapod installation may fail with an error about the language locale, or UTF-8 encoding. There are currently several different ways to work around the issue. + * From the terminal, run `pod install` directly, and open the resulting `xcworkspace` file. + * Downgrade the version of Cocoapods to 1.10.2. The issue exists only in version 1.11 and newer. + * In your `~/.bash_profile` or equivalent, add `export LANG=en_US.UTF-8` + +### **Prefer opening Xcode Workspace files in Xcode to opening Xcode Project Files** + +Try to [build iOS builds from Xcode Workspaces](https://developer.apple.com/library/archive/featuredarticles/XcodeConcepts/Concept-Workspace.html) generated by Cocoapods rather than Xcode projects: + +* Rationale: + * Unity by default only generates `.xcodeproject` files. If EDM4U is in the project, it first generates Podfiles from all iOS dependencies specified in files named "Dependencies.xml" with a prefix (ex. "AppDependencies.xml") , then runs Cocoapods, which generates an `.xcworkspace` file + * In this case, it is recommended to open the generated project by double-clicking on `.xcworkspace` instead of `.xcodeproject` since the former contains references to pods. +* If you are building in an environment you cannot open Xcode workspaces from (such as unity cloud build) then go into the **iOS resolver settings**, enter the dropdown **Cocoapods Integration** and select **Xcode project** + +### **Win32 Errors when building Xcode Workspace/Project on Mac** + +If the Unity Editor's console displays [build output that mentions win32 errors](https://issuetracker.unity3d.com/issues/webgl-builderror-constant-il2cpp-build-error-after-osx-12-dot-3-upgrade), upgrade to a more recent LTS version of Unity after 2020.3.40f1. + +* While workarounds exist, upgrading is the fastest, most convenient and most reliable way to handle it. + +### **Runtime Swift Issues** + +If you run into an issue when trying to run the game with error logs that mention Swift, try the following: + +* Turn on `Enable Swift Framework Support Workaround` in **Assets > External Dependency Manager > iOS Resolver > Settings**. + * Read the description in the settings menu. + * Make sure those changes are made to the generated Xcode project. + +If you are still experiencing issues at this point, investigate whether troubleshooting the product that utilizes EDM4U works differently or better now. Consider filing an issue here or with the product you are employing that utilizes EDM4U. \ No newline at end of file diff --git a/upm/CHANGELOG.md b/upm/CHANGELOG.md new file mode 100755 index 00000000..e1294a3a --- /dev/null +++ b/upm/CHANGELOG.md @@ -0,0 +1,1430 @@ +# Version 1.2.186 - May 19, 2025 +* iOS Resolver - Set `validateReferences` to off by default, + to prevent errors when running without iOS Support installed. + Fixes #412 and #622 + +# Version 1.2.185 - Feb 3, 2025 +* Android Resolver - Reverse conditional checker for `packaging` keyword in maintemplate based on android gradle plugin version. Fixes #715 + +# Version 1.2.184 - Jan 28, 2025 +* Android Resolver - Update and resolve `packaging` keyword in maintemplate + based on android gradle plugin version. + Fixes #715 + +# Version 1.2.183 - Sep 18, 2024 +* Android Resolver - Handle package paths that don't include a version hash, + which is no longer present with Unity 6. Fixes #697 +* Android Resolver - Handle packages referenced using local file paths. + Fixes #701 + +# Version 1.2.182 - Aug 2, 2024 +* General - Check for gradle version instead of Unity version when determining + the template files to modify. + +# Version 1.2.181 - Jun 26, 2024 +* General - Disable `EditorMeasurement` reporting that relied on the + Measurement Protocol for Universal Analytics. + +# Version 1.2.180 - Jun 4, 2024 +* General - Fix project settings resetting on domain reload. + Fixes #524 + +# Version 1.2.179 - Feb 12, 2024 +* Android Resolver - Added logic to automatically turn on `mainTemplate.gradle` + for new projects, and prompt users to enable it on projects that have previously + had the resolver run. + +# Version 1.2.178 - Dec 20, 2023 +* Added [OpenUPM support](https://openupm.com/packages/com.google.external-dependency-manager/). + +# Version 1.2.177 - Aug 14, 2023 +* iOS Resolver - Added `/opt/homebrew/bin` to Cocoapod executable search path. + Fixes #627 + +# Version 1.2.176 - Apr 27, 2023 +* Android Resolver - Added two Android Resolver settings to determine whether + EDM4U injects custom local Maven repo path as a relative path or full path. + Fixes #537 +* Android Resolver - Inject Maven Repo to `settingTemplate.gradle` from + Unity 2022.2+ + Fixes #594 +* Android Resolver - Jetifier option is enabled by default now. +* Android Resolver - `Explode Aar` option applies to all cases, whether the + project will be exported or not. + Fixes #584 + Fixes #287 + +# Version 1.2.175 - Nov 16, 2022 +* General - Added tvOS podfile support to the iOS resolver. + +# Version 1.2.174 - Oct 06, 2022 +* General - Added tvOS support to the iOS resolver. +* General - Fixed #484 - Changed `EditorMeasurement` to use secure connection. +* Android Resolver - Fixed Android Resolver unable to resolve + `mainTemplate.gradle` in Unity `2022.2+` or `2023.1+`. + +# Version 1.2.173 - Sep 28, 2022 +* General - Added tvOS library support to the export unity package scripts. + +# Version 1.2.172 - Jun 23, 2022 +* iOS Resolver - Stop forcing `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` to `YES`, + which seems to cause problem for some when submitting apps. See #526 for more + information. + +# Version 1.2.171 - May 11, 2022 +* iOS Resolver - Change `Enable Swift Framework Support Workaround` setting to + be `ON` by default since more pods are using Swift Framework now. + +# Version 1.2.170 - Apr 4, 2022 +* Android Resolver - Fixes #498 - Fix the path separator of the Maven repo + injected to `mainTemplate.gradle`. +* iOS Resolver - Fixes #470 - Switch default Cocoapods master repo from Github + to CDN. +* iOS Resolver - `Link Framework Statically` setting is now default to `true`. + That is, `use_frameworks! :linkage => static` will be added to `Podfile` by + default instead of `use_frameworks!`. This can be changed in iOS Resolver + settings. This fixes odd behaviors when pods include static libraries, ex. + Firebase Analytics. +* iOS Resolver - Added a workaround when app crashes on launch due to + `Library not loaded: @rpath/libswiftCore.dylib` when some pods includes Swift + framework. This is turned `OFF` by default and can be changed in iOS Resolver + settings. + +# Version 1.2.169 - Jan 20, 2022 +* General - Fixes #425 - Change to save `GvhProjectSettings.xml` without + Unicode byte order mark (BoM). +* Android Resolver - Remove reference to `jcenter()` +* iOS Resolver - Force setting `LANG` when executing Cocoapods in shell mode on + Mac. + +# Version 1.2.168 - Dec 9, 2021 +* All - Fixes #472 by removing the use of `System.Diagnostics.Debug.Assert` +* All - Fixed #477 by properly enabling EDM4U libraries for Unity 2021.2+ when + the package is installed through `.tgz` + +# Version 1.2.167 - Oct 6, 2021 +* All - Moved versioned `.dll` in EDM4U to a versioned folder and remove their + version postfix in their filename. For instance, `IOSResolver.dll` will be + placed at `ExternalDependencyManager/Editor/1.2.167/Google.IOSResolver.dll`. +* Android Resolver - Fixed #243 by only using the highest version in + `mainTemplate.gradle` when duplicated dependencies are presented. +* Android Resolver - Added supports to x86_64 to ABI list for Android apps on + Chrome OS. + +# Version 1.2.166 - Jun 30, 2021 +* All - Fixed #440 and fixed #447 by specifying the parameter type while calling + `GetApplicationIdentifier()` Unity API using reflection, due to a new + overloaded method introduced in Unity 2021.2. +* Android Resolver - Fixed #442 by patching `Dependency.IsGreater()` when the + version strings end '+'. + +# Version 1.2.165 - Apr 28, 2021 +## Bug Fixes +* Version Handler - Fixed #431 by replacing the use of `HttpUtility.UrlEncode()` + which causes NullReferenceException in certain version of Unity. +* Android Resolver - Check that androidSdkRootPath directory exists before using + as sdkPath. +* Android Resolver - Fixed Android Resolver integration tests with Unity + 2019.3+. + +# Version 1.2.164 - Feb 4, 2021 +## New Features +* Android Resolver - Added support for Android packages with classifier in their + namespaces. +* iOS Resolver - Added new settings in iOS Resolver to configure generated + Podfile. +* iOS Resolver - Added a new attribute `addToAllTargets` in Dependencies.xml. + +## Bug Fixes +* iOS Resolver - Fixed XML parsing for `bitcodeEnabled` attribute in + Dependencies.xml. + +# Version 1.2.163 - Dec 15, 2020 +## Bug Fixes +* Version Handler - Fixed measurement reporting + +# Version 1.2.162 - Nov 19, 2020 +## Bug Fixes +* Version Handler - Improved #413 by preventing Version Handler from running + from static constructor when it is disabled. +* Package Manager Resolver - Remove GPR + +# Version 1.2.161 - Oct 12, 2020 +## Bug Fixes +* Android Resolver - Fixed the issue that Android Resolver does not resolve + again before build in Unity 2020 if it failed to resolve previously. + +# Version 1.2.160 - Sep 30, 2020 +## Bug Fixes +* Android Resolver - Fixed a regression that gradleResolver can be null until + Initialize() is called. +* Android Resolver - Fixed a regression that Android Resolver failed in Unity + 2019.3+ due to `gradleTemplate.properties` not enabled when + `mainTemplate.gradle` is not enabled at all. + +# Version 1.2.159 - Sep 11, 2020 +## Bug Fixes +* Android Resolver - Fixed #322 where the Unity editor will lose its target SDK + setting between Unity restarts if `>28` is selected in 2019. This is due to + Unity AndroidSdkVersions enum does not contain values above 28. +* Android Resolver - Fixed #360 where building Android app with Untiy 2019.3+ + may fail due to Jetifier and AndroidX not enabled properly in generated + Gradle project. This fix requires the user to enable + `Custom Gradle Properties Template` found under + `Player Settings > Settings for Android > Publishing Settings`. + +# Version 1.2.158 - Sep 3, 2020 +## Bug Fixes +* Version Handler: Fixed editor freeze when `-executeMethod` is used in + non-batch mode. +* Android Resolver: Normalized file paths when generating local Maven repo + since the path may contains a mix of forward and backward slash on Windows. +* Export Unity Package: Fixed generation of .unitypackage with tarfile on + Windows. + +# Version 1.2.157 - Aug 6, 2020 +## Bug Fixes +* Android Resolver: Delay initialization until active build target is Android + and the editor is not in play mode. +* iOS Resolver: Delay initialization until active build target is iOS + and the editor is not in play mode. +* Export Unity Package: Workaround directory creation racy if multiple export + operations are spawned at the same time. + +# Version 1.2.156 - June 10, 2020 +## Bug Fixes +* Android Resolver: Fixed that the generated local repo assets contains + redundent labels which are causing Version Handler to failed while + uninstalling packages. +* Android Resolver: Fixed that the repo url injected into mainTemplate.gradle + is incorrect when Unity is configured to export gradle project. +* Android Resolver: Limited to only create local Maven repo when the source + repo contains ".srcaar" file. + +## Changes +* All: Described EDM4U analytics data usage in readme. + +# Version 1.2.155 - May 14, 2020 +## Bug Fixes +* All: Fixed compiler error when build with Unity 5.4 or below due to the + usage of Rect.zero. +* All: Ignore cases when checking command line arguments. + +# Version 1.2.154 - May 14, 2020 +## Bug Fixes +* All: Make each MultiSelectWindow for different purposes to have its own + unique window. + +## Changes +* All: Replace all dialog with DialogWindow which is implemented from + EditorWindow. +* Package Manager Resolver: Clarify how manifest.json will be changed in Package + Manager Resolver window. + +# Version 1.2.153 - Apr 24, 2020 +## Bug Fixes +* Android Resolver: Fixed an exception when repainting the Android resolution + window in Unity 2019.3.x. + +# Version 1.2.152 - Apr 17, 2020 +## Bug Fixes +* Version Handler: Fixed exception when waiting for enabled editor DLLs to + load. +* Android Resolver: Fixed regression when using a Custom Gradle Template + on Windows. + +# Version 1.2.151 - Apr 16, 2020 +## Bug Fixes +* Version Handler: When waiting for newly enabled editor DLLs to load, ignore + all DLLs that do not have a file-system location. +* Android Resolver: Fixed resolution when using a Custom Gradle Template with + libraries stored in a local maven repository distributed with a plugin + installed with the Unity Package Manager. + +# Version 1.2.150 - Apr 9, 2020 +## Bug Fixes +* All: The new packaging script when run on MacOS was generating a + .unitypackage archive that could not be read by Unity on Windows. + This release simply repackages the plugin with tar/gzip to fix the problem. + +# Version 1.2.149 - Apr 8, 2020 +## Bug Fixes +* Package Manager Resolver: Fixed spurious error message when resuming + migration after installing a UPM package. + +# Version 1.2.148 - Apr 8, 2020 +## Bug Fixes +* Package Manager Resolver: Fixed an exception when resuming migration + after installing a UPM package. + +# Version 1.2.147 - Apr 8, 2020 +## Bug Fixes +* Version Handler: Fixed alias traversal bug which caused problems when + migrating from installed .unitypackage files to UPM packages. + +# Version 1.2.146 - Apr 8, 2020 +## Bug Fixes +* Version Handler: Fixed exception in manifest parsing when a manifest is + detected with no aliases. + +# Version 1.2.145 - Apr 2, 2020 +## New Features +* Package Manager Resolver: Added a method to migrate Version Handler + managed packages installed via `.unitypackage` to Unity Package Manager + packages. This is initially used to migrate the External Dependency Manager + to UPM. + +## Changes +* All: Verbose logging is now no longer automatically enabled in batch mode + across all components. Instead logging can be configured using each + component's verbose logging setting or by using the `-gvh_log_debug` command + line flag when starting Unity. +* Version Handler: Sped up version handler updates when the app domain isn't + reloaded. + +## Bug Fixes +* Version Handler: Fixed the display of the obsolete files clean up dialog + when the asset database refreshes. +* Version Handler: Improved reliability of callback from + the VersionHandler.UpdateCompleteMethods event when an asset database + refresh occurs. +* Version Handler: Fixed duplicate exportPath labels when 'Assets/' is the + root of paths assigned to files. +* Version Handler: Handle empty lines in manifest files. + +# Version 1.2.144 - Mar 23, 2020 +## Changed +* iOS Resolver: Removed the ability to configure the Xcode target a Cocoapod + is added to. + +## Bug Fixes +* iOS Resolver: Reverted support for adding Cocoapods to multiple targets as + it caused a regression (exception thrown during post-build step) in some + versions of Unity. + +# Version 1.2.143 - Mar 20, 2020 +## Bug Fixes +* Android Resolver: Fixed caching of resolution state which was causing + the resolver to always run when no dependencies had changed. + +# Version 1.2.142 - Mar 19, 2020 +## Changes +* Package Manager Resolver: Enabled auto-add by default. + +# Version 1.2.141 - Mar 19, 2020 +## Bug Fixes +* Fixed a bug when retrieving project settings. If a plugin was configured + to fetch project settings, if a setting was fetched (e.g "foo") and this + setting existed in the system settings but not the project settings the + system value would override the default value leading to unexpected + behavior. +* Fixed a warning when caching web request classes in Unity 5.6. + +# Version 1.2.140 - Mar 19, 2020 +## Bug Fixes +* Fixed measurement reporting in Unity 5.x. +* Version Handler: Fixed NullReferenceException when an asset doesn't have + an AssetImporter. + +# Version 1.2.139 - Mar 18, 2020 +## Changed +* Added documentation to the built plugin. + +# Version 1.2.138 - Mar 17, 2020 +## New Features +* Package Manager Resolver: Added the Package Manager Resolver + component that allows developers to easily boostrap Unity Package Manager + (UPM) registry addition using unitypackage plugins. +* Version Handler: Added a window that allows plugins to managed by the + Version Handler to be uninstalled. +* Version Handler: Added support for displaying installed plugins. +* Version Handler: Added support for moving files in plugins to their install + locations (if the plugin has been configured to support this). +* iOS Resolver: Added the ability to configure the Xcode target a Cocoapod is + added to. + +## Bug Fixes +* Fixed upgrade from version 1.2.137 and below after the plugin rename to + EDM4U broke the upgrade process. +* Android Resolver: Worked around PlayerSettings.Android.targetSdkVersion + returning empty names for some values in 2019.x. +* Version Handler: Fixed the display of the obsolete files clean up window. +* Version Handler: Fixed managed file check when assets are modified in the + project after plugin import. + +# Version 1.2.137 - Mar 6, 2020 +## Changed +* Renamed package to External Package Manager for Unity (EDM4U). + We changed this to reflect what this plugin is doing today which is far more + than the original scope which just consisted of importing jar files from the + Android SDK maven repository. + Scripts that used to pull `play-services-resolver*.unitypackage` will now have + to request `external-dependency-manager*.unitypackage` instead. + We'll still be shipping a `play-services-resolver*_manifest.txt` file to + handle upgrading from older versions of the plugin. + +## New Features +* All Components: Added reporting of usage so that we can remotely detect + errors and target improvements. +* Android Resolver: Added support for *Dependencies.xml files in Unity Package + Manager packages. +* iOS Resolver: Added support for *Dependencies.xml files in Unity Package + Manager packages. + +## Bug Fixes +* Version Handler: Disabled attempts to disable asset metadata modification + when assets are in a Unity Package Manager managed package. + +# Version 1.2.136 - Feb 19, 2019 +## Bug Fixes +* Android Resolver: Fixed OpenJDK path discovery in Unity 2019.3.1. + +# Version 1.2.135 - Dec 5, 2019 +## Bug Fixes +* All Components: Fixed stack overflow when loading project settings. + +# Version 1.2.134 - Dec 4, 2019 +## Bug Fixes +* All Components: Fixed an issue which caused project settings to be cleared + when running in batch mode. + +# Version 1.2.133 - Nov 18, 2019 +## Bug Fixes +* All Components: Failure to save project settings will now report an error + to the log rather than throwing an exception. + +# Version 1.2.132 - Nov 11, 2019 +## Bug Fixes +* Android Resolver: Worked around expansion of DIR_UNITYPROJECT on Windows + breaking Gradle builds when used as part of a file URI. +* Android Resolver: mainTemplate.gradle is only written if it needs to be + modified. + +# Version 1.2.131 - Oct 29, 2019 +## Bug Fixes +* Version Handler: Improved execution of events on the main thread in batch + mode. +* Version Handler: Improved log level configuration at startup. +* Version Handler: Improved performance of class lookup in deferred method + calls. +* Version Handler: Fixed rename to enable / disable for editor assets. +* iOS Resolver: Improved log level configuration at startup. +* Android Resolver: Improved local maven repo path reference in + mainTemplate.gradle using DIR_UNITYPROJECT. DIR_UNITYPROJECT by Unity + to point to the local filesystem path of the Unity project when Unity + generates the Gradle project. + +# Version 1.2.130 - Oct 23, 2019 +## New Features +* iOS Resolver: Added support for modifying the Podfile before `pod install` + is executed. + +## Bug Fixes +* Version Handler: Fixed invalid classname error when calling + `VersionHandler.UpdateVersionedAssets()`. + +# Version 1.2.129 - Oct 2, 2019 +## Bug Fixes +* iOS Resolver: Changed Cocoapod integration in Unity 2019.3+ to + only add Pods to the UnityFramework target. + +# Version 1.2.128 - Oct 1, 2019 +## Bug Fixes +* iOS Resolver: Fixed Cocoapod project integration mode with Unity + 2019.3+. + +# Version 1.2.127 - Sep 30, 2019 +## Changes +* Android Resolver: All Android Resolver settings File paths are now + serialized with POSIX directory separators. + +# Version 1.2.126 - Sep 27, 2019 +## Changes +* Android Resolver: File paths are now serialized with POSIX directory + separators. +## Bug Fixes +* Android Resolver: Fixed resolution when the parent directory of a Unity + project contains a Gradle project (i.e `settings.gradle` file). + +# Version 1.2.125 - Sep 23, 2019 +## Bug Fixes +* All components: Silenced a warning about not being able to set the console + encoding to UTF8. +* Android Resolver: Worked around broken AndroidSDKTools class in some + versions of Unity. +* iOS Resolver: Fixed iOS target SDK version check +* Version Handler: Changed clean up obsolete files window so that it doesn't + exceed the screen size. + +# Version 1.2.124 - Jul 28, 2019 +## Bug Fixes +* All components: Fixed regression with source control integration when using + Unity 2019.1+. + +# Version 1.2.123 - Jul 23, 2019 +## New Features +* All components: Source control integration for project settings. +## Changes +* Android Resolver: Removed AAR cache as it now makes little difference to + incremental resolution performance. +* Android Resolver: Improved embedded resource management so that embedded + resources should upgrade when the plugin is updated without restarting + the Unity editor. +## Bug Fixes +* Version Handler: Fixed InvokeMethod() and InvokeStaticMethod() when calling + methods that have interface typed arguments. + +# Version 1.2.122 - Jul 2, 2019 +## Bug Fixes +* iOS Resolver: Worked around Unity not loading the iOS Resolver DLL as it + referenced the Xcode extension in a public interface. The iOS Resolver + DLL still references the Xcode extension internally and just handles + missing type exceptions dynamically. + +# Version 1.2.121 - Jun 27, 2019 +## Bug Fixes +* Android Resolver: Fixed warning about missing Packages folder when loading + XML dependencies files in versions of Unity without the package manager. +* Android Resolver: Fixed resolution window progress bar exceeding 100%. +* Android Resolver: If AndroidX is detected in the set of resolved libraries, + the user will be prompted to enable the Jetifier. +* Android Resolver: Improved text splitting in text area windows. +* iOS Resolver: Added support for Unity's breaking changes to the Xcode API + in 2019.3.+. Cocoapods are now added to build targets, Unity-iPhone and + UnityFramework in Unity 2019.3+. + +# Version 1.2.120 - Jun 26, 2019 +## New Features +* Android Resolver: Added support for loading *Dependencies.xml files from + Unity Package Manager packages. +* Android Resolver: Resolution window is now closed if resolution runs as + a pre-build step. +* iOS Resolver: Added support for loading *Dependencies.xml files from + Unity Package Manager packages. +## Bug Fixes +* Android Resolver: Fixed generation of relative repo paths when using + mainTemplate.gradle resolver. +* Android Resolver: Fixed copy of .srcaar to .aar files in repos embedded in a + project when a project path has characters (e.g whitespace) that are escaped + during conversion to URIs. +* Android Resolver: Fixed auto-resolution always running if the Android SDK + is managed by Unity Hub. + +# Version 1.2.119 - Jun 19, 2019 +## Bug Fixes +* Android Resolver: Fixed error reported when using Jetifier integration + in Unity 2018+ if the target SDK is set to "highest installed". + +# Version 1.2.118 - Jun 18, 2019 +## New Features +* Android Resolver: Added initial + [Jetifier](https://developer.android.com/studio/command-line/jetifier) + integration which simplifies + [migration](ttps://developer.android.com/jetpack/androidx/migrate) + to Jetpack ([AndroidX](https://developer.android.com/jetpack/androidx)) + libraries in cases where all dependencies are managed by the Android + Resolver. + This can be enabled via the `Use Jetifier` option in the + `Assets > Play Services Resolver > Android Resolver > Settings` menu. + Caveats: + - If your project contains legacy Android Support Library .jar and .aar + files, these files will need to be removed and replaced with references to + artifacts on Maven via `*Dependencies.xml` files so that the Jetifier + can map them to Jetpack (AndroidX) libraries. + For example, remove the file `support-v4-27.0.2.jar` and replace it with + `` in a + `*Dependencies.xml` file. + - If your project contains .jar or .aar files that use the legacy Android + Support Libraries, these will need to be moved into a local Maven repo + [See this guide](https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html) + and then these files should be removed from your Unity project and instead + referenced via `*Dependencies.xml` files so that the Jetifier can + patch them to reference the Jetpack lirbaries. + +## Bug Fixes +* Android Resolver: Disabled version locking of com.android.support:multidex + does not use the same versioning scheme as other legacy Android support + libraries. +* Version Handler: Made Google.VersionHandler.dll's asset GUID stable across + releases. This faciliates error-free import into projects where + Google.VersionHandler.dll is moved from the default install location. + +# Version 1.2.117 - Jun 12, 2019 +## Bug Fixes +* Android Resolver: Fix copying of .srcaar to .aar files for + mainTemplate.gradle resolution. PluginImporter configuration was previously + not being applied to .aar files unless the Unity project was saved. + +# Version 1.2.116 - Jun 7, 2019 +## Bug Fixes +* Android Resolver: Fixed resolution of Android dependencies without version + specifiers. +* Android Resolver: Fixed Maven repo not found warning in Android Resolver. +* Android Resolver: Fixed Android Player directory not found exception in + Unity 2019.x when the Android Player isn't installed. + +# Version 1.2.115 - May 28, 2019 +## Bug Fixes +* Android Resolver: Fixed exception due to Unity 2019.3.0a4 removing + x86 from the set of supported ABIs. + +# Version 1.2.114 - May 27, 2019 +## New Features +* Android Resolver: Added support for ABI stripping when using + mainTemplate.gradle. This only works with AARs stored in repos + on the local filesystem. + +# Version 1.2.113 - May 24, 2019 +## New Features +* Android Resolver: If local repos are moved, the plugin will search the + project for matching directories in an attempt to correct the error. +* Version Handler: Files can be now targeted to multiple build targets + using multiple "gvh_" asset labels. +## Bug Fixes +* Android Resolver: "implementation" or "compile" are now added correctly + to mainTemplate.gradle in Unity versions prior to 2019. + +# Version 1.2.112 - May 22, 2019 +## New Features +* Android Resolver: Added option to disable addition of dependencies to + mainTemplate.gradle. + See `Assets > Play Services Resolver > Android Resolver > Settings`. +* Android Resolver: Made paths to local maven repositories in + mainTemplate.gradle relative to the Unity project when a project is not + being exported. +## Bug Fixes +* Android Resolver: Fixed builds with mainTemplate.gradle integration in + Unity 2019. +* Android Resolver: Changed dependency inclusion in mainTemplate.gradle to + use "implementation" or "compile" depending upon the version of Gradle + included with Unity. +* Android Resolver: Gracefully handled exceptions if the console encoding + can't be modified. +* Android Resolver: Now gracefully fails if the AndroidPlayer directory + can't be found. + +# Version 1.2.111 - May 9, 2019 +## Bug Fixes +* Version Handler: Fixed invocation of methods with named arguments. +* Version Handler: Fixed occasional hang when the editor is compiling + while activating plugins. + +# Version 1.2.110 - May 7, 2019 +## Bug Fixes +* Android Resolver: Fixed inclusion of some srcaar artifacts in builds with + Gradle builds when using mainTemplate.gradle. + +# Version 1.2.109 - May 6, 2019 +## New Features: +* Added links to documentation from menu. +* Android Resolver: Added option to auto-resolve Android libraries on build. +* Android Resolver: Added support for packaging specs of Android libraries. +* Android Resolver: Pop up a window when displaying Android dependencies. + +## Bug Fixes +* Android Resolver: Support for Unity 2019 Android SDK and JDK install locations +* Android Resolver: e-enable AAR explosion if internal builds are enabled. +* Android Resolver: Gracefully handle exceptions on file deletion. +* Android Resolver: Fixed Android Resolver log spam on load. +* Android Resolver: Fixed save of Android Resolver PromptBeforeAutoResolution + setting. +* Android Resolver: Fixed AAR processing failure when an AAR without + classes.jar is found. +* Android Resolver: Removed use of EditorUtility.DisplayProgressBar which + was occasionally left displayed when resolution had completed. +* Version Handler: Fixed asset rename to disable when a disabled file exists. + +# Version 1.2.108 - May 3, 2019 +## Bug Fixes: +* Version Handler: Fixed occasional hang on startup. + +# Version 1.2.107 - May 3, 2019 +## New Features: +* Version Handler: Added support for enabling / disabling assets that do not + support the PluginImporter, based upon build target selection. +* Android Resolver: Added support for the global specification of maven repos. +* iOS Resolver: Added support for the global specification of Cocoapod sources. + +# Version 1.2.106 - May 1, 2019 +## New Features +* iOS Resolver: Added support for development pods in Xcode project integration + mode. +* iOS Resolver: Added support for source pods with resources in Xcode project + integration mode. + +# Version 1.2.105 - Apr 30, 2019 +## Bug fixes +* Android Resolver: Fixed reference to Java tool path in logs. +* Android and iOS Resolvers: Changed command line execution to emit a warning + rather than throwing an exception and failing, when it is not possible to + change the console input and output encoding to UTF-8. +* Android Resolver: Added menu option and API to delete resolved libraries. +* Android Resolver: Added menu option and API to log the repos and libraries + currently included in the project. +* Android Resolver: If Plugins/Android/mainTemplate.gradle file is present and + Gradle is selected as the build type, resolution will simply patch the file + with Android dependencies specified by plugins in the project. + +# Version 1.2.104 - Apr 10, 2019 +## Bug Fixes +* Android Resolver: Changed Android ABI selection method from using whitelisted + Unity versions to type availability. This fixes an exception on resolution + in some versions of Unity 2017.4. + +# Version 1.2.103 - Apr 2, 2019 +## Bug Fixes +* Android Resolver: Whitelisted Unity 2017.4 and above with ARM64 support. +* Android Resolver: Fixed Java version check to work with Java SE 12 and above. + +# Version 1.2.102 - Feb 13, 2019 +## Bug Fixes +* Android Resolver: Fixed the text overflow on the Android Resolver + prompt before initial run to fit inside the buttons for + smaller screens. + +# Version 1.2.101 - Feb 12, 2019 +## New Features +* Android Resolver: Prompt the user before the resolver runs for the + first time and allow the user to elect to disable from the prompt. +* Android Resolver: Change popup warning when resolver is disabled + to be a console warning. + +# Version 1.2.100 - Jan 25, 2019 +## Bug Fixes +* Android Resolver: Fixed AAR processing sometimes failing on Windows + due to file permissions. + +# Version 1.2.99 - Jan 23, 2019 +## Bug Fixes +* Android Resolver: Improved performance of project property polling. +* Version Handler: Fixed callback of VersionHandler.UpdateCompleteMethods + when the update process is complete. + +# Version 1.2.98 - Jan 9, 2019 +## New Features +* iOS Resolver: Pod declaration properties can now be set via XML pod + references. For example, this can enable pods for a subset of build + configurations. +## Bug Fixes +* iOS Resolver: Fixed incremental builds after local pods support caused + regression in 1.2.96. + +# Version 1.2.97 - Dec 17, 2018 +## Bug Fixes +* Android Resolver: Reduced memory allocation for logic that monitors build + settings when auto-resolution is enabled. If auto-resolution is disabled, + almost all build settings are no longer polled for changes. + +# Version 1.2.96 - Dec 17, 2018 +## Bug Fixes +* Android Resolver: Fixed repacking of AARs to exclude .meta files. +* Android Resolver: Only perform auto-resolution on the first scene while + building. +* Android Resolver: Fixed parsing of version ranges that include whitespace. +* iOS Resolver: Added support for local development pods. +* Version Handler: Fixed Version Handler failing to rename some files. + +# Version 1.2.95 - Oct 23, 2018 +## Bug Fixes: +* Android Resolver: Fixed auto-resolution running in a loop in some scenarios. + +# Version 1.2.94 - Oct 22, 2018 +## Bug Fixes +* iOS Resolver: Added support for PODS_TARGET_SRCROOT in source Cocoapods. + +# Version 1.2.93 - Oct 22, 2018 +## Bug Fixes +* Android Resolver: Fixed removal of Android libraries on auto-resolution when + `*Dependencies.xml` files are deleted. + +# Version 1.2.92 - Oct 2, 2018 +## Bug Fixes +* Android Resolver: Worked around auto-resolution hang on Windows if + resolution starts before compilation is finished. + +# Version 1.2.91 - Sep 27, 2018 +## Bug Fixes +* Android Resolver: Fixed Android Resolution when the selected build target + isn't Android. +* Added C# assembly symbols the plugin to simplify debugging bug reports. + +# Version 1.2.90 - Sep 21, 2018 +## Bug Fixes +* Android Resolver: Fixed transitive dependency selection of version locked + packages. + +# Version 1.2.89 - Aug 31, 2018 +## Bug Fixes +* Fixed FileLoadException in ResolveUnityEditoriOSXcodeExtension an assembly + can't be loaded. + +# Version 1.2.88 - Aug 29, 2018 +## Changed +* Improved reporting of resolution attempts and conflicts found in the Android + Resolver. +## Bug Fixes +* iOS Resolver now correctly handles sample code in CocoaPods. Previously it + would add all sample code to the project when using project level + integration. +* Android Resolver now correctly handles Gradle conflict resolution when the + resolution results in a package that is compatible with all requested + dependencies. + +# Version 1.2.87 - Aug 23, 2018 +## Bug Fixes +* Fixed Android Resolver "Processing AARs" dialog getting stuck in Unity 5.6. + +# Version 1.2.86 - Aug 22, 2018 +## Bug Fixes +* Fixed Android Resolver exception in OnPostProcessScene() when the Android + platform isn't selected. + +# Version 1.2.85 - Aug 17, 2018 +## Changes +* Added support for synchronous resolution in the Android Resolver. + PlayServicesResolver.ResolveSync() now performs resolution synchronously. +* Auto-resolution in the Android Resolver now results in synchronous resolution + of Android dependencies before the Android application build starts via + UnityEditor.Callbacks.PostProcessSceneAttribute. + +# Version 1.2.84 - Aug 16, 2018 +## Bug Fixes +* Fixed Android Resolver crash when the AndroidResolverDependencies.xml + file can't be written. +* Reduced log spam when a conflicting Android library is pinned to a + specific version. + +# Version 1.2.83 - Aug 15, 2018 +## Bug Fixes +* Fixed Android Resolver failures due to an in-accessible AAR / JAR explode + cache file. If the cache can't be read / written the resolver now continues + with reduced performance following recompilation / DLL reloads. +* Fixed incorrect version number in plugin manifest on install. + This was a minor issue since the version handler rewrote the metadata + after installation. + +# Version 1.2.82 - Aug 14, 2018 +## Changed +* Added support for alphanumeric versions in the Android Resolver. + +## Bug Fixes +* Fixed Android Resolver selection of latest duplicated library. +* Fixed Android Resolver conflict resolution when version locked and non-version + locked dependencies are specified. +* Fixed Android Resolver conflict resolution when non-existent artifacts are + referenced. + +# Version 1.2.81 - Aug 9, 2018 +## Bug Fixes +* Fixed editor error that would occur when when + `PlayerSettings.Android.targetArchitectures` was set to + `AndroidArchitecture.All`. + +# Version 1.2.80 - Jul 24, 2018 +## Bug Fixes +* Fixed project level settings incorrectly falling back to system wide settings + when default property values were set. + +# Version 1.2.79 - Jul 23, 2018 +## Bug Fixes +* Fixed AndroidManifest.xml patching on Android Resolver load in Unity 2018.x. + +# Version 1.2.78 - Jul 19, 2018 +## Changed +* Added support for overriding conflicting dependencies. + +# Version 1.2.77 - Jul 19, 2018 +## Changed +* Android Resolver now supports Unity's 2018 ABI filter (i.e arm64-v8a). +* Reduced Android Resolver build option polling frequency. +* Disabled Android Resolver auto-resolution in batch mode. Users now need + to explicitly kick off resolution through the API. +* All Android Resolver and Version Handler dialogs are now disabled in batch + mode. +* Verbose logging for all plugins is now enabled by default in batch mode. +* Version Handler bootstrapper has been improved to no longer call + UpdateComplete multiple times. However, since Unity can still reload the + app domain after plugins have been enabled, users still need to store their + plugin state to persistent storage to handle reloads. + +## Bug Fixes +* Android Resolver no longer incorrectly adds MANIFEST.MF files to AARs. +* Android Resolver auto-resolution jobs are now unscheduled when an explicit + resolve job is started. + +# Version 1.2.76 - Jul 16, 2018 +## Bug Fixes +* Fixed variable replacement in AndroidManifest.xml files in the Android + Resolver. + Version 1.2.75 introduced a regression which caused all variable replacement + to replace the *entire* property value rather than the component of the + property that referenced a variable. For example, + given "applicationId = com.my.app", "${applicationId}.foo" would be + incorrectly expanded as "com.my.app" rather than "com.my.app.foo". This + resulted in numerous issues for Android builds where content provider + initialization would fail and services may not start. + +## Changed +* Gradle prebuild experimental feature has been removed from the Android + Resolver. The feature has been broken for some time and added around 8MB + to the plugin size. +* Added better support for execution of plugin components in batch mode. + In batch mode UnityEditor.update is sometimes never called - like when a + single method is executed - so the new job scheduler will execute all jobs + synchronously from the main thread. + +# Version 1.2.75 - Jun 20, 2018 +## New Features +* Android Resolver now monitors the Android SDK path when + auto-resolution is enabled and triggers resolution when the path is + modified. + +## Changed +* Android auto-resolution is now delayed by 3 seconds when the following build + settings are changed: + - Target ABI. + - Gradle build vs. internal build. + - Project export. +* Added a progress bar display when AARs are being processed during Android + resolution. + +## Bug Fixes +* Fixed incorrect Android package version selection when a mix of + version-locked and non-version-locked packages are specified. +* Fixed non-deterministic Android package version selection to select + the highest version of a specified package rather than the last + package specification passed to the Gradle resolution script. + +# Version 1.2.74 - Jun 19, 2018 +## New Features +* Added workaround for broken AndroidManifest.xml variable replacement in + Unity 2018.x. By default ${applicationId} variables will be replaced by + the bundle ID in the Plugins/Android/AndroidManifest.xml file. The + behavior can be disabled via the Android Resolver settings menu. + +# Version 1.2.73 - May 30, 2018 +## Bug Fixes +* Fixed spurious warning message about missing Android plugins directory on + Windows. + +# Version 1.2.72 - May 23, 2018 +## Bug Fixes +* Fixed spurious warning message about missing Android plugins directory. + +# Version 1.2.71 - May 10, 2018 +## Bug Fixes +* Fixed resolution of Android dependencies when the `Assets/Plugins/Android` + directory is named in a different case e.g `Assets/plugins/Android`. + +# Version 1.2.70 - May 7, 2018 +## Bug Fixes +* Fixed bitcode flag being ignored for iOS pods. + +# Version 1.2.69 - May 7, 2018 +## Bug Fixes +* Fixed escaping of local repository paths in Android Resolver. + +# Version 1.2.68 - May 3, 2018 +## Changes +* Added support for granular builds of Google Play Services. + +# Version 1.2.67 - May 1, 2018 +## Changes +* Improved support for iOS source-only pods in Unity 5.5 and below. + +# Version 1.2.66 - April 27, 2018 +## Bug Fixes +* Fixed Version Handler renaming of Linux libraries with hyphens in filenames. + Previously, libraries named Foo-1.2.3.so were not being renamed to + libFoo-1.2.3.so on Linux which could break native library loading on some + versions of Unity. + +# Version 1.2.65 - April 26, 2018 +## Bug Fixes +* Fix CocoaPods casing in logs and comments. + +# Version 1.2.64 - Mar 16, 2018 +## Bug Fixes +* Fixed bug in download_artifacts.gradle (used by Android Resolver) which + reported a failure if required artifacts already exist. + +# Version 1.2.63 - Mar 15, 2018 +## Bug Fixes +* Fixed iOS Resolver include search paths taking precedence over system headers + when using project level resolution. +* Fixed iOS Resolver includes relative to library root, when using project level + resolution. + +# Version 1.2.62 - Mar 12, 2018 +## Changes +* Improved error reporting when a file can't be moved to trash by the + Version Handler. +## Bug Fixes +* Fixed Android Resolver throwing NullReferenceException when the Android SDK + path isn't set. +* Fixed Version Handler renaming files with underscores if the + "Rename to Canonical Filenames" setting is enabled. + +# Version 1.2.61 - Jan 22, 2018 +## Bug Fixes +* Fixed Android Resolver reporting non-existent conflicting dependencies when + Gradle build system is enabled. + +# Version 1.2.60 - Jan 12, 2018 +## Changes +* Added support for Maven / Ivy version specifications for Android packages. +* Added support for Android SNAPSHOT packages. + +## Bug Fixes +* Fixed Openjdk version check. +* Fixed non-deterministic Android package resolution when two packages contain + an artifact with the same name. + +# Version 1.2.59 - Oct 19, 2017 +## Bug Fixes +* Fixed execution of Android Gradle resolution script when it's located + in a path with whitespace. + +# Version 1.2.58 - Oct 19, 2017 +## Changes +* Removed legacy resolution method from Android Resolver. + It is now only possible to use the Gradle or Gradle prebuild resolution + methods. + +# Version 1.2.57 - Oct 18, 2017 +## Bug Fixes +* Updated Gradle wrapper to 4.2.1 to fix issues using Gradle with the + latest Openjdk. +* Android Gradle resolution now also uses gradle.properties to pass + parameters to Gradle in an attempt to workaround problems with + command line argument parsing on Windows 10. + +# Version 1.2.56 - Oct 12, 2017 +## Bug Fixes +* Fixed Gradle artifact download with non-version locked artifacts. +* Changed iOS resolver to only load dependencies at build time. + +# Version 1.2.55 - Oct 4, 2017 +## Bug Fixes +* Force Android Resolution when the "Install Android Packages" setting changes. + +# Version 1.2.54 - Oct 4, 2017 +## Bug Fixes +* Fixed execution of command line tools on Windows when the path to the tool + contains a single quote (apostrophe). In this case we fallback to executing + the tool via the system shell. + +# Version 1.2.53 - Oct 2, 2017 +## New Features +* Changed Android Resolver "resolution complete" dialog so that it now displays + failures. +* Android Resolver now detects conflicting libraries that it does not manage + warning the user if they're newer than the managed libraries and prompting + the user to clean them up if they're older or at the same version. + +## Bug Fixes +* Improved Android Resolver auto-resolution speed. +* Fixed bug in the Gradle Android Resolver which would result in resolution + succeeding when some dependencies are not found. + +# Version 1.2.52 - Sep 25, 2017 +## New Features +* Changed Android Resolver's Gradle resolution to resolve conflicting + dependencies across Google Play services and Android Support library packages. + +# Version 1.2.51 - Sep 20, 2017 +## Changes +* Changed iOS Resolver to execute the CocoaPods "pod" command via the shell + by default. Some developers customize their shell environment to use + custom ssh certs to access internal git repositories that host pods so + executing "pod" via the shell will work for these scenarios. + The drawback of executing "pod" via the shell could potentially cause + users problems if they break their shell environment. Though users who + customize their shell environments will be able to resolve these issues. + +# Version 1.2.50 - Sep 18, 2017 +## New Features +* Added option to disable the Gradle daemon in the Android Resolver. + This daemon is now disabled by default as some users are getting into a state + where multiple daemon instances are being spawned when changing dependencies + which eventually results in Android resolution failing until all daemon + processes are manually killed. + +## Bug Fixes +* Android resolution is now always executed if the user declines the update + of their Android SDK. This ensure users can continue to use out of date + Android SDK packages if they desire. + +# Version 1.2.49 - Sep 18, 2017 +## Bug Fixes +* Removed modulemap parsing in iOS Resolver. + The framework *.modulemap did not need to be parsed by the iOS Resolver + when injecting Cocoapods into a Xcode project. Simply adding a modular + framework to a Xcode project results in Xcode's Clang parsing the associated + modulemap and injecting any compile and link flags into the build process. + +# Version 1.2.48 - Sep 12, 2017 +## New Features +* Changed settings to be per-project by default. + +## Bug Fixes +* Added Google maven repository to fix GradlePrebuild resolution with Google + components. +* Fixed Android Resolution failure with spaces in paths. + +# Version 1.2.47 - Aug 29, 2017 +## New Features +* Android and iOS dependencies can now be specified using *Dependencies.xml + files. This is now the preferred method for registering dependencies, + we may remove the API for dependency addition in future. +* Added "Reset to Defaults" button to each settings dialog to restore default + settings. +* Android Resolver now validates the configured JDK is new enough to build + recently released Android libraries. +## Bug Fixes +* Fixed a bug that caused dependencies with the "LATEST" version specification + to be ignored when using the Gradle mode of the Android Resolver. +* Fixed a race condition when running Android Resolution. +* Fixed Android Resolver logging if a PlayServicesSupport instance is created + with no logging enabled before the Android Resolver is initialized. +* Fixed iOS resolver dialog in Unity 4. +* Fixed iOS Cocoapod Xcode project integration in Unity 4. + +# Version 1.2.46 - Aug 22, 2017 +## Bug Fixes +* GradlePrebuild Android resolver on Windows now correctly locates dependent + data files. + +# Version 1.2.45 - Aug 22, 2017 +## Bug Fixes +* Improved Android package auto-resolution and fixed clean up of stale + dependencies when using Gradle dependency resolution. + +# Version 1.2.44 - Aug 21, 2017 +## Bug Fixes +* Enabled autoresolution for Gradle Prebuild. +* Made the command line dialog windows have selectable text. +* Fixed incorrect "Android Settings" dialog disabled groups. +* Updated PlayServicesResolver android platform detection to use the package + manager instead of the 'android' tool. +* UnityCompat reflection methods 'GetAndroidPlatform' and + 'GetAndroidBuildToolsVersion' are now Obsolete due to dependence on the + obsolete 'android' build tool. + +# Version 1.2.43 - Aug 18, 2017 +## Bug Fixes +* Fixed Gradle resolution in the Android Resolver when running + PlayServicesResolver.Resolve() in parallel or spawning multiple + resolutions before the previous resolve completed. + +# Version 1.2.42 - Aug 17, 2017 +## Bug Fixes +* Fixed Xcode project level settings not being applied by IOS Resolver when + Xcode project pod integration is enabled. + +# Version 1.2.41 - Aug 15, 2017 +## Bug Fixes +* IOS Resolver's Xcode workspace pod integration is now disabled when Unity + Cloud Build is detected. Unity Cloud Build does not follow the same build + process as the Unity editor and fails to open the generated xcworkspace at + this time. + +# Version 1.2.40 - Aug 15, 2017 +## Bug Fixes +* Moved Android Resolver Gradle Prebuild scripts into Google.JarResolver.dll. + They are now extracted from the DLL when required. +* AARs / JARs are now cleaned up when switching the Android resolution + strategy. + +# Version 1.2.39 - Aug 10, 2017 +## New Features +* Android Resolver now supports resolution with Gradle. This enables support + for non-local artifacts. +## Bug Fixes +* Android Resolver's Gradle Prebuild now uses Android build tools to determine + the Android platform tools version rather than relying upon internal Unity + APIs. +* Android Resolver's Gradle Prebuild now correctly strips binaries that are + not required for the target ABI. + +# Version 1.2.38 - Aug 7, 2017 +## Bug Fixes +* Fixed an issue in VersionHandler where disabled targets are ignored if + the "Any Platform" flag is set on a plugin DLL. + +# Version 1.2.37 - Aug 3, 2017 +## New Features +* Exposed GooglePlayServices.PlayServicesResolver.Resolve() so that it's + possible for a script to be notified when AAR / Jar resolution is complete. + This makes it easier to setup a project to build from the command line. + +# Version 1.2.36 - Aug 3, 2017 +## New Features +* VersionHandler.UpdateCompleteMethods allows a user to provide a list of + methods to be called when VersionHandlerImpl has completed an update. + This makes it easier to import a plugin and wait for VersionHandler to + execute prior executing a build. + +# Version 1.2.35 - Jul 28, 2017 +## New Features +* VersionHandler will now rename Linux libraries so they can target Unity + versions that require different file naming. Libraries need to be labelled + gvh_linuxlibname-${basename} in order to be considered for renaming. + e.g gvh\_linuxlibname-MyLib will be named MyLib.so in Unity 5.5 and below and + libMyLib.so in Unity 5.6 and above. + +# Version 1.2.34 - Jul 28, 2017 +## Bug Fixes +* Made VersionHandler bootstrap module more robust when calling static + methods before the implementation DLL is loaded. + +# Version 1.2.33 - Jul 27, 2017 +## New Features +* Added a bootstrap module for VersionHandler so the implementation + of the VersionHandler module can be versioned without resulting in + a compile error when imported at different versions across multiple + plugins. + +# Version 1.2.32 - Jul 20, 2017 +## New Features +* Added support for build target selection based upon .NET framework + version in the VersionHandler. + When applying either gvh\_dotnet-3.5 or gvh\_dotnet-4.5 labels to + assets, the VersionHandler will only enable the asset for the + specified set of build targets when the matching .NET framework version + is selected in Unity 2017's project settings. This allows assets + to be provided in a plugin that need to differ based upon .NET version. + +# Version 1.2.31 - Jul 5, 2017 +## Bug Fixes +* Force expansion of AARs with native components when using Unity 2017 + with the internal build system. In contrast to Unity 5.x, Unity 2017's + internal build system does not include native libraries included in AARs. + Forcing expansion of AARs with native components generates an + Ant / Eclipse project for each AAR which is correctly included by Unity + 2017's internal build system. + +# Version 1.2.30 - Jul 5, 2017 +## Bug Fixes +* Fixed Cocoapods being installed when the build target isn't iOS. +* Added support for malformed AARs with missing classes.jar. + +# Version 1.2.29 - Jun 16, 2017 +## New Features +* Added support for the Android sdkmanager tool. + +# Version 1.2.28 - Jun 8, 2017 +## Bug Fixes +* Fixed non-shell command line execution (regression from + Cocoapod installation patch). + +# Version 1.2.27 - Jun 7, 2017 +## Bug Fixes +* Added support for stdout / stderr redirection when executing + commands in shell mode. + This fixes CocoaPod tool installation when shell mode is + enabled. +* Fixed incremental builds when additional sources are specified + in the Podfile. + +# Version 1.2.26 - Jun 7, 2017 +## Bug Fixes +* Fixed a crash when importing Version Handler into Unity 4.7.x. + +# Version 1.2.25 - Jun 7, 2017 +## Bug Fixes +* Fixed an issue in the Jar Resolver which incorrectly notified + event handlers of bundle ID changes when the currently selected + (not active) build target changed in Unity 5.6 and above. + +# Version 1.2.24 - Jun 6, 2017 +## New Features +* Added option to control file renaming in Version Handler settings. + Disabling file renaming (default option) significantly increases + the speed of file version management operations with the downside + that any files that are referenced directly by canonical filename + rather than asset ID will no longer be valid. +* Improved logging in the Version Handler. +## Bug Fixes +* Fixed an issue in the Version Handler which caused it to not + re-enable plugins when re-importing a custom package with disabled + version managed files. + +# Version 1.2.23 - May 26, 2017 +## Bug Fixes +* Fixed a bug with gradle prebuild resolver on windows. + +# Version 1.2.22 - May 19, 2017 +## Bug Fixes +* Fixed a bug in the iOS resolver with incremental builds. +* Fixed misdetection of Cocoapods support with Unity beta 5.6. + +# Version 1.2.21 - May 8, 2017 +## Bug Fixes +* Fix for https://github.com/googlesamples/unity-jar-resolver/issues/48 + Android dependency version number parsing when "-alpha" (etc.) are + included in dependency (AAR / JAR) versions. + +# Version 1.2.20 - May 8, 2017 +## Bug Fixes +* Attempted to fix + https://github.com/googlesamples/unity-jar-resolver/issues/48 + where a NullReferenceException could occur if a target file does not + have a valid version string. + +# Version 1.2.19 - May 4, 2017 +## Bug Fixes +* Fixed Jar Resolver exploding and deleting AAR files it isn't managing. + +# Version 1.2.18 - May 4, 2017 +## New Features +* Added support for preserving Unity pods such as when GVR is enabled. + +# Version 1.2.17 - Apr 20, 2017 +## Bug Fixes +* Fixed auto-resolution when an Android application ID is modified. + +# Version 1.2.16 - Apr 17, 2017 +## Bug Fixes +* Fixed Unity version number parsing on machines with a locale that uses + "," for decimal points. +* Fixed null reference exception if JDK path isn't set. + +# Version 1.2.15 - Mar 17, 2017 +## New Features +* Added warning when the Jar Resolver's background resolution is disabled. +## Bug Fixes +* Fixed support of AARs with native libraries when using Gradle. +* Fixed extra repository paths when resolving dependencies. + +# Version 1.2.14 - Mar 7, 2017 +## New Features +* Added experimental Android resolution using Gradle. + This alternative resolver supports proguard stripping with Unity's + internal build system. +* Added Android support for single ABI builds when using AARs include + native libraries. +* Disabled Android resolution on changes to all .cs and .js files. + File patterns that are monitored for auto-resolution can be added + using PlayServicesResolver.AddAutoResolutionFilePatterns(). +* Added tracking of resolved AARs and JARs so they can be cleaned up + if they're no longer referenced by a project. +* Added persistence of AAR / JAR version replacement for each Unity + session. +* Added settings dialog to the iOS resolver. +* Integrated Cocoapod tool installation in the iOS resolver. +* Added option to run pod tool via the shell. +## Bug Fixes +* Fixed build of some source Cocoapods (e.g Protobuf). +* VersionHandler no longer prompts to delete obsolete manifests. +* iOS resolver handles Cocoapod installation when using Ruby < 2.2.2. +* Added workaround for package version selection when including + Google Play Services on Android. +* Fixed support for pods that reference static libraries. +* Fixed support for resource-only pods. + +# Version 1.2.12 - Feb 14, 2017 +## Bug Fixes +* Fixed re-explosion of AARs when the bundle ID is modified. + +# Version 1.2.11 - Jan 30, 2017 +## New Features +* Added support for Android Studio builds. +* Added support for native (C/C++) shared libraries in AARs. + +# Version 1.2.10 - Jan 11, 2017 +## Bug Fixes +* Fixed SDK manager path retrieval. +* Also, report stderr when it's not possible to run the "pod" tool. +* Handle exceptions thrown by Unity.Cecil on asset rename +* Fixed IOSResolver to handle PlayerSettings.iOS.targetOSVersionString + +# Version 1.2.9 - Dec 7, 2016 +## Bug Fixes +* Improved error reporting when "pod repo update" fails. +* Added detection of xml format xcode projects generated by old Cocoapods + installations. + +# Version 1.2.8 - Dec 6, 2016 +## Bug Fixes +* Increased speed of JarResolver resolution. +* Fixed JarResolver caches getting out of sync with requested dependencies + by removing the caches. +* Fixed JarResolver explode cache always being rewritten even when no + dependencies change. + +# Version 1.2.7 - Dec 2, 2016 +## Bug Fixes +* Fixed VersionHandler build errors with Unity 5.5, due to the constantly + changing BuildTarget enum. +* Added support for Unity configured JDK Path rather than requiring + JAVA_HOME to be set in the Jar Resolver. + +# Version 1.2.6 - Nov 15, 2016 +## Bug Fixes +* Fixed IOSResolver errors when iOS support is not installed. +* Added fallback to "pod" executable search which queries the Ruby Gems + package manager for the binary install location. + +# Version 1.2.5 - Nov 3, 2016 +## Bug Fixes +* Added crude support for source only Cocoapods to the IOSResolver. + +# Version 1.2.4 - Oct 27, 2016 +## Bug Fixes +* Automated resolution of out of date pod repositories. + +# Version 1.2.3 - Oct 25, 2016 +## Bug Fixes +* Fixed exception when reporting conflicting dependencies. + +# Version 1.2.2 - Oct 17, 2016 +## Bug Fixes +* Fixed issue working with Unity 5.5 +* Fixed issue with PlayServicesResolver corrupting other iOS dependencies. +* Updated build script to use Unity distributed tools for building. + +# Version 1.2.1 - Jul 25, 2016 +## Bug Fixes +* Removed 1.2 Resolver and hardcoded whitelist of AARs to expand. +* Improved error reporting when the "jar" executable can't be found. +* Removed the need to set JAVA_HOME if "jar" is in the user's path. +* Fixed spurious copying of partially matching AARs. +* Changed resolver to only copy / expand when source AARs change. +* Auto-resolution of dependencies is now performed when the Android + build target is selected. + +## New Features +* Expand AARs that contain manifests with variable expansion like + ${applicationId}. +* Added optional logging in the JarResolverLib module. +* Integration with the Android SDK manager for dependencies that + declare required Android SDK packages. + +# Version 1.2.0 - May 11 2016 +## Bug Fixes +* Handles resolving dependencies when the artifacts are split across 2 repos. +* #4 Misdetecting version for versions like 1.2-alpha. These are now string + compared if alphanumeric +* Removed resolver creation via reflection since it did not work all the time. + Now a resolver needs to be loaded externally (which is existing behavior). + +## New Features +* Expose PlayServicesResolver properties to allow for script access. +* Explodes firebase-common and firebase-measurement aar files to support + ${applicationId} substitution. + +# Version 1.1.1 - 25 Feb 2016 +## Bug Fixes +* #1 Spaces in project path not handled when exploding Aar file. +* #2 Script compilation error: TypeLoadException. + +# Version 1.1.0 - 5 Feb 2016 +## New Features +* Adds friendly alert when JAVA_HOME is not set on Windows platforms. +* Adds flag for disabling background resolution. +* Expands play-services-measurement and replaces ${applicationId} with the + bundle Id. + + ## Bug Fixes +* Fixes infinite loop of resolution triggered by resolution. diff --git a/upm/CHANGELOG.md.meta b/upm/CHANGELOG.md.meta new file mode 100644 index 00000000..88b8b785 --- /dev/null +++ b/upm/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: dd6a29a412594aadb37d9698db325eca +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-CHANGELOG.md +timeCreated: 0 diff --git a/upm/Documentation~/index.md b/upm/Documentation~/index.md new file mode 100755 index 00000000..a9aafe9f --- /dev/null +++ b/upm/Documentation~/index.md @@ -0,0 +1,903 @@ +# External Dependency Manager for Unity + +[![openupm](https://img.shields.io/npm/v/com.google.external-dependency-manager?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.google.external-dependency-manager/) +[![openupm](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=downloads&query=%24.downloads&suffix=%2Fmonth&url=https%3A%2F%2Fpackage.openupm.com%2Fdownloads%2Fpoint%2Flast-month%2Fcom.google.external-dependency-manager)](https://openupm.com/packages/com.google.external-dependency-manager/) + +## Overview + +The External Dependency Manager for Unity (EDM4U) (formerly Play Services +Resolver/Jar Resolver) is intended to be used by any Unity package or user that +requires: + +* Android specific libraries (e.g + [AARs](https://developer.android.com/studio/projects/android-library.html)) + +* iOS [CocoaPods](https://cocoapods.org/) + +* Version management of transitive dependencies + +* Management of Package Manager (PM) Registries + +If you want to add and use iOS/Android dependencies directly in your project, +then you should to install EDM4U in your project. + +If you are a package user and the plugin you are using depends on EDM4U, *and* +the package does not include EDM4U as a package dependency already, then you +should to install EDM4U in your project. + +If you are a UPM package maintainer and your package requires EDM4U, then you +should add EDM4U as a +[package dependency](https://docs.unity3d.com/2019.3/Documentation/Manual/upm-dependencies.html) +in your package manifest (`package.json`): + +```json +{ + "dependencies": { + "com.google.external-dependency-manager": "1.2.178" + } +} +``` + +You should still install EDM4U to test out the package during development. + +If you are a legacy `.unitypackage` package maintainer and your package requires +EDM4U, please ask the user to install EDM4U separately. You should install EDM4U +to test out the package during development. + +Updated releases are available on +[GitHub](https://github.com/googlesamples/unity-jar-resolver) + +## Requirements + +The *Android Resolver* and *iOS Resolver* components of the plugin only work +with Unity version 4.6.8 or higher. + +The *Version Handler* component only works with Unity 5.x or higher as it +depends upon the `PluginImporter` UnityEditor API. + +The *Package Manager Resolver* component only works with Unity 2018.4 or above, +when [scoped registry](https://docs.unity3d.com/Manual/upm-scoped.html) support +was added to the Package Manager. + +## Getting Started + +Check out [troubleshooting](troubleshooting-faq.md) if you need help. + +### Install via OpenUPM + +EDM4U is available on +[OpenUPM](https://openupm.com/packages/com.google.external-dependency-manager/): + +```shell +openupm add com.google.external-dependency-manager +``` + +### Install via git URL +1. Open Package Manager +2. Click on the + icon on the top left corner of the "Package Manager" screen +3. Click on "Install package from git url..." +4. Paste: https://github.com/googlesamples/unity-jar-resolver.git?path=upm + +### Install via Google APIs for Unity + +EDM4U is available both in UPM and legacy `.unitypackage` formats on +[Google APIs for Unity](https://developers.google.com/unity/archive#external_dependency_manager_for_unity). + +You may install the UPM version (.tgz) as a +[local UPM package](https://docs.unity3d.com/Manual/upm-ui-local.html). + +You can also install EDM4U in your project as a `.unitypackage`. This is not +recommended due to potential conflicts. + +### Conflict Resolution + +For historical reasons, a package maintainer may choose to embed EDM4U in their +package for ease of installation. This will create a conflict when you try to +install EDM4U with the steps above, or with another package with embedded EDM4U. +If your project imported a `.unitypackage` that has a copy of EDM4U embedded in +it, you may safely delete it from your Assets folder. If your project depends on +another UPM package with EDM4U, please reach out to the package maintainer and +ask them to replace it with a dependency to this package. In the meantime, you +can workaround the issue by copying the package to your Packages folder (to +create an +[embedded package](https://docs.unity3d.com/Manual/upm-concepts.html#Embedded)) +and perform the steps yourself to avoid a dependency conflict. + +### Config file + +To start adding dependencies to your project, copy and rename the +[SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) +file into your plugin and add the dependencies your project requires. + +The XML file needs to be under an `Editor` directory and match the name +`*Dependencies.xml`. For example, `MyPlugin/Editor/MyPluginDependencies.xml`. + +## Usages + +### Android Resolver + +The Android Resolver copies specified dependencies from local or remote Maven +repositories into the Unity project when a user selects Android as the build +target in the Unity editor. + +For example, to add the Google Play Games library +(`com.google.android.gms:play-services-games` package) at version `9.8.0` to the +set of a plugin's Android dependencies: + +```xml + + + + + extra-google-m2repository + + + + +``` + +The version specification (last component) supports: + +* Specific versions e.g `9.8.0` + +* Partial matches e.g `9.8.+` would match 9.8.0, 9.8.1 etc. choosing the most + recent version + +* Latest version using `LATEST` or `+`. We do *not* recommend using this + unless you're 100% sure the library you depend upon will not break your + Unity plugin in future + +The above example specifies the dependency as a component of the Android SDK +manager such that the Android SDK manager will be executed to install the +package if it's not found. If your Android dependency is located on Maven +central it's possible to specify the package simply using the `androidPackage` +element: + +```xml + + + + + +``` + +#### Auto-resolution + +By default the Android Resolver automatically monitors the dependencies you have +specified and the `Plugins/Android` folder of your Unity project. The resolution +process runs when the specified dependencies are not present in your project. + +The *auto-resolution* process can be disabled via the `Assets > External +Dependency Manager > Android Resolver > Settings` menu. + +Manual resolution can be performed using the following menu options: + +* `Assets > External Dependency Manager > Android Resolver > Resolve` + +* `Assets > External Dependency Manager > Android Resolver > Force Resolve` + +#### Deleting libraries + +Resolved packages are tracked via asset labels by the Android Resolver. They can +easily be deleted using the `Assets > External Dependency Manager > Android +Resolver > Delete Resolved Libraries` menu item. + +#### Android Manifest Variable Processing + +Some AAR files (for example play-services-measurement) contain variables that +are processed by the Android Gradle plugin. Unfortunately, Unity does not +perform the same processing when using Unity's Internal Build System, so the +Android Resolver plugin handles known cases of this variable substitution by +exploding the AAR into a folder and replacing `${applicationId}` with the +`bundleID`. + +Disabling AAR explosion and therefore Android manifest processing can be done +via the `Assets > External Dependency Manager > Android Resolver > Settings` +menu. You may want to disable explosion of AARs if you're exporting a project to +be built with Gradle/Android Studio. + +#### ABI Stripping + +Some AAR files contain native libraries (.so files) for each ABI supported by +Android. Unfortunately, when targeting a single ABI (e.g x86), Unity does not +strip native libraries for unused ABIs. To strip unused ABIs, the Android +Resolver plugin explodes an AAR into a folder and removes unused ABIs to reduce +the built APK size. Furthermore, if native libraries are not stripped from an +APK (e.g you have a mix of Unity's x86 library and some armeabi-v7a libraries) +Android may attempt to load the wrong library for the current runtime ABI +completely breaking your plugin when targeting some architectures. + +AAR explosion and therefore ABI stripping can be disabled via the `Assets > +External Dependency Manager > Android Resolver > Settings` menu. You may want to +disable explosion of AARs if you're exporting a project to be built with +Gradle/Android Studio. + +#### Resolution Strategies + +By default the Android Resolver will use Gradle to download dependencies prior +to integrating them into a Unity project. This works with Unity's internal build +system and Gradle/Android Studio project export. + +It's possible to change the resolution strategy via the `Assets > External +Dependency Manager > Android Resolver > Settings` menu. + +##### Download Artifacts with Gradle + +Using the default resolution strategy, the Android resolver executes the +following operations: + +- Remove the result of previous Android resolutions. E.g Delete all files and + directories labeled with "gpsr" under `Plugins/Android` from the project. + +- Collect the set of Android dependencies (libraries) specified by a project's + `*Dependencies.xml` files. + +- Run `download_artifacts.gradle` with Gradle to resolve conflicts and, if + successful, download the set of resolved Android libraries (AARs, JARs). + +- Process each AAR/JAR so that it can be used with the currently selected + Unity build system (e.g Internal vs. Gradle, Export vs. No Export). This + involves patching each reference to `applicationId` in the + `AndroidManifest.xml` with the project's bundle ID. This means resolution + must be run again if the bundle ID has changed. + +- Move the processed AARs to `Plugins/Android` so they will be included when + Unity invokes the Android build. + +##### Integrate into mainTemplate.gradle + +Unity 5.6 introduced support for customizing the `build.gradle` used to build +Unity projects with Gradle. When the *Patch mainTemplate.gradle* setting is +enabled, rather than downloading artifacts before the build, Android resolution +results in the execution of the following operations: + +- Remove the result of previous Android resolutions. E.g Delete all files and + directories labeled with "gpsr" under `Plugins/Android` from the project and + remove sections delimited with `// Android Resolver * Start` and `// Android + Resolver * End` lines. + +- Collect the set of Android dependencies (libraries) specified by a project's + `*Dependencies.xml` files. + +- Rename any `.srcaar` files in the build to `.aar` and exclude them from + being included directly by Unity in the Android build as + `mainTemplate.gradle` will be patched to include them instead from their + local maven repositories. + +- Inject the required Gradle repositories into `mainTemplate.gradle` at the + line matching the pattern `.*apply plugin: + 'com\.android\.(application|library)'.*` or the section starting at the line + `// Android Resolver Repos Start`. If you want to control the injection + point in the file, the section delimited by the lines `// Android Resolver + Repos Start` and `// Android Resolver Repos End` should be placed in the + global scope before the `dependencies` section. + +- Inject the required Android dependencies (libraries) into + `mainTemplate.gradle` at the line matching the pattern `***DEPS***` or the + section starting at the line `// Android Resolver Dependencies Start`. If + you want to control the injection point in the file, the section delimited + by the lines `// Android Resolver Dependencies Start` and `// Android + Resolver Dependencies End` should be placed in the `dependencies` section. + +- Inject the packaging options logic, which excludes architecture specific + libraries based upon the selected build target, into `mainTemplate.gradle` + at the line matching the pattern `android +{` or the section starting at the + line `// Android Resolver Exclusions Start`. If you want to control the + injection point in the file, the section delimited by the lines `// Android + Resolver Exclusions Start` and `// Android Resolver Exclusions End` should + be placed in the global scope before the `android` section. + +#### Dependency Tracking + +The Android Resolver creates the +`ProjectSettings/AndroidResolverDependencies.xml` to quickly determine the set +of resolved dependencies in a project. This is used by the auto-resolution +process to only run the expensive resolution process when necessary. + +#### Displaying Dependencies + +It's possible to display the set of dependencies the Android Resolver would +download and process in your project via the `Assets > External Dependency +Manager > Android Resolver > Display Libraries` menu item. + +### iOS Resolver + +The iOS resolver component of this plugin manages +[CocoaPods](https://cocoapods.org/). A CocoaPods `Podfile` is generated and the +`pod` tool is executed as a post build process step to add dependencies to the +Xcode project exported by Unity. + +Dependencies for iOS are added by referring to CocoaPods. + +For example, to add the AdMob pod, version 7.0 or greater with bitcode enabled: + +```xml + + + + + +``` + +#### Integration Strategies + +The `CocoaPods` are either: + +* Downloaded and injected into the Xcode project file directly, rather than + creating a separate xcworkspace. We call this `Xcode project` integration. + +* If the Unity version supports opening a xcworkspace file, the `pod` tool is + used as intended to generate a xcworkspace which references the CocoaPods. + We call this `Xcode workspace` integration. + +The resolution strategy can be changed via the `Assets > External Dependency +Manager > iOS Resolver > Settings` menu. + +##### Appending text to generated Podfile + +In order to modify the generated Podfile you can create a script like this: + +```csharp +using System.IO; + +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEngine; + +public class PostProcessIOS : MonoBehaviour +{ + // Must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and + // that it's added before "pod install" (50). + [PostProcessBuildAttribute(45)] + private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) + { + if (target == BuildTarget.iOS) + { + using (StreamWriter sw = File.AppendText(buildPath + "/Podfile")) + { + // E.g. add an app extension + sw.WriteLine("\ntarget 'NSExtension' do\n pod 'Firebase/Messaging', '6.6.0'\nend"); + } + } + } +} +``` + +### Package Manager Resolver + +Adding registries to the +[Package Manager](https://docs.unity3d.com/Manual/Packages.html) (PM) is a +manual process. The Package Manager Resolver (PMR) component of this plugin +makes it easy for plugin maintainers to distribute new PM registry servers and +easy for plugin users to manage PM registry servers. + +#### Adding Registries + +For example, to add a registry for plugins in the scope `com.coolstuff`: + +```xml + + + + com.coolstuff + + + +``` + +When PMR is loaded it will prompt the developer to add the registry to their +project if it isn't already present in the `Packages/manifest.json` file. + +For more information, see Unity's documentation on +[scoped package registries](https://docs.unity3d.com/Manual/upm-scoped.html). + +#### Managing Registries + +It's possible to add and remove registries that are specified via PMR XML +configuration files via the following menu options: + +* `Assets > External Dependency Manager > Package Manager Resolver > Add + Registries` will prompt the user with a window which allows them to add + registries discovered in the project to the Package Manager. + +* `Assets > External Dependency Manager > Package Manager Resolver > Remove + Registries` will prompt the user with a window which allows them to remove + registries discovered in the project from the Package Manager. + +* `Assets > External Dependency Manager > Package Manager Resolver > Modify + Registries` will prompt the user with a window which allows them to add or + remove registries discovered in the project. + +#### Migration + +PMR can migrate Version Handler packages installed in the `Assets` folder to PM +packages. This requires the plugins to implement the following: + +* `.unitypackage` must include a Version Handler manifests that describes the + components of the plugin. If the plugin has no dependencies the manifest + would just include the files in the plugin. + +* The PM package JSON provided by the registry must include a keyword (in the + `versions.VERSION.keyword` list) that maps the PM package to a Version + Handler package using the format `vh-name:VERSION_HANDLER_MANIFEST_NAME` + where `VERSION_HANDLER_MANIFEST_NAME` is the name of the manifest defined in + the `.unitypackage`. For more information see the description of the + `gvhp_manifestname` asset label in the [Version Handler](#version-handler) + section. + +When using the `Assets > External Dependency Manager > Package Manager +Resolver > Migrate Packages` menu option, PMR then will: + +* List all Version Handler manager packages in the project. + +* Search all available packages in the PM registries and fetch keywords + associated with each package parsing the Version Handler manifest names for + each package. + +* Map each installed Version Handler package to a PM package. + +* Prompt the user to migrate the discovered packages. + +* Perform package migration for all selected packages if the user clicks the + `Apply` button. + +#### Configuration + +PMR can be configured via the `Assets > External Dependency Manager > Package +Manager Resolver > Settings` menu option: + +* `Add package registries` when enabled, when the plugin loads or registry + configuration files change, this will prompt the user to add registries that + are not present in the Package Manager. + +* `Prompt to add package registries` will cause a developer to be prompted + with a window that will ask for confirmation before adding registries. When + this is disabled registries are added silently to the project. + +* `Prompt to migrate packages` will cause a developer to be prompted with a + window that will ask for confirmation before migrating packages installed in + the `Assets` directory to PM packages. + +* `Enable Analytics Reporting` when enabled, reports the use of the plugin to + the developers so they can make imrpovements. + +* `Verbose logging` when enabled prints debug information to the console which + can be useful when filing bug reports. + +### Version Handler + +The Version Handler component of this plugin manages: + +* Shared Unity plugin dependencies. + +* Upgrading Unity plugins by cleaning up old files from previous versions. + +* Uninstallation of plugins that are distributed with manifest files. + +* Restoration of plugin assets to their original install locations if assets + are tagged with the `exportpath` label. + +Since the Version Handler needs to modify Unity asset metadata (`.meta` files), +to enable/disable components, rename and delete asset files it does not work +with Package Manager installed packages. It's still possible to include EDM4U in +Package Manager packages, the Version Handler component simply won't do anything +to PM plugins in this case. + +#### Using Version Handler Managed Plugins + +If a plugin is imported at multiple different versions into a project, if the +Version Handler is enabled, it will automatically check all managed assets to +determine the set of assets that are out of date and assets that should be +removed. To disable automatic checking managed assets disable the `Enable +version management` option in the `Assets > External Dependency Manager > +Version Handler > Settings` menu. + +If version management is disabled, it's possible to check managed assets +manually using the `Assets > External Dependency Manager > Version Handler > +Update` menu option. + +##### Listing Managed Plugins + +Plugins managed by the Version Handler, those that ship with manifest files, can +displayed using the `Assets > External Dependency Manager > Version Handler > +Display Managed Packages` menu option. The list of plugins are written to the +console window along with the set of files used by each plugin. + +##### Uninstalling Managed Plugins + +Plugins managed by the Version Handler, those that ship with manifest files, can +be removed using the `Assets > External Dependency Manager > Version Handler > +Uninstall Managed Packages` menu option. This operation will display a window +that allows a developer to select a set of plugins to remove which will remove +all files owned by each plugin excluding those that are in use by other +installed plugins. + +Files managed by the Version Handler, those labeled with the `gvh` asset label, +can be checked to see whether anything needs to be upgraded, disabled or removed +using the `Assets > External Dependency Manager > Version Handler > Update` menu +option. + +##### Restore Install Paths + +Some developers move assets around in their project which can make it harder for +plugin maintainers to debug issues if this breaks Unity's +[special folders](https://docs.unity3d.com/Manual/SpecialFolders.html) rules. If +assets are labeled with their original install/export path (see +`gvhp_exportpath` below), Version Handler can restore assets to their original +locations when using the `Assets > External Dependency Manager > Version +Handler > Move Files To Install Locations` menu option. + +##### Settings + +Some behavior of the Version Handler can be configured via the `Assets > +External Dependency Manager > Version Handler > Settings` menu option. + +* `Enable version management` controls whether the plugin should automatically + check asset versions and apply changes. If this is disabled the process + should be run manually when installing or upgrading managed plugins using + `Assets > External Dependency Manager > Version Handler > Update`. + +* `Rename to canonical filenames` is a legacy option that will rename files to + remove version numbers and other labels from filenames. + +* `Prompt for obsolete file deletion` enables the display of a window when + obsolete files are deleted allowing the developer to select which files to + delete and those to keep. + +* `Allow disabling files via renaming` controls whether obsolete or disabled + files should be disabled by renaming them to `myfilename_DISABLED`. Renaming + to disable files is required in some scenarios where Unity doesn't support + removing files from the build via the PluginImporter. + +* `Enable Analytics Reporting` enables/disables usage reporting to plugin + developers to improve the product. + +* `Verbose logging` enables *very* noisy log output that is useful for + debugging while filing a bug report or building a new managed plugin. + +* `Use project settings` saves settings for the plugin in the project rather + than system-wide. + +#### Redistributing a Managed Plugin + +The Version Handler employs a couple of methods for managing version selection, +upgrade and removal of plugins. + +* Each plugin can ship with a manifest file that lists the files it includes. + This makes it possible for Version Handler to calculate the difference in + assets between the most recent release of a plugin and the previous release + installed in a project. If a files are removed the Version Handler will + prompt the user to clean up obsolete files. + +* Plugins can ship using assets with unique names, unique GUIDs and version + number labels. Version numbers can be attached to assets using labels or + added to the filename (e.g `myfile.txt` would be `myfile_version-x.y.z.txt). + This allows the Version Handler to determine which set of files are the same + file at different versions, select the most recent version and prompt the + developer to clean up old versions. + +Unity plugins can be managed by the Version Handler using the following steps: + +1. Add the `gvh` asset label to each asset (file) you want Version Handler to + manage. + +1. Add the `gvh_version-VERSION` label to each asset where `VERSION` is the + version of the plugin you're releasing (e.g 1.2.3). + +1. Add the `gvhp_exportpath-PATH` label to each asset where `PATH` is the + export path of the file when the `.unitypackage` is created. This is used to + track files if they're moved around in a project by developers. + +1. Optional: Add `gvh_targets-editor` label to each editor DLL in your plugin + and disable `editor` as a target platform for the DLL. The Version Handler + will enable the most recent version of this DLL when the plugin is imported. + +1. Optional: If your plugin is included in other Unity plugins, you should add + the version number to each filename and change the GUID of each asset. This + allows multiple versions of your plugin to be imported into a Unity project, + with the Version Handler component activating only the most recent version. + +1. Create a manifest text file named `MY_UNIQUE_PLUGIN_NAME_VERSION.txt` that + lists all the files in your plugin relative to the project root. Then add + the `gvh_manifest` label to the asset to indicate this file is a plugin + manifest. + +1. Optional: Add a `gvhp_manifestname-NAME` label to your manifest file to + provide a human readable name for your package. If this isn't provided the + name of the manifest file will be used as the package name. NAME can match + the pattern `[0-9]+[a-zA-Z -]` where a leading integer will set the priority + of the name where `0` is the highest priority and preferably used as the + display name. The lowest value (i.e highest priority name) will be used as + the display name and all other specified names will be aliases of the + display name. Aliases can refer to previous names of the package allowing + renaming across published versions. + +1. Redistribute EDM4U Unity plugin with your plugin. See the + [Plugin Redistribution](#plugin-redistribution) section for details. + +If you follow these steps: + +* When users import a newer version of your plugin, files referenced by the + older version's manifest are cleaned up. + +* The latest version of the plugin will be selected when users import multiple + packages that include your plugin, assuming the steps in + [Plugin Redistribution](#plugin-redistribution) are followed. + +## Background + +Many Unity plugins have dependencies upon Android specific libraries, iOS +CocoaPods, and sometimes have transitive dependencies upon other Unity plugins. +This causes the following problems: + +* Integrating platform specific (e.g Android and iOS) libraries within a Unity + project can be complex and a burden on a Unity plugin maintainer. +* The process of resolving conflicting dependencies on platform specific + libraries is pushed to the developer attempting to use a Unity plugin. The + developer trying to use your plugin is very likely to give up when faced + with Android or iOS specific build errors. +* The process of resolving conflicting Unity plugins (due to shared Unity + plugin components) is pushed to the developer attempting to use your Unity + plugin. In an effort to resolve conflicts, the developer will very likely + attempt to resolve problems by deleting random files in your plugin, report + bugs when that doesn't work and finally give up. + +EDM4U provides solutions for each of these problems. + +### Android Dependency Management + +The *Android Resolver* component of this plugin will download and integrate +Android library dependencies and handle any conflicts between plugins that share +the same dependencies. + +Without the Android Resolver, typically Unity plugins bundle their AAR and JAR +dependencies, e.g. a Unity plugin `SomePlugin` that requires the Google Play +Games Android library would redistribute the library and its transitive +dependencies in the folder `SomePlugin/Android/`. When a user imports +`SomeOtherPlugin` that includes the same libraries (potentially at different +versions) in `SomeOtherPlugin/Android/`, the developer using `SomePlugin` and +`SomeOtherPlugin` will see an error when building for Android that can be hard +to interpret. + +Using the Android Resolver to manage Android library dependencies: + +* Solves Android library conflicts between plugins. +* Handles all of the various processing steps required to use Android + libraries (AARs, JARs) in Unity 4.x and above projects. Almost all versions + of Unity have - at best - partial support for AARs. +* (Experimental) Supports minification of included Java components without + exporting a project. + +### iOS Dependency Management + +The *iOS Resolver* component of this plugin integrates with +[CocoaPods](https://cocoapods.org/) to download and integrate iOS libraries and +frameworks into the Xcode project Unity generates when building for iOS. Using +CocoaPods allows multiple plugins to utilize shared components without forcing +developers to fix either duplicate or incompatible versions of libraries +included through multiple Unity plugins in their project. + +### Package Manager Registry Setup + +The [Package Manager](https://docs.unity3d.com/Manual/Packages.html) (PM) makes +use of [NPM](https://www.npmjs.com/) registry servers for package hosting and +provides ways to discover, install, upgrade and uninstall packages. This makes +it easier for developers to manage plugins within their projects. + +However, installing additional package registries requires a few manual steps +that can potentially be error prone. The *Package Manager Resolver* component of +this plugin integrates with [PM](https://docs.unity3d.com/Manual/Packages.html) +to provide a way to auto-install PM package registries when a `.unitypackage` is +installed which allows plugin maintainers to ship a `.unitypackage` that can +provide access to their own PM registry server to make it easier for developers +to manage their plugins. + +### Unity Plugin Version Management + +Finally, the *Version Handler* component of this plugin simplifies the process +of managing transitive dependencies of Unity plugins and each plugin's upgrade +process. + +For example, without the Version Handler plugin, if: + +* Unity plugin `SomePlugin` includes `EDM4U` plugin at version 1.1. +* Unity plugin `SomeOtherPlugin` includes `EDM4U` plugin at version 1.2. + +The version of `EDM4U` included in the developer's project depends upon the +order the developer imports `SomePlugin` or `SomeOtherPlugin`. + +This results in: + +* `EDM4U` at version 1.2, if `SomePlugin` is imported then `SomeOtherPlugin` + is imported. +* `EDM4U` at version 1.1, if `SomeOtherPlugin` is imported then `SomePlugin` + is imported. + +The Version Handler solves the problem of managing transitive dependencies by: + +* Specifying a set of packaging requirements that enable a plugin at different + versions to be imported into a Unity project. +* Providing activation logic that selects the latest version of a plugin + within a project. + +When using the Version Handler to manage `EDM4U` included in `SomePlugin` and +`SomeOtherPlugin`, from the prior example, version 1.2 will always be the +version activated in a developer's Unity project. + +Plugin creators are encouraged to adopt this library to ease integration for +their customers. For more information about integrating EDM4U into your own +plugin, see the [Plugin Redistribution](#plugin-redistribution) section of this +document. + +## Analytics + +The External Dependency Manager for Unity plugin by default logs usage to Google +Analytics. The purpose of the logging is to quantitatively measure the usage of +functionality, to gather reports on integration failures and to inform future +improvements to the developer experience of the External Dependency Manager +plugin. Note that the analytics collected are limited to the scope of the EDM4U +plugin’s usage. + +For details of what is logged, please refer to the usage of +`EditorMeasurement.Report()` in the source code. + +## Plugin Redistribution + +If you are a package maintainer and your package depends on EDM4U, it is highly +recommended to use the UPM format and add EDM4U as a dependency. If you must +include it in your `.unitypackage`, redistributing `EDM4U` inside your own +plugin might ease the integration process for your users. + +If you wish to redistribute `EDM4U` inside your plugin, you **must** follow +these steps when importing the `external-dependency-manager-*.unitypackage`, and +when exporting your own plugin package: + +1. Import the `external-dependency-manager-*.unitypackage` into your plugin + project by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), + ensuring that you add the `-gvh_disable` option. +1. Export your plugin by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), + ensuring that you: + - Include the contents of the `Assets/PlayServicesResolver` and + `Assets/ExternalDependencyManager` directory. + - Add the `-gvh_disable` option. + +You **must** specify the `-gvh_disable` option in order for the Version Handler +to work correctly! + +For example, the following command will import the +`external-dependency-manager-1.2.46.0.unitypackage` into the project +`MyPluginProject` and export the entire Assets folder to +`MyPlugin.unitypackage`: + +```shell +Unity -gvh_disable \ + -batchmode \ + -importPackage external-dependency-manager-1.2.46.0.unitypackage \ + -projectPath MyPluginProject \ + -exportPackage Assets MyPlugin.unitypackage \ + -quit +``` + +### Background + +The *Version Handler* component relies upon deferring the load of editor DLLs so +that it can run first and determine the latest version of a plugin component to +activate. The build of `EDM4U` plugin has Unity asset metadata that is +configured so that the editor components are not initially enabled when it's +imported into a Unity project. To maintain this configuration when importing the +`external-dependency-manager.unitypackage` into a Unity plugin project, you +*must* specify the command line option `-gvh_disable` which will prevent the +Version Handler component from running and changing the Unity asset metadata. + +## Building from Source + +To build this plugin from source you need the following tools installed: * Unity +2021 and below (with iOS and Android modules installed) * Java 11 + +You can build the plugin by running the following from your shell (Linux / OSX): + +```shell +./gradlew build + +``` + +or Windows: + +```shell +./gradlew.bat build +``` + +If Java 11 is not your default Java command, add +`-Dorg.gradle.java.home=` to the command above. + +## Testing + +You can run the tests by running the following from your shell (Linux / OSX): + +```shell +./gradlew test +``` + +or Windows: + +```shell +./gradlew.bat test +``` + +The following properties can be set to narrow down the tests to run or change +the test run behavior. + +* `INTERACTIVE_MODE_TESTS_ENABLED` - Default to `1`. Set to `1` to enable + interactive mode tests, which requires GPU on the machine. Otherwise, only + run tests in the batch mode. +* `INCLUDE_TEST_TYPES` - Default to empty string, which means to include every + type of the test. To narrow down the types of test to run, set this + properties with a list of case-insensitive type strings separated by comma. + For instance, `-PINCLUDE_TEST_TYPES="Python,NUnit"` means to include only + Python tests and NUnit tests. See `TestTypeEnum` in `build.gradle` for + available options. +* `EXCLUDE_TEST_TYPES` - Default to empty string, which means to exclude none. + To add types of tests to exclude, set this properties with a list of + case-insensitive type strings separated by comma. For instance, + `-PEXCLUDE_TEST_TYPES="Python,NUnit"` means to exclude Python tests and + NUnit tests. See `TestTypeEnum` in `build.gradle` for available options. +* `INCLUDE_TEST_MODULES` - Default to empty string, which means to include the + tests for every modules. To narrow down modules to test, set this properties + with a list of case-insensitive module strings separated by comma. For + instance, `-PINCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests + for tools and Android Resolver only. See `TestModuleEnum` in `build.gradle` + for available options. +* `EXCLUDE_TEST_MODULES` - Default to empty string, which means to exclude + none. To add modules to exclude, set this properties with a list of + case-insensitive module strings separated by comma. For instance, + `-PEXCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests for any + modules other than tools and Android Resolver. See `TestModuleEnum` in + `build.gradle` for available options. +* `EXCLUDE_TESTS` - Default to empty string, which means to exclude none. To + add tests to exclude, set this properties with a list of case-insensitive + test names separated by comma. For instance, + `-PEXCLUDE_TESTS="testGenGuids,testDownloadArtifacts"` means to run tests + except the tests with name of `testGenGuids` and `testDownloadArtifacts`. +* `CONTINUE_ON_FAIL_FOR_TESTS_ENABLED` - Default to `1`. Set to `1` to + continue running the next test when the current one fails. Otherwise, the + build script stops whenever any test fails. + +For instance, by running the following command, it only runs the Unity +integration tests that does not requires GPU, but exclude tests for Android +Resolver module and iOS Resolver module. + +```shell +./gradlew test \ + -PINTERACTIVE_MODE_TESTS_ENABLED=0 \ + -PINCLUDE_TEST_TYPES="Integration" \ + -PEXCLUDE_TEST_MODULES="AndroidResolver,iOSResolver" +``` + +## Releasing + +Each time a new build of this plugin is checked into the source tree you need to +do the following: + +* Bump the plugin version variable `pluginVersion` in `build.gradle` +* Update `CHANGELOG.md` with the new version number and changes included in + the release. +* Build the release using `./gradlew release` which performs the following: + * Updates `external-dependency-manager-*.unitypackage` + * Copies the unpacked plugin to the `exploded` directory. + * Updates template metadata files in the `plugin` directory. The GUIDs of + all asset metadata is modified due to the version number change. Each + file within the plugin is versioned to allow multiple versions of the + plugin to be imported into a Unity project which allows the most recent + version to be activated by the Version Handler component. +* Create release commit using `./gradlew gitCreateReleaseCommit` which + performs `git commit -a -m "description from CHANGELOG.md"` +* Once the release commit is merge, tag the release using `./gradlew + gitTagRelease` which performs the following: + * `git tag -a pluginVersion -m "version RELEASE"` to tag the release. +* Update tags on remote branch using `git push --tag REMOTE HEAD:master` diff --git a/upm/ExternalDependencyManager.meta b/upm/ExternalDependencyManager.meta new file mode 100644 index 00000000..113fad84 --- /dev/null +++ b/upm/ExternalDependencyManager.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 46f5870ddbde4a6091f50656dcd5573e +timeCreated: 1480838400 +folderAsset: true +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/ExternalDependencyManager/Editor.meta b/upm/ExternalDependencyManager/Editor.meta new file mode 100644 index 00000000..7f569fa6 --- /dev/null +++ b/upm/ExternalDependencyManager/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1f23cd25474841f6ad7555705b4807e9 +timeCreated: 1480838400 +folderAsset: true +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/ExternalDependencyManager/Editor/1.2.186.meta b/upm/ExternalDependencyManager/Editor/1.2.186.meta new file mode 100644 index 00000000..c9cc4f8b --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/1.2.186.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8a6a9bd2649d4370b43be75e1689748c +timeCreated: 1480838400 +folderAsset: true +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll b/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll new file mode 100755 index 00000000..30030559 Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll differ diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll.meta b/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll.meta new file mode 100644 index 00000000..fe84d30d --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll.meta @@ -0,0 +1,37 @@ +fileFormatVersion: 2 +guid: e2d7ea0845de4cf984265d2a444b7aa4 +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll +- gvhp_targets-editor +timeCreated: 1480838400 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + validateReferences: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb b/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb new file mode 100755 index 00000000..493d3b28 Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb differ diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb.meta b/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb.meta new file mode 100644 index 00000000..ab8ef649 --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: baf24db2bf904e729e7796721c09e8ad +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb +- gvhp_targets-editor +timeCreated: 1538009133 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: +PluginImporter: + platformData: + - first: + Editor: Editor + second: + enabled: 1 diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll b/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll new file mode 100755 index 00000000..645d5cd3 Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll differ diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll.meta b/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll.meta new file mode 100644 index 00000000..b3831d2a --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll.meta @@ -0,0 +1,36 @@ +fileFormatVersion: 2 +guid: fa49a85d4ba140a0ae21528ed12d174c +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll +- gvhp_targets-editor +timeCreated: 1480838400 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb b/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb new file mode 100755 index 00000000..c6eaef49 Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb differ diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb.meta b/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb.meta new file mode 100644 index 00000000..d8895653 --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: d13c8602d5e14e43b0e92459754c4315 +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb +- gvhp_targets-editor +timeCreated: 1538009133 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: +PluginImporter: + platformData: + - first: + Editor: Editor + second: + enabled: 1 diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll b/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll new file mode 100755 index 00000000..a4a6590c Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll differ diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll.meta b/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll.meta new file mode 100644 index 00000000..260efc5e --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll.meta @@ -0,0 +1,36 @@ +fileFormatVersion: 2 +guid: d8bb10c56a0147bc855a6296778e025e +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll +- gvhp_targets-editor +timeCreated: 1480838400 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb b/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb new file mode 100755 index 00000000..884ce212 Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb differ diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb.meta b/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb.meta new file mode 100644 index 00000000..e08c8e68 --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: a695eb9f64fe49569a2db0c4246c877d +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb +- gvhp_targets-editor +timeCreated: 1538009133 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: +PluginImporter: + platformData: + - first: + Editor: Editor + second: + enabled: 1 diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll b/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll new file mode 100755 index 00000000..8562ef33 Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll differ diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll.meta b/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll.meta new file mode 100644 index 00000000..a3e0b420 --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll.meta @@ -0,0 +1,36 @@ +fileFormatVersion: 2 +guid: 5980a684c61d42fbb6b74e2eb3477016 +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll +- gvhp_targets-editor +timeCreated: 1480838400 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb b/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb new file mode 100755 index 00000000..ed8cc976 Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb differ diff --git a/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb.meta b/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb.meta new file mode 100644 index 00000000..cb5d8ef5 --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: 9f56badf3ca84753b00163c3b632d4e5 +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb +- gvhp_targets-editor +timeCreated: 1538009133 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: +PluginImporter: + platformData: + - first: + Editor: Editor + second: + enabled: 1 diff --git a/upm/ExternalDependencyManager/Editor/Google.VersionHandler.dll b/upm/ExternalDependencyManager/Editor/Google.VersionHandler.dll new file mode 100755 index 00000000..12c150e2 Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/Google.VersionHandler.dll differ diff --git a/upm/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta b/upm/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta new file mode 100644 index 00000000..b43088d1 --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/Google.VersionHandler.dll.meta @@ -0,0 +1,36 @@ +fileFormatVersion: 2 +guid: f7632a50b10045458c53a5ddf7b6d238 +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.dll +- gvhp_targets-editor +timeCreated: 1480838400 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/ExternalDependencyManager/Editor/Google.VersionHandler.pdb b/upm/ExternalDependencyManager/Editor/Google.VersionHandler.pdb new file mode 100755 index 00000000..7dd02af5 Binary files /dev/null and b/upm/ExternalDependencyManager/Editor/Google.VersionHandler.pdb differ diff --git a/upm/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta b/upm/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta new file mode 100644 index 00000000..d4a34e05 --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/Google.VersionHandler.pdb.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 57f5a82a79ab4b098f09326c8f3c73a6 +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/Google.VersionHandler.pdb +timeCreated: 1538009133 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt b/upm/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt new file mode 100755 index 00000000..81c97ed6 --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt @@ -0,0 +1,13 @@ +Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.dll +Assets/ExternalDependencyManager/Editor/1.2.186/Google.IOSResolver.pdb +Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.dll +Assets/ExternalDependencyManager/Editor/1.2.186/Google.JarResolver.pdb +Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.dll +Assets/ExternalDependencyManager/Editor/1.2.186/Google.PackageManagerResolver.pdb +Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.dll +Assets/ExternalDependencyManager/Editor/1.2.186/Google.VersionHandlerImpl.pdb +Assets/ExternalDependencyManager/Editor/CHANGELOG.md +Assets/ExternalDependencyManager/Editor/Google.VersionHandler.dll +Assets/ExternalDependencyManager/Editor/Google.VersionHandler.pdb +Assets/ExternalDependencyManager/Editor/LICENSE +Assets/ExternalDependencyManager/Editor/README.md diff --git a/upm/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt.meta b/upm/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt.meta new file mode 100644 index 00000000..dca3f95f --- /dev/null +++ b/upm/ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt.meta @@ -0,0 +1,15 @@ +fileFormatVersion: 2 +guid: c9a3138961c74d99b7046b783112fceb +labels: +- gvh +- gvh_manifest +- gvh_version-1.2.186 +- gvhp_exportpath-ExternalDependencyManager/Editor/external-dependency-manager_version-1.2.186_manifest.txt +- gvhp_manifestname-0External Dependency Manager +- gvhp_manifestname-play-services-resolver +timeCreated: 1474401009 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/upm/LICENSE.md b/upm/LICENSE.md new file mode 100755 index 00000000..6258cc47 --- /dev/null +++ b/upm/LICENSE.md @@ -0,0 +1,245 @@ +Copyright (C) 2014 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +==================================================================================================== +This package uses MiniJSON + +Copyright (c) 2013 Calvin Rien + +Based on the JSON parser by Patrick van Bergen +http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html + +Simplified it so that it doesn't throw exceptions +and can be used in Unity iPhone with maximum code stripping. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/upm/LICENSE.md.meta b/upm/LICENSE.md.meta new file mode 100644 index 00000000..e3344950 --- /dev/null +++ b/upm/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f61a1c8e753b496bb696e77d7eedfb95 +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-LICENSE.md +timeCreated: 0 diff --git a/upm/README.md b/upm/README.md new file mode 100755 index 00000000..a9aafe9f --- /dev/null +++ b/upm/README.md @@ -0,0 +1,903 @@ +# External Dependency Manager for Unity + +[![openupm](https://img.shields.io/npm/v/com.google.external-dependency-manager?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.google.external-dependency-manager/) +[![openupm](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=downloads&query=%24.downloads&suffix=%2Fmonth&url=https%3A%2F%2Fpackage.openupm.com%2Fdownloads%2Fpoint%2Flast-month%2Fcom.google.external-dependency-manager)](https://openupm.com/packages/com.google.external-dependency-manager/) + +## Overview + +The External Dependency Manager for Unity (EDM4U) (formerly Play Services +Resolver/Jar Resolver) is intended to be used by any Unity package or user that +requires: + +* Android specific libraries (e.g + [AARs](https://developer.android.com/studio/projects/android-library.html)) + +* iOS [CocoaPods](https://cocoapods.org/) + +* Version management of transitive dependencies + +* Management of Package Manager (PM) Registries + +If you want to add and use iOS/Android dependencies directly in your project, +then you should to install EDM4U in your project. + +If you are a package user and the plugin you are using depends on EDM4U, *and* +the package does not include EDM4U as a package dependency already, then you +should to install EDM4U in your project. + +If you are a UPM package maintainer and your package requires EDM4U, then you +should add EDM4U as a +[package dependency](https://docs.unity3d.com/2019.3/Documentation/Manual/upm-dependencies.html) +in your package manifest (`package.json`): + +```json +{ + "dependencies": { + "com.google.external-dependency-manager": "1.2.178" + } +} +``` + +You should still install EDM4U to test out the package during development. + +If you are a legacy `.unitypackage` package maintainer and your package requires +EDM4U, please ask the user to install EDM4U separately. You should install EDM4U +to test out the package during development. + +Updated releases are available on +[GitHub](https://github.com/googlesamples/unity-jar-resolver) + +## Requirements + +The *Android Resolver* and *iOS Resolver* components of the plugin only work +with Unity version 4.6.8 or higher. + +The *Version Handler* component only works with Unity 5.x or higher as it +depends upon the `PluginImporter` UnityEditor API. + +The *Package Manager Resolver* component only works with Unity 2018.4 or above, +when [scoped registry](https://docs.unity3d.com/Manual/upm-scoped.html) support +was added to the Package Manager. + +## Getting Started + +Check out [troubleshooting](troubleshooting-faq.md) if you need help. + +### Install via OpenUPM + +EDM4U is available on +[OpenUPM](https://openupm.com/packages/com.google.external-dependency-manager/): + +```shell +openupm add com.google.external-dependency-manager +``` + +### Install via git URL +1. Open Package Manager +2. Click on the + icon on the top left corner of the "Package Manager" screen +3. Click on "Install package from git url..." +4. Paste: https://github.com/googlesamples/unity-jar-resolver.git?path=upm + +### Install via Google APIs for Unity + +EDM4U is available both in UPM and legacy `.unitypackage` formats on +[Google APIs for Unity](https://developers.google.com/unity/archive#external_dependency_manager_for_unity). + +You may install the UPM version (.tgz) as a +[local UPM package](https://docs.unity3d.com/Manual/upm-ui-local.html). + +You can also install EDM4U in your project as a `.unitypackage`. This is not +recommended due to potential conflicts. + +### Conflict Resolution + +For historical reasons, a package maintainer may choose to embed EDM4U in their +package for ease of installation. This will create a conflict when you try to +install EDM4U with the steps above, or with another package with embedded EDM4U. +If your project imported a `.unitypackage` that has a copy of EDM4U embedded in +it, you may safely delete it from your Assets folder. If your project depends on +another UPM package with EDM4U, please reach out to the package maintainer and +ask them to replace it with a dependency to this package. In the meantime, you +can workaround the issue by copying the package to your Packages folder (to +create an +[embedded package](https://docs.unity3d.com/Manual/upm-concepts.html#Embedded)) +and perform the steps yourself to avoid a dependency conflict. + +### Config file + +To start adding dependencies to your project, copy and rename the +[SampleDependencies.xml](https://github.com/googlesamples/unity-jar-resolver/blob/master/sample/Assets/ExternalDependencyManager/Editor/SampleDependencies.xml) +file into your plugin and add the dependencies your project requires. + +The XML file needs to be under an `Editor` directory and match the name +`*Dependencies.xml`. For example, `MyPlugin/Editor/MyPluginDependencies.xml`. + +## Usages + +### Android Resolver + +The Android Resolver copies specified dependencies from local or remote Maven +repositories into the Unity project when a user selects Android as the build +target in the Unity editor. + +For example, to add the Google Play Games library +(`com.google.android.gms:play-services-games` package) at version `9.8.0` to the +set of a plugin's Android dependencies: + +```xml + + + + + extra-google-m2repository + + + + +``` + +The version specification (last component) supports: + +* Specific versions e.g `9.8.0` + +* Partial matches e.g `9.8.+` would match 9.8.0, 9.8.1 etc. choosing the most + recent version + +* Latest version using `LATEST` or `+`. We do *not* recommend using this + unless you're 100% sure the library you depend upon will not break your + Unity plugin in future + +The above example specifies the dependency as a component of the Android SDK +manager such that the Android SDK manager will be executed to install the +package if it's not found. If your Android dependency is located on Maven +central it's possible to specify the package simply using the `androidPackage` +element: + +```xml + + + + + +``` + +#### Auto-resolution + +By default the Android Resolver automatically monitors the dependencies you have +specified and the `Plugins/Android` folder of your Unity project. The resolution +process runs when the specified dependencies are not present in your project. + +The *auto-resolution* process can be disabled via the `Assets > External +Dependency Manager > Android Resolver > Settings` menu. + +Manual resolution can be performed using the following menu options: + +* `Assets > External Dependency Manager > Android Resolver > Resolve` + +* `Assets > External Dependency Manager > Android Resolver > Force Resolve` + +#### Deleting libraries + +Resolved packages are tracked via asset labels by the Android Resolver. They can +easily be deleted using the `Assets > External Dependency Manager > Android +Resolver > Delete Resolved Libraries` menu item. + +#### Android Manifest Variable Processing + +Some AAR files (for example play-services-measurement) contain variables that +are processed by the Android Gradle plugin. Unfortunately, Unity does not +perform the same processing when using Unity's Internal Build System, so the +Android Resolver plugin handles known cases of this variable substitution by +exploding the AAR into a folder and replacing `${applicationId}` with the +`bundleID`. + +Disabling AAR explosion and therefore Android manifest processing can be done +via the `Assets > External Dependency Manager > Android Resolver > Settings` +menu. You may want to disable explosion of AARs if you're exporting a project to +be built with Gradle/Android Studio. + +#### ABI Stripping + +Some AAR files contain native libraries (.so files) for each ABI supported by +Android. Unfortunately, when targeting a single ABI (e.g x86), Unity does not +strip native libraries for unused ABIs. To strip unused ABIs, the Android +Resolver plugin explodes an AAR into a folder and removes unused ABIs to reduce +the built APK size. Furthermore, if native libraries are not stripped from an +APK (e.g you have a mix of Unity's x86 library and some armeabi-v7a libraries) +Android may attempt to load the wrong library for the current runtime ABI +completely breaking your plugin when targeting some architectures. + +AAR explosion and therefore ABI stripping can be disabled via the `Assets > +External Dependency Manager > Android Resolver > Settings` menu. You may want to +disable explosion of AARs if you're exporting a project to be built with +Gradle/Android Studio. + +#### Resolution Strategies + +By default the Android Resolver will use Gradle to download dependencies prior +to integrating them into a Unity project. This works with Unity's internal build +system and Gradle/Android Studio project export. + +It's possible to change the resolution strategy via the `Assets > External +Dependency Manager > Android Resolver > Settings` menu. + +##### Download Artifacts with Gradle + +Using the default resolution strategy, the Android resolver executes the +following operations: + +- Remove the result of previous Android resolutions. E.g Delete all files and + directories labeled with "gpsr" under `Plugins/Android` from the project. + +- Collect the set of Android dependencies (libraries) specified by a project's + `*Dependencies.xml` files. + +- Run `download_artifacts.gradle` with Gradle to resolve conflicts and, if + successful, download the set of resolved Android libraries (AARs, JARs). + +- Process each AAR/JAR so that it can be used with the currently selected + Unity build system (e.g Internal vs. Gradle, Export vs. No Export). This + involves patching each reference to `applicationId` in the + `AndroidManifest.xml` with the project's bundle ID. This means resolution + must be run again if the bundle ID has changed. + +- Move the processed AARs to `Plugins/Android` so they will be included when + Unity invokes the Android build. + +##### Integrate into mainTemplate.gradle + +Unity 5.6 introduced support for customizing the `build.gradle` used to build +Unity projects with Gradle. When the *Patch mainTemplate.gradle* setting is +enabled, rather than downloading artifacts before the build, Android resolution +results in the execution of the following operations: + +- Remove the result of previous Android resolutions. E.g Delete all files and + directories labeled with "gpsr" under `Plugins/Android` from the project and + remove sections delimited with `// Android Resolver * Start` and `// Android + Resolver * End` lines. + +- Collect the set of Android dependencies (libraries) specified by a project's + `*Dependencies.xml` files. + +- Rename any `.srcaar` files in the build to `.aar` and exclude them from + being included directly by Unity in the Android build as + `mainTemplate.gradle` will be patched to include them instead from their + local maven repositories. + +- Inject the required Gradle repositories into `mainTemplate.gradle` at the + line matching the pattern `.*apply plugin: + 'com\.android\.(application|library)'.*` or the section starting at the line + `// Android Resolver Repos Start`. If you want to control the injection + point in the file, the section delimited by the lines `// Android Resolver + Repos Start` and `// Android Resolver Repos End` should be placed in the + global scope before the `dependencies` section. + +- Inject the required Android dependencies (libraries) into + `mainTemplate.gradle` at the line matching the pattern `***DEPS***` or the + section starting at the line `// Android Resolver Dependencies Start`. If + you want to control the injection point in the file, the section delimited + by the lines `// Android Resolver Dependencies Start` and `// Android + Resolver Dependencies End` should be placed in the `dependencies` section. + +- Inject the packaging options logic, which excludes architecture specific + libraries based upon the selected build target, into `mainTemplate.gradle` + at the line matching the pattern `android +{` or the section starting at the + line `// Android Resolver Exclusions Start`. If you want to control the + injection point in the file, the section delimited by the lines `// Android + Resolver Exclusions Start` and `// Android Resolver Exclusions End` should + be placed in the global scope before the `android` section. + +#### Dependency Tracking + +The Android Resolver creates the +`ProjectSettings/AndroidResolverDependencies.xml` to quickly determine the set +of resolved dependencies in a project. This is used by the auto-resolution +process to only run the expensive resolution process when necessary. + +#### Displaying Dependencies + +It's possible to display the set of dependencies the Android Resolver would +download and process in your project via the `Assets > External Dependency +Manager > Android Resolver > Display Libraries` menu item. + +### iOS Resolver + +The iOS resolver component of this plugin manages +[CocoaPods](https://cocoapods.org/). A CocoaPods `Podfile` is generated and the +`pod` tool is executed as a post build process step to add dependencies to the +Xcode project exported by Unity. + +Dependencies for iOS are added by referring to CocoaPods. + +For example, to add the AdMob pod, version 7.0 or greater with bitcode enabled: + +```xml + + + + + +``` + +#### Integration Strategies + +The `CocoaPods` are either: + +* Downloaded and injected into the Xcode project file directly, rather than + creating a separate xcworkspace. We call this `Xcode project` integration. + +* If the Unity version supports opening a xcworkspace file, the `pod` tool is + used as intended to generate a xcworkspace which references the CocoaPods. + We call this `Xcode workspace` integration. + +The resolution strategy can be changed via the `Assets > External Dependency +Manager > iOS Resolver > Settings` menu. + +##### Appending text to generated Podfile + +In order to modify the generated Podfile you can create a script like this: + +```csharp +using System.IO; + +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEngine; + +public class PostProcessIOS : MonoBehaviour +{ + // Must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and + // that it's added before "pod install" (50). + [PostProcessBuildAttribute(45)] + private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) + { + if (target == BuildTarget.iOS) + { + using (StreamWriter sw = File.AppendText(buildPath + "/Podfile")) + { + // E.g. add an app extension + sw.WriteLine("\ntarget 'NSExtension' do\n pod 'Firebase/Messaging', '6.6.0'\nend"); + } + } + } +} +``` + +### Package Manager Resolver + +Adding registries to the +[Package Manager](https://docs.unity3d.com/Manual/Packages.html) (PM) is a +manual process. The Package Manager Resolver (PMR) component of this plugin +makes it easy for plugin maintainers to distribute new PM registry servers and +easy for plugin users to manage PM registry servers. + +#### Adding Registries + +For example, to add a registry for plugins in the scope `com.coolstuff`: + +```xml + + + + com.coolstuff + + + +``` + +When PMR is loaded it will prompt the developer to add the registry to their +project if it isn't already present in the `Packages/manifest.json` file. + +For more information, see Unity's documentation on +[scoped package registries](https://docs.unity3d.com/Manual/upm-scoped.html). + +#### Managing Registries + +It's possible to add and remove registries that are specified via PMR XML +configuration files via the following menu options: + +* `Assets > External Dependency Manager > Package Manager Resolver > Add + Registries` will prompt the user with a window which allows them to add + registries discovered in the project to the Package Manager. + +* `Assets > External Dependency Manager > Package Manager Resolver > Remove + Registries` will prompt the user with a window which allows them to remove + registries discovered in the project from the Package Manager. + +* `Assets > External Dependency Manager > Package Manager Resolver > Modify + Registries` will prompt the user with a window which allows them to add or + remove registries discovered in the project. + +#### Migration + +PMR can migrate Version Handler packages installed in the `Assets` folder to PM +packages. This requires the plugins to implement the following: + +* `.unitypackage` must include a Version Handler manifests that describes the + components of the plugin. If the plugin has no dependencies the manifest + would just include the files in the plugin. + +* The PM package JSON provided by the registry must include a keyword (in the + `versions.VERSION.keyword` list) that maps the PM package to a Version + Handler package using the format `vh-name:VERSION_HANDLER_MANIFEST_NAME` + where `VERSION_HANDLER_MANIFEST_NAME` is the name of the manifest defined in + the `.unitypackage`. For more information see the description of the + `gvhp_manifestname` asset label in the [Version Handler](#version-handler) + section. + +When using the `Assets > External Dependency Manager > Package Manager +Resolver > Migrate Packages` menu option, PMR then will: + +* List all Version Handler manager packages in the project. + +* Search all available packages in the PM registries and fetch keywords + associated with each package parsing the Version Handler manifest names for + each package. + +* Map each installed Version Handler package to a PM package. + +* Prompt the user to migrate the discovered packages. + +* Perform package migration for all selected packages if the user clicks the + `Apply` button. + +#### Configuration + +PMR can be configured via the `Assets > External Dependency Manager > Package +Manager Resolver > Settings` menu option: + +* `Add package registries` when enabled, when the plugin loads or registry + configuration files change, this will prompt the user to add registries that + are not present in the Package Manager. + +* `Prompt to add package registries` will cause a developer to be prompted + with a window that will ask for confirmation before adding registries. When + this is disabled registries are added silently to the project. + +* `Prompt to migrate packages` will cause a developer to be prompted with a + window that will ask for confirmation before migrating packages installed in + the `Assets` directory to PM packages. + +* `Enable Analytics Reporting` when enabled, reports the use of the plugin to + the developers so they can make imrpovements. + +* `Verbose logging` when enabled prints debug information to the console which + can be useful when filing bug reports. + +### Version Handler + +The Version Handler component of this plugin manages: + +* Shared Unity plugin dependencies. + +* Upgrading Unity plugins by cleaning up old files from previous versions. + +* Uninstallation of plugins that are distributed with manifest files. + +* Restoration of plugin assets to their original install locations if assets + are tagged with the `exportpath` label. + +Since the Version Handler needs to modify Unity asset metadata (`.meta` files), +to enable/disable components, rename and delete asset files it does not work +with Package Manager installed packages. It's still possible to include EDM4U in +Package Manager packages, the Version Handler component simply won't do anything +to PM plugins in this case. + +#### Using Version Handler Managed Plugins + +If a plugin is imported at multiple different versions into a project, if the +Version Handler is enabled, it will automatically check all managed assets to +determine the set of assets that are out of date and assets that should be +removed. To disable automatic checking managed assets disable the `Enable +version management` option in the `Assets > External Dependency Manager > +Version Handler > Settings` menu. + +If version management is disabled, it's possible to check managed assets +manually using the `Assets > External Dependency Manager > Version Handler > +Update` menu option. + +##### Listing Managed Plugins + +Plugins managed by the Version Handler, those that ship with manifest files, can +displayed using the `Assets > External Dependency Manager > Version Handler > +Display Managed Packages` menu option. The list of plugins are written to the +console window along with the set of files used by each plugin. + +##### Uninstalling Managed Plugins + +Plugins managed by the Version Handler, those that ship with manifest files, can +be removed using the `Assets > External Dependency Manager > Version Handler > +Uninstall Managed Packages` menu option. This operation will display a window +that allows a developer to select a set of plugins to remove which will remove +all files owned by each plugin excluding those that are in use by other +installed plugins. + +Files managed by the Version Handler, those labeled with the `gvh` asset label, +can be checked to see whether anything needs to be upgraded, disabled or removed +using the `Assets > External Dependency Manager > Version Handler > Update` menu +option. + +##### Restore Install Paths + +Some developers move assets around in their project which can make it harder for +plugin maintainers to debug issues if this breaks Unity's +[special folders](https://docs.unity3d.com/Manual/SpecialFolders.html) rules. If +assets are labeled with their original install/export path (see +`gvhp_exportpath` below), Version Handler can restore assets to their original +locations when using the `Assets > External Dependency Manager > Version +Handler > Move Files To Install Locations` menu option. + +##### Settings + +Some behavior of the Version Handler can be configured via the `Assets > +External Dependency Manager > Version Handler > Settings` menu option. + +* `Enable version management` controls whether the plugin should automatically + check asset versions and apply changes. If this is disabled the process + should be run manually when installing or upgrading managed plugins using + `Assets > External Dependency Manager > Version Handler > Update`. + +* `Rename to canonical filenames` is a legacy option that will rename files to + remove version numbers and other labels from filenames. + +* `Prompt for obsolete file deletion` enables the display of a window when + obsolete files are deleted allowing the developer to select which files to + delete and those to keep. + +* `Allow disabling files via renaming` controls whether obsolete or disabled + files should be disabled by renaming them to `myfilename_DISABLED`. Renaming + to disable files is required in some scenarios where Unity doesn't support + removing files from the build via the PluginImporter. + +* `Enable Analytics Reporting` enables/disables usage reporting to plugin + developers to improve the product. + +* `Verbose logging` enables *very* noisy log output that is useful for + debugging while filing a bug report or building a new managed plugin. + +* `Use project settings` saves settings for the plugin in the project rather + than system-wide. + +#### Redistributing a Managed Plugin + +The Version Handler employs a couple of methods for managing version selection, +upgrade and removal of plugins. + +* Each plugin can ship with a manifest file that lists the files it includes. + This makes it possible for Version Handler to calculate the difference in + assets between the most recent release of a plugin and the previous release + installed in a project. If a files are removed the Version Handler will + prompt the user to clean up obsolete files. + +* Plugins can ship using assets with unique names, unique GUIDs and version + number labels. Version numbers can be attached to assets using labels or + added to the filename (e.g `myfile.txt` would be `myfile_version-x.y.z.txt). + This allows the Version Handler to determine which set of files are the same + file at different versions, select the most recent version and prompt the + developer to clean up old versions. + +Unity plugins can be managed by the Version Handler using the following steps: + +1. Add the `gvh` asset label to each asset (file) you want Version Handler to + manage. + +1. Add the `gvh_version-VERSION` label to each asset where `VERSION` is the + version of the plugin you're releasing (e.g 1.2.3). + +1. Add the `gvhp_exportpath-PATH` label to each asset where `PATH` is the + export path of the file when the `.unitypackage` is created. This is used to + track files if they're moved around in a project by developers. + +1. Optional: Add `gvh_targets-editor` label to each editor DLL in your plugin + and disable `editor` as a target platform for the DLL. The Version Handler + will enable the most recent version of this DLL when the plugin is imported. + +1. Optional: If your plugin is included in other Unity plugins, you should add + the version number to each filename and change the GUID of each asset. This + allows multiple versions of your plugin to be imported into a Unity project, + with the Version Handler component activating only the most recent version. + +1. Create a manifest text file named `MY_UNIQUE_PLUGIN_NAME_VERSION.txt` that + lists all the files in your plugin relative to the project root. Then add + the `gvh_manifest` label to the asset to indicate this file is a plugin + manifest. + +1. Optional: Add a `gvhp_manifestname-NAME` label to your manifest file to + provide a human readable name for your package. If this isn't provided the + name of the manifest file will be used as the package name. NAME can match + the pattern `[0-9]+[a-zA-Z -]` where a leading integer will set the priority + of the name where `0` is the highest priority and preferably used as the + display name. The lowest value (i.e highest priority name) will be used as + the display name and all other specified names will be aliases of the + display name. Aliases can refer to previous names of the package allowing + renaming across published versions. + +1. Redistribute EDM4U Unity plugin with your plugin. See the + [Plugin Redistribution](#plugin-redistribution) section for details. + +If you follow these steps: + +* When users import a newer version of your plugin, files referenced by the + older version's manifest are cleaned up. + +* The latest version of the plugin will be selected when users import multiple + packages that include your plugin, assuming the steps in + [Plugin Redistribution](#plugin-redistribution) are followed. + +## Background + +Many Unity plugins have dependencies upon Android specific libraries, iOS +CocoaPods, and sometimes have transitive dependencies upon other Unity plugins. +This causes the following problems: + +* Integrating platform specific (e.g Android and iOS) libraries within a Unity + project can be complex and a burden on a Unity plugin maintainer. +* The process of resolving conflicting dependencies on platform specific + libraries is pushed to the developer attempting to use a Unity plugin. The + developer trying to use your plugin is very likely to give up when faced + with Android or iOS specific build errors. +* The process of resolving conflicting Unity plugins (due to shared Unity + plugin components) is pushed to the developer attempting to use your Unity + plugin. In an effort to resolve conflicts, the developer will very likely + attempt to resolve problems by deleting random files in your plugin, report + bugs when that doesn't work and finally give up. + +EDM4U provides solutions for each of these problems. + +### Android Dependency Management + +The *Android Resolver* component of this plugin will download and integrate +Android library dependencies and handle any conflicts between plugins that share +the same dependencies. + +Without the Android Resolver, typically Unity plugins bundle their AAR and JAR +dependencies, e.g. a Unity plugin `SomePlugin` that requires the Google Play +Games Android library would redistribute the library and its transitive +dependencies in the folder `SomePlugin/Android/`. When a user imports +`SomeOtherPlugin` that includes the same libraries (potentially at different +versions) in `SomeOtherPlugin/Android/`, the developer using `SomePlugin` and +`SomeOtherPlugin` will see an error when building for Android that can be hard +to interpret. + +Using the Android Resolver to manage Android library dependencies: + +* Solves Android library conflicts between plugins. +* Handles all of the various processing steps required to use Android + libraries (AARs, JARs) in Unity 4.x and above projects. Almost all versions + of Unity have - at best - partial support for AARs. +* (Experimental) Supports minification of included Java components without + exporting a project. + +### iOS Dependency Management + +The *iOS Resolver* component of this plugin integrates with +[CocoaPods](https://cocoapods.org/) to download and integrate iOS libraries and +frameworks into the Xcode project Unity generates when building for iOS. Using +CocoaPods allows multiple plugins to utilize shared components without forcing +developers to fix either duplicate or incompatible versions of libraries +included through multiple Unity plugins in their project. + +### Package Manager Registry Setup + +The [Package Manager](https://docs.unity3d.com/Manual/Packages.html) (PM) makes +use of [NPM](https://www.npmjs.com/) registry servers for package hosting and +provides ways to discover, install, upgrade and uninstall packages. This makes +it easier for developers to manage plugins within their projects. + +However, installing additional package registries requires a few manual steps +that can potentially be error prone. The *Package Manager Resolver* component of +this plugin integrates with [PM](https://docs.unity3d.com/Manual/Packages.html) +to provide a way to auto-install PM package registries when a `.unitypackage` is +installed which allows plugin maintainers to ship a `.unitypackage` that can +provide access to their own PM registry server to make it easier for developers +to manage their plugins. + +### Unity Plugin Version Management + +Finally, the *Version Handler* component of this plugin simplifies the process +of managing transitive dependencies of Unity plugins and each plugin's upgrade +process. + +For example, without the Version Handler plugin, if: + +* Unity plugin `SomePlugin` includes `EDM4U` plugin at version 1.1. +* Unity plugin `SomeOtherPlugin` includes `EDM4U` plugin at version 1.2. + +The version of `EDM4U` included in the developer's project depends upon the +order the developer imports `SomePlugin` or `SomeOtherPlugin`. + +This results in: + +* `EDM4U` at version 1.2, if `SomePlugin` is imported then `SomeOtherPlugin` + is imported. +* `EDM4U` at version 1.1, if `SomeOtherPlugin` is imported then `SomePlugin` + is imported. + +The Version Handler solves the problem of managing transitive dependencies by: + +* Specifying a set of packaging requirements that enable a plugin at different + versions to be imported into a Unity project. +* Providing activation logic that selects the latest version of a plugin + within a project. + +When using the Version Handler to manage `EDM4U` included in `SomePlugin` and +`SomeOtherPlugin`, from the prior example, version 1.2 will always be the +version activated in a developer's Unity project. + +Plugin creators are encouraged to adopt this library to ease integration for +their customers. For more information about integrating EDM4U into your own +plugin, see the [Plugin Redistribution](#plugin-redistribution) section of this +document. + +## Analytics + +The External Dependency Manager for Unity plugin by default logs usage to Google +Analytics. The purpose of the logging is to quantitatively measure the usage of +functionality, to gather reports on integration failures and to inform future +improvements to the developer experience of the External Dependency Manager +plugin. Note that the analytics collected are limited to the scope of the EDM4U +plugin’s usage. + +For details of what is logged, please refer to the usage of +`EditorMeasurement.Report()` in the source code. + +## Plugin Redistribution + +If you are a package maintainer and your package depends on EDM4U, it is highly +recommended to use the UPM format and add EDM4U as a dependency. If you must +include it in your `.unitypackage`, redistributing `EDM4U` inside your own +plugin might ease the integration process for your users. + +If you wish to redistribute `EDM4U` inside your plugin, you **must** follow +these steps when importing the `external-dependency-manager-*.unitypackage`, and +when exporting your own plugin package: + +1. Import the `external-dependency-manager-*.unitypackage` into your plugin + project by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), + ensuring that you add the `-gvh_disable` option. +1. Export your plugin by + [running Unity from the command line](https://docs.unity3d.com/Manual/CommandLineArguments.html), + ensuring that you: + - Include the contents of the `Assets/PlayServicesResolver` and + `Assets/ExternalDependencyManager` directory. + - Add the `-gvh_disable` option. + +You **must** specify the `-gvh_disable` option in order for the Version Handler +to work correctly! + +For example, the following command will import the +`external-dependency-manager-1.2.46.0.unitypackage` into the project +`MyPluginProject` and export the entire Assets folder to +`MyPlugin.unitypackage`: + +```shell +Unity -gvh_disable \ + -batchmode \ + -importPackage external-dependency-manager-1.2.46.0.unitypackage \ + -projectPath MyPluginProject \ + -exportPackage Assets MyPlugin.unitypackage \ + -quit +``` + +### Background + +The *Version Handler* component relies upon deferring the load of editor DLLs so +that it can run first and determine the latest version of a plugin component to +activate. The build of `EDM4U` plugin has Unity asset metadata that is +configured so that the editor components are not initially enabled when it's +imported into a Unity project. To maintain this configuration when importing the +`external-dependency-manager.unitypackage` into a Unity plugin project, you +*must* specify the command line option `-gvh_disable` which will prevent the +Version Handler component from running and changing the Unity asset metadata. + +## Building from Source + +To build this plugin from source you need the following tools installed: * Unity +2021 and below (with iOS and Android modules installed) * Java 11 + +You can build the plugin by running the following from your shell (Linux / OSX): + +```shell +./gradlew build + +``` + +or Windows: + +```shell +./gradlew.bat build +``` + +If Java 11 is not your default Java command, add +`-Dorg.gradle.java.home=` to the command above. + +## Testing + +You can run the tests by running the following from your shell (Linux / OSX): + +```shell +./gradlew test +``` + +or Windows: + +```shell +./gradlew.bat test +``` + +The following properties can be set to narrow down the tests to run or change +the test run behavior. + +* `INTERACTIVE_MODE_TESTS_ENABLED` - Default to `1`. Set to `1` to enable + interactive mode tests, which requires GPU on the machine. Otherwise, only + run tests in the batch mode. +* `INCLUDE_TEST_TYPES` - Default to empty string, which means to include every + type of the test. To narrow down the types of test to run, set this + properties with a list of case-insensitive type strings separated by comma. + For instance, `-PINCLUDE_TEST_TYPES="Python,NUnit"` means to include only + Python tests and NUnit tests. See `TestTypeEnum` in `build.gradle` for + available options. +* `EXCLUDE_TEST_TYPES` - Default to empty string, which means to exclude none. + To add types of tests to exclude, set this properties with a list of + case-insensitive type strings separated by comma. For instance, + `-PEXCLUDE_TEST_TYPES="Python,NUnit"` means to exclude Python tests and + NUnit tests. See `TestTypeEnum` in `build.gradle` for available options. +* `INCLUDE_TEST_MODULES` - Default to empty string, which means to include the + tests for every modules. To narrow down modules to test, set this properties + with a list of case-insensitive module strings separated by comma. For + instance, `-PINCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests + for tools and Android Resolver only. See `TestModuleEnum` in `build.gradle` + for available options. +* `EXCLUDE_TEST_MODULES` - Default to empty string, which means to exclude + none. To add modules to exclude, set this properties with a list of + case-insensitive module strings separated by comma. For instance, + `-PEXCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests for any + modules other than tools and Android Resolver. See `TestModuleEnum` in + `build.gradle` for available options. +* `EXCLUDE_TESTS` - Default to empty string, which means to exclude none. To + add tests to exclude, set this properties with a list of case-insensitive + test names separated by comma. For instance, + `-PEXCLUDE_TESTS="testGenGuids,testDownloadArtifacts"` means to run tests + except the tests with name of `testGenGuids` and `testDownloadArtifacts`. +* `CONTINUE_ON_FAIL_FOR_TESTS_ENABLED` - Default to `1`. Set to `1` to + continue running the next test when the current one fails. Otherwise, the + build script stops whenever any test fails. + +For instance, by running the following command, it only runs the Unity +integration tests that does not requires GPU, but exclude tests for Android +Resolver module and iOS Resolver module. + +```shell +./gradlew test \ + -PINTERACTIVE_MODE_TESTS_ENABLED=0 \ + -PINCLUDE_TEST_TYPES="Integration" \ + -PEXCLUDE_TEST_MODULES="AndroidResolver,iOSResolver" +``` + +## Releasing + +Each time a new build of this plugin is checked into the source tree you need to +do the following: + +* Bump the plugin version variable `pluginVersion` in `build.gradle` +* Update `CHANGELOG.md` with the new version number and changes included in + the release. +* Build the release using `./gradlew release` which performs the following: + * Updates `external-dependency-manager-*.unitypackage` + * Copies the unpacked plugin to the `exploded` directory. + * Updates template metadata files in the `plugin` directory. The GUIDs of + all asset metadata is modified due to the version number change. Each + file within the plugin is versioned to allow multiple versions of the + plugin to be imported into a Unity project which allows the most recent + version to be activated by the Version Handler component. +* Create release commit using `./gradlew gitCreateReleaseCommit` which + performs `git commit -a -m "description from CHANGELOG.md"` +* Once the release commit is merge, tag the release using `./gradlew + gitTagRelease` which performs the following: + * `git tag -a pluginVersion -m "version RELEASE"` to tag the release. +* Update tags on remote branch using `git push --tag REMOTE HEAD:master` diff --git a/upm/README.md.meta b/upm/README.md.meta new file mode 100644 index 00000000..a768cca5 --- /dev/null +++ b/upm/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cbbebcaa6ecb4b9582dce440a386de75 +labels: +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-README.md +timeCreated: 0 diff --git a/upm/package.json b/upm/package.json new file mode 100755 index 00000000..6d0b27ea --- /dev/null +++ b/upm/package.json @@ -0,0 +1,25 @@ +{ + "name": "com.google.external-dependency-manager", + "version": "1.2.186", + "displayName": "External Dependency Manager for Unity", + "keywords": [ + "Google", + "Android", + "Gradle", + "Cocoapods", + "Dependency", + "Unity Package Manager", + "Unity", + "vh-name:play-services-resolver", + "vh-name:unity-jar-resolver", + "vh-name:external-dependency-manager", + "vh-name:External Dependency Manager for Unity" + ], + "author": { + "name": "Google LLC", + "url": "https://github.com/googlesamples/unity-jar-resolver" + }, + "description": "External Dependency Manager for Unity (EDM4U) can be used by any Unity plugin that requires Android specific libraries (e.g. AARs), iOS CocoaPods, version management of transitive dependencies, and/or management of Unity Package Manager registries.", + "unity": "2019.1", + "dependencies": {} +} \ No newline at end of file diff --git a/upm/package.json.meta b/upm/package.json.meta new file mode 100644 index 00000000..f5581030 --- /dev/null +++ b/upm/package.json.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9bed450d5c03481d87e61b61431cf00a +labels: +- gupmr_manifest +- gvh +- gvh_version-1.2.186 +- gvhp_exportpath-package.json +timeCreated: 0