-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AuthenticationSelector isn't used for explicitely specified servers, …
…but only for dynamically resolved servers from remote POMs. Instead, we have to merge in settings files directly to Repository.Builders. So, we do that. We also merge in policies defined in settings. We overlay these so ultimately MSBuild settings overwrite settings.
- Loading branch information
Showing
5 changed files
with
259 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Collections.Generic; | ||
|
||
using java.lang; | ||
|
||
namespace IKVM.Maven.Sdk.Tasks.Extensions | ||
{ | ||
|
||
/// <summary> | ||
/// Provides extension methods for working against Java <see cref="Iterable"/> instances. | ||
/// </summary> | ||
public static class IterableExtensions | ||
{ | ||
|
||
/// <summary> | ||
/// Returns the appropriate wrapper type for the given <see cref="Iterable"/>. | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="iterable"></param> | ||
/// <returns></returns> | ||
public static IEnumerable<T> AsEnumerable<T>(this Iterable iterable) | ||
{ | ||
var e = iterable.iterator().AsEnumerator<T>(); | ||
while (e.MoveNext()) | ||
yield return e.Current; | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Collections.Generic; | ||
|
||
using java.util; | ||
|
||
namespace IKVM.Maven.Sdk.Tasks.Extensions | ||
{ | ||
|
||
/// <summary> | ||
/// Provides extension methods for working against Java <see cref="Iterator"/> instances. | ||
/// </summary> | ||
public static class IteratorExtensions | ||
{ | ||
|
||
/// <summary> | ||
/// Returns the appropriate wrapper type for the given <see cref="Iterator"/>. | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="iterator"></param> | ||
/// <returns></returns> | ||
public static IEnumerator<T> AsEnumerator<T>(this Iterator iterator) => iterator switch | ||
{ | ||
IEnumerator<T> i => i, | ||
Iterator i => new IteratorWrapper<T>(i), | ||
}; | ||
|
||
/// <summary> | ||
/// Iterators over the items in an iterator and produces an array. | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="iterator"></param> | ||
/// <returns></returns> | ||
public static List<T> RemainingToList<T>(this Iterator iterator) | ||
{ | ||
var l = new List<T>(); | ||
while (iterator.hasNext()) | ||
l.Add((T)iterator.next()); | ||
|
||
return l; | ||
} | ||
|
||
/// <summary> | ||
/// Returns an enumerable that iterators over the items in an iterator. | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="iterator"></param> | ||
/// <returns></returns> | ||
public static IEnumerable<T> RemainingToEnumerable<T>(this Iterator iterator) | ||
{ | ||
while (iterator.hasNext()) | ||
yield return (T)iterator.next(); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
using java.util; | ||
|
||
namespace IKVM.Maven.Sdk.Tasks.Extensions | ||
{ | ||
|
||
class IteratorWrapper<T> : IEnumerator<T> | ||
{ | ||
|
||
readonly Iterator iterator; | ||
T current; | ||
int position = -1; | ||
|
||
/// <summary> | ||
/// Initializes a new instance. | ||
/// </summary> | ||
/// <param name="iterator"></param> | ||
/// <exception cref="ArgumentNullException"></exception> | ||
public IteratorWrapper(Iterator iterator) | ||
{ | ||
this.iterator = iterator ?? throw new ArgumentNullException(nameof(iterator)); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the current element. | ||
/// </summary> | ||
public T Current => position > -1 ? current : throw new InvalidOperationException(); | ||
|
||
/// <summary> | ||
/// Gets the current element. | ||
/// </summary> | ||
object IEnumerator.Current => current; | ||
|
||
/// <summary> | ||
/// Moves to the next instance. | ||
/// </summary> | ||
/// <returns></returns> | ||
public bool MoveNext() | ||
{ | ||
if (iterator.hasNext()) | ||
{ | ||
current = (T)iterator.next(); | ||
position++; | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/// <summary> | ||
/// Disposes of the instance. | ||
/// </summary> | ||
public void Dispose() | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Not supported. | ||
/// </summary> | ||
/// <exception cref="NotSupportedException"></exception> | ||
public void Reset() | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters