From 575fda455a3c2b0fc968ab0f6e8cccb85fcb5331 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 27 Feb 2025 14:52:15 +0300 Subject: [PATCH 1/4] fix: align build files and javadoc file strcuture --- .github/workflows/api-level-lint.yml | 3 +++ .github/workflows/gradle-build.yml | 6 +++++ .github/workflows/preview-and-release.yml | 9 +++++++ scripts/copyFilesOnBuild.ps1 | 30 +++++++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 scripts/copyFilesOnBuild.ps1 diff --git a/.github/workflows/api-level-lint.yml b/.github/workflows/api-level-lint.yml index ab64dee06a4..6666fbcab7f 100644 --- a/.github/workflows/api-level-lint.yml +++ b/.github/workflows/api-level-lint.yml @@ -17,6 +17,9 @@ jobs: distribution: 'temurin' java-version: 21 cache: gradle + - name: Move generated sources to correct package + run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\beta\generated' + shell: pwsh - name: Setup Android SDK uses: android-actions/setup-android@v3.2.2 - name: Add execution right to the script diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml index 7b507e6f077..eab6244a922 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -25,6 +25,9 @@ jobs: run: | pip install detect-secrets git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline + - name: Move generated sources to correct package + run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\beta\generated' + shell: pwsh - name: Grant Execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle @@ -65,6 +68,9 @@ jobs: cache: gradle - name: Grant Execute permission for gradlew run: chmod +x gradlew + - name: Move generated sources to correct package + run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\beta\generated' + shell: pwsh - name: Build with Java 8 working-directory: ./java-8 run: .././gradlew -Dorg.gradle.jvmargs=-Xmx4g build diff --git a/.github/workflows/preview-and-release.yml b/.github/workflows/preview-and-release.yml index 6ed2a99b616..7be6e7416d9 100644 --- a/.github/workflows/preview-and-release.yml +++ b/.github/workflows/preview-and-release.yml @@ -41,6 +41,9 @@ jobs: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION }} cache: gradle + - name: Move generated sources to correct package + run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\beta\generated' + shell: pwsh - name: Download File run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH shell: pwsh @@ -76,6 +79,9 @@ jobs: run: | pip install detect-secrets git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline + - name: Move generated sources to correct package + run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\beta\generated' + shell: pwsh - name: Download File run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH shell: pwsh @@ -129,6 +135,9 @@ jobs: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRIBUTION}} cache: gradle + - name: Move generated sources to correct package + run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\beta\generated' + shell: pwsh - name: Download file run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH shell: pwsh diff --git a/scripts/copyFilesOnBuild.ps1 b/scripts/copyFilesOnBuild.ps1 new file mode 100644 index 00000000000..ab43ce7b5fd --- /dev/null +++ b/scripts/copyFilesOnBuild.ps1 @@ -0,0 +1,30 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +<# +.Synopsis + Copy files to a new location that is the parent of the current directory. +.Description + Receives an encoded string value and decodes it using base64. + Write the new decoded string to a local file for later consumption. +.Parameter inputPath + The encoded string we wish to decode. +#> + +Param( + [Parameter(Mandatory = $true)][string]$inputPath +) + +$fullPath = (Get-Item $inputPath).FullName +$parentDirectory = (Get-Item $inputPath).Parent +Push-Location $inputPath + +Get-ChildItem '*' -Filter *.java -recurse | ForEach-Object { + $TargetDirectory = $_.DirectoryName.Replace($fullPath, "") + $TargetPath = Join-Path -Path $parentDirectory -ChildPath $TargetDirectory + If (!(Test-Path $TargetPath)) { + New-Item -Path $TargetPath -Type Directory -Force | out-null + } + $_ | Move-Item -Destination $TargetPath -Force +} +Pop-Location From 2099dcc525ab9dec53ff31c44aa8989a0a50fa94 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 27 Feb 2025 15:53:40 +0300 Subject: [PATCH 2/4] fix: ensure javadocs are generated in the build --- build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index fa7370a8d9a..09343631287 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,10 @@ def pomConfig = { } } -tasks.withType(Javadoc).all { enabled = false } +tasks.withType(Javadoc).configureEach { + enabled = false + options.addStringOption('Xdoclint:-missing', '-quiet') +} tasks.jar { manifest { From 3334ce37a6fa96c6e244e27e68321665daac38b4 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 27 Feb 2025 16:18:15 +0300 Subject: [PATCH 3/4] chore: fix boolean value --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 09343631287..5cf28eaa296 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ def pomConfig = { } tasks.withType(Javadoc).configureEach { - enabled = false + enabled = true options.addStringOption('Xdoclint:-missing', '-quiet') } From 1a633b6bbdd82a00805d6441d5bcf2bc02db0725 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 27 Feb 2025 17:13:54 +0300 Subject: [PATCH 4/4] chore: enable zip64 --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index 5cf28eaa296..448e80b9bd9 100644 --- a/build.gradle +++ b/build.gradle @@ -53,6 +53,10 @@ tasks.withType(Javadoc).configureEach { options.addStringOption('Xdoclint:-missing', '-quiet') } +tasks.withType(Zip).configureEach { + zip64 = true +} + tasks.jar { manifest { attributes('Automatic-Module-Name': project.property('mavenGroupId'))