Skip to content

Commit 7f7e56e

Browse files
committed
Remove XPath reference
1 parent 4fa778f commit 7f7e56e

File tree

7 files changed

+39
-10
lines changed

7 files changed

+39
-10
lines changed

AdvancedSharpAdbClient.Tests/AdvancedSharpAdbClient.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
</Choose>
2121

2222
<ItemGroup>
23-
<PackageReference Include="coverlet.msbuild" Version="6.0.3" PrivateAssets="all">
23+
<PackageReference Include="coverlet.msbuild" Version="6.0.4" PrivateAssets="all">
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2525
</PackageReference>
26-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
26+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
2727
<PackageReference Include="NSubstitute" Version="5.3.0" />
28-
<PackageReference Include="xunit" Version="2.9.2" />
29-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0" PrivateAssets="all">
28+
<PackageReference Include="xunit" Version="2.9.3" />
29+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" PrivateAssets="all">
3030
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3131
</PackageReference>
3232
</ItemGroup>

AdvancedSharpAdbClient/AdvancedSharpAdbClient.csproj

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@
104104

105105
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard1.3'))
106106
and !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net1.1'))
107-
and !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.0'))">
108-
<PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
107+
and !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.0'))
108+
and !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'uap'))">
109+
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
109110
</ItemGroup>
110111

111112
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.0'))
@@ -127,12 +128,12 @@
127128
and $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net3.5-client')))">
128129
<DefineConstants>$(DefineConstants);HAS_TASK</DefineConstants>
129130
</PropertyGroup>
130-
131+
131132
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'uap'))
132133
or $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net5.0-windows10.0.17763.0'))">
133134
<DefineConstants>$(DefineConstants);HAS_WINRT</DefineConstants>
134135
</PropertyGroup>
135-
136+
136137
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'uap'))">
137138
<DefineConstants>$(DefineConstants);HAS_WUXC</DefineConstants>
138139
</PropertyGroup>
@@ -141,6 +142,12 @@
141142
<DefineConstants>$(DefineConstants);HAS_IMAGING</DefineConstants>
142143
</PropertyGroup>
143144

