@@ -7607,12 +7607,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7607
7607
} ) ;
7608
7608
} ;
7609
7609
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
7610
- exports . extractXar = exports . install = void 0 ;
7610
+ exports . install = void 0 ;
7611
7611
const core = __importStar ( __webpack_require__ ( 470 ) ) ;
7612
7612
const toolCache = __importStar ( __webpack_require__ ( 533 ) ) ;
7613
- const io = __importStar ( __webpack_require__ ( 1 ) ) ;
7614
7613
const path = __importStar ( __webpack_require__ ( 622 ) ) ;
7615
- const exec_1 = __webpack_require__ ( 986 ) ;
7616
7614
const swift_versions_1 = __webpack_require__ ( 336 ) ;
7617
7615
const get_version_1 = __webpack_require__ ( 778 ) ;
7618
7616
function install ( version , system ) {
@@ -7660,25 +7658,14 @@ function download({ url }) {
7660
7658
function unpack ( { name } , packagePath , version ) {
7661
7659
return __awaiter ( this , void 0 , void 0 , function * ( ) {
7662
7660
core . debug ( "Extracting package" ) ;
7663
- const unpackedPath = yield extractXar ( packagePath ) ;
7661
+ const unpackedPath = yield toolCache . extractXar ( packagePath ) ;
7664
7662
const extractedPath = yield toolCache . extractTar ( path . join ( unpackedPath , `${ name } -package.pkg` , "Payload" ) ) ;
7665
7663
core . debug ( "Package extracted" ) ;
7666
7664
const cachedPath = yield toolCache . cacheDir ( extractedPath , "swift-macOS" , version ) ;
7667
7665
core . debug ( "Package cached" ) ;
7668
7666
return cachedPath ;
7669
7667
} ) ;
7670
7668
}
7671
- //FIXME: Workaround until https://github.com/actions/toolkit/pull/207 is merged
7672
- function extractXar ( file ) {
7673
- return __awaiter ( this , void 0 , void 0 , function * ( ) {
7674
- const dest = path . join ( process . env [ "RUNNER_TEMP" ] || "" , "setup-swift" , "extract.tmp" ) ;
7675
- yield io . mkdirP ( dest ) ;
7676
- const xarPath = yield io . which ( "xar" , true ) ;
7677
- yield exec_1 . exec ( `"${ xarPath } "` , [ "-x" , "-C" , dest , "-f" , file ] ) ;
7678
- return dest ;
7679
- } ) ;
7680
- }
7681
- exports . extractXar = extractXar ;
7682
7669
7683
7670
7684
7671
/***/ } ) ,
@@ -8612,6 +8599,7 @@ class HTTPError extends Error {
8612
8599
}
8613
8600
exports . HTTPError = HTTPError ;
8614
8601
const IS_WINDOWS = process . platform === 'win32' ;
8602
+ const IS_MAC = process . platform === 'darwin' ;
8615
8603
const userAgent = 'actions/tool-cache' ;
8616
8604
/**
8617
8605
* Download a tool from an url and stream it into a file
@@ -8827,6 +8815,36 @@ function extractTar(file, dest, flags = 'xz') {
8827
8815
} ) ;
8828
8816
}
8829
8817
exports . extractTar = extractTar ;
8818
+ /**
8819
+ * Extract a xar compatible archive
8820
+ *
8821
+ * @param file path to the archive
8822
+ * @param dest destination directory. Optional.
8823
+ * @param flags flags for the xar. Optional.
8824
+ * @returns path to the destination directory
8825
+ */
8826
+ function extractXar ( file , dest , flags = [ ] ) {
8827
+ return __awaiter ( this , void 0 , void 0 , function * ( ) {
8828
+ assert_1 . ok ( IS_MAC , 'extractXar() not supported on current OS' ) ;
8829
+ assert_1 . ok ( file , 'parameter "file" is required' ) ;
8830
+ dest = yield _createExtractFolder ( dest ) ;
8831
+ let args ;
8832
+ if ( flags instanceof Array ) {
8833
+ args = flags ;
8834
+ }
8835
+ else {
8836
+ args = [ flags ] ;
8837
+ }
8838
+ args . push ( '-x' , '-C' , dest , '-f' , file ) ;
8839
+ if ( core . isDebug ( ) ) {
8840
+ args . push ( '-v' ) ;
8841
+ }
8842
+ const xarPath = yield io . which ( 'xar' , true ) ;
8843
+ yield exec_1 . exec ( `"${ xarPath } "` , _unique ( args ) ) ;
8844
+ return dest ;
8845
+ } ) ;
8846
+ }
8847
+ exports . extractXar = extractXar ;
8830
8848
/**
8831
8849
* Extract a zip
8832
8850
*
@@ -9135,6 +9153,13 @@ function _getGlobal(key, defaultValue) {
9135
9153
/* eslint-enable @typescript-eslint/no-explicit-any */
9136
9154
return value !== undefined ? value : defaultValue ;
9137
9155
}
9156
+ /**
9157
+ * Returns an array of unique values.
9158
+ * @param values Values to make unique.
9159
+ */
9160
+ function _unique ( values ) {
9161
+ return Array . from ( new Set ( values ) ) ;
9162
+ }
9138
9163
//# sourceMappingURL=tool-cache.js.map
9139
9164
9140
9165
/***/ } ) ,
0 commit comments