Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

Jules wip 11441372341011654930#42

Open
jlmalone wants to merge 9 commits into
masterfrom
jules_wip_11441372341011654930
Open

Jules wip 11441372341011654930#42
jlmalone wants to merge 9 commits into
masterfrom
jules_wip_11441372341011654930

Conversation

@jlmalone

@jlmalone jlmalone commented Jun 9, 2025

Copy link
Copy Markdown
Owner

No description provided.

jlmalone and others added 9 commits June 5, 2025 14:58
- Removed obsolete username/password login
- Added GVCookieManager for session-based auth
- Added ArrayUtil helper
- Updated README and added LICENSE
- Replaced hardcoded credential constructors
- Removed bundled jars
- Added wiki documentation from legacy project
… done so far and provide feedback for Jules to continue.
Summary of changes:

This commit includes the initial groundwork for implementing Google OAuth
authentication using an Ant task and integrating cookie loading into the
existing application.

Key changes:

1.  **Ant Task Placeholder**:
    *   Added a basic XML structure for a 'google-auth' Ant task in `build.xml`.
        This task is intended to handle the Google OAuth flow. The detailed
        Java implementation for the OAuth logic within this task is still pending.

2.  **Cookie Management (`GVCookieManager.java`)**:
    *   Modified `GVCookieManager.java` to load authentication cookies from a
        `google-auth.properties` file.
    *   A new private method `loadCookiesFromFile()` was added and is called
        from the constructor to populate the cookie map.

3.  **HTTP Request Integration (`Voice.java`)**:
    *   Verified that `Voice.java` already uses `GVCookieManager` to attach
        cookies to outgoing HTTP requests. No changes were needed in this file
        as the existing mechanism will use the cookies loaded by the updated
        `GVCookieManager`.

4.  **Testing (`GVCookieManagerTest.java`)**:
    *   Created a new JUnit test, `GVCookieManagerTest.java`, to verify that
        cookies are correctly loaded from the `google-auth.properties` file
        into `GVCookieManager`. This includes setting up a test properties
        file and asserting the loaded cookie values.

Work was based on the existing Ant build system. You have indicated a desire
to migrate to Gradle, Kotlin, and Java 17, which will require a new plan
and approach for future development, including the Google authentication
feature.
… done so far and provide feedback for Jules to continue.
This commit lays the foundation for migrating the project from Ant to a
modern Gradle build system using the Kotlin DSL and targeting Java 17.

Key changes include:

1.  **Gradle Build System Setup (`build.gradle.kts`):**
    *   Initialized `build.gradle.kts` with the `kotlin("jvm")` and
        `java-library` plugins.
    *   Configured Kotlin and Java toolchains for Java 17.
    *   Set up Maven Central as the repository.
    *   Added initial dependencies: Kotlin standard library,
        `org.json:json:20231013` for JSON processing.
    *   Configured JUnit 5 (with JUnit 4 compatibility via Vintage Engine)
        for testing.
    *   Created standard Gradle source set directories (`src/main/java`,
        `src/main/kotlin`, `src/test/java`, etc.).

2.  **Source Code Migration:**
    *   Moved all existing Java source files from the old Ant directory
        structure (`src/com`, `src/test/*`) to the conventional Gradle
        paths (`src/main/java`, `src/test/java`).

3.  **Build Task Replication & Enhancements:**
    *   Configured the main `jar` task's manifest with attributes loaded
        from `build.properties` (e.g., version, built-by) and build timestamp.
    *   Added standard Gradle `sourcesJar` and `javadocJar` tasks.
    *   Configured the standard `javadoc` task and set its output directory.
    *   Integrated the Dokka plugin (`org.jetbrains.dokka`) for Kotlin
        documentation and configured its output directory.
    *   Added a `cleanAntOutput` task to remove old Ant build artifacts (`bin`,
        `dist`, `doc`) and integrated it into the default `clean` task.

4.  **Test Configuration:**
    *   Configured the `test` Gradle task to `useJUnitPlatform()`, enabling
        the execution of both JUnit 4 and JUnit 5 tests.
    *   Enabled basic test logging for passed, skipped, and failed events.

5.  **Test Resource Management:**
    *   Moved `test/privateTestData_template.properties` to the Gradle
        resources path `src/test/resources/test/privateTestData_template.properties`.
    *   Removed the old root `test/` directory.

This migration provides a modern, flexible build environment. The next
major step is to implement the Google
Authentication (OAuth) feature within this new Gradle structure. You
have also emphasized ensuring all dependencies are managed via Gradle,
avoiding any bundled JARs, which aligns with this migration.
This commit includes a significant refactoring of the project from Ant to
Gradle with Kotlin DSL (Java 17 target) and the initial implementation
for Google OAuth 2.0 authentication.

Key Changes:

1.  **Gradle Migration:**
    *   Introduced `build.gradle.kts` with Kotlin JVM, java-library plugins.
    *   Configured Java 17 toolchain, Maven Central, and dependencies:
        Kotlin stdlib, org.json:json, JUnit 5 (with JUnit 4 compatibility),
        and Google OAuth libraries (google-api-client, google-oauth-client-jetty,
        google-http-client-gson).
    *   Migrated all source and test Java files to standard Gradle directories
        (src/main/java, src/test/java).
    *   Replicated Ant build functionalities (JARs, Javadoc, Dokka) in Gradle.
    *   Configured Gradle test task to use JUnit Platform.
    *   Moved test resources like `privateTestData_template.properties`.

2.  **Google OAuth 2.0 Authentication Flow:**
    *   Created `GoogleAuthHelper.java` (in `src/main/java/com/techventus/server/voice/auth/`)
        to manage the command-line OAuth 2.0 flow. This includes logic for
        loading client secrets, building the authorization URL, starting a
        local server for the redirect, exchanging the code for tokens, and
        storing the access token.
    *   Added `initiateGoogleAuth` Gradle task to execute `GoogleAuthHelper`.
    *   Modified `GVCookieManager.java` to load `google-auth.properties`
        (containing the access token) from your home directory
        (`~/.credentials/google-voice-java/`).
    *   Updated `Voice.java` to prioritize using the OAuth 2.0 Bearer token
        (from `GVCookieManager`) for the `Authorization` header in API requests,
        with a fallback to the legacy ClientLogin token.

3.  **Documentation:**
    *   Updated `README.md` extensively with new build instructions for Gradle,
        details on the OAuth 2.0 setup process (including obtaining
        `client_secret.json`), and usage notes.
    *   Added disclaimers and pointers to the new `README.md` in
        `wiki/GettingStarted.wiki`.

**Current Status & Blocker:**
The implementation of these features is logically complete. However,
testing and further validation are currently blocked because the execution
environment lacks Gradle tooling (neither `gradlew` wrapper nor a system
`gradle` installation is available). This prevents me from building the project,
running tests, or executing the `initiateGoogleAuth` Gradle task.

Next steps would require resolving the Gradle environment issue to allow
for testing and verification of the implemented OAuth flow and build processes.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant