Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an error condition for non jdk Microsoft OpenJDK build #265

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions dist/setup/index.js
Expand Up @@ -13889,6 +13889,9 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
if (!this.stable) {
throw new Error('Early access versions are not supported');
}
if (this.packageType !== 'jdk') {
throw new Error('Microsoft Build of OpenJDK provides only the `jdk` package type');
}
const availableVersionsRaw = yield this.getAvailableVersions();
const opts = this.getPlatformOption();
const availableVersions = availableVersionsRaw.map(item => ({
Expand Down
11 changes: 11 additions & 0 deletions docs/advanced-usage.md
Expand Up @@ -65,6 +65,17 @@ steps:
- run: java -cp java HelloWorldApp
```

### Microsoft
```yaml
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'microsoft'
java-version: '11'
- run: java -cp java HelloWorldApp
```

## Installing custom Java package type
```yaml
steps:
Expand Down
4 changes: 4 additions & 0 deletions src/distributions/microsoft/installer.ts
Expand Up @@ -45,6 +45,10 @@ export class MicrosoftDistributions extends JavaBase {
throw new Error('Early access versions are not supported');
}

if (this.packageType !== 'jdk') {
brcrista marked this conversation as resolved.
Show resolved Hide resolved
throw new Error('Microsoft Build of OpenJDK provides only the `jdk` package type');
}

const availableVersionsRaw = await this.getAvailableVersions();

const opts = this.getPlatformOption();
Expand Down