From b9b9b4ca9dbb535b714df4ba506a31a5fc56c773 Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Tue, 16 Feb 2021 15:29:05 +0200 Subject: [PATCH] fix(pacmak): go local replace do not respect `--outdir` in some cases (#2584) We first look for the local module under `` and only then the default `dist` directory of the dependency but since we don't break the search after we found it, the dist will override the outdir location. Adds a `break` from the inner loop if we found a replacement. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0 --- packages/jsii-pacmak/lib/targets/go.ts | 3 +++ packages/jsii-pacmak/test/build-test.sh | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/jsii-pacmak/lib/targets/go.ts b/packages/jsii-pacmak/lib/targets/go.ts index 55eb3a812c..5101daf9c7 100644 --- a/packages/jsii-pacmak/lib/targets/go.ts +++ b/packages/jsii-pacmak/lib/targets/go.ts @@ -84,6 +84,9 @@ export class Golang extends Target { const moduleDir = tryFindLocalModule(baseDir, dep); if (moduleDir) { replace[dep.goModuleName] = moduleDir; + + // we found a replacement for this dep, we can stop searching + break; } } diff --git a/packages/jsii-pacmak/test/build-test.sh b/packages/jsii-pacmak/test/build-test.sh index bbe51633ed..2c2bef47be 100755 --- a/packages/jsii-pacmak/test/build-test.sh +++ b/packages/jsii-pacmak/test/build-test.sh @@ -41,16 +41,16 @@ OPTS="--dotnet-nuget-global-packages-folder=${NUGET_CACHE}" # Single target, recursive build to a certain location clean_dists echo "Testing SINGLE TARGET, RECURSIVE build." -../bin/jsii-pacmak ${OPTS} -o ${outdir} --recurse ../../jsii-calc +../bin/jsii-pacmak ${OPTS} -v -o ${outdir} --recurse ../../jsii-calc # Multiple targets, build one-by-one into own directory clean_dists echo "Testing ONE-BY-ONE build." for dir in $packagedirs; do - ../bin/jsii-pacmak ${OPTS} $dir + ../bin/jsii-pacmak ${OPTS} -v $dir done # Multiple targets, build all at once into own directory clean_dists echo "Testing ALL-AT-ONCE build." -../bin/jsii-pacmak ${OPTS} --no-parallel $packagedirs +../bin/jsii-pacmak ${OPTS} -v --no-parallel $packagedirs