sdk update to 14

Signed-off-by: guoshengbang <guoshengbang@huawei.com>
Change-Id: I569094c6696ff6a33b694cc5250b99dff921a061
This commit is contained in:
guoshengbang
2025-03-04 12:10:13 +08:00
parent c36cf2e9c7
commit b8c25f8ad4
44 changed files with 295 additions and 161 deletions
+8 -5
View File
@@ -1,9 +1,12 @@
/node_modules
/oh_modules
/local.properties
/.idea
/.hvigor
**/build
package-lock.json
.clang-format
.clang-tidygigt
.clangd
/.hvigor
.cxx
/.clangd
/.clang-format
/.clang-tidy
**/.test
/.appanalyzer
+1 -1
View File
@@ -253,7 +253,7 @@ PrintSpooler应用是OpenHarmony中预置的系统应用,为用户提供打印
- `feature/ippPrint/src/main/ets/common/napi/NativeApi.ts`
- p2p打印机连接成功之后调用print_print_fwk的接口获取打印机支持的ipp协议能力,并调用print_print_fwk接口向cupsd服务配置一台无驱动打印机(支持Mopria协议)
```
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
public getCapabilities(uri: string, printerName: string, getCapsCallback: (result) => void): void {
Log.debug(TAG, 'getCapabilities enter');
+8 -1
View File
@@ -6,7 +6,14 @@
{
"name": "default",
"signingConfig": "default",
"compileSdkVersion": 11,
"compileSdkVersion": 14,
"compatibleSdkVersion": 11,
"runtimeOS": "OpenHarmony"
},
{
"name": "tablet",
"signingConfig": "default",
"compileSdkVersion": 14,
"compatibleSdkVersion": 11,
"runtimeOS": "OpenHarmony"
}
-1
View File
@@ -13,6 +13,5 @@
* limitations under the License.
*/
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks
+1 -1
View File
@@ -4,7 +4,7 @@
"name": "@ohos/common",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ts",
"repository": {},
"repository": '',
"version": "1.0.0",
"dependencies": {}
}
+1 -1
View File
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import { BusinessError } from '@ohos.base';
import CheckEmptyUtils from '../utils/CheckEmptyUtils';
import { Log } from '../utils/Log';
+13
View File
@@ -0,0 +1,13 @@
{
"devices": {
"general": [
"default",
"tablet"
]
},
"development": {
"addedSysCaps": [
"SystemCapability.Print.PrintFramework"
]
}
}
+1 -1
View File
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import wifi from '@ohos.wifiManager';
import { Log } from './Log';
import { WIFI_INACTIVE } from '../model/ErrorMessage';
+17 -2
View File
@@ -7,12 +7,27 @@
]
}
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": false,
"files": [
"./obfuscation-rules.txt"
]
}
}
}
},
],
"targets": [
{
"name": "default",
"name": "default"
},
{
"name": "ohosTest",
"name": "ohosTest"
}
]
}
+6 -2
View File
@@ -13,5 +13,9 @@
* limitations under the License.
*/
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').hapTasks;
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
+23
View File
@@ -0,0 +1,23 @@
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
-enable-property-obfuscation
-enable-toplevel-obfuscation
-enable-filename-obfuscation
-enable-export-obfuscation
+28
View File
@@ -0,0 +1,28 @@
{
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/common@../common": "@ohos/common@../common",
"@ohos/ippprint@../feature/ippPrint": "@ohos/ippprint@../feature/ippPrint"
},
"packages": {
"@ohos/common@../common": {
"name": "@ohos/common",
"version": "1.0.0",
"resolved": "../common",
"registryType": "local"
},
"@ohos/ippprint@../feature/ippPrint": {
"name": "@ohos/ippprint",
"version": "1.0.0",
"resolved": "../feature/ippPrint",
"registryType": "local",
"dependencies": {
"@ohos/common": "file:../../common"
}
}
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
"devDependencies": {},
"name": "entry",
"description": "example description",
"repository": {},
"repository": '',
"version": "1.0.0",
"dependencies": {
"@ohos/common": "file:../common",
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import { Log, PrinterExtensionInfo } from '@ohos/common';
import AppStorageHelper from '../Common/Adapter/AppStorageHelper';
import {AppStorageKeyName} from '@ohos/common';
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import CheckEmptyUtils, { Constants, convertToSpoolerPrintJob, isValidPrintJob, Log, PrintJob, PrintJobChangeListener, queryAllPrintJobs, SingletonHelper } from '@ohos/common';
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import FileUtil from '../Common/Utils/FileUtil';
const TAG: string = 'PrintJobManager';
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import commonEvent from '@ohos.commonEventManager';
import {
AppCommonEvent,
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import { cancelPrintJob, CustomPrintJobState, Log, PrintItemChangeListener, PrintJob, SingletonHelper } from '@ohos/common';
import { printJobMgr } from '../../Controller/PrintJobManager';
import { PageData, PrintJobItem, ShowTips } from './PrintPageModel';
@@ -29,7 +29,7 @@ import type { PrintJob } from '@ohos/common';
import { SERVICE_IPP } from '@ohos/common';
import { checkWifiEnable } from '@ohos/common';
import { GlobalThisHelper, GlobalThisStorageKey} from '@ohos/common';
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
const TAG = 'PrintExtension';
+1 -1
View File
@@ -62,7 +62,7 @@ import { Log } from '@ohos/common';
import { uuidGenerator } from '@ohos/common';
import { BISHENG_PRINTER } from '@ohos/common';
import emitter from '@ohos.events.emitter';
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import promptAction from '@ohos.promptAction';
import common from '@ohos.app.ability.common';
import {CancelButton} from './component/BaseComponent';
+7 -7
View File
@@ -26,16 +26,16 @@
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:color_ffffff",
"name": "MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ets",
"srcEntry": "./ets/MainAbility/MainAbility.ets",
"description": "$string:MainAbility_desc",
"icon": "$media:icon",
"label": "$string:MainAbility_label",
"launchType": "singleton",
"visible": false,
"visible": false
},
{
"name": "JobManagerAbility",
"srcEntrance": "./ets/MainAbility/JobManagerAbility.ts",
"srcEntry": "./ets/MainAbility/JobManagerAbility.ts",
"description": "$string:JobManagerAbility_desc",
"icon": "$media:icon",
"label": "$string:JobManagerAbility_label",
@@ -121,7 +121,7 @@
"reason": '$string:print_security_guard_require',
"usedScene": {
"abilities": [
"com.ohos.spooler.MainAbility",
"com.ohos.spooler.MainAbility"
],
"when": "inuse"
}
@@ -132,7 +132,7 @@
"reason": '$string:print_security_guard_require',
"usedScene": {
"abilities": [
"com.ohos.spooler.MainAbility",
"com.ohos.spooler.MainAbility"
],
"when": "inuse"
}
@@ -142,7 +142,7 @@
"reason": '$string:print_file_name_require',
"usedScene": {
"abilities": [
"com.ohos.spooler.MainAbility",
"com.ohos.spooler.MainAbility"
],
"when": "inuse"
}
@@ -152,7 +152,7 @@
"reason": '$string:print_file_name_require',
"usedScene": {
"abilities": [
"com.ohos.spooler.MainAbility",
"com.ohos.spooler.MainAbility"
],
"when": "inuse"
}
+13
View File
@@ -0,0 +1,13 @@
{
"devices": {
"general": [
"default",
"tablet"
]
},
"development": {
"addedSysCaps": [
"SystemCapability.Print.PrintFramework"
]
}
}
+8
View File
@@ -0,0 +1,8 @@
const printMock: Record<string, object> = {
'print': () => {
return;
}
};
export default printMock;
+5
View File
@@ -0,0 +1,5 @@
{
'@ohos.print': {
'source': 'src/mock/PrintMock.ets'
}
}
@@ -0,0 +1,36 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import hilog from '@ohos.hilog';
export default function abilityTest() {
describe('ActsAbilityTest', () => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
})
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
})
})
}
@@ -0,0 +1,5 @@
import abilityTest from './Ability.test';
export default function testsuite() {
abilityTest();
}
+12
View File
@@ -0,0 +1,12 @@
{
"module": {
"name": "entry_test",
"type": "feature",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false
}
}
+5
View File
@@ -0,0 +1,5 @@
import localUnitTest from './LocalUnit.test';
export default function testsuite() {
localUnitTest();
}
+33
View File
@@ -0,0 +1,33 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function localUnitTest() {
describe('localUnitTest', () => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
});
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
});
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
});
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
});
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
});
});
}
-2
View File
@@ -13,6 +13,4 @@
* limitations under the License.
*/
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').harTasks
+18
View File
@@ -0,0 +1,18 @@
{
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/common@../../common": "@ohos/common@../../common"
},
"packages": {
"@ohos/common@../../common": {
"name": "@ohos/common",
"version": "1.0.0",
"resolved": "../../common",
"registryType": "local"
}
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
"name": "@ohos/ippprint",
"description": "a npm package which contains arkUI2.0 page",
"main": "index.ts",
"repository": {},
"repository": '',
"version": "1.0.0",
"dependencies": {
"@ohos/common": "file:../../common"
@@ -21,7 +21,7 @@ import P2pUtils from './utils/P2pUtils';
import { Log } from '@ohos/common';
import type { PrintServiceAdapter } from './PrintServiceAdapter';
import LocalPrinter from './LocalPrinter';
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import type { WifiListener } from './model/WifiModel';
import CommonEventManager from '@ohos.commonEventManager';
import HashSet from '@ohos.util.HashSet';
@@ -23,7 +23,7 @@ import LocalPrinterCapabilities from './napi/LocalPrinterCapabilities';
import type ConnectionListener from './connect/ConnectionListener';
import P2PPrinterConnection from './connect/P2pPrinterConnection';
import type { CapabilitiesCache, OnLocalPrinterCapabilities } from './ipp/CapabilitiesCache';
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
const TAG = 'LocalPrinter';
@@ -26,7 +26,7 @@ import CommonUtils from '../utils/CommonUtils';
import type { WifiListener } from '../model/WifiModel';
import CommonEventManager from '@ohos.commonEventManager';
// @ts-ignore
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
const TAG: string = 'P2PPrinterConnection';
const CONNECT_DELAYED_TIME: number = 30000;
@@ -22,7 +22,7 @@ import LocalPrinterCapabilities from '../napi/LocalPrinterCapabilities';
import type { OnLocalPrinterCapabilities } from '../ipp/CapabilitiesCache';
import type uri from '@ohos.uri';
// @ts-ignore
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import CommonUtils from '../utils/CommonUtils';
import { WorkerUtil } from '../utils/WorkerUtil';
import type { WorkerResponse } from '../model/WorkerData';
@@ -15,7 +15,7 @@
import wifi from '@ohos.wifi';
import { Log } from '@ohos/common';
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import { P2P_SERVICE_ERROR } from '@ohos/common';
import CommonEventManager from '@ohos.commonEventManager';
import ArrayList from '@ohos.util.ArrayList';
@@ -14,7 +14,7 @@
*/
// @ts-ignore
import print from '@ohos.print';
import { print } from '@kit.BasicServicesKit';
import CheckEmptyUtils, { Log } from '@ohos/common';
const TAG = 'NativeApi';
+19 -3
View File
@@ -1,6 +1,22 @@
{
"hvigorVersion": "3.2.4",
"modelVersion": "5.0.2",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "3.2.4"
},
"execution": {
// "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
// "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
},
"logging": {
// "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
},
"debugging": {
// "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
},
"nodeOptions": {
// "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
// "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
}
}
}
File diff suppressed because one or more lines are too long
-1
View File
@@ -13,5 +13,4 @@
* limitations under the License.
*/
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
module.exports = require('@ohos/hvigor-ohos-plugin').appTasks;
-48
View File
@@ -1,48 +0,0 @@
#!/bin/bash
# ----------------------------------------------------------------------------
# Hvigor startup script, version 1.0.0
#
# Required ENV vars:
# ------------------
# NODE_HOME - location of a Node home dir
# or
# Add /usr/local/nodejs/bin to the PATH environment variable
# ----------------------------------------------------------------------------
HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
warn() {
echo ""
echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
error() {
echo ""
echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
fail() {
error "$@"
exit 1
}
# Determine node to start hvigor wrapper script
if [ -n "${NODE_HOME}" ];then
EXECUTABLE_NODE="${NODE_HOME}/bin/node"
if [ ! -x "$EXECUTABLE_NODE" ];then
fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
fi
else
EXECUTABLE_NODE="node"
which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
fi
# Check hvigor wrapper script
if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
fi
# start hvigor-wrapper script
exec "${EXECUTABLE_NODE}" \
"${HVIGOR_WRAPPER_SCRIPT}" "$@"
-64
View File
@@ -1,64 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Hvigor startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
set NODE_EXE=node.exe
goto start
:start
@rem Find node.exe
if defined NODE_HOME goto findNodeFromNodeHome
%NODE_EXE% --version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:findNodeFromNodeHome
set NODE_HOME=%NODE_HOME:"=%
set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
if exist "%NODE_EXE_PATH%" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:execute
@rem Execute hvigor
"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
if "%ERRORLEVEL%" == "0" goto hvigorwEnd
:fail
exit /b 1
:hvigorwEnd
if "%OS%" == "Windows_NT" endlocal
:end
+11 -5
View File
@@ -1,13 +1,19 @@
{
"lockfileVersion": 1,
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
"@ohos/hypium@1.0.21": "@ohos/hypium@1.0.21"
},
"packages": {
"@ohos/hypium@1.0.6": {
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
"@ohos/hypium@1.0.21": {
"name": "@ohos/hypium",
"version": "1.0.21",
"integrity": "sha512-iyKGMXxE+9PpCkqEwu0VykN/7hNpb+QOeIuHwkmZnxOpI+dFZt6yhPB7k89EgV1MiSK/ieV/hMjr5Z2mWwRfMQ==",
"resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.21.har",
"registryType": "ohpm"
}
}
}
+2 -1
View File
@@ -1,7 +1,8 @@
{
"modelVersion": "5.0.2",
"license": "ISC",
"devDependencies": {
"@ohos/hypium": "1.0.6"
"@ohos/hypium": "1.0.21"
},
"name": "hwprintspooler",
"description": "example description",