Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: bump Gradle 7.6 & AGP 7.4.2 (#1539)
* feat: bump gradle 7.6 * feat: bump android gradle plugin 7.3.1 * feat: bump android gradle plugin 7.4.2 * fix!: move android package name to build.gradle namespace * fix!: remove deprecated package name from AndroidManifest * fix: package name * fix: rename CordovaGradleConfigParser's _save to write * test: fix CordovaGradleConfigParser related specs * fix: test refactoring for gradle namespace * fix: accidental variable naming mixing --------- Co-authored-by: Norman Breau <norman@nbsolutions.ca>
- Loading branch information
Showing
25 changed files
with
243 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
*/ | ||
|
||
const fs = require('fs-extra'); | ||
const path = require('path'); | ||
const events = require('cordova-common').events; | ||
|
||
class CordovaGradleConfigParser { | ||
/** | ||
* Loads and Edits Gradle Properties File. | ||
* | ||
* Do not construct this directly. Use CordovaGradleConfigParserFactory instead. | ||
* | ||
* @param {String} platformDir is the path of the Android platform directory | ||
*/ | ||
constructor (platformDir) { | ||
this._cdvGradleConfigFilePath = path.join(platformDir, 'cdv-gradle-config.json'); | ||
this._cdvGradleConfig = this._readConfig(this._cdvGradleConfigFilePath); | ||
} | ||
|
||
/** | ||
* Reads and parses the configuration JSON file | ||
* | ||
* @param {String} configPath | ||
* @returns {Record<any, any>} The parsed JSON object representing the gradle config. | ||
*/ | ||
_readConfig (configPath) { | ||
return fs.readJSONSync(configPath, 'utf-8'); | ||
} | ||
|
||
setPackageName (packageName) { | ||
events.emit('verbose', '[Cordova Gradle Config] Setting "PACKAGE_NAMESPACE" to ' + packageName); | ||
this._cdvGradleConfig.PACKAGE_NAMESPACE = packageName; | ||
return this; | ||
} | ||
|
||
getPackageName () { | ||
return this._cdvGradleConfig.PACKAGE_NAMESPACE; | ||
} | ||
|
||
getProjectNameFromPackageName () { | ||
const packageName = this._cdvGradleConfig.PACKAGE_NAMESPACE; | ||
return packageName.substring(packageName.lastIndexOf('.') + 1); | ||
} | ||
|
||
/** | ||
* Saves any changes that has been made to the properties file. | ||
*/ | ||
write () { | ||
events.emit('verbose', '[Cordova Gradle Config] Saving File'); | ||
fs.writeJSONSync(this._cdvGradleConfigFilePath, this._cdvGradleConfig, 'utf-8'); | ||
} | ||
} | ||
|
||
module.exports = CordovaGradleConfigParser; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
/** | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
*/ | ||
|
||
const CordovaGradleConfigParser = require('./CordovaGradleConfigParser'); | ||
|
||
/** | ||
* Builds new gradle config parsers | ||
*/ | ||
module.exports = class CordovaGradleConfigParserFactory { | ||
/** | ||
* Loads and Edits Gradle Properties File. | ||
* | ||
* @param {String} platformDir is the path of the Android platform directory | ||
*/ | ||
static create (platformDir) { | ||
return new CordovaGradleConfigParser(platformDir); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.