145+
<PropertyGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard1.3'))
146+
or $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net1.1'))
147+
or $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard2.0'))">
148+
<DefineConstants>$(DefineConstants);HAS_XPATH</DefineConstants>
149+
</PropertyGroup>
150+
144151
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net4.7'))
145152
or $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp1.0'))
146153
or (!($([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETFramework')

AdvancedSharpAdbClient/DeviceCommands/DeviceClient.Async.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ public async Task<AppStatus> GetAppStatusAsync(string packageName, CancellationT
256256
return isAppRunning ? AppStatus.Background : AppStatus.Stopped;
257257
}
258258

259+
#if HAS_XPATH
259260
/// <summary>
260261
/// Gets element by xpath asynchronously. You can specify the waiting time in timeout.
261262
/// </summary>
@@ -414,6 +415,7 @@ public async IAsyncEnumerable<Element> FindAsyncElements(string xpath = "hierarc
414415
if (cancellationToken == default) { break; }
415416
}
416417
}
418+
#endif
417419
#endif
418420

419421
/// <summary>

AdvancedSharpAdbClient/DeviceCommands/DeviceClient.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ public AppStatus GetAppStatus(string packageName)
273273
return isAppRunning ? AppStatus.Background : AppStatus.Stopped;
274274
}
275275

276+
#if HAS_XPATH
276277
/// <summary>
277278
/// Gets element by xpath. You can specify the waiting time in timeout.
278279
/// </summary>
@@ -357,6 +358,7 @@ public IEnumerable<Element> FindElements(string xpath = "hierarchy/node", TimeSp
357358
}
358359
while (stopwatch.Elapsed < timeout);
359360
}
361+
#endif
360362

361363
/// <summary>
362364
/// Send key event to specific. You can see key events here https://developer.android.com/reference/android/view/KeyEvent.

AdvancedSharpAdbClient/DeviceCommands/DeviceExtensions.Async.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public static Task SwipeAsync(this IAdbClient client, DeviceData device, Point f
9797
public static Task<AppStatus> GetAppStatusAsync(this IAdbClient client, DeviceData device, string packageName, CancellationToken cancellationToken = default) =>
9898
new DeviceClient(client, device).GetAppStatusAsync(packageName, cancellationToken);
9999

100+
#if HAS_XPATH
100101
/// <summary>
101102
/// Asynchronously get element by xpath. You can specify the waiting time in timeout.
102103
/// </summary>
@@ -121,6 +122,21 @@ public static Task<AppStatus> GetAppStatusAsync(this IAdbClient client, DeviceDa
121122
public static Task<IEnumerable<Element>> FindElementsAsync(this IAdbClient client, DeviceData device, string xpath = "hierarchy/node", CancellationToken cancellationToken = default) =>
122123
new DeviceClient(client, device).FindElementsAsync(xpath, cancellationToken);
123124

125+
#if COMP_NETSTANDARD2_1
126+
/// <summary>
127+
/// Gets elements by xpath asynchronously. You can specify the waiting time in timeout.
128+
/// </summary>
129+
/// <param name="client">The <see cref="IAdbClient"/> to use when executing the command.</param>
130+
/// <param name="device">The device on which to run the command.</param>
131+
/// <param name="xpath">The xpath of the elements.</param>
132+
/// <param name="cancellationToken">A <see cref="CancellationToken"/> which can be used to cancel the asynchronous operation.
133+
/// Only check once if <see langword="default"/>. Or it will continue check until <see cref="CancellationToken.IsCancellationRequested"/> is <see langword="true"/>.</param>
134+
/// <returns>The <see cref="IAsyncEnumerable{Element}"/> of <see cref="Element"/> has got.</returns>
135+
public static IAsyncEnumerable<Element> FindAsyncElements(this IAdbClient client, DeviceData device, string xpath = "hierarchy/node", CancellationToken cancellationToken = default) =>
136+
new DeviceClient(client, device).FindAsyncElements(xpath, cancellationToken);
137+
#endif
138+
#endif
139+
124140
/// <summary>
125141
/// Asynchronously send key event to specific. You can see key events here https://developer.android.com/reference/android/view/KeyEvent.
126142
/// </summary>

AdvancedSharpAdbClient/DeviceCommands/DeviceExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public static void Swipe(this IAdbClient client, DeviceData device, Point first,
8686
public static AppStatus GetAppStatus(this IAdbClient client, DeviceData device, string packageName) =>
8787
new DeviceClient(client, device).GetAppStatus(packageName);
8888

89+
#if HAS_XPATH
8990
/// <summary>
9091
/// Gets element by xpath. You can specify the waiting time in timeout.
9192
/// </summary>
@@ -109,6 +110,7 @@ public static AppStatus GetAppStatus(this IAdbClient client, DeviceData device,
109110
/// <returns>The <see cref="IEnumerable{Element}"/> of <see cref="Element"/> has got.</returns>
110111
public static IEnumerable<Element> FindElements(this IAdbClient client, DeviceData device, string xpath = "hierarchy/node", TimeSpan timeout = default) =>
111112
new DeviceClient(client, device).FindElements(xpath, timeout);
113+
#endif
112114

113115
/// <summary>
114116
/// Send key event to specific. You can see key events here https://developer.android.com/reference/android/view/KeyEvent.

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<AssemblyTitle>.NET client for adb, the Android Debug Bridge (AdvancedSharpAdbClient)</AssemblyTitle>
55
<Authors>The Android Open Source Project, Ryan Conrad, Quamotion and improved by yungd1plomat and wherewhere</Authors>
66
<ContinuousIntegrationBuild>True</ContinuousIntegrationBuild>
7-
<Copyright>Copyright © 2021 - 2024 SharpAdb. All Rights Reserved.</Copyright>
7+
<Copyright>Copyright © 2021 - 2025 SharpAdb. All Rights Reserved.</Copyright>
88
<Description>AdvancedSharpAdbClient is a .NET library that allows .NET, Mono, Unity applications to communicate with Android devices. It's a improved version of SharpAdbClient.</Description>
99
<Deterministic>True</Deterministic>
1010
<EmbedUntrackedSources>True</EmbedUntrackedSources>
@@ -23,7 +23,7 @@
2323
<RepositoryUrl>https://github.com/SharpAdb/AdvancedSharpAdbClient</RepositoryUrl>
2424
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
2525
<Title>.NET client for adb, Android Debug Bridge (AdvancedSharpAdbClient)</Title>
26-
<VersionPrefix>3.3.14</VersionPrefix>
26+
<VersionPrefix>3.4.14</VersionPrefix>
2727
</PropertyGroup>
2828

2929
<PropertyGroup>

0 commit comments

Comments
 (0)