@@ -14,6 +14,19 @@ ARG --global TEMP_ROOT=/temp
1414ARG --global MODULE_NAME= ModuleBuilder
1515ARG --global CONFIGURATION= Release
1616
17+ # This works on Linux, and speeds things up dramatically because I don't need my .git folder
18+ # But "LOCALLY" doesn't work on Windows (yet), and that's my main dev environment
19+ # version:
20+ # COPY --if-exists GitVersion.yml .
21+ # IF [ -f ./GitVersion.yml ]
22+ # ELSE
23+ # LOCALLY
24+ # COPY tasks+tasks/tasks/GitVersion.yml .
25+ # END
26+ # LOCALLY
27+ # RUN dotnet tool update GitVersion.Tool --version 5.12.0 --global && \
28+ # dotnet gitversion > version.json
29+ # SAVE ARTIFACT ./version.json
1730
1831worker :
1932 # Dotnet tools and scripts installed by PSGet
@@ -26,24 +39,27 @@ worker:
2639 # Dealing with dependencies first allows docker to cache packages for us
2740 # So the dependency cach only re-builds when you add a new dependency
2841 COPY RequiredModules.psd1 .
29- # COPY *.csproj .
42+ # COPY --if-exists *.csproj .
3043 RUN ["pwsh" , "-File" , "/Tasks/_Bootstrap.ps1" , "-RequiredModulesPath" , "RequiredModules.psd1" ]
3144
3245build :
3346 FROM +worker
3447 RUN mkdir $OUTPUT_ROOT $TEST_ROOT $TEMP_ROOT
35- COPY . .
36- # make sure you have bin and obj in .earthlyignore, as their content from context might cause problems
48+ # On Linux we could use the version: task, we wouldn't need .git/ here and
49+ # we could avoid re-running this every time there was a commit
50+ # we could copying the Source and Invoke-Build script to improve caching
51+ COPY --dir .git/ Source/ build.psd1 Build.build.ps1 GitVersion.yml nuget.config /work
3752 RUN ["pwsh" , "-Command" , "Invoke-Build" , "-Task" , "Build" , "-File" , "Build.build.ps1" ]
3853
3954 # SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] <src> [<artifact-dest-path>] [AS LOCAL <local-path>]
4055 SAVE ARTIFACT $OUTPUT_ROOT/$MODULE_NAME AS LOCAL ./Modules/$MODULE_NAME
4156
4257test :
4358 # If we run a target as a reference in FROM or COPY, it's outputs will not be produced
44- BUILD +build
59+ # BUILD +build
4560 FROM +build
46- # make sure you have bin and obj in .earthlyignore, as their content from context might cause problems
61+ # Copy the test files here, so we can avoid rebuilding when iterating on tests
62+ COPY --dir Tests/ ScriptAnalyzerSettings.psd1 /work
4763 RUN ["pwsh" , "-Command" , "Invoke-Build" , "-Task" , "Test" , "-File" , "Build.build.ps1" ]
4864
4965 # SAVE ARTIFACT [--keep-ts] [--keep-own] [--if-exists] [--force] <src> [<artifact-dest-path>] [AS LOCAL <local-path>]
0 commit comments