-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bundled multidex jar #124
Bundled multidex jar #124
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<UsingTask TaskName="Xamarin.Android.Tools.BootstrapTasks.GenerateProfile" AssemblyFile="..\..\bin\Build$(Configuration)\Xamarin.Android.Tools.BootstrapTasks.dll" /> | ||
<UsingTask TaskName="Xamarin.Android.Tools.BootstrapTasks.UnzipDirectoryChildren" AssemblyFile="..\..\bin\Build$(Configuration)\Xamarin.Android.Tools.BootstrapTasks.dll" /> | ||
<PropertyGroup> | ||
<_SharedRuntimeBuildPath Condition=" '$(_SharedRuntimeBuildPath)' == '' ">..\..\bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid\</_SharedRuntimeBuildPath> | ||
<_GeneratedProfileClass>$(IntermediateOutputPath)Profile.g.cs</_GeneratedProfileClass> | ||
<BuildDependsOn> | ||
$(BuildDependsOn); | ||
_CopyExtractedMultiDexJar; | ||
</BuildDependsOn> | ||
<_AndroidSdkLocation>$(ANDROID_SDK_PATH)</_AndroidSdkLocation> | ||
<_AndroidSdkLocation Condition="'$(_AndroidSdkLocation)'==''">$(AndroidToolchainDirectory)\sdk</_AndroidSdkLocation> | ||
<_MultiDexAarInAndroidSdk>extras\android\m2repository\com\android\support\multidex\1.0.1\multidex-1.0.1.aar</_MultiDexAarInAndroidSdk> | ||
<_SupportLicenseInAndroidSdk>extras\android\m2repository\NOTICE.txt</_SupportLicenseInAndroidSdk> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<_SharedRuntimeAssemblies Include="$(_SharedRuntimeBuildPath)v1.0\*.dll;$(_SharedRuntimeBuildPath)$(AndroidFrameworkVersion)\*.dll"/> | ||
|
@@ -19,4 +28,19 @@ | |
Lines="$(_GeneratedProfileClass)" | ||
Overwrite="false"/> | ||
</Target> | ||
|
||
<Target Name="_CopyExtractedMultiDexJar" | ||
Inputs="$(_AndroidSdkLocation)\$(_MultiDexAarInAndroidSdk);$(_AndroidSdkLocation)\$(_SupportLicenseInAndroidSdk)" | ||
Outputs="$(OutputPath)..\..\..\mandroid\android-support-multidex.jar;$(OutputPath)..\..\..\mandroid\MULTIDEX_JAR_LICENSE"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Too cosmetic to change. |
||
<UnzipDirectoryChildren | ||
NoSubdirectory="true" | ||
SourceFiles="$(_AndroidSdkLocation)\$(_MultiDexAarInAndroidSdk)" | ||
DestinationFolder="$(IntermediateOutputPath)multidex-aar" /> | ||
<Copy | ||
SourceFiles="$(IntermediateOutputPath)multidex-aar\classes.jar" | ||
DestinationFiles="$(OutputPath)..\..\..\mandroid\android-support-multidex.jar" /> | ||
<Copy | ||
SourceFiles="$(_AndroidSdkLocation)\$(_SupportLicenseInAndroidSdk)" | ||
DestinationFiles="$(OutputPath)..\..\..\mandroid\MULTIDEX_JAR_LICENSE" /> | ||
</Target> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ public UnzipDirectoryChildren () | |
[Required] | ||
public ITaskItem DestinationFolder { get; set; } | ||
|
||
public bool NoSubdirectory { get; set; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this property name. Let's try to find a better one... The reason the task is In an ideal world, I think we'd want a separate task, but that's also ugly. Perhaps I'll I'm sure of is that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change follows the "keep changes minimum" principle. If you make your suggested change, that affects other build targets. Such a semantic change should be done in separate PR. |
||
|
||
public override bool Execute () | ||
{ | ||
Log.LogMessage (MessageImportance.Low, "Unzip:"); | ||
|
@@ -101,7 +103,9 @@ async TTask ExtractFile (string tempDir, string sourceFile, string relativeDestD | |
p.WaitForExit (); | ||
} | ||
|
||
foreach (var dir in Directory.EnumerateDirectories (nestedTemp, "*")) { | ||
var dirs = NoSubdirectory ? new string [] { nestedTemp } : Directory.EnumerateDirectories (nestedTemp, "*"); | ||
|
||
foreach (var dir in dirs) { | ||
foreach (var fse in Directory.EnumerateFileSystemEntries (dir)) { | ||
var name = Path.GetFileName (fse); | ||
var destDir = string.IsNullOrEmpty (relativeDestDir) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be the
$(AndroidSdkFullPath)
MSBuild property. Nothing is going to export an$(ANDROID_SDK_PATH)
environment variable.The
$(AndroidSdkFullPath)
property is brought in through the importing ofConfiguration.props
inXamarin.Android.Build.Tasks.csproj
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelatedly: Please fix your editor to expand tabs into spaces on
.targets
files and other XML files, with 2 space indents.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. monodroid does export that environment variable. Want me to eliminate the variables that are used ONLY in monodroid in the same manner? For example, InstantRunEnabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should happen for "pure" xamarin-android builds?
$(ANDROID_SDK_PATH)
won't be set, so e.g.$(_AndroidSdkLocation)\$(_MultiDexAarInAndroidSdk)
will be/extras/android/...
, which won't be readable or writable, and might result in a xamarin-android build error.That seems less than desirable.
Perhaps this should use a fallback?
This should allow xamarin-android to build while allowing the monodroid build to override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they can be removed, that would likely be best. If they can't be removed -- which may be the case for
$(_InstantRunEnabled)
, which is used with the<DetermineJavaLibrariesToCompile/>
task -- then perhaps it should be renamed to be something more meaningful w/o context/memory/history.For example, instead of
DetermineJavaLibrariesToCompile.EnableInstantRun
, rename it toDetermineJavaLibrariesToCompile.SkipMonoPlatformJar
. For those just readingXamarin.Android.Common.targets
, I assume that seeingSkipMonoPlatformJar="$(_SkipMonoPlatformJar)"
would be more meaningful thanEnableInstantRun="$(_InstantRunEnabled)"
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pure xamarin-android configuration for _AndroidSdkLocation is defined immediately below.