From 9eec01c4cabc7baeeede058d6e7c35c05b93b587 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 27 Feb 2025 14:43:42 +0300 Subject: [PATCH 1/3] 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 974414af971..fb463ddfc6c 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\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 b8f28ab3585..d17258cb582 100644 --- a/.github/workflows/gradle-build.yml +++ b/.github/workflows/gradle-build.yml @@ -22,6 +22,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\generated' + shell: pwsh - name: Grant Execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle @@ -60,6 +63,9 @@ jobs: java-version: 8 distribution: 'temurin' cache: gradle + - name: Move generated sources to correct package + run: .\scripts\copyFilesOnBuild.ps1 -inputPath '.\src\main\java\com\microsoft\graph\generated' + shell: pwsh - name: Grant Execute permission for gradlew run: chmod +x gradlew - name: Build with Java 8 diff --git a/.github/workflows/preview-and-release.yml b/.github/workflows/preview-and-release.yml index b6218f8cc52..352d7cc02c8 100644 --- a/.github/workflows/preview-and-release.yml +++ b/.github/workflows/preview-and-release.yml @@ -37,6 +37,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\generated' + shell: pwsh - name: Detect secrets run: | pip install detect-secrets @@ -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\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\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 455f6698125f692b556369c7d14972ddeeada53e Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 27 Feb 2025 15:52:26 +0300 Subject: [PATCH 2/3] fix: ensure javadocs are generated --- build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 314c8ae1518..36d9556b34d 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,10 @@ def pomConfig = { } } -tasks.withType(Javadoc).all { enabled = false } +tasks.withType(Javadoc).configureEach { + enabled = false + options.addStringOption('Xdoclint:-missing', '-quiet') +} tasks.jar { From 0475eef48c9f84b2d3b0d82203c6ce913c97b93d Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Thu, 27 Feb 2025 16:11:11 +0300 Subject: [PATCH 3/3] chore: fix boolean value --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 36d9556b34d..beb4723ca85 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ def pomConfig = { } tasks.withType(Javadoc).configureEach { - enabled = false + enabled = true options.addStringOption('Xdoclint:-missing', '-quiet') }