mirror of
				https://github.com/gradle/gradle-build-action.git
				synced 2025-11-04 09:58:56 +08:00 
			
		
		
		
	Add some TODOs to the code for future reference
This commit is contained in:
		@@ -23,7 +23,9 @@ inputs:
 | 
				
			|||||||
  cache-read-only:
 | 
					  cache-read-only:
 | 
				
			||||||
    description: When 'true', existing entries will be read from the cache but no entries will be written
 | 
					    description: When 'true', existing entries will be read from the cache but no entries will be written
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
 | 
					    # TODO: It might be useful to default to read-only for PRs, or non-main branch.
 | 
				
			||||||
    default: false 
 | 
					    default: false 
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  workflow-job-context:
 | 
					  workflow-job-context:
 | 
				
			||||||
    description: Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users.
 | 
					    description: Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users.
 | 
				
			||||||
    required: false
 | 
					    required: false
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,23 +8,25 @@ import * as exec from '@actions/exec'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import {AbstractCache} from './cache-utils'
 | 
					import {AbstractCache} from './cache-utils'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Paths to artifacts that are common to all/many Gradle User Home caches
 | 
					 | 
				
			||||||
// These artifacts are cached separately to avoid blowing out the size of each GUH cache
 | 
					 | 
				
			||||||
const COMMON_ARTIFACT_PATHS = [
 | 
					 | 
				
			||||||
    '~/.gradle/wrapper/dists/*/*/*.zip',
 | 
					 | 
				
			||||||
    '~/.gradle/caches/*/generated-gradle-jars/*.jar',
 | 
					 | 
				
			||||||
    '~/.gradle/caches/modules-*/files-*/**/*.jar'
 | 
					 | 
				
			||||||
]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// When a common artifact is cached separately, it is replaced by a marker file to allow for restore.
 | 
					// When a common artifact is cached separately, it is replaced by a marker file to allow for restore.
 | 
				
			||||||
const MARKER_FILE_EXTENSION = '.cached'
 | 
					const MARKER_FILE_EXTENSION = '.cached'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Which paths under Gradle User Home should be cached
 | 
					// Which paths under Gradle User Home should be cached
 | 
				
			||||||
// TODO: This should adapt for the `GRADLE_USER_HOME` environment variable
 | 
					// TODO: This should adapt for the `GRADLE_USER_HOME` environment variable
 | 
				
			||||||
 | 
					// TODO: Allow the user to override / tweak this set
 | 
				
			||||||
const CACHE_PATH = [
 | 
					const CACHE_PATH = [
 | 
				
			||||||
    '~/.gradle/caches', // All directories in 'caches'
 | 
					    '~/.gradle/caches',
 | 
				
			||||||
    '~/.gradle/notifications', // Prevent the re-rendering of first-use message for version
 | 
					    '~/.gradle/notifications', // Prevent the re-rendering of first-use message for version
 | 
				
			||||||
    `~/.gradle/wrapper/dists/*/*/*.zip${MARKER_FILE_EXTENSION}` // Only wrapper zips are required : We do not want to cache the exploded distributions
 | 
					    `~/.gradle/wrapper/dists/*/*/*.zip${MARKER_FILE_EXTENSION}` // Only cache/restore wrapper zips: Gradle will automatically expand these on startup if required
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Paths to artifacts that are common to all/many Gradle User Home caches
 | 
				
			||||||
 | 
					// These artifacts are cached separately to avoid blowing out the size of each GUH cache
 | 
				
			||||||
 | 
					// TODO: Allow the user to override / tweak this set
 | 
				
			||||||
 | 
					const COMMON_ARTIFACT_PATHS = [
 | 
				
			||||||
 | 
					    '~/.gradle/caches/*/generated-gradle-jars/*.jar',
 | 
				
			||||||
 | 
					    '~/.gradle/caches/modules-*/files-*/**/*.jar',
 | 
				
			||||||
 | 
					    '~/.gradle/wrapper/dists/*/*/*.zip'
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class GradleUserHomeCache extends AbstractCache {
 | 
					export class GradleUserHomeCache extends AbstractCache {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,6 +2,7 @@ import path from 'path'
 | 
				
			|||||||
import fs from 'fs'
 | 
					import fs from 'fs'
 | 
				
			||||||
import {AbstractCache} from './cache-utils'
 | 
					import {AbstractCache} from './cache-utils'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO: Maybe allow the user to override / tweak this set
 | 
				
			||||||
const PATHS_TO_CACHE = [
 | 
					const PATHS_TO_CACHE = [
 | 
				
			||||||
    'configuration-cache' // Only configuration-cache is stored at present
 | 
					    'configuration-cache' // Only configuration-cache is stored at present
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,8 @@ export async function run(): Promise<void> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (result.buildScanUrl) {
 | 
					        if (result.buildScanUrl) {
 | 
				
			||||||
            core.setOutput('build-scan-url', result.buildScanUrl)
 | 
					            core.setOutput('build-scan-url', result.buildScanUrl)
 | 
				
			||||||
 | 
					            // TODO Include context about the invocation (eg step name) in this message
 | 
				
			||||||
 | 
					            // Unfortunately it doesn't seem possible to access the current step name here
 | 
				
			||||||
            core.notice(`Gradle build scan: ${result.buildScanUrl}`)
 | 
					            core.notice(`Gradle build scan: ${result.buildScanUrl}`)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user