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

Publish projects to individual folders rather than publishing the whole solution to one folder (fixes #974) #975

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 31 additions & 1 deletion .build/azure-templates/publish-test-binaries.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under one
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
Expand Down Expand Up @@ -26,8 +26,33 @@ parameters:
framework: '' # The target framework
binaryArtifactName: '' # The prefix of the binary artifact to publish $(BinaryArtifactName)
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/lucene.testsettings.json' #The name of the lucene test settings file
solution: '$(Build.SourcesDirectory)/Lucene.Net.sln'
configration: '$(BuildConfiguration)' # The build configuration
platform: '$(BuildPlatform)' # The build platform

steps:
- pwsh: |
$solution = "${{ parameters.solution }}"
$configuration = "${{ parameters.configration }}"
$framework = "${{ parameters.framework }}"
$publishDirectory = "${{ parameters.publishDirectory }}"
Write-Host "solution: $solution"
Write-Host "configuration: $configuration"
Write-Host "framework: $framework"
Write-Host "publishDirectory: $publishDirectory"
&dotnet publish "${{ parameters.solution }}" --configuration "${{ parameters.configration }}" --framework: "${{ parameters.framework }}" --no-build --no-restore --verbosity normal /p:TestFrameworks=true /p:Platform="${{ parameters.platform }}" /p:AlternatePublishRootDirectory="${{ parameters.publishDirectory }}"
displayName: 'Publish Projects for ${{ parameters.framework }}'
condition: and(succeeded(), ne(variables['RunTests'], 'false'))

#- task: DotNetCoreCLI@2
# displayName: 'Publish Projects for ${{ parameters.framework }}'
# inputs:
# command: custom
# projects: '**/*.sln'
# custom: publish
# arguments: '--configuration "${{ parameters.configuration }}" --framework: "${{ parameters.framework }}" --no-build --no-restore --verbosity normal /p:TestFrameworks=true /p:Platform="${{ parameters.platform }}" /p:AlternatePublishRootDirectory="${{ parameters.publishDirectory }}"'
# condition: and(succeeded(), ne(variables['RunTests'], 'false'))

- pwsh: |
Copy-Item -Path "${{ parameters.testSettingsFilePath }}" -Destination "${{ parameters.publishDirectory }}/${{ parameters.framework }}/" -Force
displayName: 'Copy lucene.testsettings.json File to: ${{ parameters.publishDirectory }}/${{ parameters.framework }}'
Expand All @@ -40,3 +65,8 @@ steps:
artifact: '${{ parameters.binaryArtifactName }}_${{ parameters.framework }}'
publishLocation: 'pipeline'
condition: and(succeeded(), ne(variables['RunTests'], 'false'))

- pwsh: |
Remove-Item -Path "${{ parameters.publishDirectory }}/${{ parameters.framework }}/*" -Recurse -Force
displayName: 'Delete temp publish location: ${{ parameters.publishDirectory }}/${{ parameters.framework }}'
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
11 changes: 1 addition & 10 deletions .build/azure-templates/run-tests-on-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,6 @@ steps:
if (!(Test-Path "$testResultDirectory")) {
New-Item "$testResultDirectory" -ItemType Directory -Force
}
# Test binaries are copied to a temp directory so locking behavior of other processes doesn't interfere with this test run
$tempTestDirectory = "$tempDirectory/$framework/$testName"
if (!(Test-Path "$tempTestDirectory")) {
New-Item "$tempTestDirectory" -ItemType Directory -Force
}
$testTarget = "$tempTestDirectory/$($testBinary.Name)"
$sourceDirectory = $testBinary.Directory.FullName

Copy-Item -Path "$sourceDirectory/*" -Destination "$tempTestDirectory" -Recurse -Force

if ($isNightly -ne 'true' -and $isWeekly -ne 'true') {
$blameHangTimeout = "--blame-hang-timeout 15minutes"
Expand All @@ -223,7 +214,7 @@ steps:

Write-Host "Running with $blameHangTimeout"

$testExpression = "dotnet test ""$testTarget"" --framework ""$framework"" --blame --no-build --no-restore" + `
$testExpression = "dotnet test ""$($testBinary.FullName)"" --framework ""$framework"" --blame --no-build --no-restore" + `
" --logger:""console;verbosity=normal"" --logger:""trx;LogFileName=$testResultsFileName""" + `
" --results-directory:""$testResultDirectory""" + `
" --blame-hang --blame-hang-dump-type mini $blameHangTimeout"
Expand Down
22 changes: 4 additions & 18 deletions .build/runbuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ properties {
[string]$platform = $(if ($platform) { $platform } else { if ($env:BuildPlatform) { $env:BuildPlatform } else { "Any CPU" } }) #NOTE: Pass in as a parameter (not a property) or environment variable to override
[bool]$backupFiles = $true
[bool]$prepareForBuild = $true
[bool]$zipPublishedArtifacts = $false
[string]$publishedArtifactZipFileName = "artifact.zip"

[int]$maximumParallelJobs = 8

Expand Down Expand Up @@ -195,12 +193,7 @@ task Publish -depends Compile -description "This task uses dotnet publish to pac

try {
$frameworksToTest = Get-FrameworksToTest

if ($zipPublishedArtifacts) {
$outDirectory = New-TemporaryDirectory
} else {
$outDirectory = $publishDirectory
}
$outDirectory = $publishDirectory

foreach ($framework in $frameworksToTest) {

Expand All @@ -211,15 +204,14 @@ task Publish -depends Compile -description "This task uses dotnet publish to pac
}

$logPath = "$outDirectory/$framework"
$outputPath = "$logPath"

# Do this first so there is no conflict
Ensure-Directory-Exists $outputPath
Ensure-Directory-Exists $logPath

Write-Host "Configuration: $configuration"

$expression = "dotnet publish `"$solutionFile`" --configuration `"$configuration`" --framework `"$framework`" --output `"$outputPath`""
$expression = "$expression --no-build --no-restore --verbosity Normal /p:TestFrameworks=true /p:Platform=`"$platform`""
$expression = "dotnet publish `"$solutionFile`" --configuration `"$configuration`" --framework `"$framework`""
$expression = "$expression --no-build --no-restore --verbosity Normal /p:TestFrameworks=true /p:Platform=`"$platform`" /p:AlternatePublishRootDirectory=`"$outDirectory`""
$expression = "$expression > `"$logPath/dotnet-publish.log`" 2> `"$logPath/dotnet-publish-error.log`""

$scriptBlock = {
Expand All @@ -246,12 +238,6 @@ task Publish -depends Compile -description "This task uses dotnet publish to pac
# Getting the information back from the jobs (time consuming)
#Get-Job | Receive-Job

if ($zipPublishedArtifacts) {
Ensure-Directory-Exists $publishDirectory
Add-Type -assembly "System.IO.Compression.Filesystem"
[System.IO.Compression.ZipFile]::CreateFromDirectory($outDirectory, "$publishDirectory/$publishedArtifactZipFileName")
}

$success = $true
} finally {
#if ($success -ne $true) {
Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/Lucene-Net-Dependency-Conflict-Warning.yml

This file was deleted.

4 changes: 4 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

<Import Project=".build/dependencies.props" Condition="Exists('.build/dependencies.props')" />

<PropertyGroup Label="Solution-level Publish to Project-specific Directory">
<PublishDir Condition="'$(AlternatePublishRootDirectory)' != ''">$(AlternatePublishRootDirectory)/$(TargetFramework)/$(MSBuildProjectName)/</PublishDir>
</PropertyGroup>

<!-- Features in .NET 6.x, .NET 7.x, and .NET 8.x only -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('net6.')) Or $(TargetFramework.StartsWith('net7.')) Or $(TargetFramework.StartsWith('net8.')) ">

Expand Down
52 changes: 31 additions & 21 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ stages:
pool:
vmImage: 'windows-2019'

variables:
PublishTempDirectory: '$(Build.ArtifactStagingDirectory)/publish'

steps:

- checkout: self # self represents the repo where the initial Pipelines YAML file was found
Expand All @@ -112,6 +109,8 @@ stages:
- pwsh: |
$configuration = if ($env:BUILDCONFIGURATION) { $env:BUILDCONFIGURATION } else { "Release" }
Write-Host "##vso[task.setvariable variable=BuildConfiguration;]$configuration"
$platform = if ($env:BUILDPLATFORM) { $env:BUILDPLATFORM } else { "Any CPU" }
Write-Host "##vso[task.setvariable variable=BuildPlatform;]$platform"
$isRelease = if ($env:ISRELEASE -eq 'true') { 'true' } else { 'false' }
Write-Host "##vso[task.setvariable variable=IsRelease;]$isRelease"
$isNightly = if ($env:ISNIGHTLY -eq 'true') { 'true' } else { 'false' }
Expand All @@ -132,16 +131,12 @@ stages:
$parameters = @{}
$properties = @{
backupFiles='false';
publishDirectory='$(PublishTempDirectory)';
nugetPackageDirectory='$(NuGetArtifactDirectory)'
}
[string[]]$tasks = @($primaryCommand)
if ($env:RunTests -ne 'false') {
[string[]]$tasks = $primaryCommand,'Publish'
}
Invoke-Psake $(BuildDirectory)/runbuild.ps1 -Task $tasks -properties $properties -parameters $parameters
exit !($psake.build_success)
displayName: 'PSake Build, Pack, and Publish'
displayName: 'PSake Build and Pack'

#- template: '.build/azure-templates/show-all-environment-variables.yml' # Uncomment for debugging

Expand Down Expand Up @@ -213,14 +208,6 @@ stages:
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(DebugArtifactName)'
condition: and(succeeded(), ne(variables['ArtifactFeedID'], ''))

- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: $(NuGetArtifactName)'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
artifact: '$(NuGetArtifactName)'
publishLocation: 'pipeline'
condition: and(succeeded(), ne(variables['RunPack'], 'false'))

- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: $(DebugArtifactName)'
inputs:
Expand All @@ -229,40 +216,63 @@ stages:
publishLocation: 'pipeline'
condition: and(succeeded(), ne(variables['ArtifactFeedID'], ''))

- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: $(NuGetArtifactName)'
inputs:
targetPath: '$(NuGetArtifactDirectory)'
artifact: '$(NuGetArtifactName)'
publishLocation: 'pipeline'
condition: and(succeeded(), ne(variables['RunPack'], 'false'))

- pwsh: |
Remove-Item -Path "$(NuGetArtifactDirectory)/*" -Recurse -Force
displayName: 'Delete temp publish location: $(NuGetArtifactDirectory)'
condition: and(succeeded(), ne(variables['RunPack'], 'false'))

- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishTempDirectory)
publishDirectory: $(PublishDirectory)
framework: 'net8.0'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'

- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishTempDirectory)
publishDirectory: $(PublishDirectory)
framework: 'net6.0'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'

- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishTempDirectory)
publishDirectory: $(PublishDirectory)
framework: 'net5.0'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'

- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishTempDirectory)
publishDirectory: $(PublishDirectory)
framework: 'net472'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'

- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishTempDirectory)
publishDirectory: $(PublishDirectory)
framework: 'net48'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'

- job: Docs
condition: and(succeeded(), eq(variables['GenerateDocs'], 'true'))
Expand Down
1 change: 1 addition & 0 deletions src/docs/LuceneDocsPlugins/LuceneDocsPlugins.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ under the License.

<PropertyGroup Label="Assembly Publishing">
<IsPublishable>true</IsPublishable>
<IsPublishable Condition="'$(TargetFramework)' != 'net8.0'">false</IsPublishable>
</PropertyGroup>

<PropertyGroup Label="Assembly Signing">
Expand Down
4 changes: 2 additions & 2 deletions src/dotnet/tools/lucene-cli/lucene-cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
<RollForward Condition=" $(TargetFramework.StartsWith('net8.')) ">Major</RollForward>

<IsPublishable>true</IsPublishable>
<IsPublishable Condition="$(TargetFramework.StartsWith('net4'))">false</IsPublishable>
<IsPublishable>false</IsPublishable>
<IsPublishable Condition="'$(TargetFramework)' == 'net8.0' Or '$(TargetFramework)' == 'net6.0'">true</IsPublishable>
<PackAsTool>true</PackAsTool>
<ToolCommandName>lucene</ToolCommandName>

Expand Down
Loading