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

Refactor Documentation #645

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open

Conversation

dnestoro
Copy link
Collaborator

@dnestoro dnestoro commented Dec 2, 2024

This PR:

  • restyles existing docs pages
  • adds end-to-end guides for both maven and gradle
  • revisits existing options in the documentation

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 2, 2024
@dnestoro dnestoro force-pushed the dnestoro/refactor-documentation branch from c552a0a to ac98cf6 Compare December 3, 2024 10:35
@dnestoro dnestoro requested review from melix, vjovanov and olpaw December 3, 2024 10:40
@dnestoro dnestoro force-pushed the dnestoro/refactor-documentation branch from ac98cf6 to 46751a3 Compare December 3, 2024 10:56
@dnestoro dnestoro force-pushed the dnestoro/refactor-documentation branch from 46751a3 to e9a01a9 Compare December 3, 2024 10:57
Copy link
Collaborator

@melix melix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work David!

I have mostly made changes to the Gradle end-to-end guide. I think most comments can be copied to the Maven guide which reuses the same sentences.

docs/src/docs/asciidoc/index.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/end-to-end-gradle-guide.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/end-to-end-gradle-guide.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/end-to-end-gradle-guide.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/end-to-end-gradle-guide.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/end-to-end-gradle-guide.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/end-to-end-maven-guide.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/end-to-end-maven-guide.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/end-to-end-maven-guide.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/end-to-end-maven-guide.adoc Outdated Show resolved Hide resolved
@dnestoro dnestoro force-pushed the dnestoro/refactor-documentation branch from 9fb93b7 to 133308a Compare December 4, 2024 14:25
Copy link
Member

@olyagpl olyagpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnestoro, at this point I reviewed the main entry page index.adoc and gradle-plugin.adoc. Could you please follow the comments or apply suggestions? Some of the comments in gradle-plugin.adoc apply to maven-plugin.adoc too. Then I will continue.

docs/src/docs/asciidoc/gradle-plugin.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/gradle-plugin.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/gradle-plugin.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/gradle-plugin.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/gradle-plugin.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/index.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/index.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/index.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/index.adoc Outdated Show resolved Hide resolved
docs/src/docs/asciidoc/index.adoc Outdated Show resolved Hide resolved
Copy link
Member

@olyagpl olyagpl Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnestoro, don't keep the quickstart-gradle-plugin.adoc and quickstart-gradle-maven.adoc content around or just shorten what's there. The point of this refactoring was to simplify the getting started experience. Step 1: provide a demo example, a HelloWorld or very simple app. Step 2: how to add a plugin. Step 3: build and run. Step 4: the last step how to add additional options (-Ob, -Os etc.). That's what end users need to see and what we cross-link in the first place. What I see in end-to-end-maven-guide.adoc belongs to the reference documentation that should be in maven-plugin.adoc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

@dnestoro dnestoro Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But these are not getting started guides, but sequential end-to-end guides. I kept getting started guides as links at the top of end-to-end guides.

Difference between end-to-end guides and reference docs is that I described only necessary stuff that users may need, while reference documentation contains everything we support.

Copy link
Member

@olyagpl olyagpl Dec 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing the ideas over zoom with David and Vojin, here is a proposed beginning and a structure for the end-to-end Gradle guide:

# Gradle Plugin User Guide

_The GraalVM team_ 
_version 0.10.4-SNAPSHOT_

This guide walks you through integrating the Gradle plugin for Native Image into your project. 
It starts from enabling the plugin, building the first native image, and running it.

Then it takes you to more advanced use-cases such us providing configuration.
If you are an advanced user, you can skip the getting started part and go directly to the advanced section. 

## Getting Started

To compile your application ahead of time with [GraalVM Native Image](https://www.graalvm.org/latest/reference-manual/native-image/) and Gradle, enable the Gradle plugin for Native Image building.

The plugin requires that you [install GraalVM](#link).

### Enable the Plugin

1. Add the plugin declaration into your _build.gradle_ file inside `plugins` block:
 
  id 'org.graalvm.buildtools.native' version '0.10.4-SNAPSHOT'

  Older versions of the plugin are listed [here](#).

2. In _build.gradle_, add the following block that configures the plugin:

    GroovyKotlin
    graalvmNative {
        graalvmNative {
            binaries.main {
                imageName = "yourName"
                mainClass = "org.example.Main"
                buildArgs.add('-Ob')
            }
        }
    }

  It specifies the path for the application main class (the main entry point) and the name for a native executable file.
  Adjust this path according to your application sources.

  You can pass additional options to the Native Image tool using the `buildArgs.add('')` syntax.
  In this example, `-Ob` enables quick build mode.
  Learn more in [Providing Configuration Options](#link).

### Build and Run Your Application

> Note: A Java version between 17 and 21 is required to execute Gradle. (See the [Gradle Compatibility Matrix](https://docs.gradle.org/current/userguide/compatibility.html)).

1. Compile and build a native executable of your application:

  ./gradlew nativeCompile

  The executable is created in the _app/build/native/nativeCompile/_ directory of the project.

2. Run the application from the native executable:

    ./gradlew nativeRun

The Gradle plugin for Native Image registers more tasks that you may want to use, for example, `nativeTest` that executes tests found in the test sources in native mode. 
Continue reading below to learn more about the plugin.

## Advanced Use Cases

For advanced users, the guide explains how to collect metadata, use diagnostics tools to analyze native executables, and includes examples of tests that demonstrate the guide's concepts.

### Providing Configuration Options

### Collecting Metadata with Tracing Agent

### Collecting Configuration from Reachability Metadata Repository

### Maintaining Generated Metadata 

### Enabling Monitoring Tools

## Summary

@dnestoro dnestoro force-pushed the dnestoro/refactor-documentation branch from 7762f09 to bc8ea12 Compare December 12, 2024 12:50
Copy link
Member

@olyagpl olyagpl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnestoro, I'm done proofreading your latest version of end-to-end-gradle-guide.adoc.

olyagpl
olyagpl previously approved these changes Dec 25, 2024
All plugin versions are listed https://github.com/graalvm/native-build-tools/releases[here].


- Provide the application main class in _build.gradle_ / _build.gradle.kts_ as shown below.
Copy link
Member

@olyagpl olyagpl Dec 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnestoro, is it a must-have step when enabling the Gradle plugin to specify the main entry point? Also, is it still required to declare an additional plugin repository in settings.gradle?

 pluginManagement {
     repositories {
         mavenCentral()
         gradlePluginPortal()
     }
 }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I was able to run few reproducers without that.

olyagpl
olyagpl previously approved these changes Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants