Skip to content

Commit

Permalink
Use jsii-java-runtime as a devDependency (#158)
Browse files Browse the repository at this point in the history
Instead of looking up the maven repo of jsii-java-runtime in the repo
structure, define it as a devDependency and attempt to `require` it.
If it exists, it adds the local maven-repo to the user.xml maven settings
during build. Otherwise, it will just download from maven.

Also, adds a test to jsii-pacmak that recursively builds the
entire jsii-calc stack in all languages.
  • Loading branch information
Elad Ben-Israel authored Aug 7, 2018
1 parent 64ced3f commit eb291b9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
9 changes: 4 additions & 5 deletions packages/jsii-pacmak/lib/targets/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1180,11 +1180,10 @@ interface MavenDependency {
* to Maven Central.
*/
async function findJavaRuntimeLocalRepository() {
const localMavenRepo = path.resolve(path.join(__dirname, '..', '..', '..', 'jsii-java-runtime', 'maven-repo'));
if (await fs.pathExists(localMavenRepo)) {
logging.debug('Compiling against local jsii-java-runtime at:', localMavenRepo);
return localMavenRepo;
} else {
try {
const javaRuntime = require('jsii-java-runtime');
return javaRuntime.repository;
} catch (e) {
return undefined;
}
}
5 changes: 0 additions & 5 deletions packages/jsii-pacmak/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/jsii-pacmak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"build": "npm run gen && tsc && chmod +x bin/jsii-pacmak && tslint -p .",
"watch": "tsc -w",
"lint": "tslint -p . --force",
"test": "/bin/bash test/diff-test.sh",
"test": "/bin/bash test/diff-test.sh && /bin/bash test/build-test.sh",
"package": "package-js"
},
"keywords": [
Expand All @@ -39,6 +39,7 @@
"@types/yargs": "^11.1.1",
"jsii-build-tools": "^0.6.2",
"jsii-calc": "^0.6.2",
"jsii-java-runtime": "^0.6.2",
"nodeunit": "^0.11.2",
"tslint": "*",
"typescript": "^2.9.2"
Expand Down
4 changes: 4 additions & 0 deletions packages/jsii-pacmak/test/build-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail
outdir=$(mktemp -d)
bin/jsii-pacmak -o ${outdir} --recurse node_modules/jsii-calc -vv

0 comments on commit eb291b9

Please sign in to comment.