From 9c6c2745717800971502801fe2d598674e7a15ff Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Mon, 10 Apr 2017 13:51:22 +0200 Subject: [PATCH] Tweak properties substitution to be fine with deeplearning4j --- .../main/scala/coursier/core/Resolution.scala | 25 ++++---- .../deeplearning4j-core/0.8.0 | 59 +++++++++++++++++++ .../scala/coursier/test/CentralTests.scala | 7 +++ 3 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 tests/shared/src/test/resources/resolutions/org.deeplearning4j/deeplearning4j-core/0.8.0 diff --git a/core/shared/src/main/scala/coursier/core/Resolution.scala b/core/shared/src/main/scala/coursier/core/Resolution.scala index e023ae45d..cc70aa89c 100644 --- a/core/shared/src/main/scala/coursier/core/Resolution.scala +++ b/core/shared/src/main/scala/coursier/core/Resolution.scala @@ -395,16 +395,16 @@ object Resolution { // loose attempt at substituting properties in each others in properties0 // doesn't try to go recursive for now, but that could be made so if necessary - val (done, remaining) = properties0.partition { - case (_, value) => - propRegex.findFirstIn(value).isEmpty - } + val done = properties0 + .collect { + case kv @ (_, value) if propRegex.findFirstIn(value).isEmpty => + kv + } + .toMap - lazy val doneMap = done.toMap - - done ++ remaining.map { + properties0.map { case (k, v) => - k -> substituteProps(v, doneMap) + k -> substituteProps(v, done) } } @@ -895,8 +895,8 @@ final case class Resolution( val approxProperties0 = project.parent .filter(projectCache.contains) - .map(projectCache(_)._2.properties.toMap) - .fold(project.properties)(project.properties ++ _) + .map(projectCache(_)._2.properties) + .fold(project.properties)(_ ++ project.properties) // 1.1 (see above) val approxProperties = propertiesMap(approxProperties0) ++ projectProperties(project) @@ -919,9 +919,8 @@ final case class Resolution( val project0 = project.copy( properties = project.parent // belongs to 1.5 & 1.6 - .filter(projectCache.contains) - .map(projectCache(_)._2.properties) - .fold(properties0)(_ ++ properties0) + .flatMap(projectCache.get) + .fold(properties0)(_._2.properties ++ properties0) ) val propertiesMap0 = propertiesMap(projectProperties(project0)) diff --git a/tests/shared/src/test/resources/resolutions/org.deeplearning4j/deeplearning4j-core/0.8.0 b/tests/shared/src/test/resources/resolutions/org.deeplearning4j/deeplearning4j-core/0.8.0 new file mode 100644 index 000000000..aa95e24be --- /dev/null +++ b/tests/shared/src/test/resources/resolutions/org.deeplearning4j/deeplearning4j-core/0.8.0 @@ -0,0 +1,59 @@ +com.clearspring.analytics:stream:2.7.0:compile +com.github.jai-imageio:jai-imageio-core:1.3.0:compile +com.google.code.findbugs:annotations:2.0.1:compile +com.google.guava:guava:18.0:compile +com.twelvemonkeys.common:common-image:3.1.1:compile +com.twelvemonkeys.common:common-io:3.1.1:compile +com.twelvemonkeys.common:common-lang:3.1.1:compile +com.twelvemonkeys.imageio:imageio-bmp:3.1.1:compile +com.twelvemonkeys.imageio:imageio-core:3.1.1:compile +com.twelvemonkeys.imageio:imageio-jpeg:3.1.1:compile +com.twelvemonkeys.imageio:imageio-metadata:3.1.1:compile +com.twelvemonkeys.imageio:imageio-psd:3.1.1:compile +com.twelvemonkeys.imageio:imageio-tiff:3.1.1:compile +commons-codec:commons-codec:1.10:compile +commons-io:commons-io:2.4:compile +it.unimi.dsi:fastutil:6.5.7:compile +joda-time:joda-time:2.9.2:compile +junit:junit:4.8.2:compile +net.ericaro:neoitertools:1.0.0:compile +org.apache.commons:commons-compress:1.8.1:compile +org.apache.commons:commons-lang3:3.3.1:compile +org.apache.commons:commons-math3:3.4.1:compile +org.bytedeco:javacpp:1.3.2:compile +org.bytedeco:javacv:1.3.1:compile +org.bytedeco.javacpp-presets:artoolkitplus:2.3.1-1.3:compile +org.bytedeco.javacpp-presets:ffmpeg:3.2.1-1.3:compile +org.bytedeco.javacpp-presets:flandmark:1.07-1.3:compile +org.bytedeco.javacpp-presets:flycapture:2.9.3.43-1.3:compile +org.bytedeco.javacpp-presets:hdf5:1.10.0-patch1-1.3:compile +org.bytedeco.javacpp-presets:hdf5-platform:1.10.0-patch1-1.3:compile +org.bytedeco.javacpp-presets:leptonica:1.73-1.3:compile +org.bytedeco.javacpp-presets:leptonica-platform:1.73-1.3:compile +org.bytedeco.javacpp-presets:libdc1394:2.2.4-1.3:compile +org.bytedeco.javacpp-presets:libfreenect:0.5.3-1.3:compile +org.bytedeco.javacpp-presets:libfreenect2:0.2.0-1.3:compile +org.bytedeco.javacpp-presets:librealsense:1.9.6-1.3:compile +org.bytedeco.javacpp-presets:opencv:3.1.0-1.3:compile +org.bytedeco.javacpp-presets:opencv-platform:3.1.0-1.3:compile +org.bytedeco.javacpp-presets:videoinput:0.200-1.3:compile +org.codehaus.woodstox:stax2-api:3.1.4:compile +org.datavec:datavec-api:0.8.0:compile +org.datavec:datavec-data-image:0.8.0:compile +org.datavec:datavec-nd4j-common:0.8.0:compile +org.deeplearning4j:deeplearning4j-core:0.8.0:compile +org.deeplearning4j:deeplearning4j-modelimport:0.8.0:compile +org.deeplearning4j:deeplearning4j-nn:0.8.0:compile +org.deeplearning4j:deeplearning4j-ui-components:0.8.0:compile +org.freemarker:freemarker:2.3.23:compile +org.javassist:javassist:3.18.2-GA:compile +org.json:json:20131018:compile +org.nd4j:jackson:0.8.0:compile +org.nd4j:nd4j-api:0.8.0:compile +org.nd4j:nd4j-buffer:0.8.0:compile +org.nd4j:nd4j-common:0.8.0:compile +org.nd4j:nd4j-context:0.8.0:compile +org.projectlombok:lombok:1.16.10:compile +org.reflections:reflections:0.9.10:compile +org.slf4j:slf4j-api:1.7.12:compile +org.yaml:snakeyaml:1.12:compile \ No newline at end of file diff --git a/tests/shared/src/test/scala/coursier/test/CentralTests.scala b/tests/shared/src/test/scala/coursier/test/CentralTests.scala index 4a6765218..382395fdc 100644 --- a/tests/shared/src/test/scala/coursier/test/CentralTests.scala +++ b/tests/shared/src/test/scala/coursier/test/CentralTests.scala @@ -538,6 +538,13 @@ object CentralTests extends TestSuite { configuration = "optional" ) } + + 'deepLearning4j - { + resolutionCheck( + Module("org.deeplearning4j", "deeplearning4j-core"), + "0.8.0" + ) + } } }