@bubblewrap/core 1.13.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +203 -0
- package/README.md +63 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +56 -0
- package/dist/lib/BufferedLog.d.ts +20 -0
- package/dist/lib/BufferedLog.js +83 -0
- package/dist/lib/Config.d.ts +9 -0
- package/dist/lib/Config.js +50 -0
- package/dist/lib/DigitalAssetLinks.d.ts +3 -0
- package/dist/lib/DigitalAssetLinks.js +37 -0
- package/dist/lib/FetchUtils.d.ts +17 -0
- package/dist/lib/FetchUtils.js +79 -0
- package/dist/lib/GooglePlay.d.ts +41 -0
- package/dist/lib/GooglePlay.js +92 -0
- package/dist/lib/GradleWrapper.d.ts +31 -0
- package/dist/lib/GradleWrapper.js +62 -0
- package/dist/lib/ImageHelper.d.ts +37 -0
- package/dist/lib/ImageHelper.js +112 -0
- package/dist/lib/Log.d.ts +88 -0
- package/dist/lib/Log.js +114 -0
- package/dist/lib/Result.d.ts +46 -0
- package/dist/lib/Result.js +97 -0
- package/dist/lib/ShortcutInfo.d.ts +32 -0
- package/dist/lib/ShortcutInfo.js +84 -0
- package/dist/lib/TwaGenerator.d.ts +39 -0
- package/dist/lib/TwaGenerator.js +362 -0
- package/dist/lib/TwaManifest.d.ts +234 -0
- package/dist/lib/TwaManifest.js +384 -0
- package/dist/lib/androidSdk/AndroidSdkTools.d.ts +87 -0
- package/dist/lib/androidSdk/AndroidSdkTools.js +226 -0
- package/dist/lib/errors/ValidatePathError.d.ts +9 -0
- package/dist/lib/errors/ValidatePathError.js +16 -0
- package/dist/lib/features/AppsFlyerFeature.d.ts +8 -0
- package/dist/lib/features/AppsFlyerFeature.js +70 -0
- package/dist/lib/features/EmptyFeature.d.ts +28 -0
- package/dist/lib/features/EmptyFeature.js +44 -0
- package/dist/lib/features/Feature.d.ts +120 -0
- package/dist/lib/features/Feature.js +17 -0
- package/dist/lib/features/FeatureManager.d.ts +36 -0
- package/dist/lib/features/FeatureManager.js +137 -0
- package/dist/lib/features/FirstRunFlagFeature.d.ts +8 -0
- package/dist/lib/features/FirstRunFlagFeature.js +43 -0
- package/dist/lib/features/LocationDelegationFeature.d.ts +7 -0
- package/dist/lib/features/LocationDelegationFeature.js +32 -0
- package/dist/lib/features/PlayBillingFeature.d.ts +7 -0
- package/dist/lib/features/PlayBillingFeature.js +53 -0
- package/dist/lib/jdk/JarSigner.d.ts +13 -0
- package/dist/lib/jdk/JarSigner.js +55 -0
- package/dist/lib/jdk/JdkHelper.d.ts +55 -0
- package/dist/lib/jdk/JdkHelper.js +127 -0
- package/dist/lib/jdk/KeyTool.d.ts +57 -0
- package/dist/lib/jdk/KeyTool.js +136 -0
- package/dist/lib/mock/MockLog.d.ts +37 -0
- package/dist/lib/mock/MockLog.js +70 -0
- package/dist/lib/types/WebManifest.d.ts +44 -0
- package/dist/lib/types/WebManifest.js +17 -0
- package/dist/lib/util.d.ts +82 -0
- package/dist/lib/util.js +279 -0
- package/dist/lib/wrappers/svg2img.d.ts +14 -0
- package/dist/lib/wrappers/svg2img.js +39 -0
- package/package.json +58 -0
- package/template_project/app/.gitignore +1 -0
- package/template_project/app/build.gradle +211 -0
- package/template_project/app/src/main/AndroidManifest.xml +204 -0
- package/template_project/app/src/main/java/Application.java +35 -0
- package/template_project/app/src/main/java/DelegationService.java +18 -0
- package/template_project/app/src/main/java/LauncherActivity.java +62 -0
- package/template_project/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml +25 -0
- package/template_project/app/src/main/res/drawable-anydpi/shortcut_monochrome.xml +27 -0
- package/template_project/app/src/main/res/drawable-anydpi-v26/shortcut_maskable.xml +32 -0
- package/template_project/app/src/main/res/drawable-anydpi-v26/shortcut_monochrome.xml +26 -0
- package/template_project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +33 -0
- package/template_project/app/src/main/res/values/colors.xml +18 -0
- package/template_project/app/src/main/res/values/strings.xml +50 -0
- package/template_project/app/src/main/res/xml/filepaths.xml +18 -0
- package/template_project/app/src/main/res/xml/shortcuts.xml +16 -0
- package/template_project/build.gradle +42 -0
- package/template_project/enable-debug.sh +27 -0
- package/template_project/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template_project/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/template_project/gradle.properties +14 -0
- package/template_project/gradlew +188 -0
- package/template_project/gradlew.bat +100 -0
- package/template_project/settings.gradle +1 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class Config {
|
|
2
|
+
jdkPath: string;
|
|
3
|
+
androidSdkPath: string;
|
|
4
|
+
constructor(jdkPath: string, androidSdkPath: string);
|
|
5
|
+
serialize(): string;
|
|
6
|
+
saveConfig(path: string): Promise<void>;
|
|
7
|
+
static deserialize(data: string): Config;
|
|
8
|
+
static loadConfig(path: string): Promise<Config | undefined>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2019 Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.Config = void 0;
|
|
19
|
+
const fs_1 = require("fs");
|
|
20
|
+
const path_1 = require("path");
|
|
21
|
+
class Config {
|
|
22
|
+
constructor(jdkPath, androidSdkPath) {
|
|
23
|
+
this.jdkPath = jdkPath;
|
|
24
|
+
this.androidSdkPath = androidSdkPath;
|
|
25
|
+
}
|
|
26
|
+
serialize() {
|
|
27
|
+
return JSON.stringify(this);
|
|
28
|
+
}
|
|
29
|
+
async saveConfig(path) {
|
|
30
|
+
await fs_1.promises.mkdir(path_1.dirname(path), { recursive: true });
|
|
31
|
+
await fs_1.promises.writeFile(path, this.serialize());
|
|
32
|
+
}
|
|
33
|
+
static deserialize(data) {
|
|
34
|
+
const config = JSON.parse(data);
|
|
35
|
+
return new Config(config.jdkPath, config.androidSdkPath);
|
|
36
|
+
}
|
|
37
|
+
static async loadConfig(path) {
|
|
38
|
+
try {
|
|
39
|
+
const data = await fs_1.promises.readFile(path, 'utf8');
|
|
40
|
+
return Config.deserialize(data);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
// If config file does not exist
|
|
44
|
+
if (err.code === 'ENOENT')
|
|
45
|
+
return undefined;
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.Config = Config;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2019 Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.DigitalAssetLinks = void 0;
|
|
19
|
+
class DigitalAssetLinks {
|
|
20
|
+
static generateAssetLinks(applicationId, ...sha256Fingerprints) {
|
|
21
|
+
const assetlinks = new Array();
|
|
22
|
+
assetlinks.push('[');
|
|
23
|
+
sha256Fingerprints.forEach((sha256Fingerprint, index) => {
|
|
24
|
+
if (index > 0) {
|
|
25
|
+
assetlinks.push(',');
|
|
26
|
+
}
|
|
27
|
+
assetlinks.push(`{
|
|
28
|
+
"relation": ["delegate_permission/common.handle_all_urls"],
|
|
29
|
+
"target" : { "namespace": "android_app", "package_name": "${applicationId}",
|
|
30
|
+
"sha256_cert_fingerprints": ["${sha256Fingerprint}"] }
|
|
31
|
+
}\n`);
|
|
32
|
+
});
|
|
33
|
+
assetlinks.push(']');
|
|
34
|
+
return assetlinks.join('');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.DigitalAssetLinks = DigitalAssetLinks;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Response as FetchH2Response } from 'fetch-h2';
|
|
2
|
+
import { Response as NodeFetchResponse } from 'node-fetch';
|
|
3
|
+
export declare type FetchEngine = 'node-fetch' | 'fetch-h2';
|
|
4
|
+
export declare type NodeFetchOrFetchH2Response = FetchH2Response | NodeFetchResponse;
|
|
5
|
+
declare class FetchUtils {
|
|
6
|
+
private fetchEngine;
|
|
7
|
+
setFetchEngine(newFetchEngine: FetchEngine): void;
|
|
8
|
+
fetch(input: string): Promise<NodeFetchOrFetchH2Response>;
|
|
9
|
+
/**
|
|
10
|
+
* Downloads a file from `url` and saves it to `path`. If a `progressCallback` function is passed, it
|
|
11
|
+
* will be invoked for every chunk received. If the value of `total` parameter is -1, it means we
|
|
12
|
+
* were unable to determine to total file size before starting the download.
|
|
13
|
+
*/
|
|
14
|
+
downloadFile(url: string, path: string, progressCallback?: (current: number, total: number) => void): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
declare const fetchUtils: FetchUtils;
|
|
17
|
+
export { fetchUtils };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2021 Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.fetchUtils = void 0;
|
|
19
|
+
const fs = require("fs");
|
|
20
|
+
const fetch_h2_1 = require("fetch-h2");
|
|
21
|
+
const node_fetch_1 = require("node-fetch");
|
|
22
|
+
const DEFAULT_FETCH_ENGINE = 'fetch-h2';
|
|
23
|
+
class FetchUtils {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.fetchEngine = DEFAULT_FETCH_ENGINE;
|
|
26
|
+
}
|
|
27
|
+
setFetchEngine(newFetchEngine) {
|
|
28
|
+
this.fetchEngine = newFetchEngine;
|
|
29
|
+
}
|
|
30
|
+
async fetch(input) {
|
|
31
|
+
if (this.fetchEngine == 'node-fetch') {
|
|
32
|
+
return await node_fetch_1.default(input, { redirect: 'follow' });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return await fetch_h2_1.fetch(input, { redirect: 'follow' });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Downloads a file from `url` and saves it to `path`. If a `progressCallback` function is passed, it
|
|
40
|
+
* will be invoked for every chunk received. If the value of `total` parameter is -1, it means we
|
|
41
|
+
* were unable to determine to total file size before starting the download.
|
|
42
|
+
*/
|
|
43
|
+
async downloadFile(url, path, progressCallback) {
|
|
44
|
+
let result;
|
|
45
|
+
let readableStream;
|
|
46
|
+
if (this.fetchEngine === 'node-fetch') {
|
|
47
|
+
result = await node_fetch_1.default(url);
|
|
48
|
+
readableStream = result.body;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
result = await fetch_h2_1.fetch(url, { redirect: 'follow' });
|
|
52
|
+
readableStream = await result.readable();
|
|
53
|
+
}
|
|
54
|
+
// Try to determine the file size via the `Content-Length` header. This may not be available
|
|
55
|
+
// for all cases.
|
|
56
|
+
const contentLength = result.headers.get('content-length');
|
|
57
|
+
const fileSize = contentLength ? parseInt(contentLength) : -1;
|
|
58
|
+
const fileStream = fs.createWriteStream(path);
|
|
59
|
+
let received = 0;
|
|
60
|
+
await new Promise((resolve, reject) => {
|
|
61
|
+
readableStream.pipe(fileStream);
|
|
62
|
+
// Even though we're piping the chunks, we intercept them to check for the download progress.
|
|
63
|
+
if (progressCallback) {
|
|
64
|
+
readableStream.on('data', (chunk) => {
|
|
65
|
+
received = received + chunk.length;
|
|
66
|
+
progressCallback(received, fileSize);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
readableStream.on('error', (err) => {
|
|
70
|
+
reject(err);
|
|
71
|
+
});
|
|
72
|
+
fileStream.on('finish', () => {
|
|
73
|
+
resolve();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const fetchUtils = new FetchUtils();
|
|
79
|
+
exports.fetchUtils = fetchUtils;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { GradleWrapper } from '..';
|
|
2
|
+
declare const TRACK_VALUES: string[];
|
|
3
|
+
export declare type PlayStoreTrack = typeof TRACK_VALUES[number];
|
|
4
|
+
export declare const PlayStoreTracks: PlayStoreTrack[];
|
|
5
|
+
export declare function asPlayStoreTrack(input?: string): PlayStoreTrack | null;
|
|
6
|
+
export declare class GooglePlay {
|
|
7
|
+
private gradleWrapper;
|
|
8
|
+
private _googlePlayApi?;
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a Google Play object with the gradleWrapper so we can use a
|
|
11
|
+
* gradle plugin to communicate with Google Play.
|
|
12
|
+
*
|
|
13
|
+
* @param gradleWrapper This is the gradle wrapper object that supplies
|
|
14
|
+
* hooks into Gradle.
|
|
15
|
+
*/
|
|
16
|
+
constructor(gradleWrapper: GradleWrapper);
|
|
17
|
+
/**
|
|
18
|
+
* Initialized Google Play and loads the existing configruation from Google Play.
|
|
19
|
+
* The resulting files are stored in the play folder in the src directory.
|
|
20
|
+
* https://github.com/Triple-T/gradle-play-publisher#quickstart
|
|
21
|
+
*/
|
|
22
|
+
initPlay(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* This calls the publish bundle command and publishes an existing artifact to Google
|
|
25
|
+
* Play.
|
|
26
|
+
* https://github.com/Triple-T/gradle-play-publisher#uploading-a-pre-existing-artifact
|
|
27
|
+
* @param track - Specifies the track that the user would like to publish to.
|
|
28
|
+
*/
|
|
29
|
+
publishBundle(track: PlayStoreTrack, filepath: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Connects to the Google Play Console and retrieves a list of all Android App Bundles for the
|
|
32
|
+
* given packageName. Finds the largest versionCode of those bundles and returns it. Considers
|
|
33
|
+
* both ChromeOS and Android Releases.
|
|
34
|
+
*/
|
|
35
|
+
getLargestVersionCode(packageName: string, serviceAccountJsonFilePath: string): Promise<number>;
|
|
36
|
+
/**
|
|
37
|
+
* This fetches the Android client using the bubblewrap configuration file.
|
|
38
|
+
*/
|
|
39
|
+
private getAndroidClient;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2021 Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.GooglePlay = exports.asPlayStoreTrack = exports.PlayStoreTracks = void 0;
|
|
19
|
+
const googleapis_1 = require("googleapis");
|
|
20
|
+
// Possible values for release tracks
|
|
21
|
+
const TRACK_VALUES = ['alpha', 'beta', 'internal', 'production'];
|
|
22
|
+
exports.PlayStoreTracks = [...TRACK_VALUES];
|
|
23
|
+
function asPlayStoreTrack(input) {
|
|
24
|
+
if (!input) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return TRACK_VALUES.includes(input) ? input : null;
|
|
28
|
+
}
|
|
29
|
+
exports.asPlayStoreTrack = asPlayStoreTrack;
|
|
30
|
+
class GooglePlay {
|
|
31
|
+
/**
|
|
32
|
+
* Constructs a Google Play object with the gradleWrapper so we can use a
|
|
33
|
+
* gradle plugin to communicate with Google Play.
|
|
34
|
+
*
|
|
35
|
+
* @param gradleWrapper This is the gradle wrapper object that supplies
|
|
36
|
+
* hooks into Gradle.
|
|
37
|
+
*/
|
|
38
|
+
constructor(gradleWrapper) {
|
|
39
|
+
this.gradleWrapper = gradleWrapper;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Initialized Google Play and loads the existing configruation from Google Play.
|
|
43
|
+
* The resulting files are stored in the play folder in the src directory.
|
|
44
|
+
* https://github.com/Triple-T/gradle-play-publisher#quickstart
|
|
45
|
+
*/
|
|
46
|
+
async initPlay() {
|
|
47
|
+
await this.gradleWrapper.executeGradleCommand(['bootstrap']);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* This calls the publish bundle command and publishes an existing artifact to Google
|
|
51
|
+
* Play.
|
|
52
|
+
* https://github.com/Triple-T/gradle-play-publisher#uploading-a-pre-existing-artifact
|
|
53
|
+
* @param track - Specifies the track that the user would like to publish to.
|
|
54
|
+
*/
|
|
55
|
+
async publishBundle(track, filepath) {
|
|
56
|
+
// Uploads the artifact to the default internal track.
|
|
57
|
+
await this.gradleWrapper.executeGradleCommand(['publishBundle', '--artifact-dir', filepath, '--track', track]);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Connects to the Google Play Console and retrieves a list of all Android App Bundles for the
|
|
61
|
+
* given packageName. Finds the largest versionCode of those bundles and returns it. Considers
|
|
62
|
+
* both ChromeOS and Android Releases.
|
|
63
|
+
*/
|
|
64
|
+
async getLargestVersionCode(packageName, serviceAccountJsonFilePath) {
|
|
65
|
+
if (!this._googlePlayApi) {
|
|
66
|
+
this._googlePlayApi = this.getAndroidClient(serviceAccountJsonFilePath);
|
|
67
|
+
}
|
|
68
|
+
const edit = await this._googlePlayApi.edits.insert({ packageName: packageName });
|
|
69
|
+
const editId = edit.data.id;
|
|
70
|
+
const bundleResponse = await this._googlePlayApi.edits.bundles.list({ packageName: packageName, editId: editId });
|
|
71
|
+
const versionCode = Math.max(...bundleResponse.data.bundles.map((bundle) => bundle.versionCode));
|
|
72
|
+
// cleanup
|
|
73
|
+
await this._googlePlayApi.edits.delete({ editId: editId, packageName: packageName });
|
|
74
|
+
return versionCode;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* This fetches the Android client using the bubblewrap configuration file.
|
|
78
|
+
*/
|
|
79
|
+
getAndroidClient(serviceAccountJsonFilePath) {
|
|
80
|
+
// Initialize the Google API Client from service account credentials
|
|
81
|
+
const jwtClient = new googleapis_1.google.auth.JWT({
|
|
82
|
+
keyFile: serviceAccountJsonFilePath,
|
|
83
|
+
scopes: ['https://www.googleapis.com/auth/androidpublisher'],
|
|
84
|
+
});
|
|
85
|
+
// Connect to the Google Play Developer API with JWT Client
|
|
86
|
+
return googleapis_1.google.androidpublisher({
|
|
87
|
+
version: 'v3',
|
|
88
|
+
auth: jwtClient,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.GooglePlay = GooglePlay;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { AndroidSdkTools } from './androidSdk/AndroidSdkTools';
|
|
3
|
+
/**
|
|
4
|
+
* A Wrapper around the Gradle commands.
|
|
5
|
+
*/
|
|
6
|
+
export declare class GradleWrapper {
|
|
7
|
+
private process;
|
|
8
|
+
private androidSdkTools;
|
|
9
|
+
private projectLocation;
|
|
10
|
+
private gradleCmd;
|
|
11
|
+
/**
|
|
12
|
+
* Builds a new GradleWrapper
|
|
13
|
+
* @param {NodeJS.Process} process NodeJS process information.
|
|
14
|
+
* @param {AndroidSdkTools} androidSdkTools Android SDK to be used when building a project.
|
|
15
|
+
* @param {string} projectLocation The location of the Android project.
|
|
16
|
+
*/
|
|
17
|
+
constructor(process: NodeJS.Process, androidSdkTools: AndroidSdkTools, projectLocation?: string);
|
|
18
|
+
/**
|
|
19
|
+
* Invokes `gradle bundleRelease` for the Android project.
|
|
20
|
+
*/
|
|
21
|
+
bundleRelease(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Invokes `gradle assembleRelease` for the Android project.
|
|
24
|
+
*/
|
|
25
|
+
assembleRelease(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Executes gradle commands with custom arguments.
|
|
28
|
+
* @param args - Arguments supplied to gradle, also considered gradle tasks.
|
|
29
|
+
*/
|
|
30
|
+
executeGradleCommand(args: string[]): Promise<void>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2019 Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.GradleWrapper = void 0;
|
|
19
|
+
const util_1 = require("./util");
|
|
20
|
+
/**
|
|
21
|
+
* A Wrapper around the Gradle commands.
|
|
22
|
+
*/
|
|
23
|
+
class GradleWrapper {
|
|
24
|
+
/**
|
|
25
|
+
* Builds a new GradleWrapper
|
|
26
|
+
* @param {NodeJS.Process} process NodeJS process information.
|
|
27
|
+
* @param {AndroidSdkTools} androidSdkTools Android SDK to be used when building a project.
|
|
28
|
+
* @param {string} projectLocation The location of the Android project.
|
|
29
|
+
*/
|
|
30
|
+
constructor(process, androidSdkTools, projectLocation) {
|
|
31
|
+
this.process = process;
|
|
32
|
+
this.androidSdkTools = androidSdkTools;
|
|
33
|
+
this.projectLocation = projectLocation || this.process.cwd();
|
|
34
|
+
if (process.platform === 'win32') {
|
|
35
|
+
this.gradleCmd = 'gradlew.bat';
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this.gradleCmd = './gradlew';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Invokes `gradle bundleRelease` for the Android project.
|
|
43
|
+
*/
|
|
44
|
+
async bundleRelease() {
|
|
45
|
+
await this.executeGradleCommand(['bundleRelease', '--stacktrace']);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Invokes `gradle assembleRelease` for the Android project.
|
|
49
|
+
*/
|
|
50
|
+
async assembleRelease() {
|
|
51
|
+
await this.executeGradleCommand(['assembleRelease', '--stacktrace']);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Executes gradle commands with custom arguments.
|
|
55
|
+
* @param args - Arguments supplied to gradle, also considered gradle tasks.
|
|
56
|
+
*/
|
|
57
|
+
async executeGradleCommand(args) {
|
|
58
|
+
const env = this.androidSdkTools.getEnv();
|
|
59
|
+
await util_1.executeFile(this.gradleCmd, args, env, undefined, this.projectLocation);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.GradleWrapper = GradleWrapper;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Jimp from 'jimp';
|
|
2
|
+
import Color = require('color');
|
|
3
|
+
export interface IconDefinition {
|
|
4
|
+
dest: string;
|
|
5
|
+
size: number;
|
|
6
|
+
}
|
|
7
|
+
interface Icon {
|
|
8
|
+
url: string;
|
|
9
|
+
data: Jimp;
|
|
10
|
+
}
|
|
11
|
+
export declare class ImageHelper {
|
|
12
|
+
private saveIcon;
|
|
13
|
+
/**
|
|
14
|
+
* Generate a file for the given icon inside targetDir.
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} icon Object containing the original URL and the icon image data.
|
|
17
|
+
* @param {string} targetDir Path to the directory the image will be saved in.
|
|
18
|
+
* @param {Object} iconDef Icon definitions specifying the size the icon should be exported as.
|
|
19
|
+
*/
|
|
20
|
+
generateIcon(icon: Icon, targetDir: string, iconDef: IconDefinition, backgroundColor?: Color): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Set the color of a monochrome icon to be the theme color.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} icon Original monochrome icon to use.
|
|
25
|
+
* @param {Color} themeColor Color to use for the icon.
|
|
26
|
+
* @returns New image data.
|
|
27
|
+
*/
|
|
28
|
+
monochromeFilter(icon: Icon, themeColor: Color): Promise<Icon>;
|
|
29
|
+
/**
|
|
30
|
+
* Fetches an Icon.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} iconUrl the URL to fetch the icon from.
|
|
33
|
+
* @returns an Object containing the original URL and the icon image data.
|
|
34
|
+
*/
|
|
35
|
+
fetchIcon(iconUrl: string): Promise<Icon>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|