Commit 059f2e77 authored by Paul Merlin's avatar Paul Merlin
Browse files

Rename cache.ts to cache-wrapper.ts

parent 692fda9d
Loading
Loading
Loading
Loading
+5 −5
Changes for __tests__/cache-wrapper.test.ts: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
import * as cache from '../src/cache'
import * as cacheWrapper from '../src/cache-wrapper'
import * as path from 'path'

describe('cache', () => {
    describe('can extract gradle wrapper slug', () => {
        it('from wrapper properties file', async () => {
            const version = cache.extractGradleWrapperSlugFrom(
            const version = cacheWrapper.extractGradleWrapperSlugFrom(
                path.resolve(
                    '__tests__/data/basic/gradle/wrapper/gradle-wrapper.properties'
                )
@@ -12,19 +12,19 @@ describe('cache', () => {
            expect(version).toBe('6.5-bin')
        })
        it('for -bin dist', async () => {
            const version = cache.extractGradleWrapperSlugFromDistUri(
            const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
                'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.5-bin.zip'
            )
            expect(version).toBe('6.5-bin')
        })
        it('for -all dist', async () => {
            const version = cache.extractGradleWrapperSlugFromDistUri(
            const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
                'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.5-all.zip'
            )
            expect(version).toBe('6.5-all')
        })
        it('for milestone', async () => {
            const version = cache.extractGradleWrapperSlugFromDistUri(
            const version = cacheWrapper.extractGradleWrapperSlugFromDistUri(
                'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6-milestone-1-all.zip'
            )
            expect(version).toBe('6.6-milestone-1-all')

File moved.

+3 −3
Changes for src/main.ts: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ import * as core from '@actions/core'
import * as path from 'path'
import {parseArgsStringToArgv} from 'string-argv'

import * as cache from './cache'
import * as cacheWrapper from './cache-wrapper'
import * as execution from './execution'
import * as gradlew from './gradlew'
import * as provision from './provision'
@@ -41,7 +41,7 @@ async function resolveGradleExecutable(baseDirectory: string): Promise<string> {
    const gradleExecutable = inputOrNull('gradle-executable')
    if (gradleExecutable !== null) {
        if (gradleExecutable.endsWith(gradlew.wrapperFilename())) {
            await cache.restoreCachedWrapperDist(
            await cacheWrapper.restoreCachedWrapperDist(
                path.resolve(gradleExecutable, '..')
            )
        }
@@ -54,7 +54,7 @@ async function resolveGradleExecutable(baseDirectory: string): Promise<string> {
            ? path.join(baseDirectory, wrapperDirectory)
            : baseDirectory

    await cache.restoreCachedWrapperDist(gradlewDirectory)
    await cacheWrapper.restoreCachedWrapperDist(gradlewDirectory)

    return path.resolve(gradlewDirectory, gradlew.wrapperFilename())
}
+2 −2
Changes for src/post.ts: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
import * as cache from './cache'
import * as cacheWrapper from './cache-wrapper'

// Invoked by GitHub Actions
export async function run(): Promise<void> {
    await cache.cacheWrapperDist()
    await cacheWrapper.cacheWrapperDist()
}

run()