Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ jobs:

- name: Run lints
run: ./scripts/lint

build:
timeout-minutes: 15
name: build
runs-on: ${{ github.repository == 'stainless-sdks/scrapegraphai-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: |
8
21
cache: gradle

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build SDK
run: ./scripts/build

test:
timeout-minutes: 15
name: test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-sonatype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
distribution: temurin
java-version: |
8
17
21
cache: gradle

- name: Set up Gradle
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
.gradle
.idea
.kotlin
build
build/
codegen.log
kls_database.db
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.0.2"
".": "0.1.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 15
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/scrapegraphai%2Fscrapegraphai-969ebada41127057e4cda129b2e7206224743b5c7fd33aa8ae062ff71b775ac9.yml
openapi_spec_hash: 2b2c2c684e6f6885398efca5f2b1f854
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/scrapegraphai%2Fscrapegraphai-633fdeab6abaefbe666099e8f86ce6b2acc9dacff1c33a80813bb04e8e437229.yml
openapi_spec_hash: f41ec90694ca8e7233bd20cc7ff1afbf
config_hash: 6889576ba0fdc14f2c71cea09a60a0f6
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# Changelog

## 0.1.0 (2025-09-26)

Full Changelog: [v0.0.2...v0.1.0](https://github.com/ScrapeGraphAI/scrapegraphai-java/compare/v0.0.2...v0.1.0)

### Features

* add examples ([244ec60](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/244ec60f134d22f802e6bd85085e793116f7cd15))
* **client:** expose sleeper option ([31498f9](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/31498f9086172ba6d321db51a111b5560c6b458e))


### Bug Fixes

* **ci:** use java-version 21 for publish step ([7fec339](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/7fec3394bb6955ef587400b910645422df75f25b))
* **client:** deserialization of empty objects ([e38e49a](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/e38e49aecbc41f8ad39a708c368b0d96f5e0ad41))
* **client:** ensure single timer is created per client ([31498f9](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/31498f9086172ba6d321db51a111b5560c6b458e))
* **client:** incorrect `getPackageVersion` impl ([2816d70](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/2816d70a176089871b1f30ae72729722acc7e3fb))


### Performance Improvements

* **internal:** make formatting faster ([962b633](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/962b633969301291f5a1e27e44e75507657f19c3))


### Chores

* **ci:** add build job ([b160680](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/b160680211abc84f1767ac89a134c1c9bbfa33b4))
* **ci:** reduce log noise ([11577b5](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/11577b5546813200fa5d4da6c2445bc59ab48cf7))
* **client:** refactor closing / shutdown ([a9a7732](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/a9a773243446462114da094d98419dcc771c05a9))
* improve formatter performance ([edb9343](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/edb93433720d26221871ad438df547b5b1d5fb11))
* **internal:** codegen related update ([e79ba3b](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/e79ba3bb42bbfe1971d42793fa4670382f1b1c85))
* **internal:** codegen related update ([bba3567](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/bba35670aa34c9bb0f89cbb278522d3b661f0c4a))
* **internal:** codegen related update ([54c20de](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/54c20de03a87907f8988f131eb5ab4e7813fd303))
* **internal:** codegen related update ([5177422](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/5177422b248308d811474d9085e698fa24604b4e))
* **internal:** dynamically determine included projects ([6ef030b](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/6ef030b80d8d31189ed7060c45b6cafc9c3f45c7))
* **internal:** support passing arguments to test script ([e858395](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/e8583958a6302c87d5474e18ac06ff0c6505df0d))
* **internal:** support running formatters directly ([62f3ad9](https://github.com/ScrapeGraphAI/scrapegraphai-java/commit/62f3ad9598e6787adbc0ac247e6ba65a1745312d))

## 0.0.2 (2025-08-12)

Full Changelog: [v0.0.1...v0.0.2](https://github.com/ScrapeGraphAI/scrapegraphai-java/compare/v0.0.1...v0.0.2)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.scrapegraphai.api/scrapegraphai-java)](https://central.sonatype.com/artifact/com.scrapegraphai.api/scrapegraphai-java/0.0.2)
[![javadoc](https://javadoc.io/badge2/com.scrapegraphai.api/scrapegraphai-java/0.0.2/javadoc.svg)](https://javadoc.io/doc/com.scrapegraphai.api/scrapegraphai-java/0.0.2)
[![Maven Central](https://img.shields.io/maven-central/v/com.scrapegraphai.api/scrapegraphai-java)](https://central.sonatype.com/artifact/com.scrapegraphai.api/scrapegraphai-java/0.1.0)
[![javadoc](https://javadoc.io/badge2/com.scrapegraphai.api/scrapegraphai-java/0.1.0/javadoc.svg)](https://javadoc.io/doc/com.scrapegraphai.api/scrapegraphai-java/0.1.0)

<!-- x-release-please-end -->

Expand All @@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/).

<!-- x-release-please-start-version -->

The REST API documentation can be found on [scrapegraphai.com](https://scrapegraphai.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.scrapegraphai.api/scrapegraphai-java/0.0.2).
The REST API documentation can be found on [scrapegraphai.com](https://scrapegraphai.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.scrapegraphai.api/scrapegraphai-java/0.1.0).

<!-- x-release-please-end -->

Expand All @@ -24,7 +24,7 @@ The REST API documentation can be found on [scrapegraphai.com](https://scrapegra
### Gradle

```kotlin
implementation("com.scrapegraphai.api:scrapegraphai-java:0.0.2")
implementation("com.scrapegraphai.api:scrapegraphai-java:0.1.0")
```

### Maven
Expand All @@ -33,7 +33,7 @@ implementation("com.scrapegraphai.api:scrapegraphai-java:0.0.2")
<dependency>
<groupId>com.scrapegraphai.api</groupId>
<artifactId>scrapegraphai-java</artifactId>
<version>0.0.2</version>
<version>0.1.0</version>
</dependency>
```

Expand Down
15 changes: 14 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,20 @@ repositories {

allprojects {
group = "com.scrapegraphai.api"
version = "0.0.2" // x-release-please-version
version = "0.1.0" // x-release-please-version
}

subprojects {
// These are populated with dependencies by `buildSrc` scripts.
tasks.register("format") {
group = "Verification"
description = "Formats all source files."
}
tasks.register("lint") {
group = "Verification"
description = "Verifies all source files are formatted."
}
apply(plugin = "org.jetbrains.dokka")
}

subprojects {
Expand Down
1 change: 0 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ repositories {
}

dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20")
}
94 changes: 83 additions & 11 deletions buildSrc/src/main/kotlin/scrapegraphai.java.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat

plugins {
`java-library`
id("com.diffplug.spotless")
}

repositories {
Expand All @@ -15,15 +13,6 @@ configure<JavaPluginExtension> {
withSourcesJar()
}

configure<SpotlessExtension> {
java {
importOrder()
removeUnusedImports()
palantirJavaFormat()
toggleOffOn()
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
Expand Down Expand Up @@ -62,3 +51,86 @@ tasks.withType<Test>().configureEach {
exceptionFormat = TestExceptionFormat.FULL
}
}

val palantir by configurations.creating
dependencies {
palantir("com.palantir.javaformat:palantir-java-format:2.73.0")
}

fun registerPalantir(
name: String,
description: String,
) {
val javaName = "${name}Java"
tasks.register<JavaExec>(javaName) {
group = "Verification"
this.description = description

classpath = palantir
mainClass = "com.palantir.javaformat.java.Main"

// Avoid an `IllegalAccessError` on Java 9+.
jvmArgs(
"--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
)

// Use paths relative to the current module.
val argumentFile =
project.layout.buildDirectory.file("palantir-$name-args.txt").get().asFile
val lastRunTimeFile =
project.layout.buildDirectory.file("palantir-$name-last-run.txt").get().asFile

// Read the time when this task was last executed for this module (if ever).
val lastRunTime = lastRunTimeFile.takeIf { it.exists() }?.readText()?.toLongOrNull() ?: 0L

// Use a `fileTree` relative to the module's source directory.
val javaFiles = project.fileTree("src") { include("**/*.java") }

// Determine if any files need to be formatted or linted and continue only if there is at least
// one file.
onlyIf { javaFiles.any { it.lastModified() > lastRunTime } }

inputs.files(javaFiles)

doFirst {
// Create the argument file and set the preferred formatting style.
argumentFile.parentFile.mkdirs()
argumentFile.writeText("--palantir\n")

if (name == "lint") {
// For lint, do a dry run, so no files are modified. Set the exit code to 1 (instead of
// the default 0) if any files need to be formatted, indicating that linting has failed.
argumentFile.appendText("--dry-run\n")
argumentFile.appendText("--set-exit-if-changed\n")
} else {
// `--dry-run` and `--replace` (for in-place formatting) are mutually exclusive.
argumentFile.appendText("--replace\n")
}

// Write the modified files to the argument file.
javaFiles.filter { it.lastModified() > lastRunTime }
.forEach { argumentFile.appendText("${it.absolutePath}\n") }
}

doLast {
// Record the last execution time for later up-to-date checking.
lastRunTimeFile.writeText(System.currentTimeMillis().toString())
}

// Pass the argument file using the @ symbol
args = listOf("@${argumentFile.absolutePath}")

outputs.upToDateWhen { javaFiles.none { it.lastModified() > lastRunTime } }
}

tasks.named(name) {
dependsOn(tasks.named(javaName))
}
}

registerPalantir(name = "format", description = "Formats all Java source files.")
registerPalantir(name = "lint", description = "Verifies all Java source files are formatted.")
82 changes: 74 additions & 8 deletions buildSrc/src/main/kotlin/scrapegraphai.kotlin.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion

Expand All @@ -7,6 +6,10 @@ plugins {
kotlin("jvm")
}

repositories {
mavenCentral()
}

kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(21))
Expand All @@ -27,14 +30,77 @@ kotlin {
}
}

configure<SpotlessExtension> {
kotlin {
ktfmt().kotlinlangStyle()
toggleOffOn()
}
}

tasks.withType<Test>().configureEach {
systemProperty("junit.jupiter.execution.parallel.enabled", true)
systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")
}

val ktfmt by configurations.creating
dependencies {
ktfmt("com.facebook:ktfmt:0.56")
}

fun registerKtfmt(
name: String,
description: String,
) {
val kotlinName = "${name}Kotlin"
tasks.register<JavaExec>(kotlinName) {
group = "Verification"
this.description = description

classpath = ktfmt
mainClass = "com.facebook.ktfmt.cli.Main"

// Use paths relative to the current module.
val argumentFile = project.layout.buildDirectory.file("ktfmt-$name-args.txt").get().asFile
val lastRunTimeFile =
project.layout.buildDirectory.file("ktfmt-$name-last-run.txt").get().asFile

// Read the time when this task was last executed for this module (if ever).
val lastRunTime = lastRunTimeFile.takeIf { it.exists() }?.readText()?.toLongOrNull() ?: 0L

// Use a `fileTree` relative to the module's source directory.
val kotlinFiles = project.fileTree("src") { include("**/*.kt") }

// Determine if any files need to be formatted or linted and continue only if there is at least
// one file (otherwise Ktfmt will fail).
onlyIf { kotlinFiles.any { it.lastModified() > lastRunTime } }

inputs.files(kotlinFiles)

doFirst {
// Create the argument file and set the preferred formatting style.
argumentFile.parentFile.mkdirs()
argumentFile.writeText("--kotlinlang-style\n")

if (name == "lint") {
// For lint, do a dry run, so no files are modified. Set the exit code to 1 (instead of
// the default 0) if any files need to be formatted, indicating that linting has failed.
argumentFile.appendText("--dry-run\n")
argumentFile.appendText("--set-exit-if-changed\n")
}

// Write the modified files to the argument file.
kotlinFiles.filter { it.lastModified() > lastRunTime }
.forEach { argumentFile.appendText("${it.absolutePath}\n") }
}

doLast {
// Record the last execution time for later up-to-date checking.
lastRunTimeFile.writeText(System.currentTimeMillis().toString())
}

// Pass the argument file using the @ symbol
args = listOf("@${argumentFile.absolutePath}")

outputs.upToDateWhen { kotlinFiles.none { it.lastModified() > lastRunTime } }
}

tasks.named(name) {
dependsOn(tasks.named(kotlinName))
}
}

registerKtfmt(name = "format", description = "Formats all Kotlin source files.")
registerKtfmt(name = "lint", description = "Verifies all Kotlin source files are formatted.")
Loading
Loading