Update link command for Android project (#20853)
Summary: Motivation: -------------- PR #20767 bumped the version of the Android Gradle Plugin to v3 which uses the newer Gradle dependency configurations `implementation` and `api` which make `compile` obsolete. While the PR updated the template Gradle configuration, it did not cover the `link` command which will still link native modules using `compile` resulting in a warning message beeing displayed during an app build. Since `compile` will be eventually removed by Gradle, this commit updates the `link` command to attach native modules using `implementation`. Pull Request resolved: https://github.com/facebook/react-native/pull/20853 Differential Revision: D9733888 Pulled By: hramos fbshipit-source-id: 22853480d7ba7be65e3387effda2fd6c72b6906a
This commit is contained in:
parent
db9b468dd1
commit
4dfdec9b28
|
@ -1,5 +1,5 @@
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
compile "com.android.support:appcompat-v7:27.1.1"
|
implementation "com.android.support:appcompat-v7:27.1.1"
|
||||||
compile "com.facebook.react:react-native:+"
|
implementation "com.facebook.react:react-native:+"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':test')
|
implementation project(':test')
|
||||||
compile(project(':test2')) {
|
implementation(project(':test2')) {
|
||||||
exclude(group: 'org.unwanted', module: 'test10')
|
exclude(group: 'org.unwanted', module: 'test10')
|
||||||
}
|
}
|
||||||
compile fileTree(dir: "libs", include: ["*.jar"])
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
compile "com.android.support:appcompat-v7:27.1.1"
|
implementation "com.android.support:appcompat-v7:27.1.1"
|
||||||
compile "com.facebook.react:react-native:+"
|
implementation "com.facebook.react:react-native:+"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,12 @@ describe('makeBuildPatch', () => {
|
||||||
|
|
||||||
it('should make a correct patch', () => {
|
it('should make a correct patch', () => {
|
||||||
const {patch} = makeBuildPatch(name);
|
const {patch} = makeBuildPatch(name);
|
||||||
expect(patch).toBe(` compile project(':${name}')\n`);
|
expect(patch).toBe(` implementation project(':${name}')\n`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make a correct install check pattern', () => {
|
it('should make a correct install check pattern', () => {
|
||||||
const {installPattern} = makeBuildPatch(name);
|
const {installPattern} = makeBuildPatch(name);
|
||||||
const match = `/\\s{4}(compile)(\\(|\\s)(project)\\(\\':${name}\\'\\)(\\)|\\s)/`;
|
const match = `/\\s{4}(implementation)(\\(|\\s)(project)\\(\\':${name}\\'\\)(\\)|\\s)/`;
|
||||||
expect(installPattern.toString()).toBe(match);
|
expect(installPattern.toString()).toBe(match);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -39,12 +39,14 @@ describe('makeBuildPatch', () => {
|
||||||
describe('makeBuildPatchWithScopedPackage', () => {
|
describe('makeBuildPatchWithScopedPackage', () => {
|
||||||
it('should make a correct patch', () => {
|
it('should make a correct patch', () => {
|
||||||
const {patch} = makeBuildPatch(scopedName);
|
const {patch} = makeBuildPatch(scopedName);
|
||||||
expect(patch).toBe(` compile project(':${normalizedScopedName}')\n`);
|
expect(patch).toBe(
|
||||||
|
` implementation project(':${normalizedScopedName}')\n`,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should make a correct install check pattern', () => {
|
it('should make a correct install check pattern', () => {
|
||||||
const {installPattern} = makeBuildPatch(scopedName);
|
const {installPattern} = makeBuildPatch(scopedName);
|
||||||
const match = `/\\s{4}(compile)(\\(|\\s)(project)\\(\\':${normalizedScopedName}\\'\\)(\\)|\\s)/`;
|
const match = `/\\s{4}(implementation)(\\(|\\s)(project)\\(\\':${normalizedScopedName}\\'\\)(\\)|\\s)/`;
|
||||||
expect(installPattern.toString()).toBe(match);
|
expect(installPattern.toString()).toBe(match);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,12 +12,12 @@ const normalizeProjectName = require('./normalizeProjectName');
|
||||||
module.exports = function makeBuildPatch(name) {
|
module.exports = function makeBuildPatch(name) {
|
||||||
const normalizedProjectName = normalizeProjectName(name);
|
const normalizedProjectName = normalizeProjectName(name);
|
||||||
const installPattern = new RegExp(
|
const installPattern = new RegExp(
|
||||||
`\\s{4}(compile)(\\(|\\s)(project)\\(\\\':${normalizedProjectName}\\\'\\)(\\)|\\s)`,
|
`\\s{4}(implementation)(\\(|\\s)(project)\\(\\\':${normalizedProjectName}\\\'\\)(\\)|\\s)`,
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
installPattern,
|
installPattern,
|
||||||
pattern: /[^ \t]dependencies {(\r\n|\n)/,
|
pattern: /[^ \t]dependencies {(\r\n|\n)/,
|
||||||
patch: ` compile project(':${normalizedProjectName}')\n`,
|
patch: ` implementation project(':${normalizedProjectName}')\n`,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue