-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BREAKING] Produce independent mvn packages for java bindings (#98)
Fist step towards #73: * Make `jsii-pacmak` produce a full maven project for each module being built + POM produces source & javadoc attachments * Make `jsii-pacmak` build the resulting java project (unless `--only-source` is passed) * Make `jsii-pacmak` publish the artifacts (or source if `--only-source` is passed) to the `--outdir` * Associated changes in `jsii-java-runtime` and related compliance tests Also, fixes #102
- Loading branch information
1 parent
051d8ea
commit 38ffa09
Showing
130 changed files
with
6,497 additions
and
5,449 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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,5 @@ | ||
.vscode | ||
!*.js | ||
maven-repo | ||
test-maven-repo | ||
conf |
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,6 @@ | ||
*.sh | ||
*.t.js | ||
project | ||
test-project | ||
test-maven-repo | ||
conf |
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,21 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
# Generates the necessary files to test the JSII runtime | ||
# * Java bindings for jsii-calc (and it's JSII dependencies) | ||
# * A maven user settings file to allow maven to use local repositories appropriately | ||
# * A POM file for the test project, that references the dependencies correctly | ||
# Executing this script is required for the test-project to be buildable | ||
|
||
mkdir -p conf | ||
/usr/bin/env node ./user.xml.t.js > conf/user.xml | ||
|
||
staging="maven-repo" | ||
mkdir -p ${staging} | ||
for ASSM in $(node toposort.js $(find ./node_modules/jsii-calc -follow -name .jsii)); do | ||
echo "Generating java bindings for ${ASSM}" | ||
jsii-pacmak --target java --outdir ${staging} $(dirname ${ASSM}) --mvn-settings=${PWD}/conf/user.xml | ||
done | ||
|
||
# generate pom.xml and JsiiVersion.java with version from package.json | ||
/usr/bin/env node ./pom.xml.t.js > ./project/pom.xml |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
{ | ||
"name": "jsii-java-runtime-test", | ||
"version": "0.5.0-beta", | ||
"description": "Tests for the Java client for jsii runtime", | ||
"private": true, | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
"build": "/bin/bash ./generate.sh", | ||
"test": "cd project && mvn test --settings=../conf/user.xml" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^9.6.18", | ||
"jsii-calc": "^0.5.0-beta", | ||
"jsii-java-runtime": "^0.5.0-beta", | ||
"jsii-pacmak": "^0.5.0-beta" | ||
}, | ||
"author": { | ||
"name": "Amazon Web Services", | ||
"url": "https://aws.amazon.com" | ||
}, | ||
"license": "LicenseRef-LICENSE", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/awslabs/jsii" | ||
} | ||
} |
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,51 @@ | ||
const { groupId, artifactId, version } = require('jsii-java-runtime').maven; | ||
|
||
process.stdout.write(`<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<!-- Generated by ${__filename} at ${new Date().toISOString()} --> | ||
<groupId>${groupId}</groupId> | ||
<artifactId>${artifactId}-test</artifactId> | ||
<version>${version}</version> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jsii.tests</groupId> | ||
<artifactId>calculator</artifactId> | ||
<version>[0.5.0-beta,)</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- https://mvnrepository.com/artifact/junit/junit --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.6.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> | ||
`); |
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,30 @@ | ||
!index.js | ||
.idea | ||
pom.xml | ||
|
||
.classpath | ||
.project | ||
.settings | ||
|
||
# IntelliJ | ||
*.iml | ||
|
||
# Created by https://www.gitignore.io/api/maven | ||
|
||
### Maven ### | ||
target | ||
|
||
pom.xml.tag | ||
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
pom.xml.next | ||
release.properties | ||
dependency-reduced-pom.xml | ||
buildNumber.properties | ||
.mvn/timing.properties | ||
|
||
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) | ||
!/.mvn/wrapper/maven-wrapper.jar | ||
|
||
|
||
# End of https://www.gitignore.io/api/maven |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,41 @@ | ||
/* | ||
* This command takes a set of JSII module files as it's argument, and outputs | ||
* the same file names after having topologically sorted them according to their | ||
* declared dependencies. | ||
*/ | ||
|
||
const fs = require('fs'); | ||
|
||
const modules = {}; | ||
|
||
for (const file of process.argv.slice(2)) { | ||
const module = JSON.parse(fs.readFileSync(file, { encoding: 'utf-8' })); | ||
modules[module.name] = { | ||
file, | ||
dependsOn: Object.keys(module.dependencies || {}) | ||
}; | ||
} | ||
|
||
let sorted = []; | ||
const roots = Object.keys(modules).filter(name => modules[name].dependsOn.length === 0); | ||
while (roots.length != 0) { | ||
const root = roots.pop(); | ||
sorted = sorted.concat(modules[root].file); | ||
delete modules[root]; | ||
for (const name of Object.keys(modules)) { | ||
const node = modules[name]; | ||
node.dependsOn = node.dependsOn.filter(n => n !== root); | ||
if (node.dependsOn.length === 0) { | ||
roots.push(name); | ||
} | ||
} | ||
} | ||
|
||
if (Object.keys(modules).length > 0) { | ||
console.error(`There seems to be a cycle in the graph: ${JSON.stringify(modules, null, 2)}`); | ||
exit(-1); | ||
} | ||
|
||
for (const file of sorted) { | ||
console.log(file); | ||
} |
Oops, something went wrong.