|
348 | 348 | Condition=" '$(HostOS)' != 'Windows' " |
349 | 349 | Command="unzip -q -o "$(_ZipPath)" -d "$(_StagingDir)"" |
350 | 350 | /> |
351 | | - <ItemGroup Condition=" '$(HostOS)' != 'Windows' And '$(_StripComponents)' == '1' "> |
| 351 | + <ItemGroup Condition=" '$(HostOS)' != 'Windows' And '$(_StripComponents)' == '1' And Exists('$(_StagingDir)') "> |
352 | 352 | <_StagedTopDir Remove="@(_StagedTopDir)" /> |
353 | 353 | <_StagedTopDir Include="$([System.IO.Directory]::GetDirectories('$(_StagingDir)'))" /> |
354 | 354 | </ItemGroup> |
355 | 355 | <PropertyGroup Condition=" '$(HostOS)' != 'Windows' "> |
356 | 356 | <_GlobRoot Condition=" '$(_StripComponents)' == '1' ">@(_StagedTopDir)</_GlobRoot> |
357 | 357 | <_GlobRoot Condition=" '$(_StripComponents)' == '0' ">$(_StagingDir)</_GlobRoot> |
358 | 358 | </PropertyGroup> |
359 | | - <ItemGroup Condition=" '$(HostOS)' != 'Windows' "> |
| 359 | + <ItemGroup Condition=" '$(HostOS)' != 'Windows' And '$(_GlobRoot)' != '' "> |
360 | 360 | <_StagedFile Remove="@(_StagedFile)" /> |
361 | 361 | <_StagedFile Include="$(_GlobRoot)\**\*" /> |
362 | 362 | </ItemGroup> |
|
366 | 366 | DestinationFiles="@(_StagedFile->'$(_DestDir)\%(RecursiveDir)%(Filename)%(Extension)')" |
367 | 367 | /> |
368 | 368 | <RemoveDir Condition=" '$(HostOS)' != 'Windows' " Directories="$(_StagingDir)" /> |
| 369 | + <Error |
| 370 | + Condition=" !Exists('$(_DestDir)\source.properties') " |
| 371 | + Text="Expected Android SDK package '%(_AndroidSdkPackage.Identity)' to extract source.properties under '$(_DestDir)'." |
| 372 | + /> |
| 373 | + <!-- Unzip preserves archive mtimes, so refresh the sentinel used by MSBuild Outputs. --> |
| 374 | + <Touch Files="$(_DestDir)\source.properties" /> |
369 | 375 | </Target> |
370 | 376 |
|
371 | 377 | <!-- |
372 | 378 | Generate `package.xml` for components whose upstream zip omits one (e.g. emulator). |
373 | 379 | Reads `package.xml.in` next to this targets file and replaces the `@PKG_*@` |
374 | 380 | placeholders from per-item metadata (PkgPath/PkgDesc/PkgRevision). |
375 | 381 | --> |
376 | | - <Target Name="_GenerateAndroidPackageXmls" |
377 | | - DependsOnTargets="_ExtractAndroidSdkPackages" |
378 | | - Inputs="$(MSBuildThisFileDirectory)package.xml.in;@(_AndroidSdkPackage->'%(Destination)\source.properties')" |
379 | | - Outputs="@(_AndroidSdkPackage->'%(Destination)\package.xml')"> |
| 382 | + <Target Name="_AddGeneratedPackageXmls"> |
380 | 383 | <ItemGroup> |
381 | | - <_PkgXmlItem Include="@(_AndroidSdkPackage)" |
| 384 | + <_GeneratedPackageXml Remove="@(_GeneratedPackageXml)" /> |
| 385 | + <_GeneratedPackageXml Include="@(_AndroidSdkPackage)" |
382 | 386 | Condition=" '%(_AndroidSdkPackage.GeneratePackageXml)' == 'true' " /> |
383 | 387 | </ItemGroup> |
| 388 | + </Target> |
| 389 | + |
| 390 | + <Target Name="_GenerateAndroidPackageXmls" |
| 391 | + DependsOnTargets="_ExtractAndroidSdkPackages;_AddGeneratedPackageXmls" |
| 392 | + Inputs="$(MSBuildThisFileDirectory)package.xml.in;@(_GeneratedPackageXml->'%(Destination)\source.properties')" |
| 393 | + Outputs="@(_GeneratedPackageXml->'%(Destination)\package.xml')"> |
384 | 394 | <WriteLinesToFile |
385 | | - File="%(_PkgXmlItem.Destination)\package.xml" |
386 | | - Lines="$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)package.xml.in').Replace('@PKG_PATH@', '%(_PkgXmlItem.PkgPath)').Replace('@PKG_DESC@', '%(_PkgXmlItem.PkgDesc)').Replace('@PKG_REVISION_MAJOR@', $([System.Version]::Parse('%(_PkgXmlItem.PkgRevision)').Major.ToString())).Replace('@PKG_REVISION_MINOR@', $([System.Version]::Parse('%(_PkgXmlItem.PkgRevision)').Minor.ToString())).Replace('@PKG_REVISION_MICRO@', $([System.Version]::Parse('%(_PkgXmlItem.PkgRevision)').Build.ToString())))" |
| 395 | + File="%(_GeneratedPackageXml.Destination)\package.xml" |
| 396 | + Lines="$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)package.xml.in').Replace('@PKG_PATH@', '%(_GeneratedPackageXml.PkgPath)').Replace('@PKG_DESC@', '%(_GeneratedPackageXml.PkgDesc)').Replace('@PKG_REVISION_MAJOR@', $([System.Version]::Parse('%(_GeneratedPackageXml.PkgRevision)').Major.ToString())).Replace('@PKG_REVISION_MINOR@', $([System.Version]::Parse('%(_GeneratedPackageXml.PkgRevision)').Minor.ToString())).Replace('@PKG_REVISION_MICRO@', $([System.Version]::Parse('%(_GeneratedPackageXml.PkgRevision)').Build.ToString())))" |
387 | 397 | Overwrite="true" |
388 | 398 | /> |
389 | 399 | </Target> |
|
0 commit comments