@@ -3478,6 +3478,7 @@ class HTTPError extends Error {
34783478}
34793479exports . HTTPError = HTTPError ;
34803480const IS_WINDOWS = process . platform === 'win32' ;
3481+ const IS_MAC = process . platform === 'darwin' ;
34813482const userAgent = 'actions/tool-cache' ;
34823483/**
34833484 * Download a tool from an url and stream it into a file
@@ -3693,6 +3694,36 @@ function extractTar(file, dest, flags = 'xz') {
36933694 } ) ;
36943695}
36953696exports . extractTar = extractTar ;
3697+ /**
3698+ * Extract a xar compatible archive
3699+ *
3700+ * @param file path to the archive
3701+ * @param dest destination directory. Optional.
3702+ * @param flags flags for the xar. Optional.
3703+ * @returns path to the destination directory
3704+ */
3705+ function extractXar ( file , dest , flags = [ ] ) {
3706+ return __awaiter ( this , void 0 , void 0 , function * ( ) {
3707+ assert_1 . ok ( IS_MAC , 'extractXar() not supported on current OS' ) ;
3708+ assert_1 . ok ( file , 'parameter "file" is required' ) ;
3709+ dest = yield _createExtractFolder ( dest ) ;
3710+ let args ;
3711+ if ( flags instanceof Array ) {
3712+ args = flags ;
3713+ }
3714+ else {
3715+ args = [ flags ] ;
3716+ }
3717+ args . push ( '-x' , '-C' , dest , '-f' , file ) ;
3718+ if ( core . isDebug ( ) ) {
3719+ args . push ( '-v' ) ;
3720+ }
3721+ const xarPath = yield io . which ( 'xar' , true ) ;
3722+ yield exec_1 . exec ( `"${ xarPath } "` , _unique ( args ) ) ;
3723+ return dest ;
3724+ } ) ;
3725+ }
3726+ exports . extractXar = extractXar ;
36963727/**
36973728 * Extract a zip
36983729 *
@@ -4001,6 +4032,13 @@ function _getGlobal(key, defaultValue) {
40014032 /* eslint-enable @typescript-eslint/no-explicit-any */
40024033 return value !== undefined ? value : defaultValue ;
40034034}
4035+ /**
4036+ * Returns an array of unique values.
4037+ * @param values Values to make unique.
4038+ */
4039+ function _unique ( values ) {
4040+ return Array . from ( new Set ( values ) ) ;
4041+ }
40044042//# sourceMappingURL=tool-cache.js.map
40054043
40064044/***/ } ) ,
0 commit comments