chunk 2: remaining non-audio non-NewImport assets
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
// Copyright 2018 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
|
||||
//
|
||||
// https://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.Xml.Linq;
|
||||
using Google.Android.AppBundle.Editor.AssetPacks;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.AndroidManifest
|
||||
{
|
||||
/// <summary>
|
||||
/// A helper class for creating asset pack AndroidManifest xml documents.
|
||||
/// </summary>
|
||||
public static class AssetPackManifestHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new XDocument representing the AndroidManifest.xml for an asset pack.
|
||||
/// </summary>
|
||||
/// <param name="packageName">Package name of this application.</param>
|
||||
/// <param name="assetPackName">The name of the asset pack.</param>
|
||||
/// <param name="deliveryMode">The <see cref="AssetPackDeliveryMode"/> of this asset pack.</param>
|
||||
public static XDocument CreateAssetPackManifestXDocument(
|
||||
string packageName, string assetPackName, AssetPackDeliveryMode deliveryMode)
|
||||
{
|
||||
// TODO(b/129943210): Add support for <dist:instant-delivery>
|
||||
var deliveryTypeXName = ManifestConstants.DistDeliveryXName;
|
||||
XName deliveryModeXName;
|
||||
switch (deliveryMode)
|
||||
{
|
||||
case AssetPackDeliveryMode.OnDemand:
|
||||
deliveryModeXName = ManifestConstants.DistOnDemandXName;
|
||||
break;
|
||||
case AssetPackDeliveryMode.InstallTime:
|
||||
deliveryModeXName = ManifestConstants.DistInstallTimeName;
|
||||
break;
|
||||
case AssetPackDeliveryMode.FastFollow:
|
||||
deliveryModeXName = ManifestConstants.DistFastFollowName;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Unexpected delivery mode: " + deliveryMode, "deliveryMode");
|
||||
}
|
||||
|
||||
var moduleElement = new XElement(
|
||||
ManifestConstants.DistModuleXName,
|
||||
new XAttribute(ManifestConstants.DistTypeXName, ManifestConstants.AssetPack),
|
||||
new XElement(deliveryTypeXName,
|
||||
new XElement(deliveryModeXName)),
|
||||
new XElement(ManifestConstants.DistFusingXName,
|
||||
new XAttribute(ManifestConstants.DistIncludeXName, ManifestConstants.ValueTrue))
|
||||
);
|
||||
|
||||
return new XDocument(new XElement(
|
||||
ManifestConstants.Manifest,
|
||||
new XAttribute(ManifestConstants.AndroidXmlns, XNamespace.Get(ManifestConstants.AndroidNamespaceUrl)),
|
||||
new XAttribute(ManifestConstants.DistXmlns, XNamespace.Get(ManifestConstants.DistNamespaceUrl)),
|
||||
new XAttribute(ManifestConstants.Package, packageName),
|
||||
new XAttribute(ManifestConstants.Split, assetPackName),
|
||||
moduleElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3c4c13f33e6f48dc9e8130d699f1428
|
||||
timeCreated: 1540331105
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
// Copyright 2019 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
|
||||
//
|
||||
// https://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.Xml.Linq;
|
||||
using Google.Android.AppBundle.Editor.Internal.BuildTools;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.AndroidManifest
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides an interface to modify the AndroidManifest xml documents configured for asset packs.
|
||||
/// </summary>
|
||||
public interface IAssetPackManifestTransformer : IBuildTool
|
||||
{
|
||||
/// <summary>
|
||||
/// Modifies the specified AndroidManifest xml document. Returns an error message if the operation fails and
|
||||
/// null otherwise.
|
||||
/// </summary>
|
||||
string Transform(XDocument document);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 12432c2ade03483e9e956f11ddde2992
|
||||
timeCreated: 1574716612
|
||||
@@ -0,0 +1,66 @@
|
||||
// Copyright 2019 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
|
||||
//
|
||||
// https://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.Xml.Linq;
|
||||
|
||||
namespace Google.Android.AppBundle.Editor.Internal.AndroidManifest
|
||||
{
|
||||
/// <summary>
|
||||
/// String constants used by AndroidManifest.xml files.
|
||||
/// </summary>
|
||||
public static class ManifestConstants
|
||||
{
|
||||
public const string Action = "action";
|
||||
public const string Activity = "activity";
|
||||
public const string Application = "application";
|
||||
public const string AssetPack = "asset-pack";
|
||||
public const string Category = "category";
|
||||
public const string Data = "data";
|
||||
public const string IntentFilter = "intent-filter";
|
||||
public const string Manifest = "manifest";
|
||||
public const string Package = "package";
|
||||
public const string Service = "service";
|
||||
public const string Split = "split";
|
||||
public const string ValueTrue = "true";
|
||||
|
||||
public const string AndroidNamespaceAlias = "android";
|
||||
public const string AndroidNamespaceUrl = "http://schemas.android.com/apk/res/android";
|
||||
public static readonly XName AndroidXmlns = XNamespace.Xmlns + AndroidNamespaceAlias;
|
||||
public static readonly XName AndroidEnabledXName = XName.Get("enabled", AndroidNamespaceUrl);
|
||||
public static readonly XName AndroidIconXName = XName.Get("icon", AndroidNamespaceUrl);
|
||||
public static readonly XName AndroidLabelXName = XName.Get("label", AndroidNamespaceUrl);
|
||||
public static readonly XName AndroidNameXName = XName.Get("name", AndroidNamespaceUrl);
|
||||
|
||||
public static readonly XName AndroidTargetSandboxVersionXName =
|
||||
XName.Get("targetSandboxVersion", AndroidNamespaceUrl);
|
||||
|
||||
public const string DistNamespaceAlias = "dist";
|
||||
public const string DistNamespaceUrl = "http://schemas.android.com/apk/distribution";
|
||||
public static readonly XName DistXmlns = XNamespace.Xmlns + DistNamespaceAlias;
|
||||
public static readonly XName DistDeliveryXName = XName.Get("delivery", DistNamespaceUrl);
|
||||
public static readonly XName DistFastFollowName = XName.Get("fast-follow", DistNamespaceUrl);
|
||||
public static readonly XName DistFusingXName = XName.Get("fusing", DistNamespaceUrl);
|
||||
public static readonly XName DistIncludeXName = XName.Get("include", DistNamespaceUrl);
|
||||
public static readonly XName DistInstallTimeName = XName.Get("install-time", DistNamespaceUrl);
|
||||
public static readonly XName DistInstantXName = XName.Get("instant", DistNamespaceUrl);
|
||||
public static readonly XName DistModuleXName = XName.Get("module", DistNamespaceUrl);
|
||||
public static readonly XName DistOnDemandXName = XName.Get("on-demand", DistNamespaceUrl);
|
||||
public static readonly XName DistTypeXName = XName.Get("type", DistNamespaceUrl);
|
||||
|
||||
public const string ToolsNamespaceAlias = "tools";
|
||||
public const string ToolsNamespaceUrl = "http://schemas.android.com/tools";
|
||||
public static readonly XName ToolsXmlns = XNamespace.Xmlns + ToolsNamespaceAlias;
|
||||
public static readonly XName ToolsReplaceXName = XName.Get("replace", ToolsNamespaceUrl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16b5ed2898b684f67ab9286244de2e19
|
||||
timeCreated: 1556563916
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user