8000 Integrated cordova-plugin-buildinfo as a local plugin by RohitKushvaha01 · Pull Request #1387 · Acode-Foundation/Acode · GitHub
[go: up one dir, main page]

Skip to content

Integrated cordova-plugin-buildinfo as a local plugin #1387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
340 changes: 287 additions & 53 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"cordova-clipboard": "^1.3.0",
"cordova-plugin-advanced-http": "^3.3.1",
"cordova-plugin-browser": "file:src/plugins/browser",
"cordova-plugin-buildinfo": "^4.0.0",
"cordova-plugin-buildinfo": "file:src/plugins/cordova-plugin-buildinfo",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-file": "^8.0.1",
"cordova-plugin-ftp": "file:src/plugins/ftp",
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/cordova-plugin-buildinfo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
ignore/
node_modules
5 changes: 5 additions & 0 deletions src/plugins/cordova-plugin-buildinfo/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.npmignore
.travis.yml
.DS_Store
ignore/
node_modules
4 changes: 4 additions & 0 deletions src/plugins/cordova-plugin-buildinfo/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: node_js
sudo: false
node_js:
- "4.2"
21 changes: 21 additions & 0 deletions src/plugins/cordova-plugin-buildinfo/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Mikihiro Hayashi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
296 changes: 296 additions & 0 deletions src/plugins/cordova-plugin-buildinfo/README-jp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
# cordova-plugin-buildinfo

このプラグインは、BuildInfoをグローバルのオブジェクトとして定義します。

BuildInfoは deviceready イベントが発火した時点で有効になっています。

```js
document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
console.log('BuildInfo.baseUrl =' + BuildInfo.baseUrl);
console.log('BuildInfo.packageName =' + BuildInfo.packageName);
console.log('BuildInfo.basePackageName=' + BuildInfo.basePackageName);
console.log('BuildInfo.displayName =' + BuildInfo.displayName);
console.log('BuildInfo.name =' + BuildInfo.name);
console.log('BuildInfo.version =' + BuildInfo.version);
console.log('BuildInfo.versionCode =' + BuildInfo.versionCode);
console.log('BuildInfo.debug =' + BuildInfo.debug);
console.log('BuildInfo.buildType =' + BuildInfo.buildType);
console.log('BuildInfo.flavor =' + BuildInfo.flavor);
console.log('BuildInfo.buildDate =' + BuildInfo.buildDate);
console.log('BuildInfo.installDate =' + BuildInfo.installDate);
}
```

## インストール

```sh
cordova plugin add cordova-plugin-buildinfo
```

## サポートプラットフォーム

* Android
* iOS
* Windows
* macOS(OS X)
* Browser
* Electron

## プロパティ

- [`BuildInfo.baseUrl`](#BuildInfo.baseUrl)
- [`BuildInfo.packageName`](#BuildInfo.packageName)
- [`BuildInfo.basePackageName`](#BuildInfo.basePackageName)
- [`BuildInfo.displayName`](#BuildInfo.displayName)
- [`BuildInfo.name`](#BuildInfo.name)
- [`BuildInfo.version`](#BuildInfo.version)
- [`BuildInfo.versionCode`](#BuildInfo.versionCode)
- [`BuildInfo.debug`](#BuildInfo.debug)
- [`BuildInfo.buildType`](#BuildInfo.buildType)
- [`BuildInfo.flavor`](#BuildInfo.flavor)
- [`BuildInfo.buildDate`](#BuildInfo.buildDate)
- [`BuildInfo.installDate`](#BuildInfo.installDate)
- [`BuildInfo.windows`](#BuildInfo.windows)
- [`logo`](#BuildInfo.windows.logo)
- [`version`](#BuildInfo.windows.version)

### BuildInfo.baseUrl

cordova.js ファイルがあるパスを取得します。
パスの最後は "/" が付きます。

|Platform|Value|Type|
|--------|-----|----|
|Android|Path|String|
|iOS|Path|String|
|Windows|Path|String|
|macOS(OS X)|Path|String|
|Browser|Path|String|
|Electron|Path|String|

### BuildInfo.packageName

Application IDをpackageNameとして取得します。

|Platform|Value|Type|
|--------|-----|----|
|Android|Package Name|String|
|iOS|Bundle Identifier|String|
|Windows|Identity name|String|
|macOS(OS X)|Bundle Identifier|String|
|Browser|config.xml の widget 要素に設定されている id 属性の値が入ります|String|
|Electron|config.xml の widget 要素に設定されている id 属性の値が入ります|String|


### BuildInfo.basePackageName

Androidのみ。

BuildConfigクラスのpackageNameを取得します。

ビルドタイプやFlavorを利用すると、config.xmlのwidget要素で指定したidとは異なるパッケージ名を指定できるため、BuildConfigクラスが属するパッケージ名を取得するためのプロパティです。
(config.xmlのwidget要素にあるid属性と同じになるはずです)


|Platform|Value|Type|
|--------|-----|----|
|Android|BuildConfigクラスにあるパッケージ名|String|
|iOS|Bundle Identifier(BuildInfo.packageNameと同一)|String|
|Windows|Identity name(BuildInfo.packageNameと同一)|String|
|macOS(OS X)|Bundle Identifier(BuildInfo.packageNameと同一)|String|
|Browser|BuildInfo.packageName と同一|String|
|Electron|BuildInfo.packageName と同一|String|


### BuildInfo.displayName

アプリのホーム画面での表示名を取得します。

|Platform|Value|Type|
|--------|-----|----|
|Android|Application Label|String|
|iOS|CFBundleDisplayName(存在しない場合はCFBundleName)|String|
|Windows|AppxManifest.xmlのVisualElements要素にあるDisplayName属性|String|
|macOS(OS X)|CFBundleDisplayName(存在しない場合はCFBundleName)|String|
|Browser|config.xml の name 要素の short 属性の値が入ります|String|
|Electron|config.xml の name 要素の short 属性の値が入ります|String|

### BuildInfo.name

アプリの名前を取得します。
(iOSのみ。Androidでは、displayNameと同一になります)

|Platform|Value|Type|
|--------|-----|----|
|Android|Application Label(BuildInfo.displayNameと同一)|String|
|iOS|CFBundleName|String|
|Windows|Windows Store display name|String|
|macOS(OS X)|CFBundleName|String|
|Browser|config.xml の name 要素の内容が入ります|String|
|Electron|config.xml の name 要素の内容が入ります|String|


### BuildInfo.version

バージョンを取得します。

|Platform|Value|Type|
|--------|-----|----|
|Android|BuildConfig.VERSION_NAME|String|
|iOS|CFBundleShortVersionString|String|
|Windows|Major.Minor.Build 例) "1.2.3"|String|
|macOS(OS X)|CFBundleShortVersionString|String|
|Browser|config.xml の widget 要素の version 属性の値が入ります|String|
|Electron|config.xml の widget 要素の version 属性の値が入ります|String|


### BuildInfo.versionCode

Version Codeを取得します。
AndroidではINT型で提供されます。

|Platform|Value|Type|
|--------|-----|----|
|Android|BuildConfig.VERSION_CODE|int|
|iOS|CFBundleVersion|string|
|Windows|Major.Minor.Build.Revision 例) "1.2.3.4"|String|
|macOS(OS X)|CFBundleVersion|string|
|Browser|BuildInfo.version と同一|String|
|Electron|BuildInfo.version と同一|String|


### BuildInfo.debug

デバッグビルドかどうかを取得します。

|Platform|Value|Type|
|--------|-----|----|
|Android|BuildConfig.DEBUG|Boolean|
|iOS|defined "DEBUG" is true|Boolean|
|Windows|isDevelopmentMode is true|Boolean|
|Browser|常に false|Boolean|
|Electron|```cordova build electron --debug``` とした場合 true となります|Boolean|


### BuildInfo.buildType

ビルドタイプを取得します。(AndroidおよびWindowsのみ)

|Platform|Value|Type|
|--------|-----|----|
|Android|BuildConfig.BUILD_TYPE|String|
|iOS|empty string|String|
|Windows|"release" or "debug"|String|
|macOS(OS X)|empty string|String|
|Browser|empty string|String|
|Electron|empty string|String|


### BuildInfo.flavor

フレーバーを取得します。(Androidのみ)

|Platform|Value|Type|
|--------|-----|----|
|Android|BuildConfig.FLAVOR|String|
|iOS|empty string|String|
|Windows|empty string|String|
|macOS(OS X)|empty string|String|
|Browser|empty string|String|
|Electron|empty string|String|


### BuildInfo.buildDate

Dateオブジェクトとしてビルド日時を取得します。

注意:

- Aandroid: BuildInfo.gradeファイルをAndroidプロジェクトに追加します。
BuildInfo.gradeファイルは、BuildConfigクラスに_BUILDINFO_TIMESTAMPというプロパティを追加します。
- Windows: buildinfo.resjsonファイルをWindowsプロジェクトのstringsフォルダに追加します。
また、buildinfo.resjsonファイルはCordovaApp.projitemsファイルに追記されたタスクよにりビルド実行時に書き換えられます。
- Browser と Electron: ```cordova prepare``` が実行されたタイミングで
platforms/browser/www/plugins/cordova-plugin-buildinfo/src/browser/BuildInfoProxy.js
(または platforms/electron/www/plugins/cordova-plugin-buildinfo/src/browser/BuildInfoProxy.js)
ファイル内にビルド日時を埋め込みます。
```cordova prepare``` は、```cordova build```、```cordova run```、```cordova platform add```の場合も実行されます。
(参照: [Hooks Guide - Apache Cordova](https://cordova.apache.org/docs/en/9.x/guide/appdev/hooks/index.html))

|Platform|Value|Type|
|--------|-----|----|
|Android|BuildConfig.\_BUILDINFO\_TIMESTAMP value|Date|
|iOS|メインバンドルのexecutionPathから取得したInfo.plistの更新日時|Date|
|Windows|文字列リソースの "/buildinfo/Timestamp" 値を返します|Date|
|macOS(OS X)|メインバンドルのリソースから取得したconfig.xmlの更新日時|Date|
|Browser|```cordova prepare```が実行された日時|Date|
|Electron|```cordova prepare```が実行された日時|Date|


### BuildInfo.installDate

Dateオブジェクトとしてインストール日時を返します

注意:
- Browser と Electron: インストール日時は不明です。

|Platform|Value|Type|
|--------|-----|----|
|Android|PackageInfoのfirstInstallTimeプロパティ|Date|
|iOS|documentディレクトリの作成日時|Date|
|Windows|Windows.ApplicatinoModel.Package.currentのinstalledDateプロパティ|Date|
|macOS(OS X)|アプリケーションパッケージのFile Metadataに記録されている kMDItemDateAdded の日時|Date|
|Browser|常に null|null|
|Electron|常に null|null|


### BuildInfo.windows

Windowsのみ。

Windowsの追加情報を格納しています。

|Platform|Value|Type|
|--------|-----|----|
|Android|(未定義)|undefined|
|iOS|(未定義)|undefined|
|Windows|Object|Object|
|macOS(OS X)|(未定義)|undefined|
|Browser|(未定義)|undefined|
|Electron|(未定義)|undefined|

|Property name|Value|Type|
|-------------|-----|----|
|architecture|Windows.ApplicationModel.Package.current.id.architecture|integer|
|description|Windows.ApplicationModel.Package.current.description|String|
|displayName|Windows.ApplicationModel.Package.current.displayName|String|
|familyName|Windows.ApplicationModel.Package.current.id.familyName|String|
|fullName|Windows.ApplicationModel.Package.current.id.fullName|String|
|logo|Object|Object|
|publisher|Windows.ApplicationModel.Package.current.id.publisher|String|
|publisherId|Windows.ApplicationModel.Package.current.id.publisherId|String|
|publisherDisplayName|Windows.ApplicationModel.Package.current.publisherDisplayName|String|
|resourceId|Windows.ApplicationModel.Package.current.id.resourceId|String|
|version|Windows.ApplicationModel.Package.current.id.version|Object|

#### BuildInfo.windows.logo

|Property name|Value|Type|
|-------------|-----|----|
|absoluteCannonicalUri|Windows.ApplicationModel.Package.logo.absoluteCanonicalUri|String|
|absoluteUri|Windows.ApplicationModel.Package.logo.absoluteUri|String|
|displayIri|Windows.ApplicationModel.Package.logo.displayIri|String|
|displayUri|Windows.ApplicationModel.Package.logo.displayUri|String|
|path|Windows.ApplicationModel.Package.logo.path|String|
|rawUri|Windows.ApplicationModel.Package.logo.rawUri|String|

#### BuildInfo.windows.version

|Property name|Value|Type|
|-------------|-----|----|
|major|Windows.ApplicationModel.Package.current.id.version.major|integer|
|minor|Windows.ApplicationModel.Package.current.id.version.minor|integer|
|build|Windows.ApplicationModel.Package.current.id.version.build|integer|
|revision|Windows.ApplicationModel.Package.current.id.version.revision|integer|
Loading
0