Skip to content

Commit

Permalink
fix(pacmak): go local replace do not respect --outdir in some cases (
Browse files Browse the repository at this point in the history
…#2584)

We first look for the local module under `<outdir>` 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
  • Loading branch information
Elad Ben-Israel authored Feb 16, 2021
1 parent 4c32947 commit b9b9b4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/jsii-pacmak/lib/targets/go.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/jsii-pacmak/test/build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b9b9b4c

Please sign in to comment.