@@ -15,14 +15,21 @@ public class Setup(Release release) {
1515 /// The release to download and install.
1616 /// </summary>
1717 public Release Release => release ;
18+
19+ /// <summary>
20+ /// Downloads and extracts the ZIP archive of Apache Ant.
21+ /// </summary>
22+ /// <param name="optionalTasks">Value indicating whether to fetch the Ant optional tasks.</param>
23+ /// <returns>The path to the extracted directory.</returns>
24+ public string Download ( bool optionalTasks = false ) => DownloadAsync ( optionalTasks , CancellationToken . None ) . GetAwaiter ( ) . GetResult ( ) ;
1825
1926 /// <summary>
2027 /// Downloads and extracts the ZIP archive of Apache Ant.
2128 /// </summary>
2229 /// <param name="optionalTasks">Value indicating whether to fetch the Ant optional tasks.</param>
2330 /// <param name="cancellationToken">The token to cancel the operation.</param>
2431 /// <returns>The path to the extracted directory.</returns>
25- public async Task < string > Download ( bool optionalTasks = false , CancellationToken cancellationToken = default ) {
32+ public async Task < string > DownloadAsync ( bool optionalTasks = false , CancellationToken cancellationToken = default ) {
2633 using var httpClient = new HttpClient ( ) ;
2734 var version = GetType ( ) . Assembly . GetName ( ) . Version ! ;
2835 httpClient . DefaultRequestHeaders . Add ( "User-Agent" , $ ".NET/{ Environment . Version . ToString ( 3 ) } | SetupAnt/{ version . ToString ( 3 ) } ") ;
@@ -39,15 +46,22 @@ public async Task<string> Download(bool optionalTasks = false, CancellationToken
3946 if ( optionalTasks ) await FetchOptionalTasks ( antHome ) ;
4047 return antHome ;
4148 }
49+
50+ /// <summary>
51+ /// Installs Apache Ant, after downloading it.
52+ /// </summary>
53+ /// <param name="optionalTasks">Value indicating whether to fetch the Ant optional tasks.</param>
54+ /// <returns>The path to the installation directory.</returns>
55+ public string Install ( bool optionalTasks = false ) => InstallAsync ( optionalTasks , CancellationToken . None ) . GetAwaiter ( ) . GetResult ( ) ;
4256
4357 /// <summary>
4458 /// Installs Apache Ant, after downloading it.
4559 /// </summary>
4660 /// <param name="optionalTasks">Value indicating whether to fetch the Ant optional tasks.</param>
4761 /// <param name="cancellationToken">The token to cancel the operation.</param>
4862 /// <returns>The path to the installation directory.</returns>
49- public async Task < string > Install ( bool optionalTasks = false , CancellationToken cancellationToken = default ) {
50- var antHome = await Download ( optionalTasks , cancellationToken ) ;
63+ public async Task < string > InstallAsync ( bool optionalTasks = false , CancellationToken cancellationToken = default ) {
64+ var antHome = await DownloadAsync ( optionalTasks , cancellationToken ) ;
5165
5266 var binFolder = Path . Join ( antHome , "bin" ) ;
5367 Environment . SetEnvironmentVariable ( "PATH" , $ "{ Environment . GetEnvironmentVariable ( "PATH" ) } { Path . PathSeparator } { binFolder } ") ;
0 commit comments