public string Transform(XDocument document)
        {
            if (!_initialized)
            {
                throw new BuildToolNotInitializedException(this);
            }

            if (!_isInstant)
            {
                return(null);
            }

            if (PlayInstantBuildConfig.PlayGamesEnabled)
            {
                return
                    ("\n\nAsset packs aren't compatible with full Instant play games. As a workaround, deselect the " +
                     "\"Full Instant play game\" checkbox and contact the Instant play team via " +
                     "http://g.co/play/instant");
            }

            var error = AndroidManifestHelper.ConvertAssetPackManifestToInstant(document);

            if (!string.IsNullOrEmpty(error))
            {
                return("Asset Module AndroidManifest could not be converted to instant: " + error);
            }

            return(null);
        }
Example #2
0
        public string SwitchToInstant()
        {
            XDocument doc;

            if (File.Exists(AndroidManifestAssetsPath))
            {
                Debug.LogFormat("Loading existing file {0}", AndroidManifestAssetsPath);
                doc = XDocument.Load(AndroidManifestAssetsPath);
            }
            else
            {
                Debug.Log("Creating new manifest file");
                doc = AndroidManifestHelper.CreateManifestXDocument();
            }

            var errorMessage = AndroidManifestHelper.ConvertManifestToInstant(doc);

            if (errorMessage != null)
            {
                return(errorMessage);
            }

            if (!Directory.Exists(AndroidManifestAssetsDirectory))
            {
                Directory.CreateDirectory(AndroidManifestAssetsDirectory);
            }

            doc.Save(AndroidManifestAssetsPath);

            Debug.LogFormat("Successfully updated {0}", AndroidManifestAssetsPath);
            return(null);
        }
Example #3
0
        public void SwitchToInstalled()
        {
            if (!File.Exists(AndroidManifestAssetsPath))
            {
                Debug.LogFormat("Nothing to do for {0} since file does not exist", AndroidManifestAssetsPath);
                return;
            }

            Debug.LogFormat("Loading existing file {0}", AndroidManifestAssetsPath);
            var doc = XDocument.Load(AndroidManifestAssetsPath);

            AndroidManifestHelper.ConvertManifestToInstalled(doc);
            doc.Save(AndroidManifestAssetsPath);
            Debug.LogFormat("Successfully updated {0}", AndroidManifestAssetsPath);
        }
        public string Transform(XDocument document)
        {
            if (!_initialized)
            {
                throw new BuildToolNotInitializedException(this);
            }

            if (!_isInstant)
            {
                return(null);
            }

            var error = AndroidManifestHelper.ConvertAssetPackManifestToInstant(document);

            if (!string.IsNullOrEmpty(error))
            {
                return("Asset Module AndroidManifest could not be converted to instant: " + error);
            }

            return(null);
        